Commit d75baf0ce6981df27868a3dfc0e23b551909402d

Authored by root
1 parent 80fb6f43

add bouncer

Showing 110 changed files with 11086 additions and 0 deletions
  1 +before_commands:
  2 + - "composer install --prefer-source"
  3 +
  4 +tools:
  5 + # Code Coverage
  6 + external_code_coverage:
  7 + enabled: true
  8 + timeout: 300
  9 + filter:
  10 + excluded_paths:
  11 + - 'docs/*'
  12 + - 'examples/*'
  13 + - 'extras/*'
  14 + - 'test/*'
  15 + - 'vendor/*'
  16 +
  17 +
  18 + php_code_coverage:
  19 + enabled: false
  20 + test_command: phpunit
  21 + filter:
  22 + excluded_paths:
  23 + - 'docs/*'
  24 + - 'examples/*'
  25 + - 'extras/*'
  26 + - 'test/*'
  27 + - 'vendor/*'
  28 +
  29 +
  30 + # Code Sniffer
  31 + php_code_sniffer:
  32 + enabled: true
  33 + command: phpcs
  34 + config:
  35 + standard: PSR2
  36 + filter:
  37 + excluded_paths:
  38 + - 'docs/*'
  39 + - 'examples/*'
  40 + - 'extras/*'
  41 + - 'test/*'
  42 + - 'vendor/*'
  43 +
  44 +
  45 + # Copy/Paste Detector
  46 + php_cpd:
  47 + enabled: true
  48 + command: phpcpd
  49 + excluded_dirs:
  50 + - docs
  51 + - examples
  52 + - extras
  53 + - test
  54 + - vendor
  55 +
  56 +
  57 + # PHP CS Fixer (http://http://cs.sensiolabs.org/).
  58 + php_cs_fixer:
  59 + enabled: true
  60 + command: php-cs-fixer
  61 + config:
  62 + level: psr2
  63 + filter:
  64 + excluded_paths:
  65 + - 'docs/*'
  66 + - 'examples/*'
  67 + - 'extras/*'
  68 + - 'test/*'
  69 + - 'vendor/*'
  70 +
  71 +
  72 + # Analyzes the size and structure of a PHP project.
  73 + php_loc:
  74 + enabled: true
  75 + command: phploc
  76 + excluded_dirs:
  77 + - docs
  78 + - examples
  79 + - extras
  80 + - test
  81 + - vendor
  82 +
  83 +
  84 + # PHP Mess Detector (http://phpmd.org).
  85 + php_mess_detector:
  86 + enabled: true
  87 + command: phpmd
  88 + config:
  89 + rulesets:
  90 + - codesize
  91 + - unusedcode
  92 + - naming
  93 + - design
  94 + filter:
  95 + excluded_paths:
  96 + - 'docs/*'
  97 + - 'examples/*'
  98 + - 'extras/*'
  99 + - 'test/*'
  100 + - 'vendor/*'
  101 +
  102 +
  103 + # Analyzes the size and structure of a PHP project.
  104 + php_pdepend:
  105 + enabled: true
  106 + command: pdepend
  107 + excluded_dirs:
  108 + - docs
  109 + - examples
  110 + - extras
  111 + - test
  112 + - vendor
  113 +
  114 + # Runs Scrutinizer's PHP Analyzer Tool
  115 + php_analyzer:
  116 + enabled: true
  117 + filter:
  118 + excluded_paths:
  119 + - 'docs/*'
  120 + - 'examples/*'
  121 + - 'extras/*'
  122 + - 'test/*'
  123 + - 'vendor/*'
  124 +
  125 + # Security Advisory Checker
  126 + sensiolabs_security_checker: true
  1 +language: php
  2 +php:
  3 + - 5.5
  4 + - 5.4
  5 + - 5.3
  6 +before_install:
  7 + - sudo apt-get update -qq
  8 + - sudo apt-get install -y -qq postfix
  9 +before_script:
  10 + - sudo service postfix stop
  11 + - smtp-sink -d "%d.%H.%M.%S" localhost:2500 1000 &
  12 + - mkdir -p build/logs
  13 + - cd test
  14 + - cp testbootstrap-dist.php testbootstrap.php
  15 + - chmod +x fakesendmail.sh
  16 + - sudo mkdir -p /var/qmail/bin
  17 + - sudo cp fakesendmail.sh /var/qmail/bin/sendmail
  18 + - sudo cp fakesendmail.sh /usr/sbin/sendmail
  19 + - echo 'sendmail_path = "/usr/sbin/sendmail -t -i "' | sudo tee "/home/travis/.phpenv/versions/`php -i|grep "PHP Version"|head -n 1|grep -o -P '\d+\.\d+\.\d+.*'`/etc/conf.d/sendmail.ini"
  20 + - pwd
  21 + - ls -al
  22 +script:
  23 + - phpunit --configuration ../travis.phpunit.xml.dist
  24 +after_script:
  25 + - wget https://scrutinizer-ci.com/ocular.phar
  26 + - php ocular.phar code-coverage:upload --format=php-clover ../build/logs/clover.xml
  1 + GNU LESSER GENERAL PUBLIC LICENSE
  2 + Version 2.1, February 1999
  3 +
  4 + Copyright (C) 1991, 1999 Free Software Foundation, Inc.
  5 + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  6 + Everyone is permitted to copy and distribute verbatim copies
  7 + of this license document, but changing it is not allowed.
  8 +
  9 +[This is the first released version of the Lesser GPL. It also counts
  10 + as the successor of the GNU Library Public License, version 2, hence
  11 + the version number 2.1.]
  12 +
  13 + Preamble
  14 +
  15 + The licenses for most software are designed to take away your
  16 +freedom to share and change it. By contrast, the GNU General Public
  17 +Licenses are intended to guarantee your freedom to share and change
  18 +free software--to make sure the software is free for all its users.
  19 +
  20 + This license, the Lesser General Public License, applies to some
  21 +specially designated software packages--typically libraries--of the
  22 +Free Software Foundation and other authors who decide to use it. You
  23 +can use it too, but we suggest you first think carefully about whether
  24 +this license or the ordinary General Public License is the better
  25 +strategy to use in any particular case, based on the explanations below.
  26 +
  27 + When we speak of free software, we are referring to freedom of use,
  28 +not price. Our General Public Licenses are designed to make sure that
  29 +you have the freedom to distribute copies of free software (and charge
  30 +for this service if you wish); that you receive source code or can get
  31 +it if you want it; that you can change the software and use pieces of
  32 +it in new free programs; and that you are informed that you can do
  33 +these things.
  34 +
  35 + To protect your rights, we need to make restrictions that forbid
  36 +distributors to deny you these rights or to ask you to surrender these
  37 +rights. These restrictions translate to certain responsibilities for
  38 +you if you distribute copies of the library or if you modify it.
  39 +
  40 + For example, if you distribute copies of the library, whether gratis
  41 +or for a fee, you must give the recipients all the rights that we gave
  42 +you. You must make sure that they, too, receive or can get the source
  43 +code. If you link other code with the library, you must provide
  44 +complete object files to the recipients, so that they can relink them
  45 +with the library after making changes to the library and recompiling
  46 +it. And you must show them these terms so they know their rights.
  47 +
  48 + We protect your rights with a two-step method: (1) we copyright the
  49 +library, and (2) we offer you this license, which gives you legal
  50 +permission to copy, distribute and/or modify the library.
  51 +
  52 + To protect each distributor, we want to make it very clear that
  53 +there is no warranty for the free library. Also, if the library is
  54 +modified by someone else and passed on, the recipients should know
  55 +that what they have is not the original version, so that the original
  56 +author's reputation will not be affected by problems that might be
  57 +introduced by others.
  58 +
  59 + Finally, software patents pose a constant threat to the existence of
  60 +any free program. We wish to make sure that a company cannot
  61 +effectively restrict the users of a free program by obtaining a
  62 +restrictive license from a patent holder. Therefore, we insist that
  63 +any patent license obtained for a version of the library must be
  64 +consistent with the full freedom of use specified in this license.
  65 +
  66 + Most GNU software, including some libraries, is covered by the
  67 +ordinary GNU General Public License. This license, the GNU Lesser
  68 +General Public License, applies to certain designated libraries, and
  69 +is quite different from the ordinary General Public License. We use
  70 +this license for certain libraries in order to permit linking those
  71 +libraries into non-free programs.
  72 +
  73 + When a program is linked with a library, whether statically or using
  74 +a shared library, the combination of the two is legally speaking a
  75 +combined work, a derivative of the original library. The ordinary
  76 +General Public License therefore permits such linking only if the
  77 +entire combination fits its criteria of freedom. The Lesser General
  78 +Public License permits more lax criteria for linking other code with
  79 +the library.
  80 +
  81 + We call this license the "Lesser" General Public License because it
  82 +does Less to protect the user's freedom than the ordinary General
  83 +Public License. It also provides other free software developers Less
  84 +of an advantage over competing non-free programs. These disadvantages
  85 +are the reason we use the ordinary General Public License for many
  86 +libraries. However, the Lesser license provides advantages in certain
  87 +special circumstances.
  88 +
  89 + For example, on rare occasions, there may be a special need to
  90 +encourage the widest possible use of a certain library, so that it becomes
  91 +a de-facto standard. To achieve this, non-free programs must be
  92 +allowed to use the library. A more frequent case is that a free
  93 +library does the same job as widely used non-free libraries. In this
  94 +case, there is little to gain by limiting the free library to free
  95 +software only, so we use the Lesser General Public License.
  96 +
  97 + In other cases, permission to use a particular library in non-free
  98 +programs enables a greater number of people to use a large body of
  99 +free software. For example, permission to use the GNU C Library in
  100 +non-free programs enables many more people to use the whole GNU
  101 +operating system, as well as its variant, the GNU/Linux operating
  102 +system.
  103 +
  104 + Although the Lesser General Public License is Less protective of the
  105 +users' freedom, it does ensure that the user of a program that is
  106 +linked with the Library has the freedom and the wherewithal to run
  107 +that program using a modified version of the Library.
  108 +
  109 + The precise terms and conditions for copying, distribution and
  110 +modification follow. Pay close attention to the difference between a
  111 +"work based on the library" and a "work that uses the library". The
  112 +former contains code derived from the library, whereas the latter must
  113 +be combined with the library in order to run.
  114 +
  115 + GNU LESSER GENERAL PUBLIC LICENSE
  116 + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
  117 +
  118 + 0. This License Agreement applies to any software library or other
  119 +program which contains a notice placed by the copyright holder or
  120 +other authorized party saying it may be distributed under the terms of
  121 +this Lesser General Public License (also called "this License").
  122 +Each licensee is addressed as "you".
  123 +
  124 + A "library" means a collection of software functions and/or data
  125 +prepared so as to be conveniently linked with application programs
  126 +(which use some of those functions and data) to form executables.
  127 +
  128 + The "Library", below, refers to any such software library or work
  129 +which has been distributed under these terms. A "work based on the
  130 +Library" means either the Library or any derivative work under
  131 +copyright law: that is to say, a work containing the Library or a
  132 +portion of it, either verbatim or with modifications and/or translated
  133 +straightforwardly into another language. (Hereinafter, translation is
  134 +included without limitation in the term "modification".)
  135 +
  136 + "Source code" for a work means the preferred form of the work for
  137 +making modifications to it. For a library, complete source code means
  138 +all the source code for all modules it contains, plus any associated
  139 +interface definition files, plus the scripts used to control compilation
  140 +and installation of the library.
  141 +
  142 + Activities other than copying, distribution and modification are not
  143 +covered by this License; they are outside its scope. The act of
  144 +running a program using the Library is not restricted, and output from
  145 +such a program is covered only if its contents constitute a work based
  146 +on the Library (independent of the use of the Library in a tool for
  147 +writing it). Whether that is true depends on what the Library does
  148 +and what the program that uses the Library does.
  149 +
  150 + 1. You may copy and distribute verbatim copies of the Library's
  151 +complete source code as you receive it, in any medium, provided that
  152 +you conspicuously and appropriately publish on each copy an
  153 +appropriate copyright notice and disclaimer of warranty; keep intact
  154 +all the notices that refer to this License and to the absence of any
  155 +warranty; and distribute a copy of this License along with the
  156 +Library.
  157 +
  158 + You may charge a fee for the physical act of transferring a copy,
  159 +and you may at your option offer warranty protection in exchange for a
  160 +fee.
  161 +
  162 + 2. You may modify your copy or copies of the Library or any portion
  163 +of it, thus forming a work based on the Library, and copy and
  164 +distribute such modifications or work under the terms of Section 1
  165 +above, provided that you also meet all of these conditions:
  166 +
  167 + a) The modified work must itself be a software library.
  168 +
  169 + b) You must cause the files modified to carry prominent notices
  170 + stating that you changed the files and the date of any change.
  171 +
  172 + c) You must cause the whole of the work to be licensed at no
  173 + charge to all third parties under the terms of this License.
  174 +
  175 + d) If a facility in the modified Library refers to a function or a
  176 + table of data to be supplied by an application program that uses
  177 + the facility, other than as an argument passed when the facility
  178 + is invoked, then you must make a good faith effort to ensure that,
  179 + in the event an application does not supply such function or
  180 + table, the facility still operates, and performs whatever part of
  181 + its purpose remains meaningful.
  182 +
  183 + (For example, a function in a library to compute square roots has
  184 + a purpose that is entirely well-defined independent of the
  185 + application. Therefore, Subsection 2d requires that any
  186 + application-supplied function or table used by this function must
  187 + be optional: if the application does not supply it, the square
  188 + root function must still compute square roots.)
  189 +
  190 +These requirements apply to the modified work as a whole. If
  191 +identifiable sections of that work are not derived from the Library,
  192 +and can be reasonably considered independent and separate works in
  193 +themselves, then this License, and its terms, do not apply to those
  194 +sections when you distribute them as separate works. But when you
  195 +distribute the same sections as part of a whole which is a work based
  196 +on the Library, the distribution of the whole must be on the terms of
  197 +this License, whose permissions for other licensees extend to the
  198 +entire whole, and thus to each and every part regardless of who wrote
  199 +it.
  200 +
  201 +Thus, it is not the intent of this section to claim rights or contest
  202 +your rights to work written entirely by you; rather, the intent is to
  203 +exercise the right to control the distribution of derivative or
  204 +collective works based on the Library.
  205 +
  206 +In addition, mere aggregation of another work not based on the Library
  207 +with the Library (or with a work based on the Library) on a volume of
  208 +a storage or distribution medium does not bring the other work under
  209 +the scope of this License.
  210 +
  211 + 3. You may opt to apply the terms of the ordinary GNU General Public
  212 +License instead of this License to a given copy of the Library. To do
  213 +this, you must alter all the notices that refer to this License, so
  214 +that they refer to the ordinary GNU General Public License, version 2,
  215 +instead of to this License. (If a newer version than version 2 of the
  216 +ordinary GNU General Public License has appeared, then you can specify
  217 +that version instead if you wish.) Do not make any other change in
  218 +these notices.
  219 +
  220 + Once this change is made in a given copy, it is irreversible for
  221 +that copy, so the ordinary GNU General Public License applies to all
  222 +subsequent copies and derivative works made from that copy.
  223 +
  224 + This option is useful when you wish to copy part of the code of
  225 +the Library into a program that is not a library.
  226 +
  227 + 4. You may copy and distribute the Library (or a portion or
  228 +derivative of it, under Section 2) in object code or executable form
  229 +under the terms of Sections 1 and 2 above provided that you accompany
  230 +it with the complete corresponding machine-readable source code, which
  231 +must be distributed under the terms of Sections 1 and 2 above on a
  232 +medium customarily used for software interchange.
  233 +
  234 + If distribution of object code is made by offering access to copy
  235 +from a designated place, then offering equivalent access to copy the
  236 +source code from the same place satisfies the requirement to
  237 +distribute the source code, even though third parties are not
  238 +compelled to copy the source along with the object code.
  239 +
  240 + 5. A program that contains no derivative of any portion of the
  241 +Library, but is designed to work with the Library by being compiled or
  242 +linked with it, is called a "work that uses the Library". Such a
  243 +work, in isolation, is not a derivative work of the Library, and
  244 +therefore falls outside the scope of this License.
  245 +
  246 + However, linking a "work that uses the Library" with the Library
  247 +creates an executable that is a derivative of the Library (because it
  248 +contains portions of the Library), rather than a "work that uses the
  249 +library". The executable is therefore covered by this License.
  250 +Section 6 states terms for distribution of such executables.
  251 +
  252 + When a "work that uses the Library" uses material from a header file
  253 +that is part of the Library, the object code for the work may be a
  254 +derivative work of the Library even though the source code is not.
  255 +Whether this is true is especially significant if the work can be
  256 +linked without the Library, or if the work is itself a library. The
  257 +threshold for this to be true is not precisely defined by law.
  258 +
  259 + If such an object file uses only numerical parameters, data
  260 +structure layouts and accessors, and small macros and small inline
  261 +functions (ten lines or less in length), then the use of the object
  262 +file is unrestricted, regardless of whether it is legally a derivative
  263 +work. (Executables containing this object code plus portions of the
  264 +Library will still fall under Section 6.)
  265 +
  266 + Otherwise, if the work is a derivative of the Library, you may
  267 +distribute the object code for the work under the terms of Section 6.
  268 +Any executables containing that work also fall under Section 6,
  269 +whether or not they are linked directly with the Library itself.
  270 +
  271 + 6. As an exception to the Sections above, you may also combine or
  272 +link a "work that uses the Library" with the Library to produce a
  273 +work containing portions of the Library, and distribute that work
  274 +under terms of your choice, provided that the terms permit
  275 +modification of the work for the customer's own use and reverse
  276 +engineering for debugging such modifications.
  277 +
  278 + You must give prominent notice with each copy of the work that the
  279 +Library is used in it and that the Library and its use are covered by
  280 +this License. You must supply a copy of this License. If the work
  281 +during execution displays copyright notices, you must include the
  282 +copyright notice for the Library among them, as well as a reference
  283 +directing the user to the copy of this License. Also, you must do one
  284 +of these things:
  285 +
  286 + a) Accompany the work with the complete corresponding
  287 + machine-readable source code for the Library including whatever
  288 + changes were used in the work (which must be distributed under
  289 + Sections 1 and 2 above); and, if the work is an executable linked
  290 + with the Library, with the complete machine-readable "work that
  291 + uses the Library", as object code and/or source code, so that the
  292 + user can modify the Library and then relink to produce a modified
  293 + executable containing the modified Library. (It is understood
  294 + that the user who changes the contents of definitions files in the
  295 + Library will not necessarily be able to recompile the application
  296 + to use the modified definitions.)
  297 +
  298 + b) Use a suitable shared library mechanism for linking with the
  299 + Library. A suitable mechanism is one that (1) uses at run time a
  300 + copy of the library already present on the user's computer system,
  301 + rather than copying library functions into the executable, and (2)
  302 + will operate properly with a modified version of the library, if
  303 + the user installs one, as long as the modified version is
  304 + interface-compatible with the version that the work was made with.
  305 +
  306 + c) Accompany the work with a written offer, valid for at
  307 + least three years, to give the same user the materials
  308 + specified in Subsection 6a, above, for a charge no more
  309 + than the cost of performing this distribution.
  310 +
  311 + d) If distribution of the work is made by offering access to copy
  312 + from a designated place, offer equivalent access to copy the above
  313 + specified materials from the same place.
  314 +
  315 + e) verify that the user has already received a copy of these
  316 + materials or that you have already sent this user a copy.
  317 +
  318 + For an executable, the required form of the "work that uses the
  319 +Library" must include any data and utility programs needed for
  320 +reproducing the executable from it. However, as a special exception,
  321 +the materials to be distributed need not include anything that is
  322 +normally distributed (in either source or binary form) with the major
  323 +components (compiler, kernel, and so on) of the operating system on
  324 +which the executable runs, unless that component itself accompanies
  325 +the executable.
  326 +
  327 + It may happen that this requirement contradicts the license
  328 +restrictions of other proprietary libraries that do not normally
  329 +accompany the operating system. Such a contradiction means you cannot
  330 +use both them and the Library together in an executable that you
  331 +distribute.
  332 +
  333 + 7. You may place library facilities that are a work based on the
  334 +Library side-by-side in a single library together with other library
  335 +facilities not covered by this License, and distribute such a combined
  336 +library, provided that the separate distribution of the work based on
  337 +the Library and of the other library facilities is otherwise
  338 +permitted, and provided that you do these two things:
  339 +
  340 + a) Accompany the combined library with a copy of the same work
  341 + based on the Library, uncombined with any other library
  342 + facilities. This must be distributed under the terms of the
  343 + Sections above.
  344 +
  345 + b) Give prominent notice with the combined library of the fact
  346 + that part of it is a work based on the Library, and explaining
  347 + where to find the accompanying uncombined form of the same work.
  348 +
  349 + 8. You may not copy, modify, sublicense, link with, or distribute
  350 +the Library except as expressly provided under this License. Any
  351 +attempt otherwise to copy, modify, sublicense, link with, or
  352 +distribute the Library is void, and will automatically terminate your
  353 +rights under this License. However, parties who have received copies,
  354 +or rights, from you under this License will not have their licenses
  355 +terminated so long as such parties remain in full compliance.
  356 +
  357 + 9. You are not required to accept this License, since you have not
  358 +signed it. However, nothing else grants you permission to modify or
  359 +distribute the Library or its derivative works. These actions are
  360 +prohibited by law if you do not accept this License. Therefore, by
  361 +modifying or distributing the Library (or any work based on the
  362 +Library), you indicate your acceptance of this License to do so, and
  363 +all its terms and conditions for copying, distributing or modifying
  364 +the Library or works based on it.
  365 +
  366 + 10. Each time you redistribute the Library (or any work based on the
  367 +Library), the recipient automatically receives a license from the
  368 +original licensor to copy, distribute, link with or modify the Library
  369 +subject to these terms and conditions. You may not impose any further
  370 +restrictions on the recipients' exercise of the rights granted herein.
  371 +You are not responsible for enforcing compliance by third parties with
  372 +this License.
  373 +
  374 + 11. If, as a consequence of a court judgment or allegation of patent
  375 +infringement or for any other reason (not limited to patent issues),
  376 +conditions are imposed on you (whether by court order, agreement or
  377 +otherwise) that contradict the conditions of this License, they do not
  378 +excuse you from the conditions of this License. If you cannot
  379 +distribute so as to satisfy simultaneously your obligations under this
  380 +License and any other pertinent obligations, then as a consequence you
  381 +may not distribute the Library at all. For example, if a patent
  382 +license would not permit royalty-free redistribution of the Library by
  383 +all those who receive copies directly or indirectly through you, then
  384 +the only way you could satisfy both it and this License would be to
  385 +refrain entirely from distribution of the Library.
  386 +
  387 +If any portion of this section is held invalid or unenforceable under any
  388 +particular circumstance, the balance of the section is intended to apply,
  389 +and the section as a whole is intended to apply in other circumstances.
  390 +
  391 +It is not the purpose of this section to induce you to infringe any
  392 +patents or other property right claims or to contest validity of any
  393 +such claims; this section has the sole purpose of protecting the
  394 +integrity of the free software distribution system which is
  395 +implemented by public license practices. Many people have made
  396 +generous contributions to the wide range of software distributed
  397 +through that system in reliance on consistent application of that
  398 +system; it is up to the author/donor to decide if he or she is willing
  399 +to distribute software through any other system and a licensee cannot
  400 +impose that choice.
  401 +
  402 +This section is intended to make thoroughly clear what is believed to
  403 +be a consequence of the rest of this License.
  404 +
  405 + 12. If the distribution and/or use of the Library is restricted in
  406 +certain countries either by patents or by copyrighted interfaces, the
  407 +original copyright holder who places the Library under this License may add
  408 +an explicit geographical distribution limitation excluding those countries,
  409 +so that distribution is permitted only in or among countries not thus
  410 +excluded. In such case, this License incorporates the limitation as if
  411 +written in the body of this License.
  412 +
  413 + 13. The Free Software Foundation may publish revised and/or new
  414 +versions of the Lesser General Public License from time to time.
  415 +Such new versions will be similar in spirit to the present version,
  416 +but may differ in detail to address new problems or concerns.
  417 +
  418 +Each version is given a distinguishing version number. If the Library
  419 +specifies a version number of this License which applies to it and
  420 +"any later version", you have the option of following the terms and
  421 +conditions either of that version or of any later version published by
  422 +the Free Software Foundation. If the Library does not specify a
  423 +license version number, you may choose any version ever published by
  424 +the Free Software Foundation.
  425 +
  426 + 14. If you wish to incorporate parts of the Library into other free
  427 +programs whose distribution conditions are incompatible with these,
  428 +write to the author to ask for permission. For software which is
  429 +copyrighted by the Free Software Foundation, write to the Free
  430 +Software Foundation; we sometimes make exceptions for this. Our
  431 +decision will be guided by the two goals of preserving the free status
  432 +of all derivatives of our free software and of promoting the sharing
  433 +and reuse of software generally.
  434 +
  435 + NO WARRANTY
  436 +
  437 + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
  438 +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
  439 +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
  440 +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
  441 +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
  442 +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  443 +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
  444 +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
  445 +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
  446 +
  447 + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
  448 +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
  449 +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
  450 +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
  451 +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
  452 +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
  453 +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
  454 +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
  455 +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
  456 +DAMAGES.
  457 +
  458 + END OF TERMS AND CONDITIONS
  459 +
  460 + How to Apply These Terms to Your New Libraries
  461 +
  462 + If you develop a new library, and you want it to be of the greatest
  463 +possible use to the public, we recommend making it free software that
  464 +everyone can redistribute and change. You can do so by permitting
  465 +redistribution under these terms (or, alternatively, under the terms of the
  466 +ordinary General Public License).
  467 +
  468 + To apply these terms, attach the following notices to the library. It is
  469 +safest to attach them to the start of each source file to most effectively
  470 +convey the exclusion of warranty; and each file should have at least the
  471 +"copyright" line and a pointer to where the full notice is found.
  472 +
  473 + <one line to give the library's name and a brief idea of what it does.>
  474 + Copyright (C) <year> <name of author>
  475 +
  476 + This library is free software; you can redistribute it and/or
  477 + modify it under the terms of the GNU Lesser General Public
  478 + License as published by the Free Software Foundation; either
  479 + version 2.1 of the License, or (at your option) any later version.
  480 +
  481 + This library is distributed in the hope that it will be useful,
  482 + but WITHOUT ANY WARRANTY; without even the implied warranty of
  483 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  484 + Lesser General Public License for more details.
  485 +
  486 + You should have received a copy of the GNU Lesser General Public
  487 + License along with this library; if not, write to the Free Software
  488 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  489 +
  490 +Also add information on how to contact you by electronic and paper mail.
  491 +
  492 +You should also get your employer (if you work as a programmer) or your
  493 +school, if any, to sign a "copyright disclaimer" for the library, if
  494 +necessary. Here is a sample; alter the names:
  495 +
  496 + Yoyodyne, Inc., hereby disclaims all copyright interest in the
  497 + library `Frob' (a library for tweaking knobs) written by James Random Hacker.
  498 +
  499 + <signature of Ty Coon>, 1 April 1990
  500 + Ty Coon, President of Vice
  501 +
  502 +That's all there is to it!
  503 +
  504 +
  1 +<?php
  2 +/**
  3 + * PHPMailer SPL autoloader.
  4 + * PHP Version 5
  5 + * @package PHPMailer
  6 + * @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
  7 + * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
  8 + * @author Jim Jagielski (jimjag) <jimjag@gmail.com>
  9 + * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
  10 + * @author Brent R. Matzelle (original founder)
  11 + * @copyright 2012 - 2014 Marcus Bointon
  12 + * @copyright 2010 - 2012 Jim Jagielski
  13 + * @copyright 2004 - 2009 Andy Prevost
  14 + * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
  15 + * @note This program is distributed in the hope that it will be useful - WITHOUT
  16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  17 + * FITNESS FOR A PARTICULAR PURPOSE.
  18 + */
  19 +
  20 +/**
  21 + * PHPMailer SPL autoloader.
  22 + * @param string $classname The name of the class to load
  23 + */
  24 +function PHPMailerAutoload($classname)
  25 +{
  26 + //Can't use __DIR__ as it's only in PHP 5.3+
  27 + $filename = dirname(__FILE__).DIRECTORY_SEPARATOR.'class.'.strtolower($classname).'.php';
  28 + if (is_readable($filename)) {
  29 + require $filename;
  30 + }
  31 +}
  32 +
  33 +if (version_compare(PHP_VERSION, '5.1.2', '>=')) {
  34 + //SPL autoloading was introduced in PHP 5.1.2
  35 + if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
  36 + spl_autoload_register('PHPMailerAutoload', true, true);
  37 + } else {
  38 + spl_autoload_register('PHPMailerAutoload');
  39 + }
  40 +} else {
  41 + /**
  42 + * Fall back to traditional autoload for old PHP versions
  43 + * @param string $classname The name of the class to load
  44 + */
  45 + function __autoload($classname)
  46 + {
  47 + PHPMailerAutoload($classname);
  48 + }
  49 +}
  1 +![PHPMailer](https://raw.github.com/PHPMailer/PHPMailer/master/examples/images/phpmailer.png)
  2 +
  3 +# PHPMailer - A full-featured email creation and transfer class for PHP
  4 +
  5 +Build status: [![Build Status](https://travis-ci.org/PHPMailer/PHPMailer.svg)](https://travis-ci.org/PHPMailer/PHPMailer)
  6 +[![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/PHPMailer/PHPMailer/badges/quality-score.png?s=3758e21d279becdf847a557a56a3ed16dfec9d5d)](https://scrutinizer-ci.com/g/PHPMailer/PHPMailer/)
  7 +[![Code Coverage](https://scrutinizer-ci.com/g/PHPMailer/PHPMailer/badges/coverage.png?s=3fe6ca5fe8cd2cdf96285756e42932f7ca256962)](https://scrutinizer-ci.com/g/PHPMailer/PHPMailer/)
  8 +
  9 +## Class Features
  10 +
  11 +- Probably the world's most popular code for sending email from PHP!
  12 +- Used by many open-source projects: Drupal, SugarCRM, Yii, Joomla! and many more
  13 +- Integrated SMTP support - send without a local mail server
  14 +- Send emails with multiple TOs, CCs, BCCs and REPLY-TOs
  15 +- Multipart/alternative emails for mail clients that do not read HTML email
  16 +- Support for UTF-8 content and 8bit, base64, binary, and quoted-printable encodings
  17 +- SMTP authentication with LOGIN, PLAIN, NTLM and CRAM-MD5 mechanisms over SSL and TLS transports
  18 +- Native language support
  19 +- DKIM and S/MIME signing support
  20 +- Compatible with PHP 5.0 and later
  21 +- Much more!
  22 +
  23 +## Why you might need it
  24 +
  25 +Many PHP developers utilize email in their code. The only PHP function that supports this is the mail() function. However, it does not provide any assistance for making use of popular features such as HTML-based emails and attachments.
  26 +
  27 +Formatting email correctly is surprisingly difficult. There are myriad overlapping RFCs, requiring tight adherence to horribly complicated formatting and encoding rules - the vast majority of code that you'll find online that uses the mail() function directly is just plain wrong!
  28 +*Please* don't be tempted to do it yourself - if you don't use PHPMailer, there are many other excellent libraries that you should look at before rolling your own - try SwiftMailer, Zend_Mail, eZcomponents etc.
  29 +
  30 +The PHP mail() function usually sends via a local mail server, typically fronted by a `sendmail` binary on Linux, BSD and OS X platforms, however, Windows usually doesn't include a local mail server; PHPMailer's integrated SMTP implementation allows email sending on Windows platforms without a local mail server.
  31 +
  32 +## License
  33 +
  34 +This software is licenced under the [LGPL 2.1](http://www.gnu.org/licenses/lgpl-2.1.html). Please read LICENSE for information on the
  35 +software availability and distribution.
  36 +
  37 +## Installation & loading
  38 +
  39 +PHPMailer is available via [Composer/Packagist](https://packagist.org/packages/phpmailer/phpmailer). Alternatively, just copy the contents of the PHPMailer folder into somewhere that's in your PHP `include_path` setting. If you don't speak git or just want a tarball, click the 'zip' button at the top of the page in GitHub.
  40 +
  41 +PHPMailer provides an SPL-compatible autoloader, and that is the preferred way of loading the library - just `require '/path/to/PHPMailerAutoload.php';` and everything should work. The autoloader does not throw errors if it can't find classes so it prepends itself to the SPL list, allowing your own (or your framework's) autoloader to catch errors. SPL autoloading was introduced in PHP 5.1.0, so if you are using a version older than that you will need to require/include each class manually.
  42 +PHPMailer does *not* declare a namespace because namespaces were only introduced in PHP 5.3.
  43 +
  44 +### Minimal installation
  45 +
  46 +While installing the entire package manually or with composer is simple, convenient and reliable, you may want to include only vital files in your project. At the very least you will need [class.phpmailer.php](class.phpmailer.php). If you're using SMTP, you'll need [class.smtp.php](class.smtp.php), and if you're using POP-before SMTP, you'll need [class.pop3.php](class.pop3.php). For all of these, we recommend you use [the autoloader](PHPMailerAutoload.php) too. You can skip the [language](language/) folder if you're not showing errors to users and can make do with English-only errors. You may need the additional classes in the [extras](extras/) folder if you are using those features, including NTLM authentication, advanced HTML-to-text conversion and ics generation.
  47 +
  48 +## A Simple Example
  49 +
  50 +```php
  51 +<?php
  52 +require 'PHPMailerAutoload.php';
  53 +
  54 +$mail = new PHPMailer;
  55 +
  56 +$mail->isSMTP(); // Set mailer to use SMTP
  57 +$mail->Host = 'smtp1.example.com;smtp2.example.com'; // Specify main and backup SMTP servers
  58 +$mail->SMTPAuth = true; // Enable SMTP authentication
  59 +$mail->Username = 'user@example.com'; // SMTP username
  60 +$mail->Password = 'secret'; // SMTP password
  61 +$mail->SMTPSecure = 'tls'; // Enable encryption, 'ssl' also accepted
  62 +
  63 +$mail->From = 'from@example.com';
  64 +$mail->FromName = 'Mailer';
  65 +$mail->addAddress('joe@example.net', 'Joe User'); // Add a recipient
  66 +$mail->addAddress('ellen@example.com'); // Name is optional
  67 +$mail->addReplyTo('info@example.com', 'Information');
  68 +$mail->addCC('cc@example.com');
  69 +$mail->addBCC('bcc@example.com');
  70 +
  71 +$mail->WordWrap = 50; // Set word wrap to 50 characters
  72 +$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
  73 +$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
  74 +$mail->isHTML(true); // Set email format to HTML
  75 +
  76 +$mail->Subject = 'Here is the subject';
  77 +$mail->Body = 'This is the HTML message body <b>in bold!</b>';
  78 +$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
  79 +
  80 +if(!$mail->send()) {
  81 + echo 'Message could not be sent.';
  82 + echo 'Mailer Error: ' . $mail->ErrorInfo;
  83 +} else {
  84 + echo 'Message has been sent';
  85 +}
  86 +```
  87 +
  88 +You'll find plenty more to play with in the [examples](examples/) folder.
  89 +
  90 +That's it. You should now be ready to use PHPMailer!
  91 +
  92 +## Localization
  93 +PHPMailer defaults to English, but in the [language](language/) folder you'll find numerous (39 at the time of writing) translations for PHPMailer error messages that you may encounter. Their filenames contain [ISO 639-1](http://en.wikipedia.org/wiki/ISO_639-1) language code for the translations, for example `fr` for French. To specify a language, you need to tell PHPMailer which one to use, like this:
  94 +
  95 +```php
  96 +// To load the French version
  97 +$mail->setLanguage('fr', '/optional/path/to/language/directory/');
  98 +```
  99 +
  100 +We welcome corrections and new languages - if you're looking for corrections to do, run the [phpmailerLangTest.php](test/phpmailerLangTest.php) script in the tests folder and it will show any missing translations.
  101 +
  102 +## Documentation
  103 +
  104 +Generated documentation is [available online](http://phpmailer.github.io/PHPMailer/).
  105 +
  106 +You'll find some basic user-level docs in the [docs](docs/) folder, and you can generate complete API-level documentation using the [generatedocs.sh](docs/generatedocs.sh) shell script in the docs folder, though you'll need to install [PHPDocumentor](http://www.phpdoc.org) first. You may find [the unit tests](test/phpmailerTest.php) a good source of how to do various operations such as encryption.
  107 +
  108 +## Tests
  109 +
  110 +There is a PHPUnit test script in the [test](test/) folder.
  111 +
  112 +Build status: [![Build Status](https://travis-ci.org/PHPMailer/PHPMailer.svg)](https://travis-ci.org/PHPMailer/PHPMailer)
  113 +
  114 +If this isn't passing, is there something you can do to help?
  115 +
  116 +## Contributing
  117 +
  118 +Please submit bug reports, suggestions and pull requests to the [GitHub issue tracker](https://github.com/PHPMailer/PHPMailer/issues).
  119 +
  120 +We're particularly interested in fixing edge-cases, expanding test coverage and updating translations.
  121 +
  122 +With the move to the PHPMailer GitHub organisation, you'll need to update any remote URLs referencing the old GitHub location with a command like this from within your clone:
  123 +
  124 +`git remote set-url upstream https://github.com/PHPMailer/PHPMailer.git`
  125 +
  126 +Please *don't* use the SourceForge or Google Code projects any more.
  127 +
  128 +## Changelog
  129 +
  130 +See [changelog](changelog.md).
  131 +
  132 +## History
  133 +- PHPMailer was originally written in 2001 by Brent R. Matzelle as a [SourceForge project](http://sourceforge.net/projects/phpmailer/).
  134 +- Marcus Bointon (coolbru on SF) and Andy Prevost (codeworxtech) took over the project in 2004.
  135 +- Became an Apache incubator project on Google Code in 2010, managed by Jim Jagielski.
  136 +- Marcus created his fork on [GitHub](https://github.com/Synchro/PHPMailer).
  137 +- Jim and Marcus decide to join forces and use GitHub as the canonical and official repo for PHPMailer.
  138 +- PHPMailer moves to the [PHPMailer organisation](https://github.com/PHPMailer) on GitHub.
  139 +
  140 +### What's changed since moving from SourceForge?
  141 +- Official successor to the SourceForge and Google Code projects.
  142 +- Test suite.
  143 +- Continuous integration with Travis-CI.
  144 +- Composer support.
  145 +- Public development.
  146 +- Additional languages and language strings.
  147 +- CRAM-MD5 authentication support.
  148 +- Preserves full repo history of authors, commits and branches from the original SourceForge project.
  1 +# ChangeLog
  2 +
  3 +## Version 5.2.8 (May 14th 2014)
  4 +* Increase timeout to match RFC2821 section 4.5.3.2 and thus not fail greetdelays, fixes #104
  5 +* Add timestamps to default debug output
  6 +* Add connection events and new level 3 to debug output options
  7 +* Chinese language update (Thanks to @binaryoung)
  8 +* Allow custom Mailer types (Thanks to @michield)
  9 +* Cope with spaces around SMTP host specs
  10 +* Fix processing of multiple hosts in connect string
  11 +* Added Galician translation (Thanks to @donatorouco)
  12 +* Autoloader now prepends
  13 +* Docs updates
  14 +* Add Latvian translation (Thanks to @eddsstudio)
  15 +* Add Belarusian translation (Thanks to @amaksymiuk)
  16 +* Make autoloader work better on older PHP versions
  17 +* Avoid double-encoding if mbstring is overloading mail()
  18 +* Add Portuguese translation (Thanks to @Jonadabe)
  19 +* Make quoted-printable encoder respect line ending setting
  20 +* Improve Chinese translation (Thanks to @PeterDaveHello)
  21 +* Add Georgian translation (Thanks to @akalongman)
  22 +* Add Greek translation (Thanks to @lenasterg)
  23 +* Fix serverHostname on PHP < 5.3
  24 +* Improve performance of SMTP class
  25 +* Implement automatic 7bit downgrade
  26 +* Add Vietnamese translation (Thanks to @vinades)
  27 +* Improve example images, switch to PNG
  28 +* Add Croatian translation (Thanks to @hrvoj3e)
  29 +* Remove setting the Return-Path and deprecate the Return-path property - it's just wrong!
  30 +* Fix language file loading if CWD has changed (@stephandesouza)
  31 +* Add HTML5 email validation pattern
  32 +* Improve Turkish translations (Thanks to @yasinaydin)
  33 +* Improve Romanian translations (Thanks to @aflorea)
  34 +* Fix quoted-printable encoding of multiparts
  35 +* Check php.ini for path to sendmail/qmail before using default
  36 +* Improve Farsi translation (Thanks to @MHM5000)
  37 +* Don't use quoted-printable encoding for multipart types
  38 +* Add Serbian translation (Thanks to ajevremovic at gmail.com)
  39 +* Remove useless PHP5 check
  40 +* Use SVG for build status badges
  41 +* Store MessageDate on creation
  42 +* Better default behaviour for validateAddress
  43 +
  44 +## Version 5.2.7 (September 12th 2013)
  45 +* Add Ukranian translation from @Krezalis
  46 +* Support for do_verp
  47 +* Fix bug in CRAM-MD5 AUTH
  48 +* Propagate Debugoutput option to SMTP class (@Reblutus)
  49 +* Determine MIME type of attachments automatically
  50 +* Add cross-platform, multibyte-safe pathinfo replacement (with tests) and use it
  51 +* Add a new 'html' Debugoutput type
  52 +* Clean up SMTP debug output, remove embedded HTML
  53 +* Some small changes in header formatting to improve IETF msglint test results
  54 +* Update test_script to use some recently changed features, rename to code_generator
  55 +* Generated code actually works!
  56 +* Update SyntaxHighlighter
  57 +* Major overhaul and cleanup of example code
  58 +* New PHPMailer graphic
  59 +* msgHTML now uses RFC2392-compliant content ids
  60 +* Add line break normalization function and use it in msgHTML
  61 +* Don't set unnecessary reply-to addresses
  62 +* Make fakesendmail.sh a bit cleaner and safer
  63 +* Set a content-transfer-encoding on multiparts (fixes msglint error)
  64 +* Fix cid generation in msgHTML (Thanks to @digitalthought)
  65 +* Fix handling of multiple SMTP servers (Thanks to @NanoCaiordo)
  66 +* SMTP->connect() now supports stream context options (Thanks to @stanislavdavid)
  67 +* Add support for iCal event alternatives (Thanks to @reblutus)
  68 +* Update to Polish language file (Thanks to Krzysztof Kowalewski)
  69 +* Update to Norwegian language file (Thanks to @datagutten)
  70 +* Update to Hungarian language file (Thanks to @dominicus-75)
  71 +* Add Persian/Farsi translation from @jaii
  72 +* Make SMTPDebug property type match type in SMTP class
  73 +* Add unit tests for DKIM
  74 +* Major refactor of SMTP class
  75 +* Reformat to PSR-2 coding standard
  76 +* Introduce autoloader
  77 +* Allow overriding of SMTP class
  78 +* Overhaul of PHPDocs
  79 +* Fix broken Q-encoding
  80 +* Czech language update (Thanks to @nemelu)
  81 +* Removal of excess blank lines in messages
  82 +* Added fake POP server and unit tests for POP-before-SMTP
  83 +
  84 +## Version 5.2.6 (April 11th 2013)
  85 +* Reflect move to PHPMailer GitHub organisation at https://github.com/PHPMailer/PHPMailer
  86 +* Fix unbumped version numbers
  87 +* Update packagist.org with new location
  88 +* Clean up Changelog
  89 +
  90 +## Version 5.2.5 (April 6th 2013)
  91 +* First official release after move from Google Code
  92 +* Fixes for qmail when sending via mail()
  93 +* Merge in changes from Google code 5.2.4 release
  94 +* Minor coding standards cleanup in SMTP class
  95 +* Improved unit tests, now tests S/MIME signing
  96 +* Travis-CI support on GitHub, runs tests with fake SMTP server
  97 +
  98 +## Version 5.2.4 (February 19, 2013)
  99 +* Fix tag and version bug.
  100 +* un-deprecate isSMTP(), isMail(), IsSendmail() and isQmail().
  101 +* Numerous translation updates
  102 +
  103 +## Version 5.2.3 (February 8, 2013)
  104 +* Fix issue with older PCREs and ValidateAddress() (Bugz: 124)
  105 +* Add CRAM-MD5 authentication, thanks to Elijah madden, https://github.com/okonomiyaki3000
  106 +* Replacement of obsolete Quoted-Printable encoder with a much better implementation
  107 +* Composer package definition
  108 +* New language added: Hebrew
  109 +
  110 +## Version 5.2.2 (December 3, 2012)
  111 +* Some fixes and syncs from https://github.com/Synchro/PHPMailer
  112 +* Add Slovak translation, thanks to Michal Tinka
  113 +
  114 +## Version 5.2.2-rc2 (November 6, 2012)
  115 +* Fix SMTP server rotation (Bugz: 118)
  116 +* Allow override of autogen'ed 'Date' header (for Drupal's
  117 + og_mailinglist module)
  118 +* No whitespace after '-f' option (Bugz: 116)
  119 +* Work around potential warning (Bugz: 114)
  120 +
  121 +## Version 5.2.2-rc1 (September 28, 2012)
  122 +* Header encoding works with long lines (Bugz: 93)
  123 +* Turkish language update (Bugz: 94)
  124 +* undefined $pattern in EncodeQ bug squashed (Bugz: 98)
  125 +* use of mail() in safe_mode now works (Bugz: 96)
  126 +* ValidateAddress() now 'public static' so people can override the
  127 + default and use their own validation scheme.
  128 +* ValidateAddress() no longer uses broken FILTER_VALIDATE_EMAIL
  129 +* Added in AUTH PLAIN SMTP authentication
  130 +
  131 +## Version 5.2.2-beta2 (August 17, 2012)
  132 +* Fixed Postfix VERP support (Bugz: 92)
  133 +* Allow action_function callbacks to pass/use
  134 + the From address (passed as final param)
  135 +* Prevent inf look for get_lines() (Bugz: 77)
  136 +* New public var ($UseSendmailOptions). Only pass sendmail()
  137 + options iff we really are using sendmail or something sendmail
  138 + compatible. (Bugz: 75)
  139 +* default setting for LE returned to "\n" due to popular demand.
  140 +
  141 +## Version 5.2.2-beta1 (July 13, 2012)
  142 +* Expose PreSend() and PostSend() as public methods to allow
  143 + for more control if serializing message sending.
  144 +* GetSentMIMEMessage() only constructs the message copy when
  145 + needed. Save memory.
  146 +* Only pass params to mail() if the underlying MTA is
  147 + "sendmail" (as defined as "having the string sendmail
  148 + in its pathname") [#69]
  149 +* Attachments now work with Amazon SES and others [Bugz#70]
  150 +* Debug output now sent to stdout (via echo) or error_log [Bugz#5]
  151 +* New var: Debugoutput (for above) [Bugz#5]
  152 +* SMTP reads now Timeout aware (new var: Timeout=15) [Bugz#71]
  153 +* SMTP reads now can have a Timelimit associated with them
  154 + (new var: Timelimit=30)[Bugz#71]
  155 +* Fix quoting issue associated with charsets
  156 +* default setting for LE is now RFC compliant: "\r\n"
  157 +* Return-Path can now be user defined (new var: ReturnPath)
  158 + (the default is "" which implies no change from previous
  159 + behavior, which was to use either From or Sender) [Bugz#46]
  160 +* X-Mailer header can now be disabled (by setting to a
  161 + whitespace string, eg " ") [Bugz#66]
  162 +* Bugz closed: #68, #60, #42, #43, #59, #55, #66, #48, #49,
  163 + #52, #31, #41, #5. #70, #69
  164 +
  165 +## Version 5.2.1 (January 16, 2012)
  166 +* Closed several bugs #5
  167 +* Performance improvements
  168 +* MsgHTML() now returns the message as required.
  169 +* New method: GetSentMIMEMessage() (returns full copy of sent message)
  170 +
  171 +## Version 5.2 (July 19, 2011)
  172 +* protected MIME body and header
  173 +* better DKIM DNS Resource Record support
  174 +* better aly handling
  175 +* htmlfilter class added to extras
  176 +* moved to Apache Extras
  177 +
  178 +## Version 5.1 (October 20, 2009)
  179 +* fixed filename issue with AddStringAttachment (thanks to Tony)
  180 +* fixed "SingleTo" property, now works with Senmail, Qmail, and SMTP in
  181 + addition to PHP mail()
  182 +* added DKIM digital signing functionality, new properties:
  183 + - DKIM_domain (sets the domain name)
  184 + - DKIM_private (holds DKIM private key)
  185 + - DKIM_passphrase (holds your DKIM passphrase)
  186 + - DKIM_selector (holds the DKIM "selector")
  187 + - DKIM_identity (holds the identifying email address)
  188 +* added callback function support
  189 + - callback function parameters include:
  190 + result, to, cc, bcc, subject and body
  191 + - see the test/test_callback.php file for usage.
  192 +* added "auto" identity functionality
  193 + - can automatically add:
  194 + - Return-path (if Sender not set)
  195 + - Reply-To (if ReplyTo not set)
  196 + - can be disabled:
  197 + - $mail->SetFrom('yourname@yourdomain.com','First Last',false);
  198 + - or by adding the $mail->Sender and/or $mail->ReplyTo properties
  199 +
  200 +Note: "auto" identity added to help with emails ending up in spam or junk boxes because of missing headers
  201 +
  202 +## Version 5.0.2 (May 24, 2009)
  203 +* Fix for missing attachments when inline graphics are present
  204 +* Fix for missing Cc in header when using SMTP (mail was sent,
  205 + but not displayed in header -- Cc receiver only saw email To:
  206 + line and no Cc line, but did get the email (To receiver
  207 + saw same)
  208 +
  209 +## Version 5.0.1 (April 05, 2009)
  210 +* Temporary fix for missing attachments
  211 +
  212 +## Version 5.0.0 (April 02, 2009)
  213 +With the release of this version, we are initiating a new version numbering
  214 +system to differentiate from the PHP4 version of PHPMailer.
  215 +Most notable in this release is fully object oriented code.
  216 +
  217 +### class.smtp.php:
  218 +* Refactored class.smtp.php to support new exception handling
  219 +* code size reduced from 29.2 Kb to 25.6 Kb
  220 +* Removed unnecessary functions from class.smtp.php:
  221 + - public function Expand($name) {
  222 + - public function Help($keyword="") {
  223 + - public function Noop() {
  224 + - public function Send($from) {
  225 + - public function SendOrMail($from) {
  226 + - public function Verify($name) {
  227 +
  228 +### class.phpmailer.php:
  229 +* Refactored class.phpmailer.php with new exception handling
  230 +* Changed processing functionality of Sendmail and Qmail so they cannot be
  231 + inadvertently used
  232 +* removed getFile() function, just became a simple wrapper for
  233 + file_get_contents()
  234 +* added check for PHP version (will gracefully exit if not at least PHP 5.0)
  235 +* enhanced code to check if an attachment source is the same as an embedded or
  236 + inline graphic source to eliminate duplicate attachments
  237 +
  238 +### New /test_script
  239 +We have written a test script you can use to test the script as part of your
  240 +installation. Once you press submit, the test script will send a multi-mime
  241 +email with either the message you type in or an HTML email with an inline
  242 +graphic. Two attachments are included in the email (one of the attachments
  243 +is also the inline graphic so you can see that only one copy of the graphic
  244 +is sent in the email). The test script will also display the functional
  245 +script that you can copy/paste to your editor to duplicate the functionality.
  246 +
  247 +### New examples
  248 +All new examples in both basic and advanced modes. Advanced examples show
  249 + Exception handling.
  250 +
  251 +### PHPDocumentator (phpdocs) documentation for PHPMailer version 5.0.0
  252 +All new documentation
  253 +
  254 +## Version 2.3 (November 06, 2008)
  255 +* added Arabic language (many thanks to Bahjat Al Mostafa)
  256 +* removed English language from language files and made it a default within
  257 + class.phpmailer.php - if no language is found, it will default to use
  258 + the english language translation
  259 +* fixed public/private declarations
  260 +* corrected line 1728, $basedir to $directory
  261 +* added $sign_cert_file to avoid improper duplicate use of $sign_key_file
  262 +* corrected $this->Hello on line 612 to $this->Helo
  263 +* changed default of $LE to "\r\n" to comply with RFC 2822. Can be set by the user
  264 + if default is not acceptable
  265 +* removed trim() from return results in EncodeQP
  266 +* /test and three files it contained are removed from version 2.3
  267 +* fixed phpunit.php for compliance with PHP5
  268 +* changed $this->AltBody = $textMsg; to $this->AltBody = html_entity_decode($textMsg);
  269 +* We have removed the /phpdoc from the downloads. All documentation is now on
  270 + the http://phpmailer.codeworxtech.com website.
  271 +
  272 +## Version 2.2.1 () July 19 2008
  273 +* fixed line 1092 in class.smtp.php (my apologies, error on my part)
  274 +
  275 +## Version 2.2 () July 15 2008
  276 +* Fixed redirect issue (display of UTF-8 in thank you redirect)
  277 +* fixed error in getResponse function declaration (class.pop3.php)
  278 +* PHPMailer now PHP6 compliant
  279 +* fixed line 1092 in class.smtp.php (endless loop from missing = sign)
  280 +
  281 +## Version 2.1 (Wed, June 04 2008)
  282 +NOTE: WE HAVE A NEW LANGUAGE VARIABLE FOR DIGITALLY SIGNED S/MIME EMAILS. IF YOU CAN HELP WITH LANGUAGES OTHER THAN ENGLISH AND SPANISH, IT WOULD BE APPRECIATED.
  283 +
  284 +* added S/MIME functionality (ability to digitally sign emails)
  285 + BIG THANKS TO "sergiocambra" for posting this patch back in November 2007.
  286 + The "Signed Emails" functionality adds the Sign method to pass the private key
  287 + filename and the password to read it, and then email will be sent with
  288 + content-type multipart/signed and with the digital signature attached.
  289 +* fully compatible with E_STRICT error level
  290 + - Please note:
  291 + In about half the test environments this development version was subjected
  292 + to, an error was thrown for the date() functions used (line 1565 and 1569).
  293 + This is NOT a PHPMailer error, it is the result of an incorrectly configured
  294 + PHP5 installation. The fix is to modify your 'php.ini' file and include the
  295 + date.timezone = Etc/UTC (or your own zone)
  296 + directive, to your own server timezone
  297 + - If you do get this error, and are unable to access your php.ini file:
  298 + In your PHP script, add
  299 + `date_default_timezone_set('Etc/UTC');`
  300 + - do not try to use
  301 + `$myVar = date_default_timezone_get();`
  302 + as a test, it will throw an error.
  303 +* added ability to define path (mainly for embedded images)
  304 + function `MsgHTML($message,$basedir='')` ... where:
  305 + `$basedir` is the fully qualified path
  306 +* fixed `MsgHTML()` function:
  307 + - Embedded Images where images are specified by `<protocol>://` will not be altered or embedded
  308 +* fixed the return value of SMTP exit code ( pclose )
  309 +* addressed issue of multibyte characters in subject line and truncating
  310 +* added ability to have user specified Message ID
  311 + (default is still that PHPMailer create a unique Message ID)
  312 +* corrected unidentified message type to 'application/octet-stream'
  313 +* fixed chunk_split() multibyte issue (thanks to Colin Brown, et al).
  314 +* added check for added attachments
  315 +* enhanced conversion of HTML to text in MsgHTML (thanks to "brunny")
  316 +
  317 +## Version 2.1.0beta2 (Sun, Dec 02 2007)
  318 +* implemented updated EncodeQP (thanks to coolbru, aka Marcus Bointon)
  319 +* finished all testing, all known bugs corrected, enhancements tested
  320 +
  321 +Note: will NOT work with PHP4.
  322 +
  323 +Please note, this is BETA software **DO NOT USE THIS IN PRODUCTION OR LIVE PROJECTS; INTENDED STRICTLY FOR TESTING**
  324 +
  325 +## Version 2.1.0beta1
  326 +Please note, this is BETA software
  327 +** DO NOT USE THIS IN PRODUCTION OR LIVE PROJECTS
  328 + INTENDED STRICTLY FOR TESTING
  329 +
  330 +## Version 2.0.0 rc2 (Fri, Nov 16 2007), interim release
  331 +* implements new property to control VERP in class.smtp.php
  332 + example (requires instantiating class.smtp.php):
  333 + $mail->do_verp = true;
  334 +* POP-before-SMTP functionality included, thanks to Richard Davey
  335 + (see class.pop3.php & pop3_before_smtp_test.php for examples)
  336 +* included example showing how to use PHPMailer with GMAIL
  337 +* fixed the missing Cc in SendMail() and Mail()
  338 +
  339 +## Version 2.0.0 rc1 (Thu, Nov 08 2007), interim release
  340 +* dramatically simplified using inline graphics ... it's fully automated and requires no user input
  341 +* added automatic document type detection for attachments and pictures
  342 +* added MsgHTML() function to replace Body tag for HTML emails
  343 +* fixed the SendMail security issues (input validation vulnerability)
  344 +* enhanced the AddAddresses functionality so that the "Name" portion is used in the email address
  345 +* removed the need to use the AltBody method (set from the HTML, or default text used)
  346 +* set the PHP Mail() function as the default (still support SendMail, SMTP Mail)
  347 +* removed the need to set the IsHTML property (set automatically)
  348 +* added Estonian language file by Indrek P&auml;ri
  349 +* added header injection patch
  350 +* added "set" method to permit users to create their own pseudo-properties like 'X-Headers', etc.
  351 +* fixed warning message in SMTP get_lines method
  352 +* added TLS/SSL SMTP support.
  353 +* PHPMailer has been tested with PHP4 (4.4.7) and PHP5 (5.2.7)
  354 +* Works with PHP installed as a module or as CGI-PHP
  355 +NOTE: will NOT work with PHP5 in E_STRICT error mode
  356 +
  357 +## Version 1.73 (Sun, Jun 10 2005)
  358 +* Fixed denial of service bug: http://www.cybsec.com/vuln/PHPMailer-DOS.pdf
  359 +* Now has a total of 20 translations
  360 +* Fixed alt attachments bug: http://tinyurl.com/98u9k
  361 +
  362 +## Version 1.72 (Wed, May 25 2004)
  363 +* Added Dutch, Swedish, Czech, Norwegian, and Turkish translations.
  364 +* Received: Removed this method because spam filter programs like
  365 + SpamAssassin reject this header.
  366 +* Fixed error count bug.
  367 +* SetLanguage default is now "language/".
  368 +* Fixed magic_quotes_runtime bug.
  369 +
  370 +## Version 1.71 (Tue, Jul 28 2003)
  371 +* Made several speed enhancements
  372 +* Added German and Italian translation files
  373 +* Fixed HELO/AUTH bugs on keep-alive connects
  374 +* Now provides an error message if language file does not load
  375 +* Fixed attachment EOL bug
  376 +* Updated some unclear documentation
  377 +* Added additional tests and improved others
  378 +
  379 +## Version 1.70 (Mon, Jun 20 2003)
  380 +* Added SMTP keep-alive support
  381 +* Added IsError method for error detection
  382 +* Added error message translation support (SetLanguage)
  383 +* Refactored many methods to increase library performance
  384 +* Hello now sends the newer EHLO message before HELO as per RFC 2821
  385 +* Removed the boundary class and replaced it with GetBoundary
  386 +* Removed queue support methods
  387 +* New $Hostname variable
  388 +* New Message-ID header
  389 +* Received header reformat
  390 +* Helo variable default changed to $Hostname
  391 +* Removed extra spaces in Content-Type definition (#667182)
  392 +* Return-Path should be set to Sender when set
  393 +* Adds Q or B encoding to headers when necessary
  394 +* quoted-encoding should now encode NULs \000
  395 +* Fixed encoding of body/AltBody (#553370)
  396 +* Adds "To: undisclosed-recipients:;" when all recipients are hidden (BCC)
  397 +* Multiple bug fixes
  398 +
  399 +## Version 1.65 (Fri, Aug 09 2002)
  400 +* Fixed non-visible attachment bug (#585097) for Outlook
  401 +* SMTP connections are now closed after each transaction
  402 +* Fixed SMTP::Expand return value
  403 +* Converted SMTP class documentation to phpDocumentor format
  404 +
  405 +## Version 1.62 (Wed, Jun 26 2002)
  406 +* Fixed multi-attach bug
  407 +* Set proper word wrapping
  408 +* Reduced memory use with attachments
  409 +* Added more debugging
  410 +* Changed documentation to phpDocumentor format
  411 +
  412 +## Version 1.60 (Sat, Mar 30 2002)
  413 +* Sendmail pipe and address patch (Christian Holtje)
  414 +* Added embedded image and read confirmation support (A. Ognio)
  415 +* Added unit tests
  416 +* Added SMTP timeout support (*nix only)
  417 +* Added possibly temporary PluginDir variable for SMTP class
  418 +* Added LE message line ending variable
  419 +* Refactored boundary and attachment code
  420 +* Eliminated SMTP class warnings
  421 +* Added SendToQueue method for future queuing support
  422 +
  423 +## Version 1.54 (Wed, Dec 19 2001)
  424 +* Add some queuing support code
  425 +* Fixed a pesky multi/alt bug
  426 +* Messages are no longer forced to have "To" addresses
  427 +
  428 +## Version 1.50 (Thu, Nov 08 2001)
  429 +* Fix extra lines when not using SMTP mailer
  430 +* Set WordWrap variable to int with a zero default
  431 +
  432 +## Version 1.47 (Tue, Oct 16 2001)
  433 +* Fixed Received header code format
  434 +* Fixed AltBody order error
  435 +* Fixed alternate port warning
  436 +
  437 +## Version 1.45 (Tue, Sep 25 2001)
  438 +* Added enhanced SMTP debug support
  439 +* Added support for multiple ports on SMTP
  440 +* Added Received header for tracing
  441 +* Fixed AddStringAttachment encoding
  442 +* Fixed possible header name quote bug
  443 +* Fixed wordwrap() trim bug
  444 +* Couple other small bug fixes
  445 +
  446 +## Version 1.41 (Wed, Aug 22 2001)
  447 +* Fixed AltBody bug w/o attachments
  448 +* Fixed rfc_date() for certain mail servers
  449 +
  450 +## Version 1.40 (Sun, Aug 12 2001)
  451 +* Added multipart/alternative support (AltBody)
  452 +* Documentation update
  453 +* Fixed bug in Mercury MTA
  454 +
  455 +## Version 1.29 (Fri, Aug 03 2001)
  456 +* Added AddStringAttachment() method
  457 +* Added SMTP authentication support
  458 +
  459 +## Version 1.28 (Mon, Jul 30 2001)
  460 +* Fixed a typo in SMTP class
  461 +* Fixed header issue with Imail (win32) SMTP server
  462 +* Made fopen() calls for attachments use "rb" to fix win32 error
  463 +
  464 +## Version 1.25 (Mon, Jul 02 2001)
  465 +* Added RFC 822 date fix (Patrice)
  466 +* Added improved error handling by adding a $ErrorInfo variable
  467 +* Removed MailerDebug variable (obsolete with new error handler)
  468 +
  469 +## Version 1.20 (Mon, Jun 25 2001)
  470 +* Added quoted-printable encoding (Patrice)
  471 +* Set Version as public and removed PrintVersion()
  472 +* Changed phpdoc to only display public variables and methods
  473 +
  474 +## Version 1.19 (Thu, Jun 21 2001)
  475 +* Fixed MS Mail header bug
  476 +* Added fix for Bcc problem with mail(). *Does not work on Win32*
  477 + (See PHP bug report: http://www.php.net/bugs.php?id=11616)
  478 +* mail() no longer passes a fifth parameter when not needed
  479 +
  480 +## Version 1.15 (Fri, Jun 15 2001)
  481 +Note: these changes contributed by Patrice Fournier
  482 +* Changed all remaining \n to \r\n
  483 +* Bcc: header no longer writen to message except
  484 + when sent directly to sendmail
  485 +* Added a small message to non-MIME compliant mail reader
  486 +* Added Sender variable to change the Sender email
  487 + used in -f for sendmail/mail and in 'MAIL FROM' for smtp mode
  488 +* Changed boundary setting to a place it will be set only once
  489 +* Removed transfer encoding for whole message when using multipart
  490 +* Message body now uses Encoding in multipart messages
  491 +* Can set encoding and type to attachments 7bit, 8bit
  492 + and binary attachment are sent as is, base64 are encoded
  493 +* Can set Encoding to base64 to send 8 bits body
  494 + through 7 bits servers
  495 +
  496 +## Version 1.10 (Tue, Jun 12 2001)
  497 +* Fixed win32 mail header bug (printed out headers in message body)
  498 +
  499 +## Version 1.09 (Fri, Jun 08 2001)
  500 +* Changed date header to work with Netscape mail programs
  501 +* Altered phpdoc documentation
  502 +
  503 +## Version 1.08 (Tue, Jun 05 2001)
  504 +* Added enhanced error-checking
  505 +* Added phpdoc documentation to source
  506 +
  507 +## Version 1.06 (Fri, Jun 01 2001)
  508 +* Added optional name for file attachments
  509 +
  510 +## Version 1.05 (Tue, May 29 2001)
  511 +* Code cleanup
  512 +* Eliminated sendmail header warning message
  513 +* Fixed possible SMTP error
  514 +
  515 +## Version 1.03 (Thu, May 24 2001)
  516 +* Fixed problem where qmail sends out duplicate messages
  517 +
  518 +## Version 1.02 (Wed, May 23 2001)
  519 +* Added multiple recipient and attachment Clear* methods
  520 +* Added Sendmail public variable
  521 +* Fixed problem with loading SMTP library multiple times
  522 +
  523 +## Version 0.98 (Tue, May 22 2001)
  524 +* Fixed problem with redundant mail hosts sending out multiple messages
  525 +* Added additional error handler code
  526 +* Added AddCustomHeader() function
  527 +* Added support for Microsoft mail client headers (affects priority)
  528 +* Fixed small bug with Mailer variable
  529 +* Added PrintVersion() function
  530 +
  531 +## Version 0.92 (Tue, May 15 2001)
  532 +* Changed file names to class.phpmailer.php and class.smtp.php to match
  533 + current PHP class trend.
  534 +* Fixed problem where body not being printed when a message is attached
  535 +* Several small bug fixes
  536 +
  537 +## Version 0.90 (Tue, April 17 2001)
  538 +* Initial public release
This diff could not be displayed because it is too large.
  1 +<?php
  2 +/**
  3 + * PHPMailer POP-Before-SMTP Authentication Class.
  4 + * PHP Version 5
  5 + * @package PHPMailer
  6 + * @link https://github.com/PHPMailer/PHPMailer/
  7 + * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
  8 + * @author Jim Jagielski (jimjag) <jimjag@gmail.com>
  9 + * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
  10 + * @author Brent R. Matzelle (original founder)
  11 + * @copyright 2012 - 2014 Marcus Bointon
  12 + * @copyright 2010 - 2012 Jim Jagielski
  13 + * @copyright 2004 - 2009 Andy Prevost
  14 + * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
  15 + * @note This program is distributed in the hope that it will be useful - WITHOUT
  16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  17 + * FITNESS FOR A PARTICULAR PURPOSE.
  18 + */
  19 +
  20 +/**
  21 + * PHPMailer POP-Before-SMTP Authentication Class.
  22 + * Specifically for PHPMailer to use for RFC1939 POP-before-SMTP authentication.
  23 + * Does not support APOP.
  24 + * @package PHPMailer
  25 + * @author Richard Davey (original author) <rich@corephp.co.uk>
  26 + * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
  27 + * @author Jim Jagielski (jimjag) <jimjag@gmail.com>
  28 + * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
  29 + */
  30 +class POP3
  31 +{
  32 + /**
  33 + * The POP3 PHPMailer Version number.
  34 + * @type string
  35 + * @access public
  36 + */
  37 + public $Version = '5.2.8';
  38 +
  39 + /**
  40 + * Default POP3 port number.
  41 + * @type int
  42 + * @access public
  43 + */
  44 + public $POP3_PORT = 110;
  45 +
  46 + /**
  47 + * Default timeout in seconds.
  48 + * @type int
  49 + * @access public
  50 + */
  51 + public $POP3_TIMEOUT = 30;
  52 +
  53 + /**
  54 + * POP3 Carriage Return + Line Feed.
  55 + * @type string
  56 + * @access public
  57 + * @deprecated Use the constant instead
  58 + */
  59 + public $CRLF = "\r\n";
  60 +
  61 + /**
  62 + * Debug display level.
  63 + * Options: 0 = no, 1+ = yes
  64 + * @type int
  65 + * @access public
  66 + */
  67 + public $do_debug = 0;
  68 +
  69 + /**
  70 + * POP3 mail server hostname.
  71 + * @type string
  72 + * @access public
  73 + */
  74 + public $host;
  75 +
  76 + /**
  77 + * POP3 port number.
  78 + * @type int
  79 + * @access public
  80 + */
  81 + public $port;
  82 +
  83 + /**
  84 + * POP3 Timeout Value in seconds.
  85 + * @type int
  86 + * @access public
  87 + */
  88 + public $tval;
  89 +
  90 + /**
  91 + * POP3 username
  92 + * @type string
  93 + * @access public
  94 + */
  95 + public $username;
  96 +
  97 + /**
  98 + * POP3 password.
  99 + * @type string
  100 + * @access public
  101 + */
  102 + public $password;
  103 +
  104 + /**
  105 + * Resource handle for the POP3 connection socket.
  106 + * @type resource
  107 + * @access private
  108 + */
  109 + private $pop_conn;
  110 +
  111 + /**
  112 + * Are we connected?
  113 + * @type bool
  114 + * @access private
  115 + */
  116 + private $connected;
  117 +
  118 + /**
  119 + * Error container.
  120 + * @type array
  121 + * @access private
  122 + */
  123 + private $error;
  124 +
  125 + /**
  126 + * Line break constant
  127 + */
  128 + const CRLF = "\r\n";
  129 +
  130 + /**
  131 + * Constructor.
  132 + * @access public
  133 + */
  134 + public function __construct()
  135 + {
  136 + $this->pop_conn = 0;
  137 + $this->connected = false;
  138 + $this->error = null;
  139 + }
  140 +
  141 + /**
  142 + * Simple static wrapper for all-in-one POP before SMTP
  143 + * @param $host
  144 + * @param bool $port
  145 + * @param bool $tval
  146 + * @param string $username
  147 + * @param string $password
  148 + * @param int $debug_level
  149 + * @return bool
  150 + */
  151 + public static function popBeforeSmtp(
  152 + $host,
  153 + $port = false,
  154 + $tval = false,
  155 + $username = '',
  156 + $password = '',
  157 + $debug_level = 0
  158 + ) {
  159 + $pop = new POP3;
  160 + return $pop->authorise($host, $port, $tval, $username, $password, $debug_level);
  161 + }
  162 +
  163 + /**
  164 + * Authenticate with a POP3 server.
  165 + * A connect, login, disconnect sequence
  166 + * appropriate for POP-before SMTP authorisation.
  167 + * @access public
  168 + * @param string $host
  169 + * @param bool|int $port
  170 + * @param bool|int $tval
  171 + * @param string $username
  172 + * @param string $password
  173 + * @param int $debug_level
  174 + * @return bool
  175 + */
  176 + public function authorise($host, $port = false, $tval = false, $username = '', $password = '', $debug_level = 0)
  177 + {
  178 + $this->host = $host;
  179 + // If no port value provided, use default
  180 + if ($port === false) {
  181 + $this->port = $this->POP3_PORT;
  182 + } else {
  183 + $this->port = $port;
  184 + }
  185 + // If no timeout value provided, use default
  186 + if ($tval === false) {
  187 + $this->tval = $this->POP3_TIMEOUT;
  188 + } else {
  189 + $this->tval = $tval;
  190 + }
  191 + $this->do_debug = $debug_level;
  192 + $this->username = $username;
  193 + $this->password = $password;
  194 + // Refresh the error log
  195 + $this->error = null;
  196 + // connect
  197 + $result = $this->connect($this->host, $this->port, $this->tval);
  198 + if ($result) {
  199 + $login_result = $this->login($this->username, $this->password);
  200 + if ($login_result) {
  201 + $this->disconnect();
  202 + return true;
  203 + }
  204 + }
  205 + // We need to disconnect regardless of whether the login succeeded
  206 + $this->disconnect();
  207 + return false;
  208 + }
  209 +
  210 + /**
  211 + * Connect to a POP3 server.
  212 + * @access public
  213 + * @param string $host
  214 + * @param bool|int $port
  215 + * @param integer $tval
  216 + * @return boolean
  217 + */
  218 + public function connect($host, $port = false, $tval = 30)
  219 + {
  220 + // Are we already connected?
  221 + if ($this->connected) {
  222 + return true;
  223 + }
  224 +
  225 + //On Windows this will raise a PHP Warning error if the hostname doesn't exist.
  226 + //Rather than suppress it with @fsockopen, capture it cleanly instead
  227 + set_error_handler(array($this, 'catchWarning'));
  228 +
  229 + // connect to the POP3 server
  230 + $this->pop_conn = fsockopen(
  231 + $host, // POP3 Host
  232 + $port, // Port #
  233 + $errno, // Error Number
  234 + $errstr, // Error Message
  235 + $tval
  236 + ); // Timeout (seconds)
  237 + // Restore the error handler
  238 + restore_error_handler();
  239 + // Does the Error Log now contain anything?
  240 + if ($this->error && $this->do_debug >= 1) {
  241 + $this->displayErrors();
  242 + }
  243 + // Did we connect?
  244 + if ($this->pop_conn == false) {
  245 + // It would appear not...
  246 + $this->error = array(
  247 + 'error' => "Failed to connect to server $host on port $port",
  248 + 'errno' => $errno,
  249 + 'errstr' => $errstr
  250 + );
  251 + if ($this->do_debug >= 1) {
  252 + $this->displayErrors();
  253 + }
  254 + return false;
  255 + }
  256 +
  257 + // Increase the stream time-out
  258 + // Check for PHP 4.3.0 or later
  259 + if (version_compare(phpversion(), '5.0.0', 'ge')) {
  260 + stream_set_timeout($this->pop_conn, $tval, 0);
  261 + } else {
  262 + // Does not work on Windows
  263 + if (substr(PHP_OS, 0, 3) !== 'WIN') {
  264 + socket_set_timeout($this->pop_conn, $tval, 0);
  265 + }
  266 + }
  267 +
  268 + // Get the POP3 server response
  269 + $pop3_response = $this->getResponse();
  270 + // Check for the +OK
  271 + if ($this->checkResponse($pop3_response)) {
  272 + // The connection is established and the POP3 server is talking
  273 + $this->connected = true;
  274 + return true;
  275 + }
  276 + return false;
  277 + }
  278 +
  279 + /**
  280 + * Log in to the POP3 server.
  281 + * Does not support APOP (RFC 2828, 4949).
  282 + * @access public
  283 + * @param string $username
  284 + * @param string $password
  285 + * @return boolean
  286 + */
  287 + public function login($username = '', $password = '')
  288 + {
  289 + if ($this->connected == false) {
  290 + $this->error = 'Not connected to POP3 server';
  291 +
  292 + if ($this->do_debug >= 1) {
  293 + $this->displayErrors();
  294 + }
  295 + }
  296 + if (empty($username)) {
  297 + $username = $this->username;
  298 + }
  299 + if (empty($password)) {
  300 + $password = $this->password;
  301 + }
  302 +
  303 + // Send the Username
  304 + $this->sendString("USER $username" . self::CRLF);
  305 + $pop3_response = $this->getResponse();
  306 + if ($this->checkResponse($pop3_response)) {
  307 + // Send the Password
  308 + $this->sendString("PASS $password" . self::CRLF);
  309 + $pop3_response = $this->getResponse();
  310 + if ($this->checkResponse($pop3_response)) {
  311 + return true;
  312 + }
  313 + }
  314 + return false;
  315 + }
  316 +
  317 + /**
  318 + * Disconnect from the POP3 server.
  319 + * @access public
  320 + */
  321 + public function disconnect()
  322 + {
  323 + $this->sendString('QUIT');
  324 + //The QUIT command may cause the daemon to exit, which will kill our connection
  325 + //So ignore errors here
  326 + @fclose($this->pop_conn);
  327 + }
  328 +
  329 + /**
  330 + * Get a response from the POP3 server.
  331 + * $size is the maximum number of bytes to retrieve
  332 + * @param integer $size
  333 + * @return string
  334 + * @access private
  335 + */
  336 + private function getResponse($size = 128)
  337 + {
  338 + $response = fgets($this->pop_conn, $size);
  339 + if ($this->do_debug >= 1) {
  340 + echo "Server -> Client: $response";
  341 + }
  342 + return $response;
  343 + }
  344 +
  345 + /**
  346 + * Send raw data to the POP3 server.
  347 + * @param string $string
  348 + * @return integer
  349 + * @access private
  350 + */
  351 + private function sendString($string)
  352 + {
  353 + if ($this->pop_conn) {
  354 + if ($this->do_debug >= 2) { //Show client messages when debug >= 2
  355 + echo "Client -> Server: $string";
  356 + }
  357 + return fwrite($this->pop_conn, $string, strlen($string));
  358 + }
  359 + return 0;
  360 + }
  361 +
  362 + /**
  363 + * Checks the POP3 server response.
  364 + * Looks for for +OK or -ERR.
  365 + * @param string $string
  366 + * @return boolean
  367 + * @access private
  368 + */
  369 + private function checkResponse($string)
  370 + {
  371 + if (substr($string, 0, 3) !== '+OK') {
  372 + $this->error = array(
  373 + 'error' => "Server reported an error: $string",
  374 + 'errno' => 0,
  375 + 'errstr' => ''
  376 + );
  377 + if ($this->do_debug >= 1) {
  378 + $this->displayErrors();
  379 + }
  380 + return false;
  381 + } else {
  382 + return true;
  383 + }
  384 + }
  385 +
  386 + /**
  387 + * Display errors if debug is enabled.
  388 + * @access private
  389 + */
  390 + private function displayErrors()
  391 + {
  392 + echo '<pre>';
  393 + foreach ($this->error as $single_error) {
  394 + print_r($single_error);
  395 + }
  396 + echo '</pre>';
  397 + }
  398 +
  399 + /**
  400 + * POP3 connection error handler.
  401 + * @param integer $errno
  402 + * @param string $errstr
  403 + * @param string $errfile
  404 + * @param integer $errline
  405 + * @access private
  406 + */
  407 + private function catchWarning($errno, $errstr, $errfile, $errline)
  408 + {
  409 + $this->error[] = array(
  410 + 'error' => "Connecting to the POP3 server raised a PHP warning: ",
  411 + 'errno' => $errno,
  412 + 'errstr' => $errstr,
  413 + 'errfile' => $errfile,
  414 + 'errline' => $errline
  415 + );
  416 + }
  417 +}
  1 +<?php
  2 +/**
  3 + * PHPMailer RFC821 SMTP email transport class.
  4 + * PHP Version 5
  5 + * @package PHPMailer
  6 + * @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
  7 + * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
  8 + * @author Jim Jagielski (jimjag) <jimjag@gmail.com>
  9 + * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
  10 + * @author Brent R. Matzelle (original founder)
  11 + * @copyright 2014 Marcus Bointon
  12 + * @copyright 2010 - 2012 Jim Jagielski
  13 + * @copyright 2004 - 2009 Andy Prevost
  14 + * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
  15 + * @note This program is distributed in the hope that it will be useful - WITHOUT
  16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  17 + * FITNESS FOR A PARTICULAR PURPOSE.
  18 + */
  19 +
  20 +/**
  21 + * PHPMailer RFC821 SMTP email transport class.
  22 + * Implements RFC 821 SMTP commands and provides some utility methods for sending mail to an SMTP server.
  23 + * @package PHPMailer
  24 + * @author Chris Ryan <unknown@example.com>
  25 + * @author Marcus Bointon <phpmailer@synchromedia.co.uk>
  26 + */
  27 +class SMTP
  28 +{
  29 + /**
  30 + * The PHPMailer SMTP version number.
  31 + * @type string
  32 + */
  33 + const VERSION = '5.2.8';
  34 +
  35 + /**
  36 + * SMTP line break constant.
  37 + * @type string
  38 + */
  39 + const CRLF = "\r\n";
  40 +
  41 + /**
  42 + * The SMTP port to use if one is not specified.
  43 + * @type int
  44 + */
  45 + const DEFAULT_SMTP_PORT = 25;
  46 +
  47 + /**
  48 + * The maximum line length allowed by RFC 2822 section 2.1.1
  49 + * @type int
  50 + */
  51 + const MAX_LINE_LENGTH = 998;
  52 +
  53 + /**
  54 + * The PHPMailer SMTP Version number.
  55 + * @type string
  56 + * @deprecated Use the constant instead
  57 + * @see SMTP::VERSION
  58 + */
  59 + public $Version = '5.2.8';
  60 +
  61 + /**
  62 + * SMTP server port number.
  63 + * @type int
  64 + * @deprecated This is only ever used as a default value, so use the constant instead
  65 + * @see SMTP::DEFAULT_SMTP_PORT
  66 + */
  67 + public $SMTP_PORT = 25;
  68 +
  69 + /**
  70 + * SMTP reply line ending.
  71 + * @type string
  72 + * @deprecated Use the constant instead
  73 + * @see SMTP::CRLF
  74 + */
  75 + public $CRLF = "\r\n";
  76 +
  77 + /**
  78 + * Debug output level.
  79 + * Options:
  80 + * * `0` No output
  81 + * * `1` Commands
  82 + * * `2` Data and commands
  83 + * * `3` As 2 plus connection status
  84 + * * `4` Low-level data output
  85 + * @type int
  86 + */
  87 + public $do_debug = 0;
  88 +
  89 + /**
  90 + * How to handle debug output.
  91 + * Options:
  92 + * * `echo` Output plain-text as-is, appropriate for CLI
  93 + * * `html` Output escaped, line breaks converted to <br>, appropriate for browser output
  94 + * * `error_log` Output to error log as configured in php.ini
  95 + * @type string
  96 + */
  97 + public $Debugoutput = 'echo';
  98 +
  99 + /**
  100 + * Whether to use VERP.
  101 + * @link http://en.wikipedia.org/wiki/Variable_envelope_return_path
  102 + * @link http://www.postfix.org/VERP_README.html Info on VERP
  103 + * @type bool
  104 + */
  105 + public $do_verp = false;
  106 +
  107 + /**
  108 + * The timeout value for connection, in seconds.
  109 + * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2
  110 + * This needs to be quite high to function correctly with hosts using greetdelay as an anti-spam measure.
  111 + * @link http://tools.ietf.org/html/rfc2821#section-4.5.3.2
  112 + * @type int
  113 + */
  114 + public $Timeout = 300;
  115 +
  116 + /**
  117 + * The SMTP timelimit value for reads, in seconds.
  118 + * @type int
  119 + */
  120 + public $Timelimit = 30;
  121 +
  122 + /**
  123 + * The socket for the server connection.
  124 + * @type resource
  125 + */
  126 + protected $smtp_conn;
  127 +
  128 + /**
  129 + * Error message, if any, for the last call.
  130 + * @type string
  131 + */
  132 + protected $error = '';
  133 +
  134 + /**
  135 + * The reply the server sent to us for HELO.
  136 + * @type string
  137 + */
  138 + protected $helo_rply = '';
  139 +
  140 + /**
  141 + * The most recent reply received from the server.
  142 + * @type string
  143 + */
  144 + protected $last_reply = '';
  145 +
  146 + /**
  147 + * Constructor.
  148 + * @access public
  149 + */
  150 + public function __construct()
  151 + {
  152 + $this->smtp_conn = 0;
  153 + $this->error = null;
  154 + $this->helo_rply = null;
  155 + $this->do_debug = 0;
  156 + }
  157 +
  158 + /**
  159 + * Output debugging info via a user-selected method.
  160 + * @param string $str Debug string to output
  161 + * @return void
  162 + */
  163 + protected function edebug($str)
  164 + {
  165 + switch ($this->Debugoutput) {
  166 + case 'error_log':
  167 + //Don't output, just log
  168 + error_log($str);
  169 + break;
  170 + case 'html':
  171 + //Cleans up output a bit for a better looking, HTML-safe output
  172 + echo htmlentities(
  173 + preg_replace('/[\r\n]+/', '', $str),
  174 + ENT_QUOTES,
  175 + 'UTF-8'
  176 + )
  177 + . "<br>\n";
  178 + break;
  179 + case 'echo':
  180 + default:
  181 + echo gmdate('Y-m-d H:i:s')."\t".trim($str)."\n";
  182 + }
  183 + }
  184 +
  185 + /**
  186 + * Connect to an SMTP server.
  187 + * @param string $host SMTP server IP or host name
  188 + * @param int $port The port number to connect to
  189 + * @param int $timeout How long to wait for the connection to open
  190 + * @param array $options An array of options for stream_context_create()
  191 + * @access public
  192 + * @return bool
  193 + */
  194 + public function connect($host, $port = null, $timeout = 30, $options = array())
  195 + {
  196 + // Clear errors to avoid confusion
  197 + $this->error = null;
  198 + // Make sure we are __not__ connected
  199 + if ($this->connected()) {
  200 + // Already connected, generate error
  201 + $this->error = array('error' => 'Already connected to a server');
  202 + return false;
  203 + }
  204 + if (empty($port)) {
  205 + $port = self::DEFAULT_SMTP_PORT;
  206 + }
  207 + // Connect to the SMTP server
  208 + if ($this->do_debug >= 3) {
  209 + $this->edebug('Connection: opening');
  210 + }
  211 + $errno = 0;
  212 + $errstr = '';
  213 + $socket_context = stream_context_create($options);
  214 + //Suppress errors; connection failures are handled at a higher level
  215 + $this->smtp_conn = @stream_socket_client(
  216 + $host . ":" . $port,
  217 + $errno,
  218 + $errstr,
  219 + $timeout,
  220 + STREAM_CLIENT_CONNECT,
  221 + $socket_context
  222 + );
  223 + // Verify we connected properly
  224 + if (empty($this->smtp_conn)) {
  225 + $this->error = array(
  226 + 'error' => 'Failed to connect to server',
  227 + 'errno' => $errno,
  228 + 'errstr' => $errstr
  229 + );
  230 + if ($this->do_debug >= 1) {
  231 + $this->edebug(
  232 + 'SMTP ERROR: ' . $this->error['error']
  233 + . ": $errstr ($errno)"
  234 + );
  235 + }
  236 + return false;
  237 + }
  238 + if ($this->do_debug >= 3) {
  239 + $this->edebug('Connection: opened');
  240 + }
  241 + // SMTP server can take longer to respond, give longer timeout for first read
  242 + // Windows does not have support for this timeout function
  243 + if (substr(PHP_OS, 0, 3) != 'WIN') {
  244 + $max = ini_get('max_execution_time');
  245 + if ($max != 0 && $timeout > $max) { // Don't bother if unlimited
  246 + @set_time_limit($timeout);
  247 + }
  248 + stream_set_timeout($this->smtp_conn, $timeout, 0);
  249 + }
  250 + // Get any announcement
  251 + $announce = $this->get_lines();
  252 + if ($this->do_debug >= 2) {
  253 + $this->edebug('SERVER -> CLIENT: ' . $announce);
  254 + }
  255 + return true;
  256 + }
  257 +
  258 + /**
  259 + * Initiate a TLS (encrypted) session.
  260 + * @access public
  261 + * @return bool
  262 + */
  263 + public function startTLS()
  264 + {
  265 + if (!$this->sendCommand('STARTTLS', 'STARTTLS', 220)) {
  266 + return false;
  267 + }
  268 + // Begin encrypted connection
  269 + if (!stream_socket_enable_crypto(
  270 + $this->smtp_conn,
  271 + true,
  272 + STREAM_CRYPTO_METHOD_TLS_CLIENT
  273 + )) {
  274 + return false;
  275 + }
  276 + return true;
  277 + }
  278 +
  279 + /**
  280 + * Perform SMTP authentication.
  281 + * Must be run after hello().
  282 + * @see hello()
  283 + * @param string $username The user name
  284 + * @param string $password The password
  285 + * @param string $authtype The auth type (PLAIN, LOGIN, NTLM, CRAM-MD5)
  286 + * @param string $realm The auth realm for NTLM
  287 + * @param string $workstation The auth workstation for NTLM
  288 + * @access public
  289 + * @return bool True if successfully authenticated.
  290 + */
  291 + public function authenticate(
  292 + $username,
  293 + $password,
  294 + $authtype = 'LOGIN',
  295 + $realm = '',
  296 + $workstation = ''
  297 + ) {
  298 + if (empty($authtype)) {
  299 + $authtype = 'LOGIN';
  300 + }
  301 + switch ($authtype) {
  302 + case 'PLAIN':
  303 + // Start authentication
  304 + if (!$this->sendCommand('AUTH', 'AUTH PLAIN', 334)) {
  305 + return false;
  306 + }
  307 + // Send encoded username and password
  308 + if (!$this->sendCommand(
  309 + 'User & Password',
  310 + base64_encode("\0" . $username . "\0" . $password),
  311 + 235
  312 + )
  313 + ) {
  314 + return false;
  315 + }
  316 + break;
  317 + case 'LOGIN':
  318 + // Start authentication
  319 + if (!$this->sendCommand('AUTH', 'AUTH LOGIN', 334)) {
  320 + return false;
  321 + }
  322 + if (!$this->sendCommand("Username", base64_encode($username), 334)) {
  323 + return false;
  324 + }
  325 + if (!$this->sendCommand("Password", base64_encode($password), 235)) {
  326 + return false;
  327 + }
  328 + break;
  329 + case 'NTLM':
  330 + /*
  331 + * ntlm_sasl_client.php
  332 + * Bundled with Permission
  333 + *
  334 + * How to telnet in windows:
  335 + * http://technet.microsoft.com/en-us/library/aa995718%28EXCHG.65%29.aspx
  336 + * PROTOCOL Docs http://curl.haxx.se/rfc/ntlm.html#ntlmSmtpAuthentication
  337 + */
  338 + require_once 'extras/ntlm_sasl_client.php';
  339 + $temp = new stdClass();
  340 + $ntlm_client = new ntlm_sasl_client_class;
  341 + //Check that functions are available
  342 + if (!$ntlm_client->Initialize($temp)) {
  343 + $this->error = array('error' => $temp->error);
  344 + if ($this->do_debug >= 1) {
  345 + $this->edebug(
  346 + 'You need to enable some modules in your php.ini file: '
  347 + . $this->error['error']
  348 + );
  349 + }
  350 + return false;
  351 + }
  352 + //msg1
  353 + $msg1 = $ntlm_client->TypeMsg1($realm, $workstation); //msg1
  354 +
  355 + if (!$this->sendCommand(
  356 + 'AUTH NTLM',
  357 + 'AUTH NTLM ' . base64_encode($msg1),
  358 + 334
  359 + )
  360 + ) {
  361 + return false;
  362 + }
  363 + //Though 0 based, there is a white space after the 3 digit number
  364 + //msg2
  365 + $challenge = substr($this->last_reply, 3);
  366 + $challenge = base64_decode($challenge);
  367 + $ntlm_res = $ntlm_client->NTLMResponse(
  368 + substr($challenge, 24, 8),
  369 + $password
  370 + );
  371 + //msg3
  372 + $msg3 = $ntlm_client->TypeMsg3(
  373 + $ntlm_res,
  374 + $username,
  375 + $realm,
  376 + $workstation
  377 + );
  378 + // send encoded username
  379 + return $this->sendCommand('Username', base64_encode($msg3), 235);
  380 + break;
  381 + case 'CRAM-MD5':
  382 + // Start authentication
  383 + if (!$this->sendCommand('AUTH CRAM-MD5', 'AUTH CRAM-MD5', 334)) {
  384 + return false;
  385 + }
  386 + // Get the challenge
  387 + $challenge = base64_decode(substr($this->last_reply, 4));
  388 +
  389 + // Build the response
  390 + $response = $username . ' ' . $this->hmac($challenge, $password);
  391 +
  392 + // send encoded credentials
  393 + return $this->sendCommand('Username', base64_encode($response), 235);
  394 + break;
  395 + }
  396 + return true;
  397 + }
  398 +
  399 + /**
  400 + * Calculate an MD5 HMAC hash.
  401 + * Works like hash_hmac('md5', $data, $key)
  402 + * in case that function is not available
  403 + * @param string $data The data to hash
  404 + * @param string $key The key to hash with
  405 + * @access protected
  406 + * @return string
  407 + */
  408 + protected function hmac($data, $key)
  409 + {
  410 + if (function_exists('hash_hmac')) {
  411 + return hash_hmac('md5', $data, $key);
  412 + }
  413 +
  414 + // The following borrowed from
  415 + // http://php.net/manual/en/function.mhash.php#27225
  416 +
  417 + // RFC 2104 HMAC implementation for php.
  418 + // Creates an md5 HMAC.
  419 + // Eliminates the need to install mhash to compute a HMAC
  420 + // Hacked by Lance Rushing
  421 +
  422 + $bytelen = 64; // byte length for md5
  423 + if (strlen($key) > $bytelen) {
  424 + $key = pack('H*', md5($key));
  425 + }
  426 + $key = str_pad($key, $bytelen, chr(0x00));
  427 + $ipad = str_pad('', $bytelen, chr(0x36));
  428 + $opad = str_pad('', $bytelen, chr(0x5c));
  429 + $k_ipad = $key ^ $ipad;
  430 + $k_opad = $key ^ $opad;
  431 +
  432 + return md5($k_opad . pack('H*', md5($k_ipad . $data)));
  433 + }
  434 +
  435 + /**
  436 + * Check connection state.
  437 + * @access public
  438 + * @return bool True if connected.
  439 + */
  440 + public function connected()
  441 + {
  442 + if (!empty($this->smtp_conn)) {
  443 + $sock_status = stream_get_meta_data($this->smtp_conn);
  444 + if ($sock_status['eof']) {
  445 + // the socket is valid but we are not connected
  446 + if ($this->do_debug >= 1) {
  447 + $this->edebug(
  448 + 'SMTP NOTICE: EOF caught while checking if connected'
  449 + );
  450 + }
  451 + $this->close();
  452 + return false;
  453 + }
  454 + return true; // everything looks good
  455 + }
  456 + return false;
  457 + }
  458 +
  459 + /**
  460 + * Close the socket and clean up the state of the class.
  461 + * Don't use this function without first trying to use QUIT.
  462 + * @see quit()
  463 + * @access public
  464 + * @return void
  465 + */
  466 + public function close()
  467 + {
  468 + $this->error = null; // so there is no confusion
  469 + $this->helo_rply = null;
  470 + if (!empty($this->smtp_conn)) {
  471 + // close the connection and cleanup
  472 + fclose($this->smtp_conn);
  473 + if ($this->do_debug >= 3) {
  474 + $this->edebug('Connection: closed');
  475 + }
  476 + $this->smtp_conn = 0;
  477 + }
  478 + }
  479 +
  480 + /**
  481 + * Send an SMTP DATA command.
  482 + * Issues a data command and sends the msg_data to the server,
  483 + * finializing the mail transaction. $msg_data is the message
  484 + * that is to be send with the headers. Each header needs to be
  485 + * on a single line followed by a <CRLF> with the message headers
  486 + * and the message body being separated by and additional <CRLF>.
  487 + * Implements rfc 821: DATA <CRLF>
  488 + * @param string $msg_data Message data to send
  489 + * @access public
  490 + * @return bool
  491 + */
  492 + public function data($msg_data)
  493 + {
  494 + if (!$this->sendCommand('DATA', 'DATA', 354)) {
  495 + return false;
  496 + }
  497 + /* The server is ready to accept data!
  498 + * According to rfc821 we should not send more than 1000 characters on a single line (including the CRLF)
  499 + * so we will break the data up into lines by \r and/or \n then if needed we will break each of those into
  500 + * smaller lines to fit within the limit.
  501 + * We will also look for lines that start with a '.' and prepend an additional '.'.
  502 + * NOTE: this does not count towards line-length limit.
  503 + */
  504 +
  505 + // Normalize line breaks before exploding
  506 + $lines = explode("\n", str_replace(array("\r\n", "\r"), "\n", $msg_data));
  507 +
  508 + /* To distinguish between a complete RFC822 message and a plain message body, we check if the first field
  509 + * of the first line (':' separated) does not contain a space then it _should_ be a header and we will
  510 + * process all lines before a blank line as headers.
  511 + */
  512 +
  513 + $field = substr($lines[0], 0, strpos($lines[0], ':'));
  514 + $in_headers = false;
  515 + if (!empty($field) && strpos($field, ' ') === false) {
  516 + $in_headers = true;
  517 + }
  518 +
  519 + foreach ($lines as $line) {
  520 + $lines_out = array();
  521 + if ($in_headers and $line == '') {
  522 + $in_headers = false;
  523 + }
  524 + // ok we need to break this line up into several smaller lines
  525 + //This is a small micro-optimisation: isset($str[$len]) is equivalent to (strlen($str) > $len)
  526 + while (isset($line[self::MAX_LINE_LENGTH])) {
  527 + //Working backwards, try to find a space within the last MAX_LINE_LENGTH chars of the line to break on
  528 + //so as to avoid breaking in the middle of a word
  529 + $pos = strrpos(substr($line, 0, self::MAX_LINE_LENGTH), ' ');
  530 + if (!$pos) { //Deliberately matches both false and 0
  531 + //No nice break found, add a hard break
  532 + $pos = self::MAX_LINE_LENGTH - 1;
  533 + $lines_out[] = substr($line, 0, $pos);
  534 + $line = substr($line, $pos);
  535 + } else {
  536 + //Break at the found point
  537 + $lines_out[] = substr($line, 0, $pos);
  538 + //Move along by the amount we dealt with
  539 + $line = substr($line, $pos + 1);
  540 + }
  541 + /* If processing headers add a LWSP-char to the front of new line
  542 + * RFC822 section 3.1.1
  543 + */
  544 + if ($in_headers) {
  545 + $line = "\t" . $line;
  546 + }
  547 + }
  548 + $lines_out[] = $line;
  549 +
  550 + // Send the lines to the server
  551 + foreach ($lines_out as $line_out) {
  552 + //RFC2821 section 4.5.2
  553 + if (!empty($line_out) and $line_out[0] == '.') {
  554 + $line_out = '.' . $line_out;
  555 + }
  556 + $this->client_send($line_out . self::CRLF);
  557 + }
  558 + }
  559 +
  560 + // Message data has been sent, complete the command
  561 + return $this->sendCommand('DATA END', '.', 250);
  562 + }
  563 +
  564 + /**
  565 + * Send an SMTP HELO or EHLO command.
  566 + * Used to identify the sending server to the receiving server.
  567 + * This makes sure that client and server are in a known state.
  568 + * Implements RFC 821: HELO <SP> <domain> <CRLF>
  569 + * and RFC 2821 EHLO.
  570 + * @param string $host The host name or IP to connect to
  571 + * @access public
  572 + * @return bool
  573 + */
  574 + public function hello($host = '')
  575 + {
  576 + // Try extended hello first (RFC 2821)
  577 + return (bool)($this->sendHello('EHLO', $host) or $this->sendHello('HELO', $host));
  578 + }
  579 +
  580 + /**
  581 + * Send an SMTP HELO or EHLO command.
  582 + * Low-level implementation used by hello()
  583 + * @see hello()
  584 + * @param string $hello The HELO string
  585 + * @param string $host The hostname to say we are
  586 + * @access protected
  587 + * @return bool
  588 + */
  589 + protected function sendHello($hello, $host)
  590 + {
  591 + $noerror = $this->sendCommand($hello, $hello . ' ' . $host, 250);
  592 + $this->helo_rply = $this->last_reply;
  593 + return $noerror;
  594 + }
  595 +
  596 + /**
  597 + * Send an SMTP MAIL command.
  598 + * Starts a mail transaction from the email address specified in
  599 + * $from. Returns true if successful or false otherwise. If True
  600 + * the mail transaction is started and then one or more recipient
  601 + * commands may be called followed by a data command.
  602 + * Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF>
  603 + * @param string $from Source address of this message
  604 + * @access public
  605 + * @return bool
  606 + */
  607 + public function mail($from)
  608 + {
  609 + $useVerp = ($this->do_verp ? ' XVERP' : '');
  610 + return $this->sendCommand(
  611 + 'MAIL FROM',
  612 + 'MAIL FROM:<' . $from . '>' . $useVerp,
  613 + 250
  614 + );
  615 + }
  616 +
  617 + /**
  618 + * Send an SMTP QUIT command.
  619 + * Closes the socket if there is no error or the $close_on_error argument is true.
  620 + * Implements from rfc 821: QUIT <CRLF>
  621 + * @param bool $close_on_error Should the connection close if an error occurs?
  622 + * @access public
  623 + * @return bool
  624 + */
  625 + public function quit($close_on_error = true)
  626 + {
  627 + $noerror = $this->sendCommand('QUIT', 'QUIT', 221);
  628 + $err = $this->error; //Save any error
  629 + if ($noerror or $close_on_error) {
  630 + $this->close();
  631 + $this->error = $err; //Restore any error from the quit command
  632 + }
  633 + return $noerror;
  634 + }
  635 +
  636 + /**
  637 + * Send an SMTP RCPT command.
  638 + * Sets the TO argument to $toaddr.
  639 + * Returns true if the recipient was accepted false if it was rejected.
  640 + * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>
  641 + * @param string $toaddr The address the message is being sent to
  642 + * @access public
  643 + * @return bool
  644 + */
  645 + public function recipient($toaddr)
  646 + {
  647 + return $this->sendCommand(
  648 + 'RCPT TO',
  649 + 'RCPT TO:<' . $toaddr . '>',
  650 + array(250, 251)
  651 + );
  652 + }
  653 +
  654 + /**
  655 + * Send an SMTP RSET command.
  656 + * Abort any transaction that is currently in progress.
  657 + * Implements rfc 821: RSET <CRLF>
  658 + * @access public
  659 + * @return bool True on success.
  660 + */
  661 + public function reset()
  662 + {
  663 + return $this->sendCommand('RSET', 'RSET', 250);
  664 + }
  665 +
  666 + /**
  667 + * Send a command to an SMTP server and check its return code.
  668 + * @param string $command The command name - not sent to the server
  669 + * @param string $commandstring The actual command to send
  670 + * @param int|array $expect One or more expected integer success codes
  671 + * @access protected
  672 + * @return bool True on success.
  673 + */
  674 + protected function sendCommand($command, $commandstring, $expect)
  675 + {
  676 + if (!$this->connected()) {
  677 + $this->error = array(
  678 + 'error' => "Called $command without being connected"
  679 + );
  680 + return false;
  681 + }
  682 + $this->client_send($commandstring . self::CRLF);
  683 +
  684 + $reply = $this->get_lines();
  685 + $code = substr($reply, 0, 3);
  686 +
  687 + if ($this->do_debug >= 2) {
  688 + $this->edebug('SERVER -> CLIENT: ' . $reply);
  689 + }
  690 +
  691 + if (!in_array($code, (array)$expect)) {
  692 + $this->last_reply = null;
  693 + $this->error = array(
  694 + 'error' => "$command command failed",
  695 + 'smtp_code' => $code,
  696 + 'detail' => substr($reply, 4)
  697 + );
  698 + if ($this->do_debug >= 1) {
  699 + $this->edebug(
  700 + 'SMTP ERROR: ' . $this->error['error'] . ': ' . $reply
  701 + );
  702 + }
  703 + return false;
  704 + }
  705 +
  706 + $this->last_reply = $reply;
  707 + $this->error = null;
  708 + return true;
  709 + }
  710 +
  711 + /**
  712 + * Send an SMTP SAML command.
  713 + * Starts a mail transaction from the email address specified in $from.
  714 + * Returns true if successful or false otherwise. If True
  715 + * the mail transaction is started and then one or more recipient
  716 + * commands may be called followed by a data command. This command
  717 + * will send the message to the users terminal if they are logged
  718 + * in and send them an email.
  719 + * Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF>
  720 + * @param string $from The address the message is from
  721 + * @access public
  722 + * @return bool
  723 + */
  724 + public function sendAndMail($from)
  725 + {
  726 + return $this->sendCommand('SAML', "SAML FROM:$from", 250);
  727 + }
  728 +
  729 + /**
  730 + * Send an SMTP VRFY command.
  731 + * @param string $name The name to verify
  732 + * @access public
  733 + * @return bool
  734 + */
  735 + public function verify($name)
  736 + {
  737 + return $this->sendCommand('VRFY', "VRFY $name", array(250, 251));
  738 + }
  739 +
  740 + /**
  741 + * Send an SMTP NOOP command.
  742 + * Used to keep keep-alives alive, doesn't actually do anything
  743 + * @access public
  744 + * @return bool
  745 + */
  746 + public function noop()
  747 + {
  748 + return $this->sendCommand('NOOP', 'NOOP', 250);
  749 + }
  750 +
  751 + /**
  752 + * Send an SMTP TURN command.
  753 + * This is an optional command for SMTP that this class does not support.
  754 + * This method is here to make the RFC821 Definition complete for this class
  755 + * and _may_ be implemented in future
  756 + * Implements from rfc 821: TURN <CRLF>
  757 + * @access public
  758 + * @return bool
  759 + */
  760 + public function turn()
  761 + {
  762 + $this->error = array(
  763 + 'error' => 'The SMTP TURN command is not implemented'
  764 + );
  765 + if ($this->do_debug >= 1) {
  766 + $this->edebug('SMTP NOTICE: ' . $this->error['error']);
  767 + }
  768 + return false;
  769 + }
  770 +
  771 + /**
  772 + * Send raw data to the server.
  773 + * @param string $data The data to send
  774 + * @access public
  775 + * @return int|bool The number of bytes sent to the server or false on error
  776 + */
  777 + public function client_send($data)
  778 + {
  779 + if ($this->do_debug >= 1) {
  780 + $this->edebug("CLIENT -> SERVER: $data");
  781 + }
  782 + return fwrite($this->smtp_conn, $data);
  783 + }
  784 +
  785 + /**
  786 + * Get the latest error.
  787 + * @access public
  788 + * @return array
  789 + */
  790 + public function getError()
  791 + {
  792 + return $this->error;
  793 + }
  794 +
  795 + /**
  796 + * Get the last reply from the server.
  797 + * @access public
  798 + * @return string
  799 + */
  800 + public function getLastReply()
  801 + {
  802 + return $this->last_reply;
  803 + }
  804 +
  805 + /**
  806 + * Read the SMTP server's response.
  807 + * Either before eof or socket timeout occurs on the operation.
  808 + * With SMTP we can tell if we have more lines to read if the
  809 + * 4th character is '-' symbol. If it is a space then we don't
  810 + * need to read anything else.
  811 + * @access protected
  812 + * @return string
  813 + */
  814 + protected function get_lines()
  815 + {
  816 + // If the connection is bad, give up straight away
  817 + if (!is_resource($this->smtp_conn)) {
  818 + return '';
  819 + }
  820 + $data = '';
  821 + $endtime = 0;
  822 + stream_set_timeout($this->smtp_conn, $this->Timeout);
  823 + if ($this->Timelimit > 0) {
  824 + $endtime = time() + $this->Timelimit;
  825 + }
  826 + while (is_resource($this->smtp_conn) && !feof($this->smtp_conn)) {
  827 + $str = @fgets($this->smtp_conn, 515);
  828 + if ($this->do_debug >= 4) {
  829 + $this->edebug("SMTP -> get_lines(): \$data was \"$data\"");
  830 + $this->edebug("SMTP -> get_lines(): \$str is \"$str\"");
  831 + }
  832 + $data .= $str;
  833 + if ($this->do_debug >= 4) {
  834 + $this->edebug("SMTP -> get_lines(): \$data is \"$data\"");
  835 + }
  836 + // If 4th character is a space, we are done reading, break the loop, micro-optimisation over strlen
  837 + if ((isset($str[3]) and $str[3] == ' ')) {
  838 + break;
  839 + }
  840 + // Timed-out? Log and break
  841 + $info = stream_get_meta_data($this->smtp_conn);
  842 + if ($info['timed_out']) {
  843 + if ($this->do_debug >= 4) {
  844 + $this->edebug(
  845 + 'SMTP -> get_lines(): timed-out (' . $this->Timeout . ' sec)'
  846 + );
  847 + }
  848 + break;
  849 + }
  850 + // Now check if reads took too long
  851 + if ($endtime and time() > $endtime) {
  852 + if ($this->do_debug >= 4) {
  853 + $this->edebug(
  854 + 'SMTP -> get_lines(): timelimit reached ('.
  855 + $this->Timelimit . ' sec)'
  856 + );
  857 + }
  858 + break;
  859 + }
  860 + }
  861 + return $data;
  862 + }
  863 +
  864 + /**
  865 + * Enable or disable VERP address generation.
  866 + * @param bool $enabled
  867 + */
  868 + public function setVerp($enabled = false)
  869 + {
  870 + $this->do_verp = $enabled;
  871 + }
  872 +
  873 + /**
  874 + * Get VERP address generation mode.
  875 + * @return bool
  876 + */
  877 + public function getVerp()
  878 + {
  879 + return $this->do_verp;
  880 + }
  881 +
  882 + /**
  883 + * Set debug output method.
  884 + * @param string $method The function/method to use for debugging output.
  885 + */
  886 + public function setDebugOutput($method = 'echo')
  887 + {
  888 + $this->Debugoutput = $method;
  889 + }
  890 +
  891 + /**
  892 + * Get debug output method.
  893 + * @return string
  894 + */
  895 + public function getDebugOutput()
  896 + {
  897 + return $this->Debugoutput;
  898 + }
  899 +
  900 + /**
  901 + * Set debug output level.
  902 + * @param int $level
  903 + */
  904 + public function setDebugLevel($level = 0)
  905 + {
  906 + $this->do_debug = $level;
  907 + }
  908 +
  909 + /**
  910 + * Get debug output level.
  911 + * @return int
  912 + */
  913 + public function getDebugLevel()
  914 + {
  915 + return $this->do_debug;
  916 + }
  917 +
  918 + /**
  919 + * Set SMTP timeout.
  920 + * @param int $timeout
  921 + */
  922 + public function setTimeout($timeout = 0)
  923 + {
  924 + $this->Timeout = $timeout;
  925 + }
  926 +
  927 + /**
  928 + * Get SMTP timeout.
  929 + * @return int
  930 + */
  931 + public function getTimeout()
  932 + {
  933 + return $this->Timeout;
  934 + }
  935 +}
  1 +{
  2 + "name": "phpmailer/phpmailer",
  3 + "type": "library",
  4 + "description": "PHPMailer is a full-featured email creation and transfer class for PHP",
  5 + "authors": [
  6 + {
  7 + "name": "Marcus Bointon",
  8 + "email": "phpmailer@synchromedia.co.uk"
  9 + },
  10 + {
  11 + "name": "Jim Jagielski",
  12 + "email": "jimjag@gmail.com"
  13 + },
  14 + {
  15 + "name": "Andy Prevost",
  16 + "email": "codeworxtech@users.sourceforge.net"
  17 + },
  18 + {
  19 + "name": "Brent R. Matzelle"
  20 + }
  21 + ],
  22 + "require": {
  23 + "php": ">=5.0.0"
  24 + },
  25 + "require-dev": {
  26 + "phpdocumentor/phpdocumentor": "*",
  27 + "phpunit/phpunit": "4.0.*"
  28 + },
  29 + "autoload": {
  30 + "classmap": ["class.phpmailer.php", "class.pop3.php", "class.smtp.php"]
  31 + },
  32 + "license": "LGPL-2.1"
  33 +}
  1 +NEW CALLBACK FUNCTION:
  2 +======================
  3 +
  4 +We have had requests for a method to process the results of sending emails
  5 +through PHPMailer. In this new release, we have implemented a callback
  6 +function that passes the results of each email sent (to, cc, and/or bcc).
  7 +We have provided an example that echos the results back to the screen. The
  8 +callback function can be used for any purpose. With minor modifications, the
  9 +callback function can be used to create CSV logs, post results to databases,
  10 +etc.
  11 +
  12 +Please review the test.php script for the example.
  13 +
  14 +It's pretty straight forward.
  15 +
  16 +Enjoy!
  17 +Andy
  1 +CREATE DKIM KEYS and DNS Resource Record:
  2 +=========================================
  3 +
  4 +To create DomainKeys Identified Mail keys, visit:
  5 +http://dkim.worxware.com/
  6 +... read the information, fill in the form, and download the ZIP file
  7 +containing the public key, private key, DNS Resource Record and instructions
  8 +to add to your DNS Zone Record, and the PHPMailer code to enable DKIM
  9 +digital signing.
  10 +
  11 +/*** PROTECT YOUR PRIVATE & PUBLIC KEYS ***/
  12 +
  13 +You need to protect your DKIM private and public keys from being viewed or
  14 +accessed. Add protection to your .htaccess file as in this example:
  15 +
  16 +# secure htkeyprivate file
  17 +<Files .htkeyprivate>
  18 + order allow,deny
  19 + deny from all
  20 +</Files>
  21 +
  22 +# secure htkeypublic file
  23 +<Files .htkeypublic>
  24 + order allow,deny
  25 + deny from all
  26 +</Files>
  27 +
  28 +(the actual .htaccess additions are in the ZIP file sent back to you from
  29 +http://dkim.worxware.com/
  30 +
  31 +A few notes on using DomainKey Identified Mail (DKIM):
  32 +
  33 +You do not need to use PHPMailer to DKIM sign emails IF:
  34 +- you enable DomainKey support and add the DNS resource record
  35 +- you use your outbound mail server
  36 +
  37 +If you are a third-party emailer that works on behalf of domain owners to
  38 +send their emails from your own server:
  39 +- you absolutely have to DKIM sign outbound emails
  40 +- the domain owner has to add the DNS resource record to match the
  41 + private key, public key, selector, identity, and domain that you create
  42 +- use caution with the "selector" ... at least one "selector" will already
  43 + exist in the DNS Zone Record of the domain at the domain owner's server
  44 + you need to ensure that the "selector" you use is unique
  45 +Note: since the IP address will not match the domain owner's DNS Zone record
  46 +you can be certain that email providers that validate based on DomainKey will
  47 +check the domain owner's DNS Zone record for your DNS resource record. Before
  48 +sending out emails on behalf of domain owners, ensure they have entered the
  49 +DNS resource record you provided them.
  50 +
  51 +Enjoy!
  52 +Andy
  53 +
  54 +PS. if you need additional information about DKIM, please see:
  55 +http://www.dkim.org/info/dkim-faq.html
  1 +If you are having problems connecting or sending emails through your SMTP server, the SMTP class can provide more information about the processing/errors taking place.
  2 +Use the debug functionality of the class to see what's going on in your connections. To do that, set the debug level in your script. For example:
  3 +
  4 +$mail->SMTPDebug = 1;
  5 +$mail->isSMTP(); // telling the class to use SMTP
  6 +$mail->SMTPAuth = true; // enable SMTP authentication
  7 +$mail->Port = 26; // set the SMTP port
  8 +$mail->Host = "mail.yourhost.com"; // SMTP server
  9 +$mail->Username = "name@yourhost.com"; // SMTP account username
  10 +$mail->Password = "your password"; // SMTP account password
  11 +
  12 +Notes on this:
  13 +$mail->SMTPDebug = 0; ... will disable debugging (you can also leave this out completely, 0 is the default)
  14 +$mail->SMTPDebug = 1; ... will echo errors and server responses
  15 +$mail->SMTPDebug = 2; ... will echo errors, server responses and client messages
  16 +
  17 +And finally, don't forget to disable debugging before going into production.
  1 +<html>
  2 +<head>
  3 +<title>Examples using phpmailer</title>
  4 +</head>
  5 +
  6 +<body>
  7 +
  8 +<h2>Examples using PHPMailer</h2>
  9 +
  10 +<h3>1. Advanced Example</h3>
  11 +<p>
  12 +
  13 +This demonstrates sending multiple email messages with binary attachments
  14 +from a MySQL database using multipart/alternative messages.<p>
  15 +
  16 +<pre>
  17 +require 'PHPMailerAutoload.php';
  18 +
  19 +$mail = new PHPMailer();
  20 +
  21 +$mail->From = 'list@example.com';
  22 +$mail->FromName = 'List manager';
  23 +$mail->Host = 'smtp1.example.com;smtp2.example.com';
  24 +$mail->Mailer = 'smtp';
  25 +
  26 +@mysqli_connect('localhost','root','password');
  27 +@mysqli_select_db("my_company");
  28 +$query = "SELECT full_name, email, photo FROM employee";
  29 +$result = @mysqli_query($query);
  30 +
  31 +while ($row = mysqli_fetch_assoc($result))
  32 +{
  33 + // HTML body
  34 + $body = "Hello &lt;font size=\"4\"&gt;" . $row['full_name'] . "&lt;/font&gt;, &lt;p&gt;";
  35 + $body .= "&lt;i&gt;Your&lt;/i&gt; personal photograph to this message.&lt;p&gt;";
  36 + $body .= "Sincerely, &lt;br&gt;";
  37 + $body .= "phpmailer List manager";
  38 +
  39 + // Plain text body (for mail clients that cannot read HTML)
  40 + $text_body = 'Hello ' . $row['full_name'] . ", \n\n";
  41 + $text_body .= "Your personal photograph to this message.\n\n";
  42 + $text_body .= "Sincerely, \n";
  43 + $text_body .= 'phpmailer List manager';
  44 +
  45 + $mail->Body = $body;
  46 + $mail->AltBody = $text_body;
  47 + $mail->addAddress($row['email'], $row['full_name']);
  48 + $mail->addStringAttachment($row['photo'], 'YourPhoto.jpg');
  49 +
  50 + if(!$mail->send())
  51 + echo "There has been a mail error sending to " . $row['email'] . "&lt;br&gt;";
  52 +
  53 + // Clear all addresses and attachments for next loop
  54 + $mail->clearAddresses();
  55 + $mail->clearAttachments();
  56 +}
  57 +</pre>
  58 +<p>
  59 +
  60 +<h3>2. Extending PHPMailer</h3>
  61 +<p>
  62 +
  63 +Extending classes with inheritance is one of the most
  64 +powerful features of object-oriented programming. It allows you to make changes to the
  65 +original class for your own personal use without hacking the original
  66 +classes, and it's very easy to do:
  67 +
  68 +<p>
  69 +Here's a class that extends the phpmailer class and sets the defaults
  70 +for the particular site:<br>
  71 +PHP include file: my_phpmailer.php
  72 +<p>
  73 +
  74 +<pre>
  75 +require 'PHPMailerAutoload.php';
  76 +
  77 +class my_phpmailer extends PHPMailer {
  78 + // Set default variables for all new objects
  79 + public $From = 'from@example.com';
  80 + public $FromName = 'Mailer';
  81 + public $Host = 'smtp1.example.com;smtp2.example.com';
  82 + public $Mailer = 'smtp'; // Alternative to isSMTP()
  83 + public $WordWrap = 75;
  84 +
  85 + // Replace the default debug output function
  86 + protected function edebug($msg) {
  87 + print('My Site Error');
  88 + print('Description:');
  89 + printf('%s', $msg);
  90 + exit;
  91 + }
  92 +
  93 + //Extend the send function
  94 + public function send() {
  95 + $this->Subject = '[Yay for me!] '.$this->Subject;
  96 + return parent::send()
  97 + }
  98 +
  99 + // Create an additional function
  100 + public function do_something($something) {
  101 + // Place your new code here
  102 + }
  103 +}
  104 +</pre>
  105 +<br>
  106 +Now here's a normal PHP page in the site, which will have all the defaults set above:<br>
  107 +
  108 +<pre>
  109 +require 'my_phpmailer.php';
  110 +
  111 +// Instantiate your new class
  112 +$mail = new my_phpmailer;
  113 +
  114 +// Now you only need to add the necessary stuff
  115 +$mail->addAddress('josh@example.com', 'Josh Adams');
  116 +$mail->Subject = 'Here is the subject';
  117 +$mail->Body = 'This is the message body';
  118 +$mail->addAttachment('c:/temp/11-10-00.zip', 'new_name.zip'); // optional name
  119 +
  120 +if(!$mail->send())
  121 +{
  122 + echo 'There was an error sending the message';
  123 + exit;
  124 +}
  125 +
  126 +echo 'Message was sent successfully';
  127 +</pre>
  128 +</body>
  129 +</html>
  1 +<html>
  2 +<head>
  3 +<title>PHPMailer FAQ</title>
  4 +</head>
  5 +<body>
  6 +<h2>PHPMailer FAQ</h2>
  7 +<ul>
  8 + <li><strong>Q: I am concerned that using include files will take up too much
  9 + processing time on my computer. How can I make it run faster?</strong><br>
  10 + <strong>A:</strong> PHP by itself is fairly fast, but it recompiles scripts every time they are run, which takes up valuable
  11 + computer resources. You can bypass this by using an opcode cache which compiles
  12 + PHP code and store it in memory to reduce overhead immensely. <a href="http://www.php.net/apc/">APC
  13 + (Alternative PHP Cache)</a> is a free opcode cache extension in the PECL library.</li>
  14 + <li><strong>Q: Which mailer gives me the best performance?</strong><br>
  15 + <strong>A:</strong> On a single machine the <strong>sendmail (or Qmail)</strong> is fastest overall.
  16 + Next fastest is mail() to give you the best performance. Both do not have the overhead of SMTP.
  17 + If you do not have a local mail server (as is typical on Windows), SMTP is your only option.</li>
  18 + <li><strong>Q: When I try to attach a file with on my server I get a
  19 + "Could not find {file} on filesystem error". Why is this?</strong><br>
  20 + <strong>A:</strong> If you are using a Unix machine this is probably because the user
  21 + running your web server does not have read access to the directory in question. If you are using Windows,
  22 + then the problem is probably that you have used single backslashes to denote directories (\).
  23 + A single backslash has a special meaning to PHP so these are not
  24 + valid. Instead use double backslashes ("\\") or a single forward
  25 + slash ("/").</li>
  26 +</ul>
  27 +</body>
  28 +</html>
  1 +#!/bin/sh
  2 +# Regenerate PHPMailer documentation
  3 +# Run from within the docs folder
  4 +rm -rf phpdoc/*
  5 +phpdoc --directory .. --target ./phpdoc --ignore test/,examples/,extras/,test_script/ --sourcecode --force --title PHPMailer --template="clean"
  1 +This is built for PHP Mailer 1.72 and was not tested with any previous version. It was developed under PHP 4.3.11 (E_ALL). It works under PHP 5 and 5.1 with E_ALL, but not in Strict mode due to var deprecation (but then neither does PHP Mailer either!). It follows the RFC 1939 standard explicitly and is fully commented.
  2 +
  3 +With that noted, here is how to implement it:
  4 +
  5 +I didn't want to modify the PHP Mailer classes at all, so you will have to include/require this class along with the base one. It can sit quite happily in the phpmailer directory.
  6 +
  7 +When you need it, create your POP3 object
  8 +
  9 +Right before I invoke PHP Mailer I activate the POP3 authorisation. POP3 before SMTP is a process whereby you login to your web hosts POP3 mail server BEFORE sending out any emails via SMTP. The POP3 logon 'verifies' your ability to send email by SMTP, which typically otherwise blocks you. On my web host (Pair Networks) a single POP3 logon is enough to 'verify' you for 90 minutes. Here is some sample PHP code that activates the POP3 logon and then sends an email via PHP Mailer:
  10 +
  11 +<?php
  12 +$pop->authorise('pop3.example.com', 110, 30, 'mailer', 'password', 1);
  13 +$mail = new PHPMailer(); $mail->SMTPDebug = 2; $mail->isSMTP();
  14 +$mail->isHTML(false); $mail->Host = 'relay.example.com';
  15 +$mail->From = 'mailer@example.com';
  16 +$mail->FromName = 'Example Mailer';
  17 +$mail->Subject = 'My subject';
  18 +$mail->Body = 'Hello world';
  19 +$mail->addAddress('rich@corephp.co.uk', 'Richard Davey');
  20 +if (!$mail->send()) {
  21 + echo $mail->ErrorInfo;
  22 +}
  23 +?>
  24 +
  25 +The PHP Mailer parts of this code should be obvious to anyone who has used PHP Mailer before. One thing to note - you almost certainly will not need to use SMTP Authentication *and* POP3 before SMTP together. The Authorisation method is a proxy method to all of the others within that class. There are connect, Logon and disconnect methods available, but I wrapped them in the single Authorisation one to make things easier.
  26 +The Parameters
  27 +
  28 +The authorise parameters are as follows:
  29 +
  30 +$pop->authorise('pop3.example.com', 110, 30, 'mailer', 'password', 1);
  31 +
  32 + 1. pop3.example.com - The POP3 Mail Server Name (hostname or IP address)
  33 + 2. 110 - The POP3 Port on which to connect (default is usually 110, but check with your host)
  34 + 3. 30 - A connection time-out value (in seconds)
  35 + 4. mailer - The POP3 Username required to logon
  36 + 5. password - The POP3 Password required to logon
  37 + 6. 1 - The class debug level (0 = off, 1+ = debug output is echoed to the browser)
  38 +
  39 +Final Comments + the Download
  40 +
  41 +1) This class does not support APOP connections. This is only because I did not have an APOP server to test with, but if you'd like to see that added just contact me.
  42 +
  43 +2) Opening and closing lots of POP3 connections can be quite a resource/network drain. If you need to send a whole batch of emails then just perform the authentication once at the start, and then loop through your mail sending script. Providing this process doesn't take longer than the verification period lasts on your POP3 server, you should be fine. With my host that period is 90 minutes, i.e. plenty of time.
  44 +
  45 +3) If you have heavy requirements for this script (i.e. send a LOT of email on a frequent basis) then I would advise seeking out an alternative sending method (direct SMTP ideally). If this isn't possible then you could modify this class so the 'last authorised' date is recorded somewhere (MySQL, Flat file, etc) meaning you only open a new connection if the old one has expired, saving you precious overhead.
  46 +
  47 +4) There are lots of other POP3 classes for PHP available. However most of them implement the full POP3 command set, where-as this one is purely for authentication, and much lighter as a result. However using any of the other POP3 classes to just logon to your server would have the same net result. At the end of the day, use whatever method you feel most comfortable with.
  48 +Download
  49 +
  50 +My thanks to Chris Ryan for the inspiration (even if indirectly, via his SMTP class)
  1 + GNU LESSER GENERAL PUBLIC LICENSE
  2 + Version 3, 29 June 2007
  3 +
  4 + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
  5 + Everyone is permitted to copy and distribute verbatim copies
  6 + of this license document, but changing it is not allowed.
  7 +
  8 +
  9 + This version of the GNU Lesser General Public License incorporates
  10 +the terms and conditions of version 3 of the GNU General Public
  11 +License, supplemented by the additional permissions listed below.
  12 +
  13 + 0. Additional Definitions.
  14 +
  15 + As used herein, "this License" refers to version 3 of the GNU Lesser
  16 +General Public License, and the "GNU GPL" refers to version 3 of the GNU
  17 +General Public License.
  18 +
  19 + "The Library" refers to a covered work governed by this License,
  20 +other than an Application or a Combined Work as defined below.
  21 +
  22 + An "Application" is any work that makes use of an interface provided
  23 +by the Library, but which is not otherwise based on the Library.
  24 +Defining a subclass of a class defined by the Library is deemed a mode
  25 +of using an interface provided by the Library.
  26 +
  27 + A "Combined Work" is a work produced by combining or linking an
  28 +Application with the Library. The particular version of the Library
  29 +with which the Combined Work was made is also called the "Linked
  30 +Version".
  31 +
  32 + The "Minimal Corresponding Source" for a Combined Work means the
  33 +Corresponding Source for the Combined Work, excluding any source code
  34 +for portions of the Combined Work that, considered in isolation, are
  35 +based on the Application, and not on the Linked Version.
  36 +
  37 + The "Corresponding Application Code" for a Combined Work means the
  38 +object code and/or source code for the Application, including any data
  39 +and utility programs needed for reproducing the Combined Work from the
  40 +Application, but excluding the System Libraries of the Combined Work.
  41 +
  42 + 1. Exception to Section 3 of the GNU GPL.
  43 +
  44 + You may convey a covered work under sections 3 and 4 of this License
  45 +without being bound by section 3 of the GNU GPL.
  46 +
  47 + 2. Conveying Modified Versions.
  48 +
  49 + If you modify a copy of the Library, and, in your modifications, a
  50 +facility refers to a function or data to be supplied by an Application
  51 +that uses the facility (other than as an argument passed when the
  52 +facility is invoked), then you may convey a copy of the modified
  53 +version:
  54 +
  55 + a) under this License, provided that you make a good faith effort to
  56 + ensure that, in the event an Application does not supply the
  57 + function or data, the facility still operates, and performs
  58 + whatever part of its purpose remains meaningful, or
  59 +
  60 + b) under the GNU GPL, with none of the additional permissions of
  61 + this License applicable to that copy.
  62 +
  63 + 3. Object Code Incorporating Material from Library Header Files.
  64 +
  65 + The object code form of an Application may incorporate material from
  66 +a header file that is part of the Library. You may convey such object
  67 +code under terms of your choice, provided that, if the incorporated
  68 +material is not limited to numerical parameters, data structure
  69 +layouts and accessors, or small macros, inline functions and templates
  70 +(ten or fewer lines in length), you do both of the following:
  71 +
  72 + a) Give prominent notice with each copy of the object code that the
  73 + Library is used in it and that the Library and its use are
  74 + covered by this License.
  75 +
  76 + b) Accompany the object code with a copy of the GNU GPL and this license
  77 + document.
  78 +
  79 + 4. Combined Works.
  80 +
  81 + You may convey a Combined Work under terms of your choice that,
  82 +taken together, effectively do not restrict modification of the
  83 +portions of the Library contained in the Combined Work and reverse
  84 +engineering for debugging such modifications, if you also do each of
  85 +the following:
  86 +
  87 + a) Give prominent notice with each copy of the Combined Work that
  88 + the Library is used in it and that the Library and its use are
  89 + covered by this License.
  90 +
  91 + b) Accompany the Combined Work with a copy of the GNU GPL and this license
  92 + document.
  93 +
  94 + c) For a Combined Work that displays copyright notices during
  95 + execution, include the copyright notice for the Library among
  96 + these notices, as well as a reference directing the user to the
  97 + copies of the GNU GPL and this license document.
  98 +
  99 + d) Do one of the following:
  100 +
  101 + 0) Convey the Minimal Corresponding Source under the terms of this
  102 + License, and the Corresponding Application Code in a form
  103 + suitable for, and under terms that permit, the user to
  104 + recombine or relink the Application with a modified version of
  105 + the Linked Version to produce a modified Combined Work, in the
  106 + manner specified by section 6 of the GNU GPL for conveying
  107 + Corresponding Source.
  108 +
  109 + 1) Use a suitable shared library mechanism for linking with the
  110 + Library. A suitable mechanism is one that (a) uses at run time
  111 + a copy of the Library already present on the user's computer
  112 + system, and (b) will operate properly with a modified version
  113 + of the Library that is interface-compatible with the Linked
  114 + Version.
  115 +
  116 + e) Provide Installation Information, but only if you would otherwise
  117 + be required to provide such information under section 6 of the
  118 + GNU GPL, and only to the extent that such information is
  119 + necessary to install and execute a modified version of the
  120 + Combined Work produced by recombining or relinking the
  121 + Application with a modified version of the Linked Version. (If
  122 + you use option 4d0, the Installation Information must accompany
  123 + the Minimal Corresponding Source and Corresponding Application
  124 + Code. If you use option 4d1, you must provide the Installation
  125 + Information in the manner specified by section 6 of the GNU GPL
  126 + for conveying Corresponding Source.)
  127 +
  128 + 5. Combined Libraries.
  129 +
  130 + You may place library facilities that are a work based on the
  131 +Library side by side in a single library together with other library
  132 +facilities that are not Applications and are not covered by this
  133 +License, and convey such a combined library under terms of your
  134 +choice, if you do both of the following:
  135 +
  136 + a) Accompany the combined library with a copy of the same work based
  137 + on the Library, uncombined with any other library facilities,
  138 + conveyed under the terms of this License.
  139 +
  140 + b) Give prominent notice with the combined library that part of it
  141 + is a work based on the Library, and explaining where to find the
  142 + accompanying uncombined form of the same work.
  143 +
  144 + 6. Revised Versions of the GNU Lesser General Public License.
  145 +
  146 + The Free Software Foundation may publish revised and/or new versions
  147 +of the GNU Lesser General Public License from time to time. Such new
  148 +versions will be similar in spirit to the present version, but may
  149 +differ in detail to address new problems or concerns.
  150 +
  151 + Each version is given a distinguishing version number. If the
  152 +Library as you received it specifies that a certain numbered version
  153 +of the GNU Lesser General Public License "or any later version"
  154 +applies to it, you have the option of following the terms and
  155 +conditions either of that published version or of any later version
  156 +published by the Free Software Foundation. If the Library as you
  157 +received it does not specify a version number of the GNU Lesser
  158 +General Public License, you may choose any version of the GNU Lesser
  159 +General Public License ever published by the Free Software Foundation.
  160 +
  161 + If the Library as you received it specifies that a proxy can decide
  162 +whether future versions of the GNU Lesser General Public License shall
  163 +apply, that proxy's public statement of acceptance of any version is
  164 +permanent authorization for you to choose that version for the
  165 +Library.
  1 +<?php
  2 +/*
  3 +* revised, updated and corrected 27/02/2013
  4 +* by matt.sturdy@gmail.com
  5 +*/
  6 +require '../PHPMailerAutoload.php';
  7 +
  8 +$CFG['smtp_debug'] = 2; //0 == off, 1 for client output, 2 for client and server
  9 +$CFG['smtp_debugoutput'] = 'html';
  10 +$CFG['smtp_server'] = 'localhost';
  11 +$CFG['smtp_port'] = '25';
  12 +$CFG['smtp_authenticate'] = false;
  13 +$CFG['smtp_username'] = 'name@example.com';
  14 +$CFG['smtp_password'] = 'yourpassword';
  15 +$CFG['smtp_secure'] = 'None';
  16 +
  17 +$from_name = (isset($_POST['From_Name'])) ? $_POST['From_Name'] : '';
  18 +$from_email = (isset($_POST['From_Email'])) ? $_POST['From_Email'] : '';
  19 +$to_name = (isset($_POST['To_Name'])) ? $_POST['To_Name'] : '';
  20 +$to_email = (isset($_POST['To_Email'])) ? $_POST['To_Email'] : '';
  21 +$cc_email = (isset($_POST['cc_Email'])) ? $_POST['cc_Email'] : '';
  22 +$bcc_email = (isset($_POST['bcc_Email'])) ? $_POST['bcc_Email'] : '';
  23 +$subject = (isset($_POST['Subject'])) ? $_POST['Subject'] : '';
  24 +$message = (isset($_POST['Message'])) ? $_POST['Message'] : '';
  25 +$test_type = (isset($_POST['test_type'])) ? $_POST['test_type'] : 'smtp';
  26 +$smtp_debug = (isset($_POST['smtp_debug'])) ? $_POST['smtp_debug'] : $CFG['smtp_debug'];
  27 +$smtp_server = (isset($_POST['smtp_server'])) ? $_POST['smtp_server'] : $CFG['smtp_server'];
  28 +$smtp_port = (isset($_POST['smtp_port'])) ? $_POST['smtp_port'] : $CFG['smtp_port'];
  29 +$smtp_secure = strtolower((isset($_POST['smtp_secure'])) ? $_POST['smtp_secure'] : $CFG['smtp_secure']);
  30 +$smtp_authenticate = (isset($_POST['smtp_authenticate'])) ?
  31 + $_POST['smtp_authenticate'] : $CFG['smtp_authenticate'];
  32 +$authenticate_password = (isset($_POST['authenticate_password'])) ?
  33 + $_POST['authenticate_password'] : $CFG['smtp_password'];
  34 +$authenticate_username = (isset($_POST['authenticate_username'])) ?
  35 + $_POST['authenticate_username'] : $CFG['smtp_username'];
  36 +
  37 +// storing all status output from the script to be shown to the user later
  38 +$results_messages = array();
  39 +
  40 +// $example_code represents the "final code" that we're using, and will
  41 +// be shown to the user at the end.
  42 +$example_code = "\nrequire_once '../PHPMailerAutoload.php';";
  43 +$example_code .= "\n\n\$results_messages = array();";
  44 +
  45 +$mail = new PHPMailer(true); //PHPMailer instance with exceptions enabled
  46 +$mail->CharSet = 'utf-8';
  47 +$mail->Debugoutput = $CFG['smtp_debugoutput'];
  48 +$example_code .= "\n\n\$mail = new PHPMailer(true);";
  49 +$example_code .= "\n\$mail->CharSet = 'utf-8';";
  50 +
  51 +class phpmailerAppException extends phpmailerException
  52 +{
  53 +}
  54 +
  55 +$example_code .= "\n\nclass phpmailerAppException extends phpmailerException {}";
  56 +$example_code .= "\n\ntry {";
  57 +
  58 +try {
  59 + if (isset($_POST["submit"]) && $_POST['submit'] == "Submit") {
  60 + $to = $_POST['To_Email'];
  61 + if (!PHPMailer::validateAddress($to)) {
  62 + throw new phpmailerAppException("Email address " . $to . " is invalid -- aborting!");
  63 + }
  64 +
  65 + $example_code .= "\n\$to = '{$_POST['To_Email']}';";
  66 + $example_code .= "\nif(!PHPMailer::validateAddress(\$to)) {";
  67 + $example_code .= "\n throw new phpmailerAppException(\"Email address \" . " .
  68 + "\$to . \" is invalid -- aborting!\");";
  69 + $example_code .= "\n}";
  70 +
  71 + switch ($_POST['test_type']) {
  72 + case 'smtp':
  73 + $mail->isSMTP(); // telling the class to use SMTP
  74 + $mail->SMTPDebug = (integer)$_POST['smtp_debug'];
  75 + $mail->Host = $_POST['smtp_server']; // SMTP server
  76 + $mail->Port = (integer)$_POST['smtp_port']; // set the SMTP port
  77 + if ($_POST['smtp_secure']) {
  78 + $mail->SMTPSecure = strtolower($_POST['smtp_secure']);
  79 + }
  80 + $mail->SMTPAuth = array_key_exists('smtp_authenticate', $_POST); // enable SMTP authentication?
  81 + if (array_key_exists('smtp_authenticate', $_POST)) {
  82 + $mail->Username = $_POST['authenticate_username']; // SMTP account username
  83 + $mail->Password = $_POST['authenticate_password']; // SMTP account password
  84 + }
  85 +
  86 + $example_code .= "\n\$mail->isSMTP();";
  87 + $example_code .= "\n\$mail->SMTPDebug = " . $_POST['smtp_debug'] . ";";
  88 + $example_code .= "\n\$mail->Host = \"" . $_POST['smtp_server'] . "\";";
  89 + $example_code .= "\n\$mail->Port = \"" . $_POST['smtp_port'] . "\";";
  90 + $example_code .= "\n\$mail->SMTPSecure = \"" . strtolower($_POST['smtp_secure']) . "\";";
  91 + $example_code .= "\n\$mail->SMTPAuth = " . (array_key_exists(
  92 + 'smtp_authenticate',
  93 + $_POST
  94 + ) ? 'true' : 'false') . ";";
  95 + if (array_key_exists('smtp_authenticate', $_POST)) {
  96 + $example_code .= "\n\$mail->Username = \"" . $_POST['authenticate_username'] . "\";";
  97 + $example_code .= "\n\$mail->Password = \"" . $_POST['authenticate_password'] . "\";";
  98 + }
  99 + break;
  100 + case 'mail':
  101 + $mail->isMail(); // telling the class to use PHP's mail()
  102 + $example_code .= "\n\$mail->isMail();";
  103 + break;
  104 + case 'sendmail':
  105 + $mail->isSendmail(); // telling the class to use Sendmail
  106 + $example_code .= "\n\$mail->isSendmail();";
  107 + break;
  108 + case 'qmail':
  109 + $mail->isQmail(); // telling the class to use Qmail
  110 + $example_code .= "\n\$mail->isQmail();";
  111 + break;
  112 + default:
  113 + throw new phpmailerAppException('Invalid test_type provided');
  114 + }
  115 +
  116 + try {
  117 + if ($_POST['From_Name'] != '') {
  118 + $mail->addReplyTo($_POST['From_Email'], $_POST['From_Name']);
  119 + $mail->From = $_POST['From_Email'];
  120 + $mail->FromName = $_POST['From_Name'];
  121 +
  122 + $example_code .= "\n\$mail->addReplyTo(\"" .
  123 + $_POST['From_Email'] . "\", \"" . $_POST['From_Name'] . "\");";
  124 + $example_code .= "\n\$mail->From = \"" . $_POST['From_Email'] . "\";";
  125 + $example_code .= "\n\$mail->FromName = \"" . $_POST['From_Name'] . "\";";
  126 + } else {
  127 + $mail->addReplyTo($_POST['From_Email']);
  128 + $mail->From = $_POST['From_Email'];
  129 + $mail->FromName = $_POST['From_Email'];
  130 +
  131 + $example_code .= "\n\$mail->addReplyTo(\"" . $_POST['From_Email'] . "\");";
  132 + $example_code .= "\n\$mail->From = \"" . $_POST['From_Email'] . "\";";
  133 + $example_code .= "\n\$mail->FromName = \"" . $_POST['From_Email'] . "\";";
  134 + }
  135 +
  136 + if ($_POST['To_Name'] != '') {
  137 + $mail->addAddress($to, $_POST['To_Name']);
  138 + $example_code .= "\n\$mail->addAddress(\"$to\", \"" . $_POST['To_Name'] . "\");";
  139 + } else {
  140 + $mail->addAddress($to);
  141 + $example_code .= "\n\$mail->addAddress(\"$to\");";
  142 + }
  143 +
  144 + if ($_POST['bcc_Email'] != '') {
  145 + $indiBCC = explode(" ", $_POST['bcc_Email']);
  146 + foreach ($indiBCC as $key => $value) {
  147 + $mail->addBCC($value);
  148 + $example_code .= "\n\$mail->addBCC(\"$value\");";
  149 + }
  150 + }
  151 +
  152 + if ($_POST['cc_Email'] != '') {
  153 + $indiCC = explode(" ", $_POST['cc_Email']);
  154 + foreach ($indiCC as $key => $value) {
  155 + $mail->addCC($value);
  156 + $example_code .= "\n\$mail->addCC(\"$value\");";
  157 + }
  158 + }
  159 + } catch (phpmailerException $e) { //Catch all kinds of bad addressing
  160 + throw new phpmailerAppException($e->getMessage());
  161 + }
  162 + $mail->Subject = $_POST['Subject'] . ' (PHPMailer test using ' . strtoupper($_POST['test_type']) . ')';
  163 + $example_code .= "\n\$mail->Subject = \"" . $_POST['Subject'] .
  164 + '(PHPMailer test using ' . strtoupper($_POST['test_type']) . ')";';
  165 +
  166 + if ($_POST['Message'] == '') {
  167 + $body = file_get_contents('contents.html');
  168 + } else {
  169 + $body = $_POST['Message'];
  170 + }
  171 +
  172 + $example_code .= "\n\$body = <<<'EOT'\n" . htmlentities($body) . "\nEOT;";
  173 +
  174 + $mail->WordWrap = 80; // set word wrap
  175 + $mail->msgHTML($body, dirname(__FILE__), true); //Create message bodies and embed images
  176 +
  177 + $example_code .= "\n\$mail->WordWrap = 80;";
  178 + $example_code .= "\n\$mail->msgHTML(\$body, dirname(__FILE__), true); //Create message bodies and embed images";
  179 +
  180 + $mail->addAttachment('images/phpmailer_mini.png', 'phpmailer_mini.png'); // optional name
  181 + $mail->addAttachment('images/phpmailer.png', 'phpmailer.png'); // optional name
  182 + $example_code .= "\n\$mail->addAttachment('images/phpmailer_mini.png'," .
  183 + "'phpmailer_mini.png'); // optional name";
  184 + $example_code .= "\n\$mail->addAttachment('images/phpmailer.png', 'phpmailer.png'); // optional name";
  185 +
  186 + try {
  187 + $mail->send();
  188 + $results_messages[] = "Message has been sent using " . strtoupper($_POST["test_type"]);
  189 + } catch (phpmailerException $e) {
  190 + throw new phpmailerAppException("Unable to send to: " . $to . ': ' . $e->getMessage());
  191 + }
  192 +
  193 + $example_code .= "\n\ntry {";
  194 + $example_code .= "\n \$mail->send();";
  195 + $example_code .= "\n \$results_messages[] = \"Message has been sent using " .
  196 + strtoupper($_POST['test_type']) . "\";";
  197 + $example_code .= "\n}";
  198 + $example_code .= "\ncatch (phpmailerException \$e) {";
  199 + $example_code .= "\n throw new phpmailerAppException('Unable to send to: ' . \$to. ': '.\$e->getMessage());";
  200 + $example_code .= "\n}";
  201 + }
  202 +} catch (phpmailerAppException $e) {
  203 + $results_messages[] = $e->errorMessage();
  204 +}
  205 +$example_code .= "\n}";
  206 +$example_code .= "\ncatch (phpmailerAppException \$e) {";
  207 +$example_code .= "\n \$results_messages[] = \$e->errorMessage();";
  208 +$example_code .= "\n}";
  209 +$example_code .= "\n\nif (count(\$results_messages) > 0) {";
  210 +$example_code .= "\n echo \"<h2>Run results</h2>\\n\";";
  211 +$example_code .= "\n echo \"<ul>\\n\";";
  212 +$example_code .= "\nforeach (\$results_messages as \$result) {";
  213 +$example_code .= "\n echo \"<li>\$result</li>\\n\";";
  214 +$example_code .= "\n}";
  215 +$example_code .= "\necho \"</ul>\\n\";";
  216 +$example_code .= "\n}";
  217 +?><!DOCTYPE html>
  218 +<html>
  219 +<head>
  220 + <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  221 + <title>PHPMailer Test Page</title>
  222 + <script type="text/javascript" src="scripts/shCore.js"></script>
  223 + <script type="text/javascript" src="scripts/shBrushPhp.js"></script>
  224 + <link type="text/css" rel="stylesheet" href="styles/shCore.css">
  225 + <link type="text/css" rel="stylesheet" href="styles/shThemeDefault.css">
  226 + <style>
  227 + body {
  228 + font-family: Arial, Helvetica, sans-serif;
  229 + font-size: 1em;
  230 + padding: 1em;
  231 + }
  232 +
  233 + table {
  234 + margin: 0 auto;
  235 + border-spacing: 0;
  236 + border-collapse: collapse;
  237 + }
  238 +
  239 + table.column {
  240 + border-collapse: collapse;
  241 + background-color: #FFFFFF;
  242 + padding: 0.5em;
  243 + width: 35em;
  244 + }
  245 +
  246 + td {
  247 + font-size: 1em;
  248 + padding: 0.1em 0.25em;
  249 + -moz-border-radius: 1em;
  250 + -webkit-border-radius: 1em;
  251 + border-radius: 1em;
  252 + }
  253 +
  254 + td.colleft {
  255 + text-align: right;
  256 + width: 35%;
  257 + }
  258 +
  259 + td.colrite {
  260 + text-align: left;
  261 + width: 65%;
  262 + }
  263 +
  264 + fieldset {
  265 + padding: 1em 1em 1em 1em;
  266 + margin: 0 2em;
  267 + border-radius: 1.5em;
  268 + -webkit-border-radius: 1em;
  269 + -moz-border-radius: 1em;
  270 + }
  271 +
  272 + fieldset.inner {
  273 + width: 40%;
  274 + }
  275 +
  276 + fieldset:hover, tr:hover {
  277 + background-color: #fafafa;
  278 + }
  279 +
  280 + legend {
  281 + font-weight: bold;
  282 + font-size: 1.1em;
  283 + }
  284 +
  285 + div.column-left {
  286 + float: left;
  287 + width: 45em;
  288 + height: 31em;
  289 + }
  290 +
  291 + div.column-right {
  292 + display: inline;
  293 + width: 45em;
  294 + max-height: 31em;
  295 + }
  296 +
  297 + input.radio {
  298 + float: left;
  299 + }
  300 +
  301 + div.radio {
  302 + padding: 0.2em;
  303 + }
  304 + </style>
  305 + <script>
  306 + SyntaxHighlighter.config.clipboardSwf = 'scripts/clipboard.swf';
  307 + SyntaxHighlighter.all();
  308 +
  309 + function startAgain() {
  310 + var post_params = {
  311 + "From_Name": "<?php echo $from_name; ?>",
  312 + "From_Email": "<?php echo $from_email; ?>",
  313 + "To_Name": "<?php echo $to_name; ?>",
  314 + "To_Email": "<?php echo $to_email; ?>",
  315 + "cc_Email": "<?php echo $cc_email; ?>",
  316 + "bcc_Email": "<?php echo $bcc_email; ?>",
  317 + "Subject": "<?php echo $subject; ?>",
  318 + "Message": "<?php echo $message; ?>",
  319 + "test_type": "<?php echo $test_type; ?>",
  320 + "smtp_debug": "<?php echo $smtp_debug; ?>",
  321 + "smtp_server": "<?php echo $smtp_server; ?>",
  322 + "smtp_port": "<?php echo $smtp_port; ?>",
  323 + "smtp_secure": "<?php echo $smtp_secure; ?>",
  324 + "smtp_authenticate": "<?php echo $smtp_authenticate; ?>",
  325 + "authenticate_username": "<?php echo $authenticate_username; ?>",
  326 + "authenticate_password": "<?php echo $authenticate_password; ?>"
  327 + };
  328 +
  329 + var resetForm = document.createElement("form");
  330 + resetForm.setAttribute("method", "POST");
  331 + resetForm.setAttribute("path", "index.php");
  332 +
  333 + for (var k in post_params) {
  334 + var h = document.createElement("input");
  335 + h.setAttribute("type", "hidden");
  336 + h.setAttribute("name", k);
  337 + h.setAttribute("value", post_params[k]);
  338 + resetForm.appendChild(h);
  339 + }
  340 +
  341 + document.body.appendChild(resetForm);
  342 + resetForm.submit();
  343 + }
  344 +
  345 + function showHideDiv(test, element_id) {
  346 + var ops = {"smtp-options-table": "smtp"};
  347 +
  348 + if (test == ops[element_id]) {
  349 + document.getElementById(element_id).style.display = "block";
  350 + } else {
  351 + document.getElementById(element_id).style.display = "none";
  352 + }
  353 + }
  354 + </script>
  355 +</head>
  356 +<body>
  357 +<?php
  358 +if (version_compare(PHP_VERSION, '5.0.0', '<')) {
  359 + echo 'Current PHP version: ' . phpversion() . "<br>";
  360 + echo exit("ERROR: Wrong PHP version. Must be PHP 5 or above.");
  361 +}
  362 +
  363 +if (count($results_messages) > 0) {
  364 + echo '<h2>Run results</h2>';
  365 + echo '<ul>';
  366 + foreach ($results_messages as $result) {
  367 + echo "<li>$result</li>";
  368 + }
  369 + echo '</ul>';
  370 +}
  371 +
  372 +if (isset($_POST["submit"]) && $_POST["submit"] == "Submit") {
  373 + echo "<button type=\"submit\" onclick=\"startAgain();\">Start Over</button><br>\n";
  374 + echo "<br><span>Script:</span>\n";
  375 + echo "<pre class=\"brush: php;\">\n";
  376 + echo $example_code;
  377 + echo "\n</pre>\n";
  378 + echo "\n<hr style=\"margin: 3em;\">\n";
  379 +}
  380 +?>
  381 +<form method="POST" enctype="multipart/form-data">
  382 + <div>
  383 + <div class="column-left">
  384 + <fieldset>
  385 + <legend>Mail Details</legend>
  386 + <table border="1" class="column">
  387 + <tr>
  388 + <td class="colleft">
  389 + <label for="From_Name"><strong>From</strong> Name</label>
  390 + </td>
  391 + <td class="colrite">
  392 + <input type="text" id="From_Name" name="From_Name" value="<?php echo $from_name; ?>"
  393 + style="width:95%;" autofocus placeholder="Your Name">
  394 + </td>
  395 + </tr>
  396 + <tr>
  397 + <td class="colleft">
  398 + <label for="From_Email"><strong>From</strong> Email Address</label>
  399 + </td>
  400 + <td class="colrite">
  401 + <input type="text" id="From_Email" name="From_Email" value="<?php echo $from_email; ?>"
  402 + style="width:95%;" required placeholder="Your.Email@example.com">
  403 + </td>
  404 + </tr>
  405 + <tr>
  406 + <td class="colleft">
  407 + <label for="To_Name"><strong>To</strong> Name</label>
  408 + </td>
  409 + <td class="colrite">
  410 + <input type="text" id="To_Name" name="To_Name" value="<?php echo $to_name; ?>"
  411 + style="width:95%;" placeholder="Recipient's Name">
  412 + </td>
  413 + </tr>
  414 + <tr>
  415 + <td class="colleft">
  416 + <label for="To_Email"><strong>To</strong> Email Address</label>
  417 + </td>
  418 + <td class="colrite">
  419 + <input type="text" id="To_Email" name="To_Email" value="<?php echo $to_email; ?>"
  420 + style="width:95%;" required placeholder="Recipients.Email@example.com">
  421 + </td>
  422 + </tr>
  423 + <tr>
  424 + <td class="colleft">
  425 + <label for="cc_Email"><strong>CC Recipients</strong><br>
  426 + <small>(separate with commas)</small>
  427 + </label>
  428 + </td>
  429 + <td class="colrite">
  430 + <input type="text" id="cc_Email" name="cc_Email" value="<?php echo $cc_email; ?>"
  431 + style="width:95%;" placeholder="cc1@example.com, cc2@example.com">
  432 + </td>
  433 + </tr>
  434 + <tr>
  435 + <td class="colleft">
  436 + <label for="bcc_Email"><strong>BCC Recipients</strong><br>
  437 + <small>(separate with commas)</small>
  438 + </label>
  439 + </td>
  440 + <td class="colrite">
  441 + <input type="text" id="bcc_Email" name="bcc_Email" value="<?php echo $bcc_email; ?>"
  442 + style="width:95%;" placeholder="bcc1@example.com, bcc2@example.com">
  443 + </td>
  444 + </tr>
  445 + <tr>
  446 + <td class="colleft">
  447 + <label for="Subject"><strong>Subject</strong></label>
  448 + </td>
  449 + <td class="colrite">
  450 + <input type="text" name="Subject" id="Subject" value="<?php echo $subject; ?>"
  451 + style="width:95%;" placeholder="Email Subject">
  452 + </td>
  453 + </tr>
  454 + <tr>
  455 + <td class="colleft">
  456 + <label for="Message"><strong>Message</strong><br>
  457 + <small>If blank, will use content.html</small>
  458 + </label>
  459 + </td>
  460 + <td class="colrite">
  461 + <textarea name="Message" id="Message" style="width:95%;height:5em;"
  462 + placeholder="Body of your email"><?php echo $message; ?></textarea>
  463 + </td>
  464 + </tr>
  465 + </table>
  466 + <div style="margin:1em 0;">Test will include two attachments.</div>
  467 + </fieldset>
  468 + </div>
  469 + <div class="column-right">
  470 + <fieldset class="inner"> <!-- SELECT TYPE OF MAIL -->
  471 + <legend>Mail Test Specs</legend>
  472 + <table border="1" class="column">
  473 + <tr>
  474 + <td class="colleft">Test Type</td>
  475 + <td class="colrite">
  476 + <div class="radio">
  477 + <label for="radio-mail">Mail()</label>
  478 + <input class="radio" type="radio" name="test_type" value="mail" id="radio-mail"
  479 + onclick="showHideDiv(this.value, 'smtp-options-table');"
  480 + <?php echo ($test_type == 'mail') ? 'checked' : ''; ?>
  481 + required>
  482 + </div>
  483 + <div class="radio">
  484 + <label for="radio-sendmail">Sendmail</label>
  485 + <input class="radio" type="radio" name="test_type" value="sendmail" id="radio-sendmail"
  486 + onclick="showHideDiv(this.value, 'smtp-options-table');"
  487 + <?php echo ($test_type == 'sendmail') ? 'checked' : ''; ?>
  488 + required>
  489 + </div>
  490 + <div class="radio">
  491 + <label for="radio-qmail">Qmail</label>
  492 + <input class="radio" type="radio" name="test_type" value="qmail" id="radio-qmail"
  493 + onclick="showHideDiv(this.value, 'smtp-options-table');"
  494 + <?php echo ($test_type == 'qmail') ? 'checked' : ''; ?>
  495 + required>
  496 + </div>
  497 + <div class="radio">
  498 + <label for="radio-smtp">SMTP</label>
  499 + <input class="radio" type="radio" name="test_type" value="smtp" id="radio-smtp"
  500 + onclick="showHideDiv(this.value, 'smtp-options-table');"
  501 + <?php echo ($test_type == 'smtp') ? 'checked' : ''; ?>
  502 + required>
  503 + </div>
  504 + </td>
  505 + </tr>
  506 + </table>
  507 + <div id="smtp-options-table" style="margin:1em 0 0 0;
  508 +<?php if ($test_type != 'smtp') {
  509 + echo "display: none;";
  510 +} ?>">
  511 + <span style="margin:1.25em 0; display:block;"><strong>SMTP Specific Options:</strong></span>
  512 + <table border="1" class="column">
  513 + <tr>
  514 + <td class="colleft"><label for="smtp_debug">SMTP Debug ?</label></td>
  515 + <td class="colrite">
  516 + <select size="1" id="smtp_debug" name="smtp_debug">
  517 + <option <?php echo ($smtp_debug == '0') ? 'selected' : ''; ?> value="0">
  518 + 0 - Disabled
  519 + </option>
  520 + <option <?php echo ($smtp_debug == '1') ? 'selected' : ''; ?> value="1">
  521 + 1 - Client messages
  522 + </option>
  523 + <option <?php echo ($smtp_debug == '2') ? 'selected' : ''; ?> value="2">
  524 + 2 - Client and server messages
  525 + </option>
  526 + </select>
  527 + </td>
  528 + </tr>
  529 + <tr>
  530 + <td class="colleft"><label for="smtp_server">SMTP Server</label></td>
  531 + <td class="colrite">
  532 + <input type="text" id="smtp_server" name="smtp_server"
  533 + value="<?php echo $smtp_server; ?>" style="width:95%;"
  534 + placeholder="smtp.server.com">
  535 + </td>
  536 + </tr>
  537 + <tr>
  538 + <td class="colleft" style="width: 5em;"><label for="smtp_port">SMTP Port</label></td>
  539 + <td class="colrite">
  540 + <input type="text" name="smtp_port" id="smtp_port" size="3"
  541 + value="<?php echo $smtp_port; ?>" placeholder="Port">
  542 + </td>
  543 + </tr>
  544 + <tr>
  545 + <td class="colleft"><label for="smtp_secure">SMTP Security</label></td>
  546 + <td>
  547 + <select size="1" name="smtp_secure" id="smtp_secure">
  548 + <option <?php echo ($smtp_secure == 'none') ? 'selected' : '' ?>>None</option>
  549 + <option <?php echo ($smtp_secure == 'tls') ? 'selected' : '' ?>>TLS</option>
  550 + <option <?php echo ($smtp_secure == 'ssl') ? 'selected' : '' ?>>SSL</option>
  551 + </select>
  552 + </td>
  553 + </tr>
  554 + <tr>
  555 + <td class="colleft"><label for="smtp-authenticate">SMTP Authenticate?</label></td>
  556 + <td class="colrite">
  557 + <input type="checkbox" id="smtp-authenticate"
  558 + name="smtp_authenticate"
  559 +<?php if ($smtp_authenticate != '') {
  560 + echo "checked";
  561 +} ?>
  562 + value="<?php echo $smtp_authenticate; ?>">
  563 + </td>
  564 + </tr>
  565 + <tr>
  566 + <td class="colleft"><label for="authenticate_username">Authenticate Username</label></td>
  567 + <td class="colrite">
  568 + <input type="text" id="authenticate_username" name="authenticate_username"
  569 + value="<?php echo $authenticate_username; ?>" style="width:95%;"
  570 + placeholder="SMTP Server Username">
  571 + </td>
  572 + </tr>
  573 + <tr>
  574 + <td class="colleft"><label for="authenticate_password">Authenticate Password</label></td>
  575 + <td class="colrite">
  576 + <input type="password" name="authenticate_password" id="authenticate_password"
  577 + value="<?php echo $authenticate_password; ?>" style="width:95%;"
  578 + placeholder="SMTP Server Password">
  579 + </td>
  580 + </tr>
  581 + </table>
  582 + </div>
  583 + </fieldset>
  584 + </div>
  585 + <br style="clear:both;">
  586 +
  587 + <div style="margin-left:2em; margin-bottom:5em; float:left;">
  588 + <div style="margin-bottom: 1em; ">
  589 + <input type="submit" value="Submit" name="submit">
  590 + </div>
  591 + <?php echo 'Current PHP version: ' . phpversion(); ?>
  592 + </div>
  593 + </div>
  594 +</form>
  595 +</body>
  596 +</html>
  1 +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2 +<html>
  3 +<head>
  4 + <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5 + <title>PHPMailer Test</title>
  6 +</head>
  7 +<body>
  8 + <div style="width: 640px; font-family: Arial, Helvetica, sans-serif; font-size: 11px;">
  9 + <h1>This is a test of PHPMailer.</h1>
  10 + <div align="center">
  11 + <a href="https://github.com/PHPMailer/PHPMailer/"><img src="images/phpmailer.png" height="90" width="340" alt="PHPMailer rocks"></a>
  12 + </div>
  13 + <p>This example uses <strong>HTML</strong>.</p>
  14 + <p>The PHPMailer image at the top has been embedded automatically.</p>
  15 + </div>
  16 +</body>
  17 +</html>
  1 +<!DOCTYPE html>
  2 +<html>
  3 +<head>
  4 + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  5 + <title>PHPMailer - Exceptions test</title>
  6 +</head>
  7 +<body>
  8 +<?php
  9 +require '../PHPMailerAutoload.php';
  10 +
  11 +//Create a new PHPMailer instance
  12 +//Passing true to the constructor enables the use of exceptions for error handling
  13 +$mail = new PHPMailer(true);
  14 +try {
  15 + //Set who the message is to be sent from
  16 + $mail->setFrom('from@example.com', 'First Last');
  17 + //Set an alternative reply-to address
  18 + $mail->addReplyTo('replyto@example.com', 'First Last');
  19 + //Set who the message is to be sent to
  20 + $mail->addAddress('whoto@example.com', 'John Doe');
  21 + //Set the subject line
  22 + $mail->Subject = 'PHPMailer Exceptions test';
  23 + //Read an HTML message body from an external file, convert referenced images to embedded,
  24 + //and convert the HTML into a basic plain-text alternative body
  25 + $mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
  26 + //Replace the plain text body with one created manually
  27 + $mail->AltBody = 'This is a plain-text message body';
  28 + //Attach an image file
  29 + $mail->addAttachment('images/phpmailer_mini.png');
  30 + //send the message
  31 + //Note that we don't need check the response from this because it will throw an exception if it has trouble
  32 + $mail->send();
  33 + echo "Message sent!";
  34 +} catch (phpmailerException $e) {
  35 + echo $e->errorMessage(); //Pretty error messages from PHPMailer
  36 +} catch (Exception $e) {
  37 + echo $e->getMessage(); //Boring error messages from anything else!
  38 +}
  39 +?>
  40 +</body>
  41 +</html>
  1 +<!DOCTYPE html>
  2 +<html>
  3 +<head>
  4 + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  5 + <title>PHPMailer - GMail SMTP test</title>
  6 +</head>
  7 +<body>
  8 +<?php
  9 +
  10 +//SMTP needs accurate times, and the PHP time zone MUST be set
  11 +//This should be done in your php.ini, but this is how to do it if you don't have access to that
  12 +date_default_timezone_set('Etc/UTC');
  13 +
  14 +require '../PHPMailerAutoload.php';
  15 +
  16 +//Create a new PHPMailer instance
  17 +$mail = new PHPMailer();
  18 +
  19 +//Tell PHPMailer to use SMTP
  20 +$mail->isSMTP();
  21 +
  22 +//Enable SMTP debugging
  23 +// 0 = off (for production use)
  24 +// 1 = client messages
  25 +// 2 = client and server messages
  26 +$mail->SMTPDebug = 2;
  27 +
  28 +//Ask for HTML-friendly debug output
  29 +$mail->Debugoutput = 'html';
  30 +
  31 +//Set the hostname of the mail server
  32 +$mail->Host = 'smtp.gmail.com';
  33 +
  34 +//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
  35 +$mail->Port = 587;
  36 +
  37 +//Set the encryption system to use - ssl (deprecated) or tls
  38 +$mail->SMTPSecure = 'tls';
  39 +
  40 +//Whether to use SMTP authentication
  41 +$mail->SMTPAuth = true;
  42 +
  43 +//Username to use for SMTP authentication - use full email address for gmail
  44 +$mail->Username = "username@gmail.com";
  45 +
  46 +//Password to use for SMTP authentication
  47 +$mail->Password = "yourpassword";
  48 +
  49 +//Set who the message is to be sent from
  50 +$mail->setFrom('from@example.com', 'First Last');
  51 +
  52 +//Set an alternative reply-to address
  53 +$mail->addReplyTo('replyto@example.com', 'First Last');
  54 +
  55 +//Set who the message is to be sent to
  56 +$mail->addAddress('whoto@example.com', 'John Doe');
  57 +
  58 +//Set the subject line
  59 +$mail->Subject = 'PHPMailer GMail SMTP test';
  60 +
  61 +//Read an HTML message body from an external file, convert referenced images to embedded,
  62 +//convert HTML into a basic plain-text alternative body
  63 +$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
  64 +
  65 +//Replace the plain text body with one created manually
  66 +$mail->AltBody = 'This is a plain-text message body';
  67 +
  68 +//Attach an image file
  69 +$mail->addAttachment('images/phpmailer_mini.png');
  70 +
  71 +//send the message, check for errors
  72 +if (!$mail->send()) {
  73 + echo "Mailer Error: " . $mail->ErrorInfo;
  74 +} else {
  75 + echo "Message sent!";
  76 +}
  77 +?>
  78 +</body>
  79 +</html>
  1 +<!DOCTYPE html>
  2 +<html>
  3 +<head>
  4 + <meta charset="UTF-8">
  5 + <title>PHPMailer Examples</title>
  6 +</head>
  7 +<body>
  8 +<h1>PHPMailer code examples<a href="https://github.com/PHPMailer/PHPMailer"><img src="images/phpmailer.png" style="float:right; border:0;" alt="PHPMailer logo"></a></h1>
  9 +<p>This folder contains a collection of examples of using <a href="https://github.com/PHPMailer/PHPMailer">PHPMailer</a>.</p>
  10 +<h2>About testing email sending</h2>
  11 +<p>When working on email sending code you'll find yourself worrying about what might happen if all these test emails got sent to your mailing list. The solution is to use a fake mail server, one that acts just like the real thing, but just doesn't actually send anything out. Some offer web interfaces, feedback, logging, the ability to return specific error codes, all things that are useful for testing error handling, authentication etc. Here's a selection of mail testing tools you might like to try:</p>
  12 +<ul>
  13 + <li><a href="https://github.com/isotoma/FakeEmail">FakeEmail</a>, a Python-based fake mail server with a web interface.</li>
  14 + <li><a href="http://www.postfix.org/smtp-sink.1.html">smtp-sink</a>, part of the Postfix mail server, so you probably already have this installed. This is used in the Travis-CI configuration to run PHPMailer's unit tests.</li>
  15 + <li><a href="https://github.com/Nilhcem/FakeSMTP">FakeSMTP</a>, a Java desktop app with the ability to show an SMTP log and save messages to a folder.</li>
  16 + <li><a href="http://smtp4dev.codeplex.com">smtp4dev</a>, a dummy SMTP server for Windows.</li>
  17 + <li><a href="https://github.com/PHPMailer/PHPMailer/blob/master/test/fakesendmail.sh">fakesendmail.sh</a>, part of PHPMailer's test setup, this is a shell script that emulates sendmail for testing 'mail' or 'sendmail' methods in PHPMailer.</li>
  18 + <li><a href="http://tools.ietf.org/tools/msglint/">msglint</a>, not a mail server, the IETF's MIME structure analyser checks the formatting of your messages.</li>
  19 +</ul>
  20 +<div style="padding: 8px; color: #333333; background-color: #dc8b92">
  21 +<h2>Security note</h2>
  22 +<p>Before running these examples you'll need to rename them with '.php' extensions. They are supplied as '.phps' files which will usually be displayed with syntax highlighting by PHP instead of running them. This prevents potential security issues with running potential spam-gateway code if you happen to deploy these code examples on a live site - <em>please don't do that!</em> Similarly, don't leave your passwords in these files as they will be visible to the world!</p>
  23 +</div>
  24 +<h2><a href="code_generator.phps">code_generator.phps</a></h2>
  25 +<p>This script is a simple code generator - fill in the form and hit submit, and it will use when you entered to email you a message, and will also generate PHP code using your settings that you can copy and paste to use in your own apps. If you need to get going quickly, this is probably the best place to start.</p>
  26 +<h2><a href="mail.phps">mail.phps</a></h2>
  27 +<p>This script is a basic example which creates an email message from an external HTML file, creates a plain text body, sets various addresses, adds an attachment and sends the message. It uses PHP's built-in mail() function which is the simplest to use, but relies on the presence of a local mail server, something which is not usually available on Windows. If you find yourself in that sitution, either install a local mail server, or use a remote one and send using SMTP instead.</p>
  28 +<h2><a href="exceptions.phps">exceptions.phps</a></h2>
  29 +<p>The same as the mail example, but shows how to use PHPMailer's optional exceptions for error handling.</p>
  30 +<h2><a href="smtp.phps">smtp.phps</a></h2>
  31 +<p>A simple example sending using SMTP with authentication.</p>
  32 +<h2><a href="smtp_no_auth.phps">smtp_no_auth.phps</a></h2>
  33 +<p>A simple example sending using SMTP without authentication.</p>
  34 +<h2><a href="sendmail.phps">sendmail.phps</a></h2>
  35 +<p>A simple example using sendmail. Sendmail is a program (usually found on Linux/BSD, OS X and other UNIX-alikes) that can be used to submit messages to a local mail server without a lengthy SMTP conversation. It's probably the fastest sending mechanism, but lacks some error reporting features. There are sendmail emulators for most popular mail servers including postfix, qmail, exim etc.</p>
  36 +<h2><a href="gmail.phps">gmail.phps</a></h2>
  37 +<p>Submitting email via Google's Gmail service is a popular use of PHPMailer. It's much the same as normal SMTP sending, just with some specific settings, namely using TLS encryption, authentication is enabled, and it connects to the SMTP submission port 587 on the smtp.gmail.com host. This example does all that.</p>
  38 +<h2><a href="pop_before_smtp.phps">pop_before_smtp.phps</a></h2>
  39 +<p>Before effective SMTP authentication mechanisms were available, it was common for ISPs to use POP-before-SMTP authentication. As it implies, you authenticate using the POP3 protocol (an older protocol now mostly replaced by the far superior IMAP), and then the SMTP server will allow send access from your IP address for a short while, usually 5-15 minutes. PHPMailer includes a POP3 protocol client, so it can carry out this sequence - it's just like a normal SMTP conversation (without authentication), but connects via POP first.</p>
  40 +<h2><a href="mailing_list.phps">mailing_list.phps</a></h2>
  41 +<p>This is a somewhat naïve example of sending similar emails to a list of different addresses. It sets up a PHPMailer instance using SMTP, then connects to a MySQL database to retrieve a list of recipients. The code loops over this list, sending email to each person using their info and marks them as sent in the database. It makes use of SMTP keepalive which saves reconnecting and re-authenticating between each message.</p>
  42 +<hr>
  43 +<p>Most of these examples use the 'example.com' domain. This domain is reserved by IANA for illustrative purposes, as documented in <a href="http://tools.ietf.org/html/rfc2606">RFC 2606</a>. Don't use made-up domains like 'mydomain.com' or 'somedomain.com' in examples as someone, somewhere, probably owns them!</p>
  44 +</body>
  45 +</html>
  1 +<!DOCTYPE html>
  2 +<html>
  3 +<head>
  4 + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  5 + <title>PHPMailer - mail() test</title>
  6 +</head>
  7 +<body>
  8 +<?php
  9 +require '../PHPMailerAutoload.php';
  10 +
  11 +//Create a new PHPMailer instance
  12 +$mail = new PHPMailer();
  13 +//Set who the message is to be sent from
  14 +$mail->setFrom('from@example.com', 'First Last');
  15 +//Set an alternative reply-to address
  16 +$mail->addReplyTo('replyto@example.com', 'First Last');
  17 +//Set who the message is to be sent to
  18 +$mail->addAddress('whoto@example.com', 'John Doe');
  19 +//Set the subject line
  20 +$mail->Subject = 'PHPMailer mail() test';
  21 +//Read an HTML message body from an external file, convert referenced images to embedded,
  22 +//convert HTML into a basic plain-text alternative body
  23 +$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
  24 +//Replace the plain text body with one created manually
  25 +$mail->AltBody = 'This is a plain-text message body';
  26 +//Attach an image file
  27 +$mail->addAttachment('images/phpmailer_mini.png');
  28 +
  29 +//send the message, check for errors
  30 +if (!$mail->send()) {
  31 + echo "Mailer Error: " . $mail->ErrorInfo;
  32 +} else {
  33 + echo "Message sent!";
  34 +}
  35 +?>
  36 +</body>
  37 +</html>
  1 +<?php
  2 +
  3 +error_reporting(E_STRICT | E_ALL);
  4 +
  5 +date_default_timezone_set('Etc/UTC');
  6 +
  7 +require '../PHPMailerAutoload.php';
  8 +
  9 +$mail = new PHPMailer();
  10 +
  11 +$body = file_get_contents('contents.html');
  12 +
  13 +$mail->isSMTP();
  14 +$mail->Host = 'smtp.example.com';
  15 +$mail->SMTPAuth = true;
  16 +$mail->SMTPKeepAlive = true; // SMTP connection will not close after each email sent, reduces SMTP overhead
  17 +$mail->Port = 25;
  18 +$mail->Username = 'yourname@example.com';
  19 +$mail->Password = 'yourpassword';
  20 +$mail->setFrom('list@example.com', 'List manager');
  21 +$mail->addReplyTo('list@example.com', 'List manager');
  22 +
  23 +$mail->Subject = "PHPMailer Simple database mailing list test";
  24 +
  25 +//Same body for all messages, so set this before the sending loop
  26 +//If you generate a different body for each recipient (e.g. you're using a templating system),
  27 +//set it inside the loop
  28 +$mail->msgHTML($body);
  29 +//msgHTML also sets AltBody, so if you want a custom one, set it afterwards
  30 +$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!';
  31 +
  32 +//Connect to the database and select the recipients from your mailing list that have not yet been sent to
  33 +//You'll need to alter this to match your database
  34 +$mysql = mysql_connect('localhost', 'username', 'password');
  35 +mysql_select_db('mydb', $mysql);
  36 +$result = mysql_query("SELECT full_name, email, photo FROM mailinglist WHERE sent = false", $mysql);
  37 +
  38 +while ($row = mysql_fetch_array($result)) {
  39 + $mail->addAddress($row['email'], $row['full_name']);
  40 + $mail->addStringAttachment($row['photo'], 'YourPhoto.jpg'); //Assumes the image data is stored in the DB
  41 +
  42 + if (!$mail->send()) {
  43 + echo "Mailer Error (" . str_replace("@", "&#64;", $row["email"]) . ') ' . $mail->ErrorInfo . '<br />';
  44 + break; //Abandon sending
  45 + } else {
  46 + echo "Message sent to :" . $row['full_name'] . ' (' . str_replace("@", "&#64;", $row['email']) . ')<br />';
  47 + //Mark it as sent in the DB
  48 + mysql_query(
  49 + "UPDATE mailinglist SET sent = true WHERE email = '" . mysql_real_escape_string($row['email'], $mysql) . "'"
  50 + );
  51 + }
  52 + // Clear all addresses and attachments for next loop
  53 + $mail->clearAddresses();
  54 + $mail->clearAttachments();
  55 +}
  1 +<!DOCTYPE html>
  2 +<html>
  3 +<head>
  4 + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  5 + <title>PHPMailer - POP-before-SMTP test</title>
  6 +</head>
  7 +<body>
  8 +<?php
  9 +require '../PHPMailerAutoload.php';
  10 +
  11 +//Authenticate via POP3
  12 +//Now you should be clear to submit messages over SMTP for a while
  13 +//Only applies if your host supports POP-before-SMTP
  14 +$pop = POP3::popBeforeSmtp('pop3.example.com', 110, 30, 'username', 'password', 1);
  15 +
  16 +//Create a new PHPMailer instance
  17 +//Passing true to the constructor enables the use of exceptions for error handling
  18 +$mail = new PHPMailer(true);
  19 +try {
  20 + $mail->isSMTP();
  21 + //Enable SMTP debugging
  22 + // 0 = off (for production use)
  23 + // 1 = client messages
  24 + // 2 = client and server messages
  25 + $mail->SMTPDebug = 2;
  26 + //Ask for HTML-friendly debug output
  27 + $mail->Debugoutput = 'html';
  28 + //Set the hostname of the mail server
  29 + $mail->Host = "mail.example.com";
  30 + //Set the SMTP port number - likely to be 25, 465 or 587
  31 + $mail->Port = 25;
  32 + //Whether to use SMTP authentication
  33 + $mail->SMTPAuth = false;
  34 + //Set who the message is to be sent from
  35 + $mail->setFrom('from@example.com', 'First Last');
  36 + //Set an alternative reply-to address
  37 + $mail->addReplyTo('replyto@example.com', 'First Last');
  38 + //Set who the message is to be sent to
  39 + $mail->addAddress('whoto@example.com', 'John Doe');
  40 + //Set the subject line
  41 + $mail->Subject = 'PHPMailer POP-before-SMTP test';
  42 + //Read an HTML message body from an external file, convert referenced images to embedded,
  43 + //and convert the HTML into a basic plain-text alternative body
  44 + $mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
  45 + //Replace the plain text body with one created manually
  46 + $mail->AltBody = 'This is a plain-text message body';
  47 + //Attach an image file
  48 + $mail->addAttachment('images/phpmailer_mini.png');
  49 + //send the message
  50 + //Note that we don't need check the response from this because it will throw an exception if it has trouble
  51 + $mail->send();
  52 + echo "Message sent!";
  53 +} catch (phpmailerException $e) {
  54 + echo $e->errorMessage(); //Pretty error messages from PHPMailer
  55 +} catch (Exception $e) {
  56 + echo $e->getMessage(); //Boring error messages from anything else!
  57 +}
  58 +?>
  59 +</body>
  60 +</html>
  1 +// XRegExp 1.5.1
  2 +// (c) 2007-2012 Steven Levithan
  3 +// MIT License
  4 +// <http://xregexp.com>
  5 +// Provides an augmented, extensible, cross-browser implementation of regular expressions,
  6 +// including support for additional syntax, flags, and methods
  7 +
  8 +var XRegExp;
  9 +
  10 +if (XRegExp) {
  11 + // Avoid running twice, since that would break references to native globals
  12 + throw Error("can't load XRegExp twice in the same frame");
  13 +}
  14 +
  15 +// Run within an anonymous function to protect variables and avoid new globals
  16 +(function (undefined) {
  17 +
  18 + //---------------------------------
  19 + // Constructor
  20 + //---------------------------------
  21 +
  22 + // Accepts a pattern and flags; returns a new, extended `RegExp` object. Differs from a native
  23 + // regular expression in that additional syntax and flags are supported and cross-browser
  24 + // syntax inconsistencies are ameliorated. `XRegExp(/regex/)` clones an existing regex and
  25 + // converts to type XRegExp
  26 + XRegExp = function (pattern, flags) {
  27 + var output = [],
  28 + currScope = XRegExp.OUTSIDE_CLASS,
  29 + pos = 0,
  30 + context, tokenResult, match, chr, regex;
  31 +
  32 + if (XRegExp.isRegExp(pattern)) {
  33 + if (flags !== undefined)
  34 + throw TypeError("can't supply flags when constructing one RegExp from another");
  35 + return clone(pattern);
  36 + }
  37 + // Tokens become part of the regex construction process, so protect against infinite
  38 + // recursion when an XRegExp is constructed within a token handler or trigger
  39 + if (isInsideConstructor)
  40 + throw Error("can't call the XRegExp constructor within token definition functions");
  41 +
  42 + flags = flags || "";
  43 + context = { // `this` object for custom tokens
  44 + hasNamedCapture: false,
  45 + captureNames: [],
  46 + hasFlag: function (flag) {return flags.indexOf(flag) > -1;},
  47 + setFlag: function (flag) {flags += flag;}
  48 + };
  49 +
  50 + while (pos < pattern.length) {
  51 + // Check for custom tokens at the current position
  52 + tokenResult = runTokens(pattern, pos, currScope, context);
  53 +
  54 + if (tokenResult) {
  55 + output.push(tokenResult.output);
  56 + pos += (tokenResult.match[0].length || 1);
  57 + } else {
  58 + // Check for native multicharacter metasequences (excluding character classes) at
  59 + // the current position
  60 + if (match = nativ.exec.call(nativeTokens[currScope], pattern.slice(pos))) {
  61 + output.push(match[0]);
  62 + pos += match[0].length;
  63 + } else {
  64 + chr = pattern.charAt(pos);
  65 + if (chr === "[")
  66 + currScope = XRegExp.INSIDE_CLASS;
  67 + else if (chr === "]")
  68 + currScope = XRegExp.OUTSIDE_CLASS;
  69 + // Advance position one character
  70 + output.push(chr);
  71 + pos++;
  72 + }
  73 + }
  74 + }
  75 +
  76 + regex = RegExp(output.join(""), nativ.replace.call(flags, flagClip, ""));
  77 + regex._xregexp = {
  78 + source: pattern,
  79 + captureNames: context.hasNamedCapture ? context.captureNames : null
  80 + };
  81 + return regex;
  82 + };
  83 +
  84 +
  85 + //---------------------------------
  86 + // Public properties
  87 + //---------------------------------
  88 +
  89 + XRegExp.version = "1.5.1";
  90 +
  91 + // Token scope bitflags
  92 + XRegExp.INSIDE_CLASS = 1;
  93 + XRegExp.OUTSIDE_CLASS = 2;
  94 +
  95 +
  96 + //---------------------------------
  97 + // Private variables
  98 + //---------------------------------
  99 +
  100 + var replacementToken = /\$(?:(\d\d?|[$&`'])|{([$\w]+)})/g,
  101 + flagClip = /[^gimy]+|([\s\S])(?=[\s\S]*\1)/g, // Nonnative and duplicate flags
  102 + quantifier = /^(?:[?*+]|{\d+(?:,\d*)?})\??/,
  103 + isInsideConstructor = false,
  104 + tokens = [],
  105 + // Copy native globals for reference ("native" is an ES3 reserved keyword)
  106 + nativ = {
  107 + exec: RegExp.prototype.exec,
  108 + test: RegExp.prototype.test,
  109 + match: String.prototype.match,
  110 + replace: String.prototype.replace,
  111 + split: String.prototype.split
  112 + },
  113 + compliantExecNpcg = nativ.exec.call(/()??/, "")[1] === undefined, // check `exec` handling of nonparticipating capturing groups
  114 + compliantLastIndexIncrement = function () {
  115 + var x = /^/g;
  116 + nativ.test.call(x, "");
  117 + return !x.lastIndex;
  118 + }(),
  119 + hasNativeY = RegExp.prototype.sticky !== undefined,
  120 + nativeTokens = {};
  121 +
  122 + // `nativeTokens` match native multicharacter metasequences only (including deprecated octals,
  123 + // excluding character classes)
  124 + nativeTokens[XRegExp.INSIDE_CLASS] = /^(?:\\(?:[0-3][0-7]{0,2}|[4-7][0-7]?|x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|c[A-Za-z]|[\s\S]))/;
  125 + nativeTokens[XRegExp.OUTSIDE_CLASS] = /^(?:\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9]\d*|x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|c[A-Za-z]|[\s\S])|\(\?[:=!]|[?*+]\?|{\d+(?:,\d*)?}\??)/;
  126 +
  127 +
  128 + //---------------------------------
  129 + // Public methods
  130 + //---------------------------------
  131 +
  132 + // Lets you extend or change XRegExp syntax and create custom flags. This is used internally by
  133 + // the XRegExp library and can be used to create XRegExp plugins. This function is intended for
  134 + // users with advanced knowledge of JavaScript's regular expression syntax and behavior. It can
  135 + // be disabled by `XRegExp.freezeTokens`
  136 + XRegExp.addToken = function (regex, handler, scope, trigger) {
  137 + tokens.push({
  138 + pattern: clone(regex, "g" + (hasNativeY ? "y" : "")),
  139 + handler: handler,
  140 + scope: scope || XRegExp.OUTSIDE_CLASS,
  141 + trigger: trigger || null
  142 + });
  143 + };
  144 +
  145 + // Accepts a pattern and flags; returns an extended `RegExp` object. If the pattern and flag
  146 + // combination has previously been cached, the cached copy is returned; otherwise the newly
  147 + // created regex is cached
  148 + XRegExp.cache = function (pattern, flags) {
  149 + var key = pattern + "/" + (flags || "");
  150 + return XRegExp.cache[key] || (XRegExp.cache[key] = XRegExp(pattern, flags));
  151 + };
  152 +
  153 + // Accepts a `RegExp` instance; returns a copy with the `/g` flag set. The copy has a fresh
  154 + // `lastIndex` (set to zero). If you want to copy a regex without forcing the `global`
  155 + // property, use `XRegExp(regex)`. Do not use `RegExp(regex)` because it will not preserve
  156 + // special properties required for named capture
  157 + XRegExp.copyAsGlobal = function (regex) {
  158 + return clone(regex, "g");
  159 + };
  160 +
  161 + // Accepts a string; returns the string with regex metacharacters escaped. The returned string
  162 + // can safely be used at any point within a regex to match the provided literal string. Escaped
  163 + // characters are [ ] { } ( ) * + ? - . , \ ^ $ | # and whitespace
  164 + XRegExp.escape = function (str) {
  165 + return str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
  166 + };
  167 +
  168 + // Accepts a string to search, regex to search with, position to start the search within the
  169 + // string (default: 0), and an optional Boolean indicating whether matches must start at-or-
  170 + // after the position or at the specified position only. This function ignores the `lastIndex`
  171 + // of the provided regex in its own handling, but updates the property for compatibility
  172 + XRegExp.execAt = function (str, regex, pos, anchored) {
  173 + var r2 = clone(regex, "g" + ((anchored && hasNativeY) ? "y" : "")),
  174 + match;
  175 + r2.lastIndex = pos = pos || 0;
  176 + match = r2.exec(str); // Run the altered `exec` (required for `lastIndex` fix, etc.)
  177 + if (anchored && match && match.index !== pos)
  178 + match = null;
  179 + if (regex.global)
  180 + regex.lastIndex = match ? r2.lastIndex : 0;
  181 + return match;
  182 + };
  183 +
  184 + // Breaks the unrestorable link to XRegExp's private list of tokens, thereby preventing
  185 + // syntax and flag changes. Should be run after XRegExp and any plugins are loaded
  186 + XRegExp.freezeTokens = function () {
  187 + XRegExp.addToken = function () {
  188 + throw Error("can't run addToken after freezeTokens");
  189 + };
  190 + };
  191 +
  192 + // Accepts any value; returns a Boolean indicating whether the argument is a `RegExp` object.
  193 + // Note that this is also `true` for regex literals and regexes created by the `XRegExp`
  194 + // constructor. This works correctly for variables created in another frame, when `instanceof`
  195 + // and `constructor` checks would fail to work as intended
  196 + XRegExp.isRegExp = function (o) {
  197 + return Object.prototype.toString.call(o) === "[object RegExp]";
  198 + };
  199 +
  200 + // Executes `callback` once per match within `str`. Provides a simpler and cleaner way to
  201 + // iterate over regex matches compared to the traditional approaches of subverting
  202 + // `String.prototype.replace` or repeatedly calling `exec` within a `while` loop
  203 + XRegExp.iterate = function (str, regex, callback, context) {
  204 + var r2 = clone(regex, "g"),
  205 + i = -1, match;
  206 + while (match = r2.exec(str)) { // Run the altered `exec` (required for `lastIndex` fix, etc.)
  207 + if (regex.global)
  208 + regex.lastIndex = r2.lastIndex; // Doing this to follow expectations if `lastIndex` is checked within `callback`
  209 + callback.call(context, match, ++i, str, regex);
  210 + if (r2.lastIndex === match.index)
  211 + r2.lastIndex++;
  212 + }
  213 + if (regex.global)
  214 + regex.lastIndex = 0;
  215 + };
  216 +
  217 + // Accepts a string and an array of regexes; returns the result of using each successive regex
  218 + // to search within the matches of the previous regex. The array of regexes can also contain
  219 + // objects with `regex` and `backref` properties, in which case the named or numbered back-
  220 + // references specified are passed forward to the next regex or returned. E.g.:
  221 + // var xregexpImgFileNames = XRegExp.matchChain(html, [
  222 + // {regex: /<img\b([^>]+)>/i, backref: 1}, // <img> tag attributes
  223 + // {regex: XRegExp('(?ix) \\s src=" (?<src> [^"]+ )'), backref: "src"}, // src attribute values
  224 + // {regex: XRegExp("^http://xregexp\\.com(/[^#?]+)", "i"), backref: 1}, // xregexp.com paths
  225 + // /[^\/]+$/ // filenames (strip directory paths)
  226 + // ]);
  227 + XRegExp.matchChain = function (str, chain) {
  228 + return function recurseChain (values, level) {
  229 + var item = chain[level].regex ? chain[level] : {regex: chain[level]},
  230 + regex = clone(item.regex, "g"),
  231 + matches = [], i;
  232 + for (i = 0; i < values.length; i++) {
  233 + XRegExp.iterate(values[i], regex, function (match) {
  234 + matches.push(item.backref ? (match[item.backref] || "") : match[0]);
  235 + });
  236 + }
  237 + return ((level === chain.length - 1) || !matches.length) ?
  238 + matches : recurseChain(matches, level + 1);
  239 + }([str], 0);
  240 + };
  241 +
  242 +
  243 + //---------------------------------
  244 + // New RegExp prototype methods
  245 + //---------------------------------
  246 +
  247 + // Accepts a context object and arguments array; returns the result of calling `exec` with the
  248 + // first value in the arguments array. the context is ignored but is accepted for congruity
  249 + // with `Function.prototype.apply`
  250 + RegExp.prototype.apply = function (context, args) {
  251 + return this.exec(args[0]);
  252 + };
  253 +
  254 + // Accepts a context object and string; returns the result of calling `exec` with the provided
  255 + // string. the context is ignored but is accepted for congruity with `Function.prototype.call`
  256 + RegExp.prototype.call = function (context, str) {
  257 + return this.exec(str);
  258 + };
  259 +
  260 +
  261 + //---------------------------------
  262 + // Overriden native methods
  263 + //---------------------------------
  264 +
  265 + // Adds named capture support (with backreferences returned as `result.name`), and fixes two
  266 + // cross-browser issues per ES3:
  267 + // - Captured values for nonparticipating capturing groups should be returned as `undefined`,
  268 + // rather than the empty string.
  269 + // - `lastIndex` should not be incremented after zero-length matches.
  270 + RegExp.prototype.exec = function (str) {
  271 + var match, name, r2, origLastIndex;
  272 + if (!this.global)
  273 + origLastIndex = this.lastIndex;
  274 + match = nativ.exec.apply(this, arguments);
  275 + if (match) {
  276 + // Fix browsers whose `exec` methods don't consistently return `undefined` for
  277 + // nonparticipating capturing groups
  278 + if (!compliantExecNpcg && match.length > 1 && indexOf(match, "") > -1) {
  279 + r2 = RegExp(this.source, nativ.replace.call(getNativeFlags(this), "g", ""));
  280 + // Using `str.slice(match.index)` rather than `match[0]` in case lookahead allowed
  281 + // matching due to characters outside the match
  282 + nativ.replace.call((str + "").slice(match.index), r2, function () {
  283 + for (var i = 1; i < arguments.length - 2; i++) {
  284 + if (arguments[i] === undefined)
  285 + match[i] = undefined;
  286 + }
  287 + });
  288 + }
  289 + // Attach named capture properties
  290 + if (this._xregexp && this._xregexp.captureNames) {
  291 + for (var i = 1; i < match.length; i++) {
  292 + name = this._xregexp.captureNames[i - 1];
  293 + if (name)
  294 + match[name] = match[i];
  295 + }
  296 + }
  297 + // Fix browsers that increment `lastIndex` after zero-length matches
  298 + if (!compliantLastIndexIncrement && this.global && !match[0].length && (this.lastIndex > match.index))
  299 + this.lastIndex--;
  300 + }
  301 + if (!this.global)
  302 + this.lastIndex = origLastIndex; // Fix IE, Opera bug (last tested IE 9.0.5, Opera 11.61 on Windows)
  303 + return match;
  304 + };
  305 +
  306 + // Fix browser bugs in native method
  307 + RegExp.prototype.test = function (str) {
  308 + // Use the native `exec` to skip some processing overhead, even though the altered
  309 + // `exec` would take care of the `lastIndex` fixes
  310 + var match, origLastIndex;
  311 + if (!this.global)
  312 + origLastIndex = this.lastIndex;
  313 + match = nativ.exec.call(this, str);
  314 + // Fix browsers that increment `lastIndex` after zero-length matches
  315 + if (match && !compliantLastIndexIncrement && this.global && !match[0].length && (this.lastIndex > match.index))
  316 + this.lastIndex--;
  317 + if (!this.global)
  318 + this.lastIndex = origLastIndex; // Fix IE, Opera bug (last tested IE 9.0.5, Opera 11.61 on Windows)
  319 + return !!match;
  320 + };
  321 +
  322 + // Adds named capture support and fixes browser bugs in native method
  323 + String.prototype.match = function (regex) {
  324 + if (!XRegExp.isRegExp(regex))
  325 + regex = RegExp(regex); // Native `RegExp`
  326 + if (regex.global) {
  327 + var result = nativ.match.apply(this, arguments);
  328 + regex.lastIndex = 0; // Fix IE bug
  329 + return result;
  330 + }
  331 + return regex.exec(this); // Run the altered `exec`
  332 + };
  333 +
  334 + // Adds support for `${n}` tokens for named and numbered backreferences in replacement text,
  335 + // and provides named backreferences to replacement functions as `arguments[0].name`. Also
  336 + // fixes cross-browser differences in replacement text syntax when performing a replacement
  337 + // using a nonregex search value, and the value of replacement regexes' `lastIndex` property
  338 + // during replacement iterations. Note that this doesn't support SpiderMonkey's proprietary
  339 + // third (`flags`) parameter
  340 + String.prototype.replace = function (search, replacement) {
  341 + var isRegex = XRegExp.isRegExp(search),
  342 + captureNames, result, str, origLastIndex;
  343 +
  344 + // There are too many combinations of search/replacement types/values and browser bugs that
  345 + // preclude passing to native `replace`, so don't try
  346 + //if (...)
  347 + // return nativ.replace.apply(this, arguments);
  348 +
  349 + if (isRegex) {
  350 + if (search._xregexp)
  351 + captureNames = search._xregexp.captureNames; // Array or `null`
  352 + if (!search.global)
  353 + origLastIndex = search.lastIndex;
  354 + } else {
  355 + search = search + ""; // Type conversion
  356 + }
  357 +
  358 + if (Object.prototype.toString.call(replacement) === "[object Function]") {
  359 + result = nativ.replace.call(this + "", search, function () {
  360 + if (captureNames) {
  361 + // Change the `arguments[0]` string primitive to a String object which can store properties
  362 + arguments[0] = new String(arguments[0]);
  363 + // Store named backreferences on `arguments[0]`
  364 + for (var i = 0; i < captureNames.length; i++) {
  365 + if (captureNames[i])
  366 + arguments[0][captureNames[i]] = arguments[i + 1];
  367 + }
  368 + }
  369 + // Update `lastIndex` before calling `replacement` (fix browsers)
  370 + if (isRegex && search.global)
  371 + search.lastIndex = arguments[arguments.length - 2] + arguments[0].length;
  372 + return replacement.apply(null, arguments);
  373 + });
  374 + } else {
  375 + str = this + ""; // Type conversion, so `args[args.length - 1]` will be a string (given nonstring `this`)
  376 + result = nativ.replace.call(str, search, function () {
  377 + var args = arguments; // Keep this function's `arguments` available through closure
  378 + return nativ.replace.call(replacement + "", replacementToken, function ($0, $1, $2) {
  379 + // Numbered backreference (without delimiters) or special variable
  380 + if ($1) {
  381 + switch ($1) {
  382 + case "$": return "$";
  383 + case "&": return args[0];
  384 + case "`": return args[args.length - 1].slice(0, args[args.length - 2]);
  385 + case "'": return args[args.length - 1].slice(args[args.length - 2] + args[0].length);
  386 + // Numbered backreference
  387 + default:
  388 + // What does "$10" mean?
  389 + // - Backreference 10, if 10 or more capturing groups exist
  390 + // - Backreference 1 followed by "0", if 1-9 capturing groups exist
  391 + // - Otherwise, it's the string "$10"
  392 + // Also note:
  393 + // - Backreferences cannot be more than two digits (enforced by `replacementToken`)
  394 + // - "$01" is equivalent to "$1" if a capturing group exists, otherwise it's the string "$01"
  395 + // - There is no "$0" token ("$&" is the entire match)
  396 + var literalNumbers = "";
  397 + $1 = +$1; // Type conversion; drop leading zero
  398 + if (!$1) // `$1` was "0" or "00"
  399 + return $0;
  400 + while ($1 > args.length - 3) {
  401 + literalNumbers = String.prototype.slice.call($1, -1) + literalNumbers;
  402 + $1 = Math.floor($1 / 10); // Drop the last digit
  403 + }
  404 + return ($1 ? args[$1] || "" : "$") + literalNumbers;
  405 + }
  406 + // Named backreference or delimited numbered backreference
  407 + } else {
  408 + // What does "${n}" mean?
  409 + // - Backreference to numbered capture n. Two differences from "$n":
  410 + // - n can be more than two digits
  411 + // - Backreference 0 is allowed, and is the entire match
  412 + // - Backreference to named capture n, if it exists and is not a number overridden by numbered capture
  413 + // - Otherwise, it's the string "${n}"
  414 + var n = +$2; // Type conversion; drop leading zeros
  415 + if (n <= args.length - 3)
  416 + return args[n];
  417 + n = captureNames ? indexOf(captureNames, $2) : -1;
  418 + return n > -1 ? args[n + 1] : $0;
  419 + }
  420 + });
  421 + });
  422 + }
  423 +
  424 + if (isRegex) {
  425 + if (search.global)
  426 + search.lastIndex = 0; // Fix IE, Safari bug (last tested IE 9.0.5, Safari 5.1.2 on Windows)
  427 + else
  428 + search.lastIndex = origLastIndex; // Fix IE, Opera bug (last tested IE 9.0.5, Opera 11.61 on Windows)
  429 + }
  430 +
  431 + return result;
  432 + };
  433 +
  434 + // A consistent cross-browser, ES3 compliant `split`
  435 + String.prototype.split = function (s /* separator */, limit) {
  436 + // If separator `s` is not a regex, use the native `split`
  437 + if (!XRegExp.isRegExp(s))
  438 + return nativ.split.apply(this, arguments);
  439 +
  440 + var str = this + "", // Type conversion
  441 + output = [],
  442 + lastLastIndex = 0,
  443 + match, lastLength;
  444 +
  445 + // Behavior for `limit`: if it's...
  446 + // - `undefined`: No limit
  447 + // - `NaN` or zero: Return an empty array
  448 + // - A positive number: Use `Math.floor(limit)`
  449 + // - A negative number: No limit
  450 + // - Other: Type-convert, then use the above rules
  451 + if (limit === undefined || +limit < 0) {
  452 + limit = Infinity;
  453 + } else {
  454 + limit = Math.floor(+limit);
  455 + if (!limit)
  456 + return [];
  457 + }
  458 +
  459 + // This is required if not `s.global`, and it avoids needing to set `s.lastIndex` to zero
  460 + // and restore it to its original value when we're done using the regex
  461 + s = XRegExp.copyAsGlobal(s);
  462 +
  463 + while (match = s.exec(str)) { // Run the altered `exec` (required for `lastIndex` fix, etc.)
  464 + if (s.lastIndex > lastLastIndex) {
  465 + output.push(str.slice(lastLastIndex, match.index));
  466 +
  467 + if (match.length > 1 && match.index < str.length)
  468 + Array.prototype.push.apply(output, match.slice(1));
  469 +
  470 + lastLength = match[0].length;
  471 + lastLastIndex = s.lastIndex;
  472 +
  473 + if (output.length >= limit)
  474 + break;
  475 + }
  476 +
  477 + if (s.lastIndex === match.index)
  478 + s.lastIndex++;
  479 + }
  480 +
  481 + if (lastLastIndex === str.length) {
  482 + if (!nativ.test.call(s, "") || lastLength)
  483 + output.push("");
  484 + } else {
  485 + output.push(str.slice(lastLastIndex));
  486 + }
  487 +
  488 + return output.length > limit ? output.slice(0, limit) : output;
  489 + };
  490 +
  491 +
  492 + //---------------------------------
  493 + // Private helper functions
  494 + //---------------------------------
  495 +
  496 + // Supporting function for `XRegExp`, `XRegExp.copyAsGlobal`, etc. Returns a copy of a `RegExp`
  497 + // instance with a fresh `lastIndex` (set to zero), preserving properties required for named
  498 + // capture. Also allows adding new flags in the process of copying the regex
  499 + function clone (regex, additionalFlags) {
  500 + if (!XRegExp.isRegExp(regex))
  501 + throw TypeError("type RegExp expected");
  502 + var x = regex._xregexp;
  503 + regex = XRegExp(regex.source, getNativeFlags(regex) + (additionalFlags || ""));
  504 + if (x) {
  505 + regex._xregexp = {
  506 + source: x.source,
  507 + captureNames: x.captureNames ? x.captureNames.slice(0) : null
  508 + };
  509 + }
  510 + return regex;
  511 + }
  512 +
  513 + function getNativeFlags (regex) {
  514 + return (regex.global ? "g" : "") +
  515 + (regex.ignoreCase ? "i" : "") +
  516 + (regex.multiline ? "m" : "") +
  517 + (regex.extended ? "x" : "") + // Proposed for ES4; included in AS3
  518 + (regex.sticky ? "y" : "");
  519 + }
  520 +
  521 + function runTokens (pattern, index, scope, context) {
  522 + var i = tokens.length,
  523 + result, match, t;
  524 + // Protect against constructing XRegExps within token handler and trigger functions
  525 + isInsideConstructor = true;
  526 + // Must reset `isInsideConstructor`, even if a `trigger` or `handler` throws
  527 + try {
  528 + while (i--) { // Run in reverse order
  529 + t = tokens[i];
  530 + if ((scope & t.scope) && (!t.trigger || t.trigger.call(context))) {
  531 + t.pattern.lastIndex = index;
  532 + match = t.pattern.exec(pattern); // Running the altered `exec` here allows use of named backreferences, etc.
  533 + if (match && match.index === index) {
  534 + result = {
  535 + output: t.handler.call(context, match, scope),
  536 + match: match
  537 + };
  538 + break;
  539 + }
  540 + }
  541 + }
  542 + } catch (err) {
  543 + throw err;
  544 + } finally {
  545 + isInsideConstructor = false;
  546 + }
  547 + return result;
  548 + }
  549 +
  550 + function indexOf (array, item, from) {
  551 + if (Array.prototype.indexOf) // Use the native array method if available
  552 + return array.indexOf(item, from);
  553 + for (var i = from || 0; i < array.length; i++) {
  554 + if (array[i] === item)
  555 + return i;
  556 + }
  557 + return -1;
  558 + }
  559 +
  560 +
  561 + //---------------------------------
  562 + // Built-in tokens
  563 + //---------------------------------
  564 +
  565 + // Augment XRegExp's regular expression syntax and flags. Note that when adding tokens, the
  566 + // third (`scope`) argument defaults to `XRegExp.OUTSIDE_CLASS`
  567 +
  568 + // Comment pattern: (?# )
  569 + XRegExp.addToken(
  570 + /\(\?#[^)]*\)/,
  571 + function (match) {
  572 + // Keep tokens separated unless the following token is a quantifier
  573 + return nativ.test.call(quantifier, match.input.slice(match.index + match[0].length)) ? "" : "(?:)";
  574 + }
  575 + );
  576 +
  577 + // Capturing group (match the opening parenthesis only).
  578 + // Required for support of named capturing groups
  579 + XRegExp.addToken(
  580 + /\((?!\?)/,
  581 + function () {
  582 + this.captureNames.push(null);
  583 + return "(";
  584 + }
  585 + );
  586 +
  587 + // Named capturing group (match the opening delimiter only): (?<name>
  588 + XRegExp.addToken(
  589 + /\(\?<([$\w]+)>/,
  590 + function (match) {
  591 + this.captureNames.push(match[1]);
  592 + this.hasNamedCapture = true;
  593 + return "(";
  594 + }
  595 + );
  596 +
  597 + // Named backreference: \k<name>
  598 + XRegExp.addToken(
  599 + /\\k<([\w$]+)>/,
  600 + function (match) {
  601 + var index = indexOf(this.captureNames, match[1]);
  602 + // Keep backreferences separate from subsequent literal numbers. Preserve back-
  603 + // references to named groups that are undefined at this point as literal strings
  604 + return index > -1 ?
  605 + "\\" + (index + 1) + (isNaN(match.input.charAt(match.index + match[0].length)) ? "" : "(?:)") :
  606 + match[0];
  607 + }
  608 + );
  609 +
  610 + // Empty character class: [] or [^]
  611 + XRegExp.addToken(
  612 + /\[\^?]/,
  613 + function (match) {
  614 + // For cross-browser compatibility with ES3, convert [] to \b\B and [^] to [\s\S].
  615 + // (?!) should work like \b\B, but is unreliable in Firefox
  616 + return match[0] === "[]" ? "\\b\\B" : "[\\s\\S]";
  617 + }
  618 + );
  619 +
  620 + // Mode modifier at the start of the pattern only, with any combination of flags imsx: (?imsx)
  621 + // Does not support x(?i), (?-i), (?i-m), (?i: ), (?i)(?m), etc.
  622 + XRegExp.addToken(
  623 + /^\(\?([imsx]+)\)/,
  624 + function (match) {
  625 + this.setFlag(match[1]);
  626 + return "";
  627 + }
  628 + );
  629 +
  630 + // Whitespace and comments, in free-spacing (aka extended) mode only
  631 + XRegExp.addToken(
  632 + /(?:\s+|#.*)+/,
  633 + function (match) {
  634 + // Keep tokens separated unless the following token is a quantifier
  635 + return nativ.test.call(quantifier, match.input.slice(match.index + match[0].length)) ? "" : "(?:)";
  636 + },
  637 + XRegExp.OUTSIDE_CLASS,
  638 + function () {return this.hasFlag("x");}
  639 + );
  640 +
  641 + // Dot, in dotall (aka singleline) mode only
  642 + XRegExp.addToken(
  643 + /\./,
  644 + function () {return "[\\s\\S]";},
  645 + XRegExp.OUTSIDE_CLASS,
  646 + function () {return this.hasFlag("s");}
  647 + );
  648 +
  649 +
  650 + //---------------------------------
  651 + // Backward compatibility
  652 + //---------------------------------
  653 +
  654 + // Uncomment the following block for compatibility with XRegExp 1.0-1.2:
  655 + /*
  656 + XRegExp.matchWithinChain = XRegExp.matchChain;
  657 + RegExp.prototype.addFlags = function (s) {return clone(this, s);};
  658 + RegExp.prototype.execAll = function (s) {var r = []; XRegExp.iterate(s, this, function (m) {r.push(m);}); return r;};
  659 + RegExp.prototype.forEachExec = function (s, f, c) {return XRegExp.iterate(s, this, f, c);};
  660 + RegExp.prototype.validate = function (s) {var r = RegExp("^(?:" + this.source + ")$(?!\\s)", getNativeFlags(this)); if (this.global) this.lastIndex = 0; return s.search(r) === 0;};
  661 + */
  662 +
  663 +})();
  664 +
  1 +(function() {
  2 +
  3 +var sh = SyntaxHighlighter;
  4 +
  5 +/**
  6 + * Provides functionality to dynamically load only the brushes that a needed to render the current page.
  7 + *
  8 + * There are two syntaxes that autoload understands. For example:
  9 + *
  10 + * SyntaxHighlighter.autoloader(
  11 + * [ 'applescript', 'Scripts/shBrushAppleScript.js' ],
  12 + * [ 'actionscript3', 'as3', 'Scripts/shBrushAS3.js' ]
  13 + * );
  14 + *
  15 + * or a more easily comprehendable one:
  16 + *
  17 + * SyntaxHighlighter.autoloader(
  18 + * 'applescript Scripts/shBrushAppleScript.js',
  19 + * 'actionscript3 as3 Scripts/shBrushAS3.js'
  20 + * );
  21 + */
  22 +sh.autoloader = function()
  23 +{
  24 + var list = arguments,
  25 + elements = sh.findElements(),
  26 + brushes = {},
  27 + scripts = {},
  28 + all = SyntaxHighlighter.all,
  29 + allCalled = false,
  30 + allParams = null,
  31 + i
  32 + ;
  33 +
  34 + SyntaxHighlighter.all = function(params)
  35 + {
  36 + allParams = params;
  37 + allCalled = true;
  38 + };
  39 +
  40 + function addBrush(aliases, url)
  41 + {
  42 + for (var i = 0; i < aliases.length; i++)
  43 + brushes[aliases[i]] = url;
  44 + };
  45 +
  46 + function getAliases(item)
  47 + {
  48 + return item.pop
  49 + ? item
  50 + : item.split(/\s+/)
  51 + ;
  52 + }
  53 +
  54 + // create table of aliases and script urls
  55 + for (i = 0; i < list.length; i++)
  56 + {
  57 + var aliases = getAliases(list[i]),
  58 + url = aliases.pop()
  59 + ;
  60 +
  61 + addBrush(aliases, url);
  62 + }
  63 +
  64 + // dynamically add <script /> tags to the document body
  65 + for (i = 0; i < elements.length; i++)
  66 + {
  67 + var url = brushes[elements[i].params.brush];
  68 +
  69 + if(url && scripts[url] === undefined)
  70 + {
  71 + if(elements[i].params['html-script'] === 'true')
  72 + {
  73 + if(scripts[brushes['xml']] === undefined) {
  74 + loadScript(brushes['xml']);
  75 + scripts[url] = false;
  76 + }
  77 + }
  78 +
  79 + scripts[url] = false;
  80 + loadScript(url);
  81 + }
  82 + }
  83 +
  84 + function loadScript(url)
  85 + {
  86 + var script = document.createElement('script'),
  87 + done = false
  88 + ;
  89 +
  90 + script.src = url;
  91 + script.type = 'text/javascript';
  92 + script.language = 'javascript';
  93 + script.onload = script.onreadystatechange = function()
  94 + {
  95 + if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete'))
  96 + {
  97 + done = true;
  98 + scripts[url] = true;
  99 + checkAll();
  100 +
  101 + // Handle memory leak in IE
  102 + script.onload = script.onreadystatechange = null;
  103 + script.parentNode.removeChild(script);
  104 + }
  105 + };
  106 +
  107 + // sync way of adding script tags to the page
  108 + document.body.appendChild(script);
  109 + };
  110 +
  111 + function checkAll()
  112 + {
  113 + for(var url in scripts)
  114 + if (scripts[url] == false)
  115 + return;
  116 +
  117 + if (allCalled)
  118 + SyntaxHighlighter.highlight(allParams);
  119 + };
  120 +};
  121 +
  122 +})();
  1 +;(function()
  2 +{
  3 + // CommonJS
  4 + SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null);
  5 +
  6 + function Brush()
  7 + {
  8 + var funcs = 'abs acos acosh addcslashes addslashes ' +
  9 + 'array_change_key_case array_chunk array_combine array_count_values array_diff '+
  10 + 'array_diff_assoc array_diff_key array_diff_uassoc array_diff_ukey array_fill '+
  11 + 'array_filter array_flip array_intersect array_intersect_assoc array_intersect_key '+
  12 + 'array_intersect_uassoc array_intersect_ukey array_key_exists array_keys array_map '+
  13 + 'array_merge array_merge_recursive array_multisort array_pad array_pop array_product '+
  14 + 'array_push array_rand array_reduce array_reverse array_search array_shift '+
  15 + 'array_slice array_splice array_sum array_udiff array_udiff_assoc '+
  16 + 'array_udiff_uassoc array_uintersect array_uintersect_assoc '+
  17 + 'array_uintersect_uassoc array_unique array_unshift array_values array_walk '+
  18 + 'array_walk_recursive atan atan2 atanh base64_decode base64_encode base_convert '+
  19 + 'basename bcadd bccomp bcdiv bcmod bcmul bindec bindtextdomain bzclose bzcompress '+
  20 + 'bzdecompress bzerrno bzerror bzerrstr bzflush bzopen bzread bzwrite ceil chdir '+
  21 + 'checkdate checkdnsrr chgrp chmod chop chown chr chroot chunk_split class_exists '+
  22 + 'closedir closelog copy cos cosh count count_chars date decbin dechex decoct '+
  23 + 'deg2rad delete ebcdic2ascii echo empty end ereg ereg_replace eregi eregi_replace error_log '+
  24 + 'error_reporting escapeshellarg escapeshellcmd eval exec exit exp explode extension_loaded '+
  25 + 'feof fflush fgetc fgetcsv fgets fgetss file_exists file_get_contents file_put_contents '+
  26 + 'fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype '+
  27 + 'floatval flock floor flush fmod fnmatch fopen fpassthru fprintf fputcsv fputs fread fscanf '+
  28 + 'fseek fsockopen fstat ftell ftok getallheaders getcwd getdate getenv gethostbyaddr gethostbyname '+
  29 + 'gethostbynamel getimagesize getlastmod getmxrr getmygid getmyinode getmypid getmyuid getopt '+
  30 + 'getprotobyname getprotobynumber getrandmax getrusage getservbyname getservbyport gettext '+
  31 + 'gettimeofday gettype glob gmdate gmmktime ini_alter ini_get ini_get_all ini_restore ini_set '+
  32 + 'interface_exists intval ip2long is_a is_array is_bool is_callable is_dir is_double '+
  33 + 'is_executable is_file is_finite is_float is_infinite is_int is_integer is_link is_long '+
  34 + 'is_nan is_null is_numeric is_object is_readable is_real is_resource is_scalar is_soap_fault '+
  35 + 'is_string is_subclass_of is_uploaded_file is_writable is_writeable mkdir mktime nl2br '+
  36 + 'parse_ini_file parse_str parse_url passthru pathinfo print readlink realpath rewind rewinddir rmdir '+
  37 + 'round str_ireplace str_pad str_repeat str_replace str_rot13 str_shuffle str_split '+
  38 + 'str_word_count strcasecmp strchr strcmp strcoll strcspn strftime strip_tags stripcslashes '+
  39 + 'stripos stripslashes stristr strlen strnatcasecmp strnatcmp strncasecmp strncmp strpbrk '+
  40 + 'strpos strptime strrchr strrev strripos strrpos strspn strstr strtok strtolower strtotime '+
  41 + 'strtoupper strtr strval substr substr_compare';
  42 +
  43 + var keywords = 'abstract and array as break case catch cfunction class clone const continue declare default die do ' +
  44 + 'else elseif enddeclare endfor endforeach endif endswitch endwhile extends final for foreach ' +
  45 + 'function global goto if implements include include_once interface instanceof insteadof namespace new ' +
  46 + 'old_function or private protected public return require require_once static switch ' +
  47 + 'trait throw try use var while xor ';
  48 +
  49 + var constants = '__FILE__ __LINE__ __METHOD__ __FUNCTION__ __CLASS__';
  50 +
  51 + this.regexList = [
  52 + { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
  53 + { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
  54 + { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
  55 + { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
  56 + { regex: /\$\w+/g, css: 'variable' }, // variables
  57 + { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }, // common functions
  58 + { regex: new RegExp(this.getKeywords(constants), 'gmi'), css: 'constants' }, // constants
  59 + { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keyword
  60 + ];
  61 +
  62 + this.forHtmlScript(SyntaxHighlighter.regexLib.phpScriptTags);
  63 + };
  64 +
  65 + Brush.prototype = new SyntaxHighlighter.Highlighter();
  66 + Brush.aliases = ['php'];
  67 +
  68 + SyntaxHighlighter.brushes.Php = Brush;
  69 +
  70 + // CommonJS
  71 + typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
  72 +})();
  1 +var XRegExp;if(XRegExp)throw Error("can't load XRegExp twice in the same frame");(function(e){function c(e,t){if(!XRegExp.isRegExp(e))throw TypeError("type RegExp expected");var n=e._xregexp;return e=XRegExp(e.source,h(e)+(t||"")),n&&(e._xregexp={source:n.source,captureNames:n.captureNames?n.captureNames.slice(0):null}),e}function h(e){return(e.global?"g":"")+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.extended?"x":"")+(e.sticky?"y":"")}function p(e,t,n,r){var o=s.length,u,a,f;i=!0;try{while(o--){f=s[o];if(n&f.scope&&(!f.trigger||f.trigger.call(r))){f.pattern.lastIndex=t,a=f.pattern.exec(e);if(a&&a.index===t){u={output:f.handler.call(r,a,n),match:a};break}}}}catch(l){throw l}finally{i=!1}return u}function d(e,t,n){if(Array.prototype.indexOf)return e.indexOf(t,n);for(var r=n||0;r<e.length;r++)if(e[r]===t)return r;return-1}XRegExp=function(t,r){var s=[],u=XRegExp.OUTSIDE_CLASS,a=0,f,h,d,v,m;if(XRegExp.isRegExp(t)){if(r!==e)throw TypeError("can't supply flags when constructing one RegExp from another");return c(t)}if(i)throw Error("can't call the XRegExp constructor within token definition functions");r=r||"",f={hasNamedCapture:!1,captureNames:[],hasFlag:function(e){return r.indexOf(e)>-1},setFlag:function(e){r+=e}};while(a<t.length)h=p(t,a,u,f),h?(s.push(h.output),a+=h.match[0].length||1):(d=o.exec.call(l[u],t.slice(a)))?(s.push(d[0]),a+=d[0].length):(v=t.charAt(a),v==="["?u=XRegExp.INSIDE_CLASS:v==="]"&&(u=XRegExp.OUTSIDE_CLASS),s.push(v),a++);return m=RegExp(s.join(""),o.replace.call(r,n,"")),m._xregexp={source:t,captureNames:f.hasNamedCapture?f.captureNames:null},m},XRegExp.version="1.5.1",XRegExp.INSIDE_CLASS=1,XRegExp.OUTSIDE_CLASS=2;var t=/\$(?:(\d\d?|[$&`'])|{([$\w]+)})/g,n=/[^gimy]+|([\s\S])(?=[\s\S]*\1)/g,r=/^(?:[?*+]|{\d+(?:,\d*)?})\??/,i=!1,s=[],o={exec:RegExp.prototype.exec,test:RegExp.prototype.test,match:String.prototype.match,replace:String.prototype.replace,split:String.prototype.split},u=o.exec.call(/()??/,"")[1]===e,a=function(){var e=/^/g;return o.test.call(e,""),!e.lastIndex}(),f=RegExp.prototype.sticky!==e,l={};l[XRegExp.INSIDE_CLASS]=/^(?:\\(?:[0-3][0-7]{0,2}|[4-7][0-7]?|x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|c[A-Za-z]|[\s\S]))/,l[XRegExp.OUTSIDE_CLASS]=/^(?:\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9]\d*|x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|c[A-Za-z]|[\s\S])|\(\?[:=!]|[?*+]\?|{\d+(?:,\d*)?}\??)/,XRegExp.addToken=function(e,t,n,r){s.push({pattern:c(e,"g"+(f?"y":"")),handler:t,scope:n||XRegExp.OUTSIDE_CLASS,trigger:r||null})},XRegExp.cache=function(e,t){var n=e+"/"+(t||"");return XRegExp.cache[n]||(XRegExp.cache[n]=XRegExp(e,t))},XRegExp.copyAsGlobal=function(e){return c(e,"g")},XRegExp.escape=function(e){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},XRegExp.execAt=function(e,t,n,r){var i=c(t,"g"+(r&&f?"y":"")),s;return i.lastIndex=n=n||0,s=i.exec(e),r&&s&&s.index!==n&&(s=null),t.global&&(t.lastIndex=s?i.lastIndex:0),s},XRegExp.freezeTokens=function(){XRegExp.addToken=function(){throw Error("can't run addToken after freezeTokens")}},XRegExp.isRegExp=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},XRegExp.iterate=function(e,t,n,r){var i=c(t,"g"),s=-1,o;while(o=i.exec(e))t.global&&(t.lastIndex=i.lastIndex),n.call(r,o,++s,e,t),i.lastIndex===o.index&&i.lastIndex++;t.global&&(t.lastIndex=0)},XRegExp.matchChain=function(e,t){return function n(e,r){var i=t[r].regex?t[r]:{regex:t[r]},s=c(i.regex,"g"),o=[],u;for(u=0;u<e.length;u++)XRegExp.iterate(e[u],s,function(e){o.push(i.backref?e[i.backref]||"":e[0])});return r===t.length-1||!o.length?o:n(o,r+1)}([e],0)},RegExp.prototype.apply=function(e,t){return this.exec(t[0])},RegExp.prototype.call=function(e,t){return this.exec(t)},RegExp.prototype.exec=function(t){var n,r,i,s;this.global||(s=this.lastIndex),n=o.exec.apply(this,arguments);if(n){!u&&n.length>1&&d(n,"")>-1&&(i=RegExp(this.source,o.replace.call(h(this),"g","")),o.replace.call((t+"").slice(n.index),i,function(){for(var t=1;t<arguments.length-2;t++)arguments[t]===e&&(n[t]=e)}));if(this._xregexp&&this._xregexp.captureNames)for(var f=1;f<n.length;f++)r=this._xregexp.captureNames[f-1],r&&(n[r]=n[f]);!a&&this.global&&!n[0].length&&this.lastIndex>n.index&&this.lastIndex--}return this.global||(this.lastIndex=s),n},RegExp.prototype.test=function(e){var t,n;return this.global||(n=this.lastIndex),t=o.exec.call(this,e),t&&!a&&this.global&&!t[0].length&&this.lastIndex>t.index&&this.lastIndex--,this.global||(this.lastIndex=n),!!t},String.prototype.match=function(e){XRegExp.isRegExp(e)||(e=RegExp(e));if(e.global){var t=o.match.apply(this,arguments);return e.lastIndex=0,t}return e.exec(this)},String.prototype.replace=function(e,n){var r=XRegExp.isRegExp(e),i,s,u,a;return r?(e._xregexp&&(i=e._xregexp.captureNames),e.global||(a=e.lastIndex)):e+="",Object.prototype.toString.call(n)==="[object Function]"?s=o.replace.call(this+"",e,function(){if(i){arguments[0]=new String(arguments[0]);for(var t=0;t<i.length;t++)i[t]&&(arguments[0][i[t]]=arguments[t+1])}return r&&e.global&&(e.lastIndex=arguments[arguments.length-2]+arguments[0].length),n.apply(null,arguments)}):(u=this+"",s=o.replace.call(u,e,function(){var e=arguments;return o.replace.call(n+"",t,function(t,n,r){if(!n){var o=+r;return o<=e.length-3?e[o]:(o=i?d(i,r):-1,o>-1?e[o+1]:t)}switch(n){case"$":return"$";case"&":return e[0];case"`":return e[e.length-1].slice(0,e[e.length-2]);case"'":return e[e.length-1].slice(e[e.length-2]+e[0].length);default:var s="";n=+n;if(!n)return t;while(n>e.length-3)s=String.prototype.slice.call(n,-1)+s,n=Math.floor(n/10);return(n?e[n]||"":"$")+s}})})),r&&(e.global?e.lastIndex=0:e.lastIndex=a),s},String.prototype.split=function(t,n){if(!XRegExp.isRegExp(t))return o.split.apply(this,arguments);var r=this+"",i=[],s=0,u,a;if(n===e||+n<0)n=Infinity;else{n=Math.floor(+n);if(!n)return[]}t=XRegExp.copyAsGlobal(t);while(u=t.exec(r)){if(t.lastIndex>s){i.push(r.slice(s,u.index)),u.length>1&&u.index<r.length&&Array.prototype.push.apply(i,u.slice(1)),a=u[0].length,s=t.lastIndex;if(i.length>=n)break}t.lastIndex===u.index&&t.lastIndex++}return s===r.length?(!o.test.call(t,"")||a)&&i.push(""):i.push(r.slice(s)),i.length>n?i.slice(0,n):i},XRegExp.addToken(/\(\?#[^)]*\)/,function(e){return o.test.call(r,e.input.slice(e.index+e[0].length))?"":"(?:)"}),XRegExp.addToken(/\((?!\?)/,function(){return this.captureNames.push(null),"("}),XRegExp.addToken(/\(\?<([$\w]+)>/,function(e){return this.captureNames.push(e[1]),this.hasNamedCapture=!0,"("}),XRegExp.addToken(/\\k<([\w$]+)>/,function(e){var t=d(this.captureNames,e[1]);return t>-1?"\\"+(t+1)+(isNaN(e.input.charAt(e.index+e[0].length))?"":"(?:)"):e[0]}),XRegExp.addToken(/\[\^?]/,function(e){return e[0]==="[]"?"\\b\\B":"[\\s\\S]"}),XRegExp.addToken(/^\(\?([imsx]+)\)/,function(e){return this.setFlag(e[1]),""}),XRegExp.addToken(/(?:\s+|#.*)+/,function(e){return o.test.call(r,e.input.slice(e.index+e[0].length))?"":"(?:)"},XRegExp.OUTSIDE_CLASS,function(){return this.hasFlag("x")}),XRegExp.addToken(/\./,function(){return"[\\s\\S]"},XRegExp.OUTSIDE_CLASS,function(){return this.hasFlag("s")})})();if(typeof SyntaxHighlighter=="undefined")var SyntaxHighlighter=function(){function t(e,t){return e.className.indexOf(t)!=-1}function n(e,n){t(e,n)||(e.className+=" "+n)}function r(e,t){e.className=e.className.replace(t,"")}function i(e){var t=[];for(var n=0;n<e.length;n++)t.push(e[n]);return t}function s(e){return e.split(/\r?\n/)}function o(e){var t="highlighter_";return e.indexOf(t)==0?e:t+e}function u(t){return e.vars.highlighters[o(t)]}function a(e){return document.getElementById(o(e))}function f(t){e.vars.highlighters[o(t.id)]=t}function l(e,t,n){if(e==null)return null;var r=n!=1?e.childNodes:[e.parentNode],i={"#":"id",".":"className"}[t.substr(0,1)]||"nodeName",s,o;s=i!="nodeName"?t.substr(1):t.toUpperCase();if((e[i]||"").indexOf(s)!=-1)return e;for(var u=0;r&&u<r.length&&o==null;u++)o=l(r[u],t,n);return o}function c(e,t){return l(e,t,!0)}function h(e,t,n){n=Math.max(n||0,0);for(var r=n;r<e.length;r++)if(e[r]==t)return r;return-1}function p(e){return(e||"")+Math.round(Math.random()*1e6).toString()}function d(e,t){var n={},r;for(r in e)n[r]=e[r];for(r in t)n[r]=t[r];return n}function v(e){var t={"true":!0,"false":!1}[e];return t==null?e:t}function m(e,t,n,r,i){var s=(screen.width-n)/2,o=(screen.height-r)/2;i+=", left="+s+", top="+o+", width="+n+", height="+r,i=i.replace(/^,/,"");var u=window.open(e,t,i);return u.focus(),u}function g(e,t,n,r){function i(e){e=e||window.event,e.target||(e.target=e.srcElement,e.preventDefault=function(){this.returnValue=!1}),n.call(r||window,e)}e.attachEvent?e.attachEvent("on"+t,i):e.addEventListener(t,i,!1)}function y(t){window.alert(e.config.strings.alert+t)}function b(t,n){var r=e.vars.discoveredBrushes,i=null;if(r==null){r={};for(var s in e.brushes){var o=e.brushes[s],u=o.aliases;if(u==null)continue;o.brushName=s.toLowerCase();for(var a=0;a<u.length;a++)r[u[a]]=s}e.vars.discoveredBrushes=r}return i=e.brushes[r[t]],i==null&&n&&y(e.config.strings.noBrush+t),i}function w(e,t){var n=s(e);for(var r=0;r<n.length;r++)n[r]=t(n[r],r);return n.join("\r\n")}function E(e){return e.replace(/^[ ]*[\n]+|[\n]*[ ]*$/g,"")}function S(e){var t,n={},r=new XRegExp("^\\[(?<values>(.*?))\\]$"),i=new XRegExp("(?<name>[\\w-]+)\\s*:\\s*(?<value>[\\w-%#]+|\\[.*?\\]|\".*?\"|'.*?')\\s*;?","g");while((t=i.exec(e))!=null){var s=t.value.replace(/^['"]|['"]$/g,"");if(s!=null&&r.test(s)){var o=r.exec(s);s=o.values.length>0?o.values.split(/\s*,\s*/):[]}n[t.name]=s}return n}function x(t,n){return t==null||t.length==0||t=="\n"?t:(t=t.replace(/</g,"&lt;"),t=t.replace(/ {2,}/g,function(t){var n="";for(var r=0;r<t.length-1;r++)n+=e.config.space;return n+" "}),n!=null&&(t=w(t,function(e){if(e.length==0)return"";var t="";return e=e.replace(/^(&nbsp;| )+/,function(e){return t=e,""}),e.length==0?t:t+'<code class="'+n+'">'+e+"</code>"})),t)}function T(e,t){var n=e.toString();while(n.length<t)n="0"+n;return n}function N(e,t){var n="";for(var r=0;r<t;r++)n+=" ";return e.replace(/\t/g,n)}function C(e,t){function u(e,t,n){return e.substr(0,t)+i.substr(0,n)+e.substr(t+1,e.length)}var n=s(e),r=" ",i="";for(var o=0;o<50;o++)i+=" ";return e=w(e,function(e){if(e.indexOf(r)==-1)return e;var n=0;while((n=e.indexOf(r))!=-1){var i=t-n%t;e=u(e,n,i)}return e}),e}function k(t){var n=/<br\s*\/?>|&lt;br\s*\/?&gt;/gi;return e.config.bloggerMode==1&&(t=t.replace(n,"\n")),e.config.stripBrs==1&&(t=t.replace(n,"")),t}function L(e){return e.replace(/^\s+|\s+$/g,"")}function A(e){var t=s(k(e)),n=new Array,r=/^\s*/,i=1e3;for(var o=0;o<t.length&&i>0;o++){var u=t[o];if(L(u).length==0)continue;var a=r.exec(u);if(a==null)return e;i=Math.min(a[0].length,i)}if(i>0)for(var o=0;o<t.length;o++)t[o]=t[o].substr(i);return t.join("\n")}function O(e,t){return e.index<t.index?-1:e.index>t.index?1:e.length<t.length?-1:e.length>t.length?1:0}function M(t,n){function r(e,t){return e[0]}var i=0,s=null,o=[],u=n.func?n.func:r;while((s=n.regex.exec(t))!=null){var a=u(s,n);typeof a=="string"&&(a=[new e.Match(a,s.index,n.css)]),o=o.concat(a)}return o}function _(t){var n=/(.*)((&gt;|&lt;).*)/;return t.replace(e.regexLib.url,function(e){var t="",r=null;if(r=n.exec(e))e=r[1],t=r[2];return'<a href="'+e+'">'+e+"</a>"+t})}function D(){var e=document.getElementsByTagName("script"),t=[];for(var n=0;n<e.length;n++)e[n].type=="syntaxhighlighter"&&t.push(e[n]);return t}function P(e){var t="<![CDATA[",n="]]>",r=L(e),i=!1,s=t.length,o=n.length;r.indexOf(t)==0&&(r=r.substring(s),i=!0);var u=r.length;return r.indexOf(n)==u-o&&(r=r.substring(0,u-o),i=!0),i?r:e}function H(e){var t=e.target,i=c(t,".syntaxhighlighter"),s=c(t,".container"),o=document.createElement("textarea"),a;if(!s||!i||l(s,"textarea"))return;a=u(i.id),n(i,"source");var f=s.childNodes,h=[];for(var p=0;p<f.length;p++)h.push(f[p].innerText||f[p].textContent);h=h.join("\r"),h=h.replace(/\u00a0/g," "),o.appendChild(document.createTextNode(h)),s.appendChild(o),o.focus(),o.select(),g(o,"blur",function(e){o.parentNode.removeChild(o),r(i,"source")})}typeof require!="undefined"&&typeof XRegExp=="undefined"&&(XRegExp=require("XRegExp").XRegExp);var e={defaults:{"class-name":"","first-line":1,"pad-line-numbers":!1,highlight:null,title:null,"smart-tabs":!0,"tab-size":4,gutter:!0,toolbar:!0,"quick-code":!0,collapse:!1,"auto-links":!0,light:!1,unindent:!0,"html-script":!1},config:{space:"&nbsp;",useScriptTags:!0,bloggerMode:!1,stripBrs:!1,tagName:"pre",strings:{expandSource:"expand source",help:"?",alert:"SyntaxHighlighter\n\n",noBrush:"Can't find brush for: ",brushNotHtmlScript:"Brush wasn't configured for html-script option: ",aboutDialog:"@ABOUT@"}},vars:{discoveredBrushes:null,highlighters:{}},brushes:{},regexLib:{multiLineCComments:/\/\*[\s\S]*?\*\//gm,singleLineCComments:/\/\/.*$/gm,singleLinePerlComments:/#.*$/gm,doubleQuotedString:/"([^\\"\n]|\\.)*"/g,singleQuotedString:/'([^\\'\n]|\\.)*'/g,multiLineDoubleQuotedString:new XRegExp('"([^\\\\"]|\\\\.)*"',"gs"),multiLineSingleQuotedString:new XRegExp("'([^\\\\']|\\\\.)*'","gs"),xmlComments:/(&lt;|<)!--[\s\S]*?--(&gt;|>)/gm,url:/\w+:\/\/[\w-.\/?%&=:@;#]*/g,phpScriptTags:{left:/(&lt;|<)\?(?:=|php)?/g,right:/\?(&gt;|>)/g,eof:!0},aspScriptTags:{left:/(&lt;|<)%=?/g,right:/%(&gt;|>)/g},scriptScriptTags:{left:/(&lt;|<)\s*script.*?(&gt;|>)/gi,right:/(&lt;|<)\/\s*script\s*(&gt;|>)/gi}},toolbar:{getHtml:function(t){function s(t,n){return e.toolbar.getButtonHtml(t,n,e.config.strings[n])}var n='<div class="toolbar">',r=e.toolbar.items,i=r.list;for(var o=0;o<i.length;o++)n+=(r[i[o]].getHtml||s)(t,i[o]);return n+="</div>",n},getButtonHtml:function(e,t,n){return'<span><a href="#" class="toolbar_item command_'+t+" "+t+'">'+n+"</a></span>"},handler:function(t){function i(e){var t=new RegExp(e+"_(\\w+)"),n=t.exec(r);return n?n[1]:null}var n=t.target,r=n.className||"",s=u(c(n,".syntaxhighlighter").id),o=i("command");s&&o&&e.toolbar.items[o].execute(s),t.preventDefault()},items:{list:["expandSource","help"],expandSource:{getHtml:function(t){if(t.getParam("collapse")!=1)return"";var n=t.getParam("title");return e.toolbar.getButtonHtml(t,"expandSource",n?n:e.config.strings.expandSource)},execute:function(e){var t=a(e.id);r(t,"collapsed")}},help:{execute:function(t){var n=m("","_blank",500,250,"scrollbars=0"),r=n.document;r.write(e.config.strings.aboutDialog),r.close(),n.focus()}}}},findElements:function(t,n){var r=n?[n]:i(document.getElementsByTagName(e.config.tagName)),s=e.config,o=[];s.useScriptTags&&(r=r.concat(D()));if(r.length===0)return o;for(var u=0;u<r.length;u++){var a={target:r[u],params:d(t,S(r[u].className))};if(a.params["brush"]==null)continue;o.push(a)}return o},highlight:function(t,n){var r=this.findElements(t,n),i="innerHTML",s=null,o=e.config;if(r.length===0)return;for(var u=0;u<r.length;u++){var n=r[u],a=n.target,f=n.params,l=f.brush,c;if(l==null)continue;if(f["html-script"]=="true"||e.defaults["html-script"]==1)s=new e.HtmlScript(l),l="htmlscript";else{var h=b(l);if(!h)continue;s=new h}c=a[i],o.useScriptTags&&(c=P(c)),(a.title||"")!=""&&(f.title=a.title),f.brush=l,s.init(f),n=s.getDiv(c),(a.id||"")!=""&&(n.id=a.id),a.parentNode.replaceChild(n,a)}},all:function(t){g(window,"load",function(){e.highlight(t)})}};return e.Match=function(e,t,n){this.value=e,this.index=t,this.length=e.length,this.css=n,this.brushName=null},e.Match.prototype.toString=function(){return this.value},e.HtmlScript=function(t){function f(e,t){for(var n=0;n<e.length;n++)e[n].index+=t}function l(e,t){var i=e.code,s=[],o=r.regexList,u=e.index+e.left.length,a=r.htmlScript,l;for(var c=0;c<o.length;c++)l=M(i,o[c]),f(l,u),s=s.concat(l);a.left!=null&&e.left!=null&&(l=M(e.left,a.left),f(l,e.index),s=s.concat(l)),a.right!=null&&e.right!=null&&(l=M(e.right,a.right),f(l,e.index+e[0].lastIndexOf(e.right)),s=s.concat(l));for(var h=0;h<s.length;h++)s[h].brushName=n.brushName;return s}var n=b(t),r,i=new e.brushes.Xml,s=null,o=this,u="getDiv getHtml init".split(" ");if(n==null)return;r=new n;for(var a=0;a<u.length;a++)(function(){var e=u[a];o[e]=function(){return i[e].apply(i,arguments)}})();if(r.htmlScript==null){y(e.config.strings.brushNotHtmlScript+t);return}i.regexList.push({regex:r.htmlScript.code,func:l})},e.Highlighter=function(){},e.Highlighter.prototype={getParam:function(e,t){var n=this.params[e];return v(n==null?t:n)},create:function(e){return document.createElement(e)},findMatches:function(e,t){var n=[];if(e!=null)for(var r=0;r<e.length;r++)typeof e[r]=="object"&&(n=n.concat(M(t,e[r])));return this.removeNestedMatches(n.sort(O))},removeNestedMatches:function(e){for(var t=0;t<e.length;t++){if(e[t]===null)continue;var n=e[t],r=n.index+n.length;for(var i=t+1;i<e.length&&e[t]!==null;i++){var s=e[i];if(s===null)continue;if(s.index>r)break;s.index==n.index&&s.length>n.length?e[t]=null:s.index>=n.index&&s.index<r&&(e[i]=null)}}return e},figureOutLineNumbers:function(e){var t=[],n=parseInt(this.getParam("first-line"));return w(e,function(e,r){t.push(r+n)}),t},isLineHighlighted:function(e){var t=this.getParam("highlight",[]);return typeof t!="object"&&t.push==null&&(t=[t]),h(t,e.toString())!=-1},getLineHtml:function(e,t,n){var r=["line","number"+t,"index"+e,"alt"+(t%2==0?1:2).toString()];return this.isLineHighlighted(t)&&r.push("highlighted"),t==0&&r.push("break"),'<div class="'+r.join(" ")+'">'+n+"</div>"},getLineNumbersHtml:function(t,n){var r="",i=s(t).length,o=parseInt(this.getParam("first-line")),u=this.getParam("pad-line-numbers");u==1?u=(o+i-1).toString().length:isNaN(u)==1&&(u=0);for(var a=0;a<i;a++){var f=n?n[a]:o+a,t=f==0?e.config.space:T(f,u);r+=this.getLineHtml(a,f,t)}return r},getCodeLinesHtml:function(t,n){t=L(t);var r=s(t),i=this.getParam("pad-line-numbers"),o=parseInt(this.getParam("first-line")),t="",u=this.getParam("brush");for(var a=0;a<r.length;a++){var f=r[a],l=/^(&nbsp;|\s)+/.exec(f),c=null,h=n?n[a]:o+a;l!=null&&(c=l[0].toString(),f=f.substr(c.length),c=c.replace(" ",e.config.space)),f=L(f),f.length==0&&(f=e.config.space),t+=this.getLineHtml(a,h,(c!=null?'<code class="'+u+' spaces">'+c+"</code>":"")+f)}return t},getTitleHtml:function(e){return e?"<caption>"+e+"</caption>":""},getMatchesHtml:function(e,t){function s(e){var t=e?e.brushName||i:i;return t?t+" ":""}var n=0,r="",i=this.getParam("brush","");for(var o=0;o<t.length;o++){var u=t[o],a;if(u===null||u.length===0)continue;a=s(u),r+=x(e.substr(n,u.index-n),a+"plain")+x(u.value,a+u.css),n=u.index+u.length+(u.offset||0)}return r+=x(e.substr(n),s()+"plain"),r},getHtml:function(t){var n="",r=["syntaxhighlighter"],i,s,u;return this.getParam("light")==1&&(this.params.toolbar=this.params.gutter=!1),className="syntaxhighlighter",this.getParam("collapse")==1&&r.push("collapsed"),(gutter=this.getParam("gutter"))==0&&r.push("nogutter"),r.push(this.getParam("class-name")),r.push(this.getParam("brush")),t=E(t).replace(/\r/g," "),i=this.getParam("tab-size"),t=this.getParam("smart-tabs")==1?C(t,i):N(t,i),this.getParam("unindent")&&(t=A(t)),gutter&&(u=this.figureOutLineNumbers(t)),s=this.findMatches(this.regexList,t),n=this.getMatchesHtml(t,s),n=this.getCodeLinesHtml(n,u),this.getParam("auto-links")&&(n=_(n)),typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.match(/MSIE/)&&r.push("ie"),n='<div id="'+o(this.id)+'" class="'+r.join(" ")+'">'+(this.getParam("toolbar")?e.toolbar.getHtml(this):"")+'<table border="0" cellpadding="0" cellspacing="0">'+this.getTitleHtml(this.getParam("title"))+"<tbody>"+"<tr>"+(gutter?'<td class="gutter">'+this.getLineNumbersHtml(t)+"</td>":"")+'<td class="code">'+'<div class="container">'+n+"</div>"+"</td>"+"</tr>"+"</tbody>"+"</table>"+"</div>",n},getDiv:function(t){t===null&&(t=""),this.code=t;var n=this.create("div");return n.innerHTML=this.getHtml(t),this.getParam("toolbar")&&g(l(n,".toolbar"),"click",e.toolbar.handler),this.getParam("quick-code")&&g(l(n,".code"),"dblclick",H),n},init:function(t){this.id=p(),f(this),this.params=d(e.defaults,t||{}),this.getParam("light")==1&&(this.params.toolbar=this.params.gutter=!1)},getKeywords:function(e){return e=e.replace(/^\s+|\s+$/g,"").replace(/\s+/g,"|"),"\\b(?:"+e+")\\b"},forHtmlScript:function(e){var t={end:e.right.source};e.eof&&(t.end="(?:(?:"+t.end+")|$)"),this.htmlScript={left:{regex:e.left,css:"script"},right:{regex:e.right,css:"script"},code:new XRegExp("(?<left>"+e.left.source+")"+"(?<code>.*?)"+"(?<right>"+t.end+")","sgi")}}},e}();typeof exports!="undefined"?exports.SyntaxHighlighter=SyntaxHighlighter:null
  1 +var dp = {
  2 + SyntaxHighlighter : {}
  3 +};
  4 +
  5 +dp.SyntaxHighlighter = {
  6 + parseParams: function(
  7 + input,
  8 + showGutter,
  9 + showControls,
  10 + collapseAll,
  11 + firstLine,
  12 + showColumns
  13 + )
  14 + {
  15 + function getValue(list, name)
  16 + {
  17 + var regex = new XRegExp('^' + name + '\\[(?<value>\\w+)\\]$', 'gi'),
  18 + match = null
  19 + ;
  20 +
  21 + for (var i = 0; i < list.length; i++)
  22 + if ((match = regex.exec(list[i])) != null)
  23 + return match.value;
  24 +
  25 + return null;
  26 + };
  27 +
  28 + function defaultValue(value, def)
  29 + {
  30 + return value != null ? value : def;
  31 + };
  32 +
  33 + function asString(value)
  34 + {
  35 + return value != null ? value.toString() : null;
  36 + };
  37 +
  38 + var parts = input.split(':'),
  39 + brushName = parts[0],
  40 + options = {},
  41 + straight = { 'true' : true }
  42 + reverse = { 'true' : false },
  43 + result = null,
  44 + defaults = SyntaxHighlighter.defaults
  45 + ;
  46 +
  47 + for (var i in parts)
  48 + options[parts[i]] = 'true';
  49 +
  50 + showGutter = asString(defaultValue(showGutter, defaults.gutter));
  51 + showControls = asString(defaultValue(showControls, defaults.toolbar));
  52 + collapseAll = asString(defaultValue(collapseAll, defaults.collapse));
  53 + showColumns = asString(defaultValue(showColumns, defaults.ruler));
  54 + firstLine = asString(defaultValue(firstLine, defaults['first-line']));
  55 +
  56 + return {
  57 + brush : brushName,
  58 + gutter : defaultValue(reverse[options.nogutter], showGutter),
  59 + toolbar : defaultValue(reverse[options.nocontrols], showControls),
  60 + collapse : defaultValue(straight[options.collapse], collapseAll),
  61 + // ruler : defaultValue(straight[options.showcolumns], showColumns),
  62 + 'first-line' : defaultValue(getValue(parts, 'firstline'), firstLine)
  63 + };
  64 + },
  65 +
  66 + HighlightAll: function(
  67 + name,
  68 + showGutter /* optional */,
  69 + showControls /* optional */,
  70 + collapseAll /* optional */,
  71 + firstLine /* optional */,
  72 + showColumns /* optional */
  73 + )
  74 + {
  75 + function findValue()
  76 + {
  77 + var a = arguments;
  78 +
  79 + for (var i = 0; i < a.length; i++)
  80 + {
  81 + if (a[i] === null)
  82 + continue;
  83 +
  84 + if (typeof(a[i]) == 'string' && a[i] != '')
  85 + return a[i] + '';
  86 +
  87 + if (typeof(a[i]) == 'object' && a[i].value != '')
  88 + return a[i].value + '';
  89 + }
  90 +
  91 + return null;
  92 + };
  93 +
  94 + function findTagsByName(list, name, tagName)
  95 + {
  96 + var tags = document.getElementsByTagName(tagName);
  97 +
  98 + for (var i = 0; i < tags.length; i++)
  99 + if (tags[i].getAttribute('name') == name)
  100 + list.push(tags[i]);
  101 + }
  102 +
  103 + var elements = [],
  104 + highlighter = null,
  105 + registered = {},
  106 + propertyName = 'innerHTML'
  107 + ;
  108 +
  109 + // for some reason IE doesn't find <pre/> by name, however it does see them just fine by tag name...
  110 + findTagsByName(elements, name, 'pre');
  111 + findTagsByName(elements, name, 'textarea');
  112 +
  113 + if (elements.length === 0)
  114 + return;
  115 +
  116 + for (var i = 0; i < elements.length; i++)
  117 + {
  118 + var element = elements[i],
  119 + params = findValue(
  120 + element.attributes['class'], element.className,
  121 + element.attributes['language'], element.language
  122 + ),
  123 + language = ''
  124 + ;
  125 +
  126 + if (params === null)
  127 + continue;
  128 +
  129 + params = dp.SyntaxHighlighter.parseParams(
  130 + params,
  131 + showGutter,
  132 + showControls,
  133 + collapseAll,
  134 + firstLine,
  135 + showColumns
  136 + );
  137 +
  138 + SyntaxHighlighter.highlight(params, element);
  139 + }
  140 + }
  141 +};
  1 +<!DOCTYPE html>
  2 +<html>
  3 +<head>
  4 + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  5 + <title>PHPMailer - sendmail test</title>
  6 +</head>
  7 +<body>
  8 +<?php
  9 +require '../PHPMailerAutoload.php';
  10 +
  11 +//Create a new PHPMailer instance
  12 +$mail = new PHPMailer();
  13 +// Set PHPMailer to use the sendmail transport
  14 +$mail->isSendmail();
  15 +//Set who the message is to be sent from
  16 +$mail->setFrom('from@example.com', 'First Last');
  17 +//Set an alternative reply-to address
  18 +$mail->addReplyTo('replyto@example.com', 'First Last');
  19 +//Set who the message is to be sent to
  20 +$mail->addAddress('whoto@example.com', 'John Doe');
  21 +//Set the subject line
  22 +$mail->Subject = 'PHPMailer sendmail test';
  23 +//Read an HTML message body from an external file, convert referenced images to embedded,
  24 +//convert HTML into a basic plain-text alternative body
  25 +$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
  26 +//Replace the plain text body with one created manually
  27 +$mail->AltBody = 'This is a plain-text message body';
  28 +//Attach an image file
  29 +$mail->addAttachment('images/phpmailer_mini.png');
  30 +
  31 +//send the message, check for errors
  32 +if (!$mail->send()) {
  33 + echo "Mailer Error: " . $mail->ErrorInfo;
  34 +} else {
  35 + echo "Message sent!";
  36 +}
  37 +?>
  38 +</body>
  39 +</html>
  1 +<!DOCTYPE html>
  2 +<html>
  3 +<head>
  4 + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  5 + <title>PHPMailer - SMTP test</title>
  6 +</head>
  7 +<body>
  8 +<?php
  9 +
  10 +//SMTP needs accurate times, and the PHP time zone MUST be set
  11 +//This should be done in your php.ini, but this is how to do it if you don't have access to that
  12 +date_default_timezone_set('Etc/UTC');
  13 +
  14 +require '../PHPMailerAutoload.php';
  15 +
  16 +//Create a new PHPMailer instance
  17 +$mail = new PHPMailer();
  18 +//Tell PHPMailer to use SMTP
  19 +$mail->isSMTP();
  20 +//Enable SMTP debugging
  21 +// 0 = off (for production use)
  22 +// 1 = client messages
  23 +// 2 = client and server messages
  24 +$mail->SMTPDebug = 2;
  25 +//Ask for HTML-friendly debug output
  26 +$mail->Debugoutput = 'html';
  27 +//Set the hostname of the mail server
  28 +$mail->Host = "mail.example.com";
  29 +//Set the SMTP port number - likely to be 25, 465 or 587
  30 +$mail->Port = 25;
  31 +//Whether to use SMTP authentication
  32 +$mail->SMTPAuth = true;
  33 +//Username to use for SMTP authentication
  34 +$mail->Username = "yourname@example.com";
  35 +//Password to use for SMTP authentication
  36 +$mail->Password = "yourpassword";
  37 +//Set who the message is to be sent from
  38 +$mail->setFrom('from@example.com', 'First Last');
  39 +//Set an alternative reply-to address
  40 +$mail->addReplyTo('replyto@example.com', 'First Last');
  41 +//Set who the message is to be sent to
  42 +$mail->addAddress('whoto@example.com', 'John Doe');
  43 +//Set the subject line
  44 +$mail->Subject = 'PHPMailer SMTP test';
  45 +//Read an HTML message body from an external file, convert referenced images to embedded,
  46 +//convert HTML into a basic plain-text alternative body
  47 +$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
  48 +//Replace the plain text body with one created manually
  49 +$mail->AltBody = 'This is a plain-text message body';
  50 +//Attach an image file
  51 +$mail->addAttachment('images/phpmailer_mini.png');
  52 +
  53 +//send the message, check for errors
  54 +if (!$mail->send()) {
  55 + echo "Mailer Error: " . $mail->ErrorInfo;
  56 +} else {
  57 + echo "Message sent!";
  58 +}
  59 +?>
  60 +</body>
  61 +</html>
  1 +<!DOCTYPE html>
  2 +<html>
  3 +<head>
  4 + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  5 + <title>PHPMailer - SMTP without auth test</title>
  6 +</head>
  7 +<body>
  8 +<?php
  9 +
  10 +//SMTP needs accurate times, and the PHP time zone MUST be set
  11 +//This should be done in your php.ini, but this is how to do it if you don't have access to that
  12 +date_default_timezone_set('Etc/UTC');
  13 +
  14 +require_once '../PHPMailerAutoload.php';
  15 +
  16 +//Create a new PHPMailer instance
  17 +$mail = new PHPMailer();
  18 +//Tell PHPMailer to use SMTP
  19 +$mail->isSMTP();
  20 +//Enable SMTP debugging
  21 +// 0 = off (for production use)
  22 +// 1 = client messages
  23 +// 2 = client and server messages
  24 +$mail->SMTPDebug = 2;
  25 +//Ask for HTML-friendly debug output
  26 +$mail->Debugoutput = 'html';
  27 +//Set the hostname of the mail server
  28 +$mail->Host = "mail.example.com";
  29 +//Set the SMTP port number - likely to be 25, 465 or 587
  30 +$mail->Port = 25;
  31 +//Whether to use SMTP authentication
  32 +$mail->SMTPAuth = false;
  33 +//Set who the message is to be sent from
  34 +$mail->setFrom('from@example.com', 'First Last');
  35 +//Set an alternative reply-to address
  36 +$mail->addReplyTo('replyto@example.com', 'First Last');
  37 +//Set who the message is to be sent to
  38 +$mail->addAddress('whoto@example.com', 'John Doe');
  39 +//Set the subject line
  40 +$mail->Subject = 'PHPMailer SMTP without auth test';
  41 +//Read an HTML message body from an external file, convert referenced images to embedded,
  42 +//convert HTML into a basic plain-text alternative body
  43 +$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
  44 +//Replace the plain text body with one created manually
  45 +$mail->AltBody = 'This is a plain-text message body';
  46 +//Attach an image file
  47 +$mail->addAttachment('images/phpmailer_mini.png');
  48 +
  49 +//send the message, check for errors
  50 +if (!$mail->send()) {
  51 + echo "Mailer Error: " . $mail->ErrorInfo;
  52 +} else {
  53 + echo "Message sent!";
  54 +}
  55 +?>
  56 +</body>
  57 +</html>
  1 +.syntaxhighlighter a,.syntaxhighlighter div,.syntaxhighlighter code,.syntaxhighlighter table,.syntaxhighlighter table td,.syntaxhighlighter table tr,.syntaxhighlighter table tbody,.syntaxhighlighter table thead,.syntaxhighlighter table caption,.syntaxhighlighter textarea{-moz-border-radius:0 0 0 0 !important;-webkit-border-radius:0 0 0 0 !important;background:none !important;border:0 !important;bottom:auto !important;float:none !important;height:auto !important;left:auto !important;line-height:1.1em !important;margin:0 !important;outline:0 !important;overflow:visible !important;padding:0 !important;position:static !important;right:auto !important;text-align:left !important;top:auto !important;vertical-align:baseline !important;width:auto !important;box-sizing:content-box !important;font-family:"Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;font-weight:normal !important;font-style:normal !important;font-size:1em !important;min-height:inherit !important;min-height:auto !important;}
  2 +.syntaxhighlighter{width:100% !important;margin:1em 0 1em 0 !important;position:relative !important;overflow:auto !important;font-size:1em !important;}
  3 +.syntaxhighlighter.source{overflow:hidden !important;}
  4 +.syntaxhighlighter .bold{font-weight:bold !important;}
  5 +.syntaxhighlighter .italic{font-style:italic !important;}
  6 +.syntaxhighlighter .line{white-space:pre !important;}
  7 +.syntaxhighlighter table{width:100% !important;}
  8 +.syntaxhighlighter table caption{text-align:left !important;padding:.5em 0 0.5em 1em !important;}
  9 +.syntaxhighlighter table td.code{width:100% !important;}
  10 +.syntaxhighlighter table td.code .container{position:relative !important;}
  11 +.syntaxhighlighter table td.code .container textarea{box-sizing:border-box !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:100% !important;border:none !important;background:white !important;padding-left:1em !important;overflow:hidden !important;white-space:pre !important;}
  12 +.syntaxhighlighter table td.gutter .line{text-align:right !important;padding:0 0.5em 0 1em !important;}
  13 +.syntaxhighlighter table td.code .line{padding:0 1em !important;}
  14 +.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0em !important;}
  15 +.syntaxhighlighter.show{display:block !important;}
  16 +.syntaxhighlighter.collapsed table{display:none !important;}
  17 +.syntaxhighlighter.collapsed .toolbar{padding:0.1em 0.8em 0em 0.8em !important;font-size:1em !important;position:static !important;width:auto !important;height:auto !important;}
  18 +.syntaxhighlighter.collapsed .toolbar span{display:inline !important;margin-right:1em !important;}
  19 +.syntaxhighlighter.collapsed .toolbar span a{padding:0 !important;display:none !important;}
  20 +.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline !important;}
  21 +.syntaxhighlighter .toolbar{position:absolute !important;right:1px !important;top:1px !important;width:11px !important;height:11px !important;font-size:10px !important;z-index:10 !important;}
  22 +.syntaxhighlighter .toolbar span.title{display:inline !important;}
  23 +.syntaxhighlighter .toolbar a{display:block !important;text-align:center !important;text-decoration:none !important;padding-top:1px !important;}
  24 +.syntaxhighlighter .toolbar a.expandSource{display:none !important;}
  25 +.syntaxhighlighter.ie{font-size:.9em !important;padding:1px 0 1px 0 !important;}
  26 +.syntaxhighlighter.ie .toolbar{line-height:8px !important;}
  27 +.syntaxhighlighter.ie .toolbar a{padding-top:0px !important;}
  28 +.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:none !important;}
  29 +.syntaxhighlighter.printing .line .number{color:#bbbbbb !important;}
  30 +.syntaxhighlighter.printing .line .content{color:black !important;}
  31 +.syntaxhighlighter.printing .toolbar{display:none !important;}
  32 +.syntaxhighlighter.printing a{text-decoration:none !important;}
  33 +.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:black !important;}
  34 +.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200 !important;}
  35 +.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:blue !important;}
  36 +.syntaxhighlighter.printing .keyword{color:#006699 !important;font-weight:bold !important;}
  37 +.syntaxhighlighter.printing .preprocessor{color:gray !important;}
  38 +.syntaxhighlighter.printing .variable{color:#aa7700 !important;}
  39 +.syntaxhighlighter.printing .value{color:#009900 !important;}
  40 +.syntaxhighlighter.printing .functions{color:#ff1493 !important;}
  41 +.syntaxhighlighter.printing .constants{color:#0066cc !important;}
  42 +.syntaxhighlighter.printing .script{font-weight:bold !important;}
  43 +.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray !important;}
  44 +.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493 !important;}
  45 +.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red !important;}
  46 +.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:black !important;}
  1 +.syntaxhighlighter a,.syntaxhighlighter div,.syntaxhighlighter code,.syntaxhighlighter table,.syntaxhighlighter table td,.syntaxhighlighter table tr,.syntaxhighlighter table tbody,.syntaxhighlighter table thead,.syntaxhighlighter table caption,.syntaxhighlighter textarea{-moz-border-radius:0 0 0 0 !important;-webkit-border-radius:0 0 0 0 !important;background:none !important;border:0 !important;bottom:auto !important;float:none !important;height:auto !important;left:auto !important;line-height:1.1em !important;margin:0 !important;outline:0 !important;overflow:visible !important;padding:0 !important;position:static !important;right:auto !important;text-align:left !important;top:auto !important;vertical-align:baseline !important;width:auto !important;box-sizing:content-box !important;font-family:"Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;font-weight:normal !important;font-style:normal !important;font-size:1em !important;min-height:inherit !important;min-height:auto !important;}
  2 +.syntaxhighlighter{width:100% !important;margin:1em 0 1em 0 !important;position:relative !important;overflow:auto !important;font-size:1em !important;}
  3 +.syntaxhighlighter.source{overflow:hidden !important;}
  4 +.syntaxhighlighter .bold{font-weight:bold !important;}
  5 +.syntaxhighlighter .italic{font-style:italic !important;}
  6 +.syntaxhighlighter .line{white-space:pre !important;}
  7 +.syntaxhighlighter table{width:100% !important;}
  8 +.syntaxhighlighter table caption{text-align:left !important;padding:.5em 0 0.5em 1em !important;}
  9 +.syntaxhighlighter table td.code{width:100% !important;}
  10 +.syntaxhighlighter table td.code .container{position:relative !important;}
  11 +.syntaxhighlighter table td.code .container textarea{box-sizing:border-box !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:100% !important;border:none !important;background:white !important;padding-left:1em !important;overflow:hidden !important;white-space:pre !important;}
  12 +.syntaxhighlighter table td.gutter .line{text-align:right !important;padding:0 0.5em 0 1em !important;}
  13 +.syntaxhighlighter table td.code .line{padding:0 1em !important;}
  14 +.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0em !important;}
  15 +.syntaxhighlighter.show{display:block !important;}
  16 +.syntaxhighlighter.collapsed table{display:none !important;}
  17 +.syntaxhighlighter.collapsed .toolbar{padding:0.1em 0.8em 0em 0.8em !important;font-size:1em !important;position:static !important;width:auto !important;height:auto !important;}
  18 +.syntaxhighlighter.collapsed .toolbar span{display:inline !important;margin-right:1em !important;}
  19 +.syntaxhighlighter.collapsed .toolbar span a{padding:0 !important;display:none !important;}
  20 +.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline !important;}
  21 +.syntaxhighlighter .toolbar{position:absolute !important;right:1px !important;top:1px !important;width:11px !important;height:11px !important;font-size:10px !important;z-index:10 !important;}
  22 +.syntaxhighlighter .toolbar span.title{display:inline !important;}
  23 +.syntaxhighlighter .toolbar a{display:block !important;text-align:center !important;text-decoration:none !important;padding-top:1px !important;}
  24 +.syntaxhighlighter .toolbar a.expandSource{display:none !important;}
  25 +.syntaxhighlighter.ie{font-size:.9em !important;padding:1px 0 1px 0 !important;}
  26 +.syntaxhighlighter.ie .toolbar{line-height:8px !important;}
  27 +.syntaxhighlighter.ie .toolbar a{padding-top:0px !important;}
  28 +.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:none !important;}
  29 +.syntaxhighlighter.printing .line .number{color:#bbbbbb !important;}
  30 +.syntaxhighlighter.printing .line .content{color:black !important;}
  31 +.syntaxhighlighter.printing .toolbar{display:none !important;}
  32 +.syntaxhighlighter.printing a{text-decoration:none !important;}
  33 +.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:black !important;}
  34 +.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200 !important;}
  35 +.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:blue !important;}
  36 +.syntaxhighlighter.printing .keyword{color:#006699 !important;font-weight:bold !important;}
  37 +.syntaxhighlighter.printing .preprocessor{color:gray !important;}
  38 +.syntaxhighlighter.printing .variable{color:#aa7700 !important;}
  39 +.syntaxhighlighter.printing .value{color:#009900 !important;}
  40 +.syntaxhighlighter.printing .functions{color:#ff1493 !important;}
  41 +.syntaxhighlighter.printing .constants{color:#0066cc !important;}
  42 +.syntaxhighlighter.printing .script{font-weight:bold !important;}
  43 +.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray !important;}
  44 +.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493 !important;}
  45 +.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red !important;}
  46 +.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:black !important;}
  47 +.syntaxhighlighter{background-color:white !important;}
  48 +.syntaxhighlighter .line.alt1{background-color:white !important;}
  49 +.syntaxhighlighter .line.alt2{background-color:white !important;}
  50 +.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#e0e0e0 !important;}
  51 +.syntaxhighlighter .line.highlighted.number{color:black !important;}
  52 +.syntaxhighlighter table caption{color:black !important;}
  53 +.syntaxhighlighter .gutter{color:#afafaf !important;}
  54 +.syntaxhighlighter .gutter .line{border-right:3px solid #6ce26c !important;}
  55 +.syntaxhighlighter .gutter .line.highlighted{background-color:#6ce26c !important;color:white !important;}
  56 +.syntaxhighlighter.printing .line .content{border:none !important;}
  57 +.syntaxhighlighter.collapsed{overflow:visible !important;}
  58 +.syntaxhighlighter.collapsed .toolbar{color:blue !important;background:white !important;border:1px solid #6ce26c !important;}
  59 +.syntaxhighlighter.collapsed .toolbar a{color:blue !important;}
  60 +.syntaxhighlighter.collapsed .toolbar a:hover{color:red !important;}
  61 +.syntaxhighlighter .toolbar{color:white !important;background:#6ce26c !important;border:none !important;}
  62 +.syntaxhighlighter .toolbar a{color:white !important;}
  63 +.syntaxhighlighter .toolbar a:hover{color:black !important;}
  64 +.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:black !important;}
  65 +.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#008200 !important;}
  66 +.syntaxhighlighter .string,.syntaxhighlighter .string a{color:blue !important;}
  67 +.syntaxhighlighter .keyword{color:#006699 !important;}
  68 +.syntaxhighlighter .preprocessor{color:gray !important;}
  69 +.syntaxhighlighter .variable{color:#aa7700 !important;}
  70 +.syntaxhighlighter .value{color:#009900 !important;}
  71 +.syntaxhighlighter .functions{color:#ff1493 !important;}
  72 +.syntaxhighlighter .constants{color:#0066cc !important;}
  73 +.syntaxhighlighter .script{font-weight:bold !important;color:#006699 !important;background-color:none !important;}
  74 +.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:gray !important;}
  75 +.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#ff1493 !important;}
  76 +.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:red !important;}
  77 +.syntaxhighlighter .keyword{font-weight:bold !important;}
  1 +.syntaxhighlighter a,.syntaxhighlighter div,.syntaxhighlighter code,.syntaxhighlighter table,.syntaxhighlighter table td,.syntaxhighlighter table tr,.syntaxhighlighter table tbody,.syntaxhighlighter table thead,.syntaxhighlighter table caption,.syntaxhighlighter textarea{-moz-border-radius:0 0 0 0 !important;-webkit-border-radius:0 0 0 0 !important;background:none !important;border:0 !important;bottom:auto !important;float:none !important;height:auto !important;left:auto !important;line-height:1.1em !important;margin:0 !important;outline:0 !important;overflow:visible !important;padding:0 !important;position:static !important;right:auto !important;text-align:left !important;top:auto !important;vertical-align:baseline !important;width:auto !important;box-sizing:content-box !important;font-family:"Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;font-weight:normal !important;font-style:normal !important;font-size:1em !important;min-height:inherit !important;min-height:auto !important;}
  2 +.syntaxhighlighter{width:100% !important;margin:1em 0 1em 0 !important;position:relative !important;overflow:auto !important;font-size:1em !important;}
  3 +.syntaxhighlighter.source{overflow:hidden !important;}
  4 +.syntaxhighlighter .bold{font-weight:bold !important;}
  5 +.syntaxhighlighter .italic{font-style:italic !important;}
  6 +.syntaxhighlighter .line{white-space:pre !important;}
  7 +.syntaxhighlighter table{width:100% !important;}
  8 +.syntaxhighlighter table caption{text-align:left !important;padding:.5em 0 0.5em 1em !important;}
  9 +.syntaxhighlighter table td.code{width:100% !important;}
  10 +.syntaxhighlighter table td.code .container{position:relative !important;}
  11 +.syntaxhighlighter table td.code .container textarea{box-sizing:border-box !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:100% !important;border:none !important;background:white !important;padding-left:1em !important;overflow:hidden !important;white-space:pre !important;}
  12 +.syntaxhighlighter table td.gutter .line{text-align:right !important;padding:0 0.5em 0 1em !important;}
  13 +.syntaxhighlighter table td.code .line{padding:0 1em !important;}
  14 +.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0em !important;}
  15 +.syntaxhighlighter.show{display:block !important;}
  16 +.syntaxhighlighter.collapsed table{display:none !important;}
  17 +.syntaxhighlighter.collapsed .toolbar{padding:0.1em 0.8em 0em 0.8em !important;font-size:1em !important;position:static !important;width:auto !important;height:auto !important;}
  18 +.syntaxhighlighter.collapsed .toolbar span{display:inline !important;margin-right:1em !important;}
  19 +.syntaxhighlighter.collapsed .toolbar span a{padding:0 !important;display:none !important;}
  20 +.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline !important;}
  21 +.syntaxhighlighter .toolbar{position:absolute !important;right:1px !important;top:1px !important;width:11px !important;height:11px !important;font-size:10px !important;z-index:10 !important;}
  22 +.syntaxhighlighter .toolbar span.title{display:inline !important;}
  23 +.syntaxhighlighter .toolbar a{display:block !important;text-align:center !important;text-decoration:none !important;padding-top:1px !important;}
  24 +.syntaxhighlighter .toolbar a.expandSource{display:none !important;}
  25 +.syntaxhighlighter.ie{font-size:.9em !important;padding:1px 0 1px 0 !important;}
  26 +.syntaxhighlighter.ie .toolbar{line-height:8px !important;}
  27 +.syntaxhighlighter.ie .toolbar a{padding-top:0px !important;}
  28 +.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:none !important;}
  29 +.syntaxhighlighter.printing .line .number{color:#bbbbbb !important;}
  30 +.syntaxhighlighter.printing .line .content{color:black !important;}
  31 +.syntaxhighlighter.printing .toolbar{display:none !important;}
  32 +.syntaxhighlighter.printing a{text-decoration:none !important;}
  33 +.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:black !important;}
  34 +.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200 !important;}
  35 +.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:blue !important;}
  36 +.syntaxhighlighter.printing .keyword{color:#006699 !important;font-weight:bold !important;}
  37 +.syntaxhighlighter.printing .preprocessor{color:gray !important;}
  38 +.syntaxhighlighter.printing .variable{color:#aa7700 !important;}
  39 +.syntaxhighlighter.printing .value{color:#009900 !important;}
  40 +.syntaxhighlighter.printing .functions{color:#ff1493 !important;}
  41 +.syntaxhighlighter.printing .constants{color:#0066cc !important;}
  42 +.syntaxhighlighter.printing .script{font-weight:bold !important;}
  43 +.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray !important;}
  44 +.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493 !important;}
  45 +.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red !important;}
  46 +.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:black !important;}
  47 +.syntaxhighlighter{background-color:#0a2b1d !important;}
  48 +.syntaxhighlighter .line.alt1{background-color:#0a2b1d !important;}
  49 +.syntaxhighlighter .line.alt2{background-color:#0a2b1d !important;}
  50 +.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#233729 !important;}
  51 +.syntaxhighlighter .line.highlighted.number{color:white !important;}
  52 +.syntaxhighlighter table caption{color:#f8f8f8 !important;}
  53 +.syntaxhighlighter .gutter{color:#497958 !important;}
  54 +.syntaxhighlighter .gutter .line{border-right:3px solid #41a83e !important;}
  55 +.syntaxhighlighter .gutter .line.highlighted{background-color:#41a83e !important;color:#0a2b1d !important;}
  56 +.syntaxhighlighter.printing .line .content{border:none !important;}
  57 +.syntaxhighlighter.collapsed{overflow:visible !important;}
  58 +.syntaxhighlighter.collapsed .toolbar{color:#96dd3b !important;background:black !important;border:1px solid #41a83e !important;}
  59 +.syntaxhighlighter.collapsed .toolbar a{color:#96dd3b !important;}
  60 +.syntaxhighlighter.collapsed .toolbar a:hover{color:white !important;}
  61 +.syntaxhighlighter .toolbar{color:white !important;background:#41a83e !important;border:none !important;}
  62 +.syntaxhighlighter .toolbar a{color:white !important;}
  63 +.syntaxhighlighter .toolbar a:hover{color:#ffe862 !important;}
  64 +.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:#f8f8f8 !important;}
  65 +.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#336442 !important;}
  66 +.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#9df39f !important;}
  67 +.syntaxhighlighter .keyword{color:#96dd3b !important;}
  68 +.syntaxhighlighter .preprocessor{color:#91bb9e !important;}
  69 +.syntaxhighlighter .variable{color:#ffaa3e !important;}
  70 +.syntaxhighlighter .value{color:#f7e741 !important;}
  71 +.syntaxhighlighter .functions{color:#ffaa3e !important;}
  72 +.syntaxhighlighter .constants{color:#e0e8ff !important;}
  73 +.syntaxhighlighter .script{font-weight:bold !important;color:#96dd3b !important;background-color:none !important;}
  74 +.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#eb939a !important;}
  75 +.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#91bb9e !important;}
  76 +.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#edef7d !important;}
  77 +.syntaxhighlighter .comments{font-style:italic !important;}
  78 +.syntaxhighlighter .keyword{font-weight:bold !important;}
  1 +.syntaxhighlighter a,.syntaxhighlighter div,.syntaxhighlighter code,.syntaxhighlighter table,.syntaxhighlighter table td,.syntaxhighlighter table tr,.syntaxhighlighter table tbody,.syntaxhighlighter table thead,.syntaxhighlighter table caption,.syntaxhighlighter textarea{-moz-border-radius:0 0 0 0 !important;-webkit-border-radius:0 0 0 0 !important;background:none !important;border:0 !important;bottom:auto !important;float:none !important;height:auto !important;left:auto !important;line-height:1.1em !important;margin:0 !important;outline:0 !important;overflow:visible !important;padding:0 !important;position:static !important;right:auto !important;text-align:left !important;top:auto !important;vertical-align:baseline !important;width:auto !important;box-sizing:content-box !important;font-family:"Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;font-weight:normal !important;font-style:normal !important;font-size:1em !important;min-height:inherit !important;min-height:auto !important;}
  2 +.syntaxhighlighter{width:100% !important;margin:1em 0 1em 0 !important;position:relative !important;overflow:auto !important;font-size:1em !important;}
  3 +.syntaxhighlighter.source{overflow:hidden !important;}
  4 +.syntaxhighlighter .bold{font-weight:bold !important;}
  5 +.syntaxhighlighter .italic{font-style:italic !important;}
  6 +.syntaxhighlighter .line{white-space:pre !important;}
  7 +.syntaxhighlighter table{width:100% !important;}
  8 +.syntaxhighlighter table caption{text-align:left !important;padding:.5em 0 0.5em 1em !important;}
  9 +.syntaxhighlighter table td.code{width:100% !important;}
  10 +.syntaxhighlighter table td.code .container{position:relative !important;}
  11 +.syntaxhighlighter table td.code .container textarea{box-sizing:border-box !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:100% !important;border:none !important;background:white !important;padding-left:1em !important;overflow:hidden !important;white-space:pre !important;}
  12 +.syntaxhighlighter table td.gutter .line{text-align:right !important;padding:0 0.5em 0 1em !important;}
  13 +.syntaxhighlighter table td.code .line{padding:0 1em !important;}
  14 +.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0em !important;}
  15 +.syntaxhighlighter.show{display:block !important;}
  16 +.syntaxhighlighter.collapsed table{display:none !important;}
  17 +.syntaxhighlighter.collapsed .toolbar{padding:0.1em 0.8em 0em 0.8em !important;font-size:1em !important;position:static !important;width:auto !important;height:auto !important;}
  18 +.syntaxhighlighter.collapsed .toolbar span{display:inline !important;margin-right:1em !important;}
  19 +.syntaxhighlighter.collapsed .toolbar span a{padding:0 !important;display:none !important;}
  20 +.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline !important;}
  21 +.syntaxhighlighter .toolbar{position:absolute !important;right:1px !important;top:1px !important;width:11px !important;height:11px !important;font-size:10px !important;z-index:10 !important;}
  22 +.syntaxhighlighter .toolbar span.title{display:inline !important;}
  23 +.syntaxhighlighter .toolbar a{display:block !important;text-align:center !important;text-decoration:none !important;padding-top:1px !important;}
  24 +.syntaxhighlighter .toolbar a.expandSource{display:none !important;}
  25 +.syntaxhighlighter.ie{font-size:.9em !important;padding:1px 0 1px 0 !important;}
  26 +.syntaxhighlighter.ie .toolbar{line-height:8px !important;}
  27 +.syntaxhighlighter.ie .toolbar a{padding-top:0px !important;}
  28 +.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:none !important;}
  29 +.syntaxhighlighter.printing .line .number{color:#bbbbbb !important;}
  30 +.syntaxhighlighter.printing .line .content{color:black !important;}
  31 +.syntaxhighlighter.printing .toolbar{display:none !important;}
  32 +.syntaxhighlighter.printing a{text-decoration:none !important;}
  33 +.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:black !important;}
  34 +.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200 !important;}
  35 +.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:blue !important;}
  36 +.syntaxhighlighter.printing .keyword{color:#006699 !important;font-weight:bold !important;}
  37 +.syntaxhighlighter.printing .preprocessor{color:gray !important;}
  38 +.syntaxhighlighter.printing .variable{color:#aa7700 !important;}
  39 +.syntaxhighlighter.printing .value{color:#009900 !important;}
  40 +.syntaxhighlighter.printing .functions{color:#ff1493 !important;}
  41 +.syntaxhighlighter.printing .constants{color:#0066cc !important;}
  42 +.syntaxhighlighter.printing .script{font-weight:bold !important;}
  43 +.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray !important;}
  44 +.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493 !important;}
  45 +.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red !important;}
  46 +.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:black !important;}
  47 +.syntaxhighlighter{background-color:white !important;}
  48 +.syntaxhighlighter .line.alt1{background-color:white !important;}
  49 +.syntaxhighlighter .line.alt2{background-color:white !important;}
  50 +.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#c3defe !important;}
  51 +.syntaxhighlighter .line.highlighted.number{color:white !important;}
  52 +.syntaxhighlighter table caption{color:black !important;}
  53 +.syntaxhighlighter .gutter{color:#787878 !important;}
  54 +.syntaxhighlighter .gutter .line{border-right:3px solid #d4d0c8 !important;}
  55 +.syntaxhighlighter .gutter .line.highlighted{background-color:#d4d0c8 !important;color:white !important;}
  56 +.syntaxhighlighter.printing .line .content{border:none !important;}
  57 +.syntaxhighlighter.collapsed{overflow:visible !important;}
  58 +.syntaxhighlighter.collapsed .toolbar{color:#3f5fbf !important;background:white !important;border:1px solid #d4d0c8 !important;}
  59 +.syntaxhighlighter.collapsed .toolbar a{color:#3f5fbf !important;}
  60 +.syntaxhighlighter.collapsed .toolbar a:hover{color:#aa7700 !important;}
  61 +.syntaxhighlighter .toolbar{color:#a0a0a0 !important;background:#d4d0c8 !important;border:none !important;}
  62 +.syntaxhighlighter .toolbar a{color:#a0a0a0 !important;}
  63 +.syntaxhighlighter .toolbar a:hover{color:red !important;}
  64 +.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:black !important;}
  65 +.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#3f5fbf !important;}
  66 +.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#2a00ff !important;}
  67 +.syntaxhighlighter .keyword{color:#7f0055 !important;}
  68 +.syntaxhighlighter .preprocessor{color:#646464 !important;}
  69 +.syntaxhighlighter .variable{color:#aa7700 !important;}
  70 +.syntaxhighlighter .value{color:#009900 !important;}
  71 +.syntaxhighlighter .functions{color:#ff1493 !important;}
  72 +.syntaxhighlighter .constants{color:#0066cc !important;}
  73 +.syntaxhighlighter .script{font-weight:bold !important;color:#7f0055 !important;background-color:none !important;}
  74 +.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:gray !important;}
  75 +.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#ff1493 !important;}
  76 +.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:red !important;}
  77 +.syntaxhighlighter .keyword{font-weight:bold !important;}
  78 +.syntaxhighlighter .xml .keyword{color:#3f7f7f !important;font-weight:normal !important;}
  79 +.syntaxhighlighter .xml .color1,.syntaxhighlighter .xml .color1 a{color:#7f007f !important;}
  80 +.syntaxhighlighter .xml .string{font-style:italic !important;color:#2a00ff !important;}
  1 +.syntaxhighlighter a,.syntaxhighlighter div,.syntaxhighlighter code,.syntaxhighlighter table,.syntaxhighlighter table td,.syntaxhighlighter table tr,.syntaxhighlighter table tbody,.syntaxhighlighter table thead,.syntaxhighlighter table caption,.syntaxhighlighter textarea{-moz-border-radius:0 0 0 0 !important;-webkit-border-radius:0 0 0 0 !important;background:none !important;border:0 !important;bottom:auto !important;float:none !important;height:auto !important;left:auto !important;line-height:1.1em !important;margin:0 !important;outline:0 !important;overflow:visible !important;padding:0 !important;position:static !important;right:auto !important;text-align:left !important;top:auto !important;vertical-align:baseline !important;width:auto !important;box-sizing:content-box !important;font-family:"Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;font-weight:normal !important;font-style:normal !important;font-size:1em !important;min-height:inherit !important;min-height:auto !important;}
  2 +.syntaxhighlighter{width:100% !important;margin:1em 0 1em 0 !important;position:relative !important;overflow:auto !important;font-size:1em !important;}
  3 +.syntaxhighlighter.source{overflow:hidden !important;}
  4 +.syntaxhighlighter .bold{font-weight:bold !important;}
  5 +.syntaxhighlighter .italic{font-style:italic !important;}
  6 +.syntaxhighlighter .line{white-space:pre !important;}
  7 +.syntaxhighlighter table{width:100% !important;}
  8 +.syntaxhighlighter table caption{text-align:left !important;padding:.5em 0 0.5em 1em !important;}
  9 +.syntaxhighlighter table td.code{width:100% !important;}
  10 +.syntaxhighlighter table td.code .container{position:relative !important;}
  11 +.syntaxhighlighter table td.code .container textarea{box-sizing:border-box !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:100% !important;border:none !important;background:white !important;padding-left:1em !important;overflow:hidden !important;white-space:pre !important;}
  12 +.syntaxhighlighter table td.gutter .line{text-align:right !important;padding:0 0.5em 0 1em !important;}
  13 +.syntaxhighlighter table td.code .line{padding:0 1em !important;}
  14 +.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0em !important;}
  15 +.syntaxhighlighter.show{display:block !important;}
  16 +.syntaxhighlighter.collapsed table{display:none !important;}
  17 +.syntaxhighlighter.collapsed .toolbar{padding:0.1em 0.8em 0em 0.8em !important;font-size:1em !important;position:static !important;width:auto !important;height:auto !important;}
  18 +.syntaxhighlighter.collapsed .toolbar span{display:inline !important;margin-right:1em !important;}
  19 +.syntaxhighlighter.collapsed .toolbar span a{padding:0 !important;display:none !important;}
  20 +.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline !important;}
  21 +.syntaxhighlighter .toolbar{position:absolute !important;right:1px !important;top:1px !important;width:11px !important;height:11px !important;font-size:10px !important;z-index:10 !important;}
  22 +.syntaxhighlighter .toolbar span.title{display:inline !important;}
  23 +.syntaxhighlighter .toolbar a{display:block !important;text-align:center !important;text-decoration:none !important;padding-top:1px !important;}
  24 +.syntaxhighlighter .toolbar a.expandSource{display:none !important;}
  25 +.syntaxhighlighter.ie{font-size:.9em !important;padding:1px 0 1px 0 !important;}
  26 +.syntaxhighlighter.ie .toolbar{line-height:8px !important;}
  27 +.syntaxhighlighter.ie .toolbar a{padding-top:0px !important;}
  28 +.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:none !important;}
  29 +.syntaxhighlighter.printing .line .number{color:#bbbbbb !important;}
  30 +.syntaxhighlighter.printing .line .content{color:black !important;}
  31 +.syntaxhighlighter.printing .toolbar{display:none !important;}
  32 +.syntaxhighlighter.printing a{text-decoration:none !important;}
  33 +.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:black !important;}
  34 +.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200 !important;}
  35 +.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:blue !important;}
  36 +.syntaxhighlighter.printing .keyword{color:#006699 !important;font-weight:bold !important;}
  37 +.syntaxhighlighter.printing .preprocessor{color:gray !important;}
  38 +.syntaxhighlighter.printing .variable{color:#aa7700 !important;}
  39 +.syntaxhighlighter.printing .value{color:#009900 !important;}
  40 +.syntaxhighlighter.printing .functions{color:#ff1493 !important;}
  41 +.syntaxhighlighter.printing .constants{color:#0066cc !important;}
  42 +.syntaxhighlighter.printing .script{font-weight:bold !important;}
  43 +.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray !important;}
  44 +.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493 !important;}
  45 +.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red !important;}
  46 +.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:black !important;}
  47 +.syntaxhighlighter{background-color:black !important;}
  48 +.syntaxhighlighter .line.alt1{background-color:black !important;}
  49 +.syntaxhighlighter .line.alt2{background-color:black !important;}
  50 +.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#2a3133 !important;}
  51 +.syntaxhighlighter .line.highlighted.number{color:white !important;}
  52 +.syntaxhighlighter table caption{color:#d3d3d3 !important;}
  53 +.syntaxhighlighter .gutter{color:#d3d3d3 !important;}
  54 +.syntaxhighlighter .gutter .line{border-right:3px solid #990000 !important;}
  55 +.syntaxhighlighter .gutter .line.highlighted{background-color:#990000 !important;color:black !important;}
  56 +.syntaxhighlighter.printing .line .content{border:none !important;}
  57 +.syntaxhighlighter.collapsed{overflow:visible !important;}
  58 +.syntaxhighlighter.collapsed .toolbar{color:#ebdb8d !important;background:black !important;border:1px solid #990000 !important;}
  59 +.syntaxhighlighter.collapsed .toolbar a{color:#ebdb8d !important;}
  60 +.syntaxhighlighter.collapsed .toolbar a:hover{color:#ff7d27 !important;}
  61 +.syntaxhighlighter .toolbar{color:white !important;background:#990000 !important;border:none !important;}
  62 +.syntaxhighlighter .toolbar a{color:white !important;}
  63 +.syntaxhighlighter .toolbar a:hover{color:#9ccff4 !important;}
  64 +.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:#d3d3d3 !important;}
  65 +.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#ff7d27 !important;}
  66 +.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#ff9e7b !important;}
  67 +.syntaxhighlighter .keyword{color:aqua !important;}
  68 +.syntaxhighlighter .preprocessor{color:#aec4de !important;}
  69 +.syntaxhighlighter .variable{color:#ffaa3e !important;}
  70 +.syntaxhighlighter .value{color:#009900 !important;}
  71 +.syntaxhighlighter .functions{color:#81cef9 !important;}
  72 +.syntaxhighlighter .constants{color:#ff9e7b !important;}
  73 +.syntaxhighlighter .script{font-weight:bold !important;color:aqua !important;background-color:none !important;}
  74 +.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#ebdb8d !important;}
  75 +.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#ff7d27 !important;}
  76 +.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#aec4de !important;}
  1 +.syntaxhighlighter a,.syntaxhighlighter div,.syntaxhighlighter code,.syntaxhighlighter table,.syntaxhighlighter table td,.syntaxhighlighter table tr,.syntaxhighlighter table tbody,.syntaxhighlighter table thead,.syntaxhighlighter table caption,.syntaxhighlighter textarea{-moz-border-radius:0 0 0 0 !important;-webkit-border-radius:0 0 0 0 !important;background:none !important;border:0 !important;bottom:auto !important;float:none !important;height:auto !important;left:auto !important;line-height:1.1em !important;margin:0 !important;outline:0 !important;overflow:visible !important;padding:0 !important;position:static !important;right:auto !important;text-align:left !important;top:auto !important;vertical-align:baseline !important;width:auto !important;box-sizing:content-box !important;font-family:"Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;font-weight:normal !important;font-style:normal !important;font-size:1em !important;min-height:inherit !important;min-height:auto !important;}
  2 +.syntaxhighlighter{width:100% !important;margin:1em 0 1em 0 !important;position:relative !important;overflow:auto !important;font-size:1em !important;}
  3 +.syntaxhighlighter.source{overflow:hidden !important;}
  4 +.syntaxhighlighter .bold{font-weight:bold !important;}
  5 +.syntaxhighlighter .italic{font-style:italic !important;}
  6 +.syntaxhighlighter .line{white-space:pre !important;}
  7 +.syntaxhighlighter table{width:100% !important;}
  8 +.syntaxhighlighter table caption{text-align:left !important;padding:.5em 0 0.5em 1em !important;}
  9 +.syntaxhighlighter table td.code{width:100% !important;}
  10 +.syntaxhighlighter table td.code .container{position:relative !important;}
  11 +.syntaxhighlighter table td.code .container textarea{box-sizing:border-box !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:100% !important;border:none !important;background:white !important;padding-left:1em !important;overflow:hidden !important;white-space:pre !important;}
  12 +.syntaxhighlighter table td.gutter .line{text-align:right !important;padding:0 0.5em 0 1em !important;}
  13 +.syntaxhighlighter table td.code .line{padding:0 1em !important;}
  14 +.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0em !important;}
  15 +.syntaxhighlighter.show{display:block !important;}
  16 +.syntaxhighlighter.collapsed table{display:none !important;}
  17 +.syntaxhighlighter.collapsed .toolbar{padding:0.1em 0.8em 0em 0.8em !important;font-size:1em !important;position:static !important;width:auto !important;height:auto !important;}
  18 +.syntaxhighlighter.collapsed .toolbar span{display:inline !important;margin-right:1em !important;}
  19 +.syntaxhighlighter.collapsed .toolbar span a{padding:0 !important;display:none !important;}
  20 +.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline !important;}
  21 +.syntaxhighlighter .toolbar{position:absolute !important;right:1px !important;top:1px !important;width:11px !important;height:11px !important;font-size:10px !important;z-index:10 !important;}
  22 +.syntaxhighlighter .toolbar span.title{display:inline !important;}
  23 +.syntaxhighlighter .toolbar a{display:block !important;text-align:center !important;text-decoration:none !important;padding-top:1px !important;}
  24 +.syntaxhighlighter .toolbar a.expandSource{display:none !important;}
  25 +.syntaxhighlighter.ie{font-size:.9em !important;padding:1px 0 1px 0 !important;}
  26 +.syntaxhighlighter.ie .toolbar{line-height:8px !important;}
  27 +.syntaxhighlighter.ie .toolbar a{padding-top:0px !important;}
  28 +.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:none !important;}
  29 +.syntaxhighlighter.printing .line .number{color:#bbbbbb !important;}
  30 +.syntaxhighlighter.printing .line .content{color:black !important;}
  31 +.syntaxhighlighter.printing .toolbar{display:none !important;}
  32 +.syntaxhighlighter.printing a{text-decoration:none !important;}
  33 +.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:black !important;}
  34 +.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200 !important;}
  35 +.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:blue !important;}
  36 +.syntaxhighlighter.printing .keyword{color:#006699 !important;font-weight:bold !important;}
  37 +.syntaxhighlighter.printing .preprocessor{color:gray !important;}
  38 +.syntaxhighlighter.printing .variable{color:#aa7700 !important;}
  39 +.syntaxhighlighter.printing .value{color:#009900 !important;}
  40 +.syntaxhighlighter.printing .functions{color:#ff1493 !important;}
  41 +.syntaxhighlighter.printing .constants{color:#0066cc !important;}
  42 +.syntaxhighlighter.printing .script{font-weight:bold !important;}
  43 +.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray !important;}
  44 +.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493 !important;}
  45 +.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red !important;}
  46 +.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:black !important;}
  47 +.syntaxhighlighter{background-color:#121212 !important;}
  48 +.syntaxhighlighter .line.alt1{background-color:#121212 !important;}
  49 +.syntaxhighlighter .line.alt2{background-color:#121212 !important;}
  50 +.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#2c2c29 !important;}
  51 +.syntaxhighlighter .line.highlighted.number{color:white !important;}
  52 +.syntaxhighlighter table caption{color:white !important;}
  53 +.syntaxhighlighter .gutter{color:#afafaf !important;}
  54 +.syntaxhighlighter .gutter .line{border-right:3px solid #3185b9 !important;}
  55 +.syntaxhighlighter .gutter .line.highlighted{background-color:#3185b9 !important;color:#121212 !important;}
  56 +.syntaxhighlighter.printing .line .content{border:none !important;}
  57 +.syntaxhighlighter.collapsed{overflow:visible !important;}
  58 +.syntaxhighlighter.collapsed .toolbar{color:#3185b9 !important;background:black !important;border:1px solid #3185b9 !important;}
  59 +.syntaxhighlighter.collapsed .toolbar a{color:#3185b9 !important;}
  60 +.syntaxhighlighter.collapsed .toolbar a:hover{color:#d01d33 !important;}
  61 +.syntaxhighlighter .toolbar{color:white !important;background:#3185b9 !important;border:none !important;}
  62 +.syntaxhighlighter .toolbar a{color:white !important;}
  63 +.syntaxhighlighter .toolbar a:hover{color:#96daff !important;}
  64 +.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:white !important;}
  65 +.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#696854 !important;}
  66 +.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#e3e658 !important;}
  67 +.syntaxhighlighter .keyword{color:#d01d33 !important;}
  68 +.syntaxhighlighter .preprocessor{color:#435a5f !important;}
  69 +.syntaxhighlighter .variable{color:#898989 !important;}
  70 +.syntaxhighlighter .value{color:#009900 !important;}
  71 +.syntaxhighlighter .functions{color:#aaaaaa !important;}
  72 +.syntaxhighlighter .constants{color:#96daff !important;}
  73 +.syntaxhighlighter .script{font-weight:bold !important;color:#d01d33 !important;background-color:none !important;}
  74 +.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#ffc074 !important;}
  75 +.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#4a8cdb !important;}
  76 +.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#96daff !important;}
  77 +.syntaxhighlighter .functions{font-weight:bold !important;}
  1 +.syntaxhighlighter a,.syntaxhighlighter div,.syntaxhighlighter code,.syntaxhighlighter table,.syntaxhighlighter table td,.syntaxhighlighter table tr,.syntaxhighlighter table tbody,.syntaxhighlighter table thead,.syntaxhighlighter table caption,.syntaxhighlighter textarea{-moz-border-radius:0 0 0 0 !important;-webkit-border-radius:0 0 0 0 !important;background:none !important;border:0 !important;bottom:auto !important;float:none !important;height:auto !important;left:auto !important;line-height:1.1em !important;margin:0 !important;outline:0 !important;overflow:visible !important;padding:0 !important;position:static !important;right:auto !important;text-align:left !important;top:auto !important;vertical-align:baseline !important;width:auto !important;box-sizing:content-box !important;font-family:"Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;font-weight:normal !important;font-style:normal !important;font-size:1em !important;min-height:inherit !important;min-height:auto !important;}
  2 +.syntaxhighlighter{width:100% !important;margin:1em 0 1em 0 !important;position:relative !important;overflow:auto !important;font-size:1em !important;}
  3 +.syntaxhighlighter.source{overflow:hidden !important;}
  4 +.syntaxhighlighter .bold{font-weight:bold !important;}
  5 +.syntaxhighlighter .italic{font-style:italic !important;}
  6 +.syntaxhighlighter .line{white-space:pre !important;}
  7 +.syntaxhighlighter table{width:100% !important;}
  8 +.syntaxhighlighter table caption{text-align:left !important;padding:.5em 0 0.5em 1em !important;}
  9 +.syntaxhighlighter table td.code{width:100% !important;}
  10 +.syntaxhighlighter table td.code .container{position:relative !important;}
  11 +.syntaxhighlighter table td.code .container textarea{box-sizing:border-box !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:100% !important;border:none !important;background:white !important;padding-left:1em !important;overflow:hidden !important;white-space:pre !important;}
  12 +.syntaxhighlighter table td.gutter .line{text-align:right !important;padding:0 0.5em 0 1em !important;}
  13 +.syntaxhighlighter table td.code .line{padding:0 1em !important;}
  14 +.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0em !important;}
  15 +.syntaxhighlighter.show{display:block !important;}
  16 +.syntaxhighlighter.collapsed table{display:none !important;}
  17 +.syntaxhighlighter.collapsed .toolbar{padding:0.1em 0.8em 0em 0.8em !important;font-size:1em !important;position:static !important;width:auto !important;height:auto !important;}
  18 +.syntaxhighlighter.collapsed .toolbar span{display:inline !important;margin-right:1em !important;}
  19 +.syntaxhighlighter.collapsed .toolbar span a{padding:0 !important;display:none !important;}
  20 +.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline !important;}
  21 +.syntaxhighlighter .toolbar{position:absolute !important;right:1px !important;top:1px !important;width:11px !important;height:11px !important;font-size:10px !important;z-index:10 !important;}
  22 +.syntaxhighlighter .toolbar span.title{display:inline !important;}
  23 +.syntaxhighlighter .toolbar a{display:block !important;text-align:center !important;text-decoration:none !important;padding-top:1px !important;}
  24 +.syntaxhighlighter .toolbar a.expandSource{display:none !important;}
  25 +.syntaxhighlighter.ie{font-size:.9em !important;padding:1px 0 1px 0 !important;}
  26 +.syntaxhighlighter.ie .toolbar{line-height:8px !important;}
  27 +.syntaxhighlighter.ie .toolbar a{padding-top:0px !important;}
  28 +.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:none !important;}
  29 +.syntaxhighlighter.printing .line .number{color:#bbbbbb !important;}
  30 +.syntaxhighlighter.printing .line .content{color:black !important;}
  31 +.syntaxhighlighter.printing .toolbar{display:none !important;}
  32 +.syntaxhighlighter.printing a{text-decoration:none !important;}
  33 +.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:black !important;}
  34 +.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200 !important;}
  35 +.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:blue !important;}
  36 +.syntaxhighlighter.printing .keyword{color:#006699 !important;font-weight:bold !important;}
  37 +.syntaxhighlighter.printing .preprocessor{color:gray !important;}
  38 +.syntaxhighlighter.printing .variable{color:#aa7700 !important;}
  39 +.syntaxhighlighter.printing .value{color:#009900 !important;}
  40 +.syntaxhighlighter.printing .functions{color:#ff1493 !important;}
  41 +.syntaxhighlighter.printing .constants{color:#0066cc !important;}
  42 +.syntaxhighlighter.printing .script{font-weight:bold !important;}
  43 +.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray !important;}
  44 +.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493 !important;}
  45 +.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red !important;}
  46 +.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:black !important;}
  47 +.syntaxhighlighter{background-color:#222222 !important;}
  48 +.syntaxhighlighter .line.alt1{background-color:#222222 !important;}
  49 +.syntaxhighlighter .line.alt2{background-color:#222222 !important;}
  50 +.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#253e5a !important;}
  51 +.syntaxhighlighter .line.highlighted.number{color:white !important;}
  52 +.syntaxhighlighter table caption{color:lime !important;}
  53 +.syntaxhighlighter .gutter{color:#38566f !important;}
  54 +.syntaxhighlighter .gutter .line{border-right:3px solid #435a5f !important;}
  55 +.syntaxhighlighter .gutter .line.highlighted{background-color:#435a5f !important;color:#222222 !important;}
  56 +.syntaxhighlighter.printing .line .content{border:none !important;}
  57 +.syntaxhighlighter.collapsed{overflow:visible !important;}
  58 +.syntaxhighlighter.collapsed .toolbar{color:#428bdd !important;background:black !important;border:1px solid #435a5f !important;}
  59 +.syntaxhighlighter.collapsed .toolbar a{color:#428bdd !important;}
  60 +.syntaxhighlighter.collapsed .toolbar a:hover{color:lime !important;}
  61 +.syntaxhighlighter .toolbar{color:#aaaaff !important;background:#435a5f !important;border:none !important;}
  62 +.syntaxhighlighter .toolbar a{color:#aaaaff !important;}
  63 +.syntaxhighlighter .toolbar a:hover{color:#9ccff4 !important;}
  64 +.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:lime !important;}
  65 +.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#428bdd !important;}
  66 +.syntaxhighlighter .string,.syntaxhighlighter .string a{color:lime !important;}
  67 +.syntaxhighlighter .keyword{color:#aaaaff !important;}
  68 +.syntaxhighlighter .preprocessor{color:#8aa6c1 !important;}
  69 +.syntaxhighlighter .variable{color:aqua !important;}
  70 +.syntaxhighlighter .value{color:#f7e741 !important;}
  71 +.syntaxhighlighter .functions{color:#ff8000 !important;}
  72 +.syntaxhighlighter .constants{color:yellow !important;}
  73 +.syntaxhighlighter .script{font-weight:bold !important;color:#aaaaff !important;background-color:none !important;}
  74 +.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:red !important;}
  75 +.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:yellow !important;}
  76 +.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#ffaa3e !important;}
  1 +.syntaxhighlighter a,.syntaxhighlighter div,.syntaxhighlighter code,.syntaxhighlighter table,.syntaxhighlighter table td,.syntaxhighlighter table tr,.syntaxhighlighter table tbody,.syntaxhighlighter table thead,.syntaxhighlighter table caption,.syntaxhighlighter textarea{-moz-border-radius:0 0 0 0 !important;-webkit-border-radius:0 0 0 0 !important;background:none !important;border:0 !important;bottom:auto !important;float:none !important;height:auto !important;left:auto !important;line-height:1.1em !important;margin:0 !important;outline:0 !important;overflow:visible !important;padding:0 !important;position:static !important;right:auto !important;text-align:left !important;top:auto !important;vertical-align:baseline !important;width:auto !important;box-sizing:content-box !important;font-family:"Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;font-weight:normal !important;font-style:normal !important;font-size:1em !important;min-height:inherit !important;min-height:auto !important;}
  2 +.syntaxhighlighter{width:100% !important;margin:1em 0 1em 0 !important;position:relative !important;overflow:auto !important;font-size:1em !important;}
  3 +.syntaxhighlighter.source{overflow:hidden !important;}
  4 +.syntaxhighlighter .bold{font-weight:bold !important;}
  5 +.syntaxhighlighter .italic{font-style:italic !important;}
  6 +.syntaxhighlighter .line{white-space:pre !important;}
  7 +.syntaxhighlighter table{width:100% !important;}
  8 +.syntaxhighlighter table caption{text-align:left !important;padding:.5em 0 0.5em 1em !important;}
  9 +.syntaxhighlighter table td.code{width:100% !important;}
  10 +.syntaxhighlighter table td.code .container{position:relative !important;}
  11 +.syntaxhighlighter table td.code .container textarea{box-sizing:border-box !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:100% !important;border:none !important;background:white !important;padding-left:1em !important;overflow:hidden !important;white-space:pre !important;}
  12 +.syntaxhighlighter table td.gutter .line{text-align:right !important;padding:0 0.5em 0 1em !important;}
  13 +.syntaxhighlighter table td.code .line{padding:0 1em !important;}
  14 +.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0em !important;}
  15 +.syntaxhighlighter.show{display:block !important;}
  16 +.syntaxhighlighter.collapsed table{display:none !important;}
  17 +.syntaxhighlighter.collapsed .toolbar{padding:0.1em 0.8em 0em 0.8em !important;font-size:1em !important;position:static !important;width:auto !important;height:auto !important;}
  18 +.syntaxhighlighter.collapsed .toolbar span{display:inline !important;margin-right:1em !important;}
  19 +.syntaxhighlighter.collapsed .toolbar span a{padding:0 !important;display:none !important;}
  20 +.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline !important;}
  21 +.syntaxhighlighter .toolbar{position:absolute !important;right:1px !important;top:1px !important;width:11px !important;height:11px !important;font-size:10px !important;z-index:10 !important;}
  22 +.syntaxhighlighter .toolbar span.title{display:inline !important;}
  23 +.syntaxhighlighter .toolbar a{display:block !important;text-align:center !important;text-decoration:none !important;padding-top:1px !important;}
  24 +.syntaxhighlighter .toolbar a.expandSource{display:none !important;}
  25 +.syntaxhighlighter.ie{font-size:.9em !important;padding:1px 0 1px 0 !important;}
  26 +.syntaxhighlighter.ie .toolbar{line-height:8px !important;}
  27 +.syntaxhighlighter.ie .toolbar a{padding-top:0px !important;}
  28 +.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:none !important;}
  29 +.syntaxhighlighter.printing .line .number{color:#bbbbbb !important;}
  30 +.syntaxhighlighter.printing .line .content{color:black !important;}
  31 +.syntaxhighlighter.printing .toolbar{display:none !important;}
  32 +.syntaxhighlighter.printing a{text-decoration:none !important;}
  33 +.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:black !important;}
  34 +.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200 !important;}
  35 +.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:blue !important;}
  36 +.syntaxhighlighter.printing .keyword{color:#006699 !important;font-weight:bold !important;}
  37 +.syntaxhighlighter.printing .preprocessor{color:gray !important;}
  38 +.syntaxhighlighter.printing .variable{color:#aa7700 !important;}
  39 +.syntaxhighlighter.printing .value{color:#009900 !important;}
  40 +.syntaxhighlighter.printing .functions{color:#ff1493 !important;}
  41 +.syntaxhighlighter.printing .constants{color:#0066cc !important;}
  42 +.syntaxhighlighter.printing .script{font-weight:bold !important;}
  43 +.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray !important;}
  44 +.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493 !important;}
  45 +.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red !important;}
  46 +.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:black !important;}
  47 +.syntaxhighlighter{background-color:#0f192a !important;}
  48 +.syntaxhighlighter .line.alt1{background-color:#0f192a !important;}
  49 +.syntaxhighlighter .line.alt2{background-color:#0f192a !important;}
  50 +.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#253e5a !important;}
  51 +.syntaxhighlighter .line.highlighted.number{color:#38566f !important;}
  52 +.syntaxhighlighter table caption{color:#d1edff !important;}
  53 +.syntaxhighlighter .gutter{color:#afafaf !important;}
  54 +.syntaxhighlighter .gutter .line{border-right:3px solid #435a5f !important;}
  55 +.syntaxhighlighter .gutter .line.highlighted{background-color:#435a5f !important;color:#0f192a !important;}
  56 +.syntaxhighlighter.printing .line .content{border:none !important;}
  57 +.syntaxhighlighter.collapsed{overflow:visible !important;}
  58 +.syntaxhighlighter.collapsed .toolbar{color:#428bdd !important;background:black !important;border:1px solid #435a5f !important;}
  59 +.syntaxhighlighter.collapsed .toolbar a{color:#428bdd !important;}
  60 +.syntaxhighlighter.collapsed .toolbar a:hover{color:#1dc116 !important;}
  61 +.syntaxhighlighter .toolbar{color:#d1edff !important;background:#435a5f !important;border:none !important;}
  62 +.syntaxhighlighter .toolbar a{color:#d1edff !important;}
  63 +.syntaxhighlighter .toolbar a:hover{color:#8aa6c1 !important;}
  64 +.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:#d1edff !important;}
  65 +.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#428bdd !important;}
  66 +.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#1dc116 !important;}
  67 +.syntaxhighlighter .keyword{color:#b43d3d !important;}
  68 +.syntaxhighlighter .preprocessor{color:#8aa6c1 !important;}
  69 +.syntaxhighlighter .variable{color:#ffaa3e !important;}
  70 +.syntaxhighlighter .value{color:#f7e741 !important;}
  71 +.syntaxhighlighter .functions{color:#ffaa3e !important;}
  72 +.syntaxhighlighter .constants{color:#e0e8ff !important;}
  73 +.syntaxhighlighter .script{font-weight:bold !important;color:#b43d3d !important;background-color:none !important;}
  74 +.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#f8bb00 !important;}
  75 +.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:white !important;}
  76 +.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#ffaa3e !important;}
  1 +.syntaxhighlighter a,.syntaxhighlighter div,.syntaxhighlighter code,.syntaxhighlighter table,.syntaxhighlighter table td,.syntaxhighlighter table tr,.syntaxhighlighter table tbody,.syntaxhighlighter table thead,.syntaxhighlighter table caption,.syntaxhighlighter textarea{-moz-border-radius:0 0 0 0 !important;-webkit-border-radius:0 0 0 0 !important;background:none !important;border:0 !important;bottom:auto !important;float:none !important;height:auto !important;left:auto !important;line-height:1.1em !important;margin:0 !important;outline:0 !important;overflow:visible !important;padding:0 !important;position:static !important;right:auto !important;text-align:left !important;top:auto !important;vertical-align:baseline !important;width:auto !important;box-sizing:content-box !important;font-family:"Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;font-weight:normal !important;font-style:normal !important;font-size:1em !important;min-height:inherit !important;min-height:auto !important;}
  2 +.syntaxhighlighter{width:100% !important;margin:1em 0 1em 0 !important;position:relative !important;overflow:auto !important;font-size:1em !important;}
  3 +.syntaxhighlighter.source{overflow:hidden !important;}
  4 +.syntaxhighlighter .bold{font-weight:bold !important;}
  5 +.syntaxhighlighter .italic{font-style:italic !important;}
  6 +.syntaxhighlighter .line{white-space:pre !important;}
  7 +.syntaxhighlighter table{width:100% !important;}
  8 +.syntaxhighlighter table caption{text-align:left !important;padding:.5em 0 0.5em 1em !important;}
  9 +.syntaxhighlighter table td.code{width:100% !important;}
  10 +.syntaxhighlighter table td.code .container{position:relative !important;}
  11 +.syntaxhighlighter table td.code .container textarea{box-sizing:border-box !important;position:absolute !important;left:0 !important;top:0 !important;width:100% !important;height:100% !important;border:none !important;background:white !important;padding-left:1em !important;overflow:hidden !important;white-space:pre !important;}
  12 +.syntaxhighlighter table td.gutter .line{text-align:right !important;padding:0 0.5em 0 1em !important;}
  13 +.syntaxhighlighter table td.code .line{padding:0 1em !important;}
  14 +.syntaxhighlighter.nogutter td.code .container textarea,.syntaxhighlighter.nogutter td.code .line{padding-left:0em !important;}
  15 +.syntaxhighlighter.show{display:block !important;}
  16 +.syntaxhighlighter.collapsed table{display:none !important;}
  17 +.syntaxhighlighter.collapsed .toolbar{padding:0.1em 0.8em 0em 0.8em !important;font-size:1em !important;position:static !important;width:auto !important;height:auto !important;}
  18 +.syntaxhighlighter.collapsed .toolbar span{display:inline !important;margin-right:1em !important;}
  19 +.syntaxhighlighter.collapsed .toolbar span a{padding:0 !important;display:none !important;}
  20 +.syntaxhighlighter.collapsed .toolbar span a.expandSource{display:inline !important;}
  21 +.syntaxhighlighter .toolbar{position:absolute !important;right:1px !important;top:1px !important;width:11px !important;height:11px !important;font-size:10px !important;z-index:10 !important;}
  22 +.syntaxhighlighter .toolbar span.title{display:inline !important;}
  23 +.syntaxhighlighter .toolbar a{display:block !important;text-align:center !important;text-decoration:none !important;padding-top:1px !important;}
  24 +.syntaxhighlighter .toolbar a.expandSource{display:none !important;}
  25 +.syntaxhighlighter.ie{font-size:.9em !important;padding:1px 0 1px 0 !important;}
  26 +.syntaxhighlighter.ie .toolbar{line-height:8px !important;}
  27 +.syntaxhighlighter.ie .toolbar a{padding-top:0px !important;}
  28 +.syntaxhighlighter.printing .line.alt1 .content,.syntaxhighlighter.printing .line.alt2 .content,.syntaxhighlighter.printing .line.highlighted .number,.syntaxhighlighter.printing .line.highlighted.alt1 .content,.syntaxhighlighter.printing .line.highlighted.alt2 .content{background:none !important;}
  29 +.syntaxhighlighter.printing .line .number{color:#bbbbbb !important;}
  30 +.syntaxhighlighter.printing .line .content{color:black !important;}
  31 +.syntaxhighlighter.printing .toolbar{display:none !important;}
  32 +.syntaxhighlighter.printing a{text-decoration:none !important;}
  33 +.syntaxhighlighter.printing .plain,.syntaxhighlighter.printing .plain a{color:black !important;}
  34 +.syntaxhighlighter.printing .comments,.syntaxhighlighter.printing .comments a{color:#008200 !important;}
  35 +.syntaxhighlighter.printing .string,.syntaxhighlighter.printing .string a{color:blue !important;}
  36 +.syntaxhighlighter.printing .keyword{color:#006699 !important;font-weight:bold !important;}
  37 +.syntaxhighlighter.printing .preprocessor{color:gray !important;}
  38 +.syntaxhighlighter.printing .variable{color:#aa7700 !important;}
  39 +.syntaxhighlighter.printing .value{color:#009900 !important;}
  40 +.syntaxhighlighter.printing .functions{color:#ff1493 !important;}
  41 +.syntaxhighlighter.printing .constants{color:#0066cc !important;}
  42 +.syntaxhighlighter.printing .script{font-weight:bold !important;}
  43 +.syntaxhighlighter.printing .color1,.syntaxhighlighter.printing .color1 a{color:gray !important;}
  44 +.syntaxhighlighter.printing .color2,.syntaxhighlighter.printing .color2 a{color:#ff1493 !important;}
  45 +.syntaxhighlighter.printing .color3,.syntaxhighlighter.printing .color3 a{color:red !important;}
  46 +.syntaxhighlighter.printing .break,.syntaxhighlighter.printing .break a{color:black !important;}
  47 +.syntaxhighlighter{background-color:#1b2426 !important;}
  48 +.syntaxhighlighter .line.alt1{background-color:#1b2426 !important;}
  49 +.syntaxhighlighter .line.alt2{background-color:#1b2426 !important;}
  50 +.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#323e41 !important;}
  51 +.syntaxhighlighter .line.highlighted.number{color:#b9bdb6 !important;}
  52 +.syntaxhighlighter table caption{color:#b9bdb6 !important;}
  53 +.syntaxhighlighter .gutter{color:#afafaf !important;}
  54 +.syntaxhighlighter .gutter .line{border-right:3px solid #435a5f !important;}
  55 +.syntaxhighlighter .gutter .line.highlighted{background-color:#435a5f !important;color:#1b2426 !important;}
  56 +.syntaxhighlighter.printing .line .content{border:none !important;}
  57 +.syntaxhighlighter.collapsed{overflow:visible !important;}
  58 +.syntaxhighlighter.collapsed .toolbar{color:#5ba1cf !important;background:black !important;border:1px solid #435a5f !important;}
  59 +.syntaxhighlighter.collapsed .toolbar a{color:#5ba1cf !important;}
  60 +.syntaxhighlighter.collapsed .toolbar a:hover{color:#5ce638 !important;}
  61 +.syntaxhighlighter .toolbar{color:white !important;background:#435a5f !important;border:none !important;}
  62 +.syntaxhighlighter .toolbar a{color:white !important;}
  63 +.syntaxhighlighter .toolbar a:hover{color:#e0e8ff !important;}
  64 +.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:#b9bdb6 !important;}
  65 +.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#878a85 !important;}
  66 +.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#5ce638 !important;}
  67 +.syntaxhighlighter .keyword{color:#5ba1cf !important;}
  68 +.syntaxhighlighter .preprocessor{color:#435a5f !important;}
  69 +.syntaxhighlighter .variable{color:#ffaa3e !important;}
  70 +.syntaxhighlighter .value{color:#009900 !important;}
  71 +.syntaxhighlighter .functions{color:#ffaa3e !important;}
  72 +.syntaxhighlighter .constants{color:#e0e8ff !important;}
  73 +.syntaxhighlighter .script{font-weight:bold !important;color:#5ba1cf !important;background-color:none !important;}
  74 +.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#e0e8ff !important;}
  75 +.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:white !important;}
  76 +.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#ffaa3e !important;}
  1 +.syntaxhighlighter.applescript{background:white;font-size:1em;color:black;}
  2 +.syntaxhighlighter.applescript div,.syntaxhighlighter.applescript code{font:1em/1.25 Verdana,sans-serif !important;}
  3 +.syntaxhighlighter.applescript .code .line{overflow:hidden !important;}
  4 +.syntaxhighlighter.applescript .code .line.highlighted{background:#b5d5ff !important;}
  5 +.syntaxhighlighter.applescript .color1{color:#000000 !important;}
  6 +.syntaxhighlighter.applescript .color2{color:#000000 !important;}
  7 +.syntaxhighlighter.applescript .color3{color:#000000 !important;font-weight:bold !important;}
  8 +.syntaxhighlighter.applescript .keyword{color:#000000 !important;font-weight:bold !important;}
  9 +.syntaxhighlighter.applescript .color4{color:#0000ff !important;font-style:italic !important;}
  10 +.syntaxhighlighter.applescript .comments{color:#4c4d4d !important;}
  11 +.syntaxhighlighter.applescript .plain{color:#408000 !important;}
  12 +.syntaxhighlighter.applescript .string{color:#000000 !important;}
  13 +.syntaxhighlighter.applescript .commandNames{color:#0000ff !important;font-weight:bold !important;}
  14 +.syntaxhighlighter.applescript .parameterNames{color:#0000ff !important;}
  15 +.syntaxhighlighter.applescript .classes{color:#0000ff !important;font-style:italic !important;}
  16 +.syntaxhighlighter.applescript .properties{color:#6c04d4 !important;}
  17 +.syntaxhighlighter.applescript .enumeratedValues{color:#4a1e7f !important;}
  18 +.syntaxhighlighter.applescript .additionCommandNames{color:#0016b0 !important;font-weight:bold !important;}
  19 +.syntaxhighlighter.applescript .additionParameterNames{color:#0016b0 !important;}
  20 +.syntaxhighlighter.applescript .additionClasses{color:#0016b0 !important;font-style:italic !important;}
  21 +.syntaxhighlighter.applescript .spaces{display:inline-block;height:0 !important;font-size:1.75em !important;line-height:0 !important;}
  1 +.syntaxhighlighter{background-color:white !important;}
  2 +.syntaxhighlighter .line.alt1{background-color:white !important;}
  3 +.syntaxhighlighter .line.alt2{background-color:white !important;}
  4 +.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#e0e0e0 !important;}
  5 +.syntaxhighlighter .line.highlighted.number{color:black !important;}
  6 +.syntaxhighlighter table caption{color:black !important;}
  7 +.syntaxhighlighter .gutter{color:#afafaf !important;}
  8 +.syntaxhighlighter .gutter .line{border-right:3px solid #6ce26c !important;}
  9 +.syntaxhighlighter .gutter .line.highlighted{background-color:#6ce26c !important;color:white !important;}
  10 +.syntaxhighlighter.printing .line .content{border:none !important;}
  11 +.syntaxhighlighter.collapsed{overflow:visible !important;}
  12 +.syntaxhighlighter.collapsed .toolbar{color:blue !important;background:white !important;border:1px solid #6ce26c !important;}
  13 +.syntaxhighlighter.collapsed .toolbar a{color:blue !important;}
  14 +.syntaxhighlighter.collapsed .toolbar a:hover{color:red !important;}
  15 +.syntaxhighlighter .toolbar{color:white !important;background:#6ce26c !important;border:none !important;}
  16 +.syntaxhighlighter .toolbar a{color:white !important;}
  17 +.syntaxhighlighter .toolbar a:hover{color:black !important;}
  18 +.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:black !important;}
  19 +.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#008200 !important;}
  20 +.syntaxhighlighter .string,.syntaxhighlighter .string a{color:blue !important;}
  21 +.syntaxhighlighter .keyword{color:#006699 !important;}
  22 +.syntaxhighlighter .preprocessor{color:gray !important;}
  23 +.syntaxhighlighter .variable{color:#aa7700 !important;}
  24 +.syntaxhighlighter .value{color:#009900 !important;}
  25 +.syntaxhighlighter .functions{color:#ff1493 !important;}
  26 +.syntaxhighlighter .constants{color:#0066cc !important;}
  27 +.syntaxhighlighter .script{font-weight:bold !important;color:#006699 !important;background-color:none !important;}
  28 +.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:gray !important;}
  29 +.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#ff1493 !important;}
  30 +.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:red !important;}
  31 +.syntaxhighlighter .keyword{font-weight:bold !important;}
  1 +.syntaxhighlighter{background-color:#0a2b1d !important;}
  2 +.syntaxhighlighter .line.alt1{background-color:#0a2b1d !important;}
  3 +.syntaxhighlighter .line.alt2{background-color:#0a2b1d !important;}
  4 +.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#233729 !important;}
  5 +.syntaxhighlighter .line.highlighted.number{color:white !important;}
  6 +.syntaxhighlighter table caption{color:#f8f8f8 !important;}
  7 +.syntaxhighlighter .gutter{color:#497958 !important;}
  8 +.syntaxhighlighter .gutter .line{border-right:3px solid #41a83e !important;}
  9 +.syntaxhighlighter .gutter .line.highlighted{background-color:#41a83e !important;color:#0a2b1d !important;}
  10 +.syntaxhighlighter.printing .line .content{border:none !important;}
  11 +.syntaxhighlighter.collapsed{overflow:visible !important;}
  12 +.syntaxhighlighter.collapsed .toolbar{color:#96dd3b !important;background:black !important;border:1px solid #41a83e !important;}
  13 +.syntaxhighlighter.collapsed .toolbar a{color:#96dd3b !important;}
  14 +.syntaxhighlighter.collapsed .toolbar a:hover{color:white !important;}
  15 +.syntaxhighlighter .toolbar{color:white !important;background:#41a83e !important;border:none !important;}
  16 +.syntaxhighlighter .toolbar a{color:white !important;}
  17 +.syntaxhighlighter .toolbar a:hover{color:#ffe862 !important;}
  18 +.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:#f8f8f8 !important;}
  19 +.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#336442 !important;}
  20 +.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#9df39f !important;}
  21 +.syntaxhighlighter .keyword{color:#96dd3b !important;}
  22 +.syntaxhighlighter .preprocessor{color:#91bb9e !important;}
  23 +.syntaxhighlighter .variable{color:#ffaa3e !important;}
  24 +.syntaxhighlighter .value{color:#f7e741 !important;}
  25 +.syntaxhighlighter .functions{color:#ffaa3e !important;}
  26 +.syntaxhighlighter .constants{color:#e0e8ff !important;}
  27 +.syntaxhighlighter .script{font-weight:bold !important;color:#96dd3b !important;background-color:none !important;}
  28 +.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#eb939a !important;}
  29 +.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#91bb9e !important;}
  30 +.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#edef7d !important;}
  31 +.syntaxhighlighter .comments{font-style:italic !important;}
  32 +.syntaxhighlighter .keyword{font-weight:bold !important;}
  1 +.syntaxhighlighter{background-color:white !important;}
  2 +.syntaxhighlighter .line.alt1{background-color:white !important;}
  3 +.syntaxhighlighter .line.alt2{background-color:white !important;}
  4 +.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#c3defe !important;}
  5 +.syntaxhighlighter .line.highlighted.number{color:white !important;}
  6 +.syntaxhighlighter table caption{color:black !important;}
  7 +.syntaxhighlighter .gutter{color:#787878 !important;}
  8 +.syntaxhighlighter .gutter .line{border-right:3px solid #d4d0c8 !important;}
  9 +.syntaxhighlighter .gutter .line.highlighted{background-color:#d4d0c8 !important;color:white !important;}
  10 +.syntaxhighlighter.printing .line .content{border:none !important;}
  11 +.syntaxhighlighter.collapsed{overflow:visible !important;}
  12 +.syntaxhighlighter.collapsed .toolbar{color:#3f5fbf !important;background:white !important;border:1px solid #d4d0c8 !important;}
  13 +.syntaxhighlighter.collapsed .toolbar a{color:#3f5fbf !important;}
  14 +.syntaxhighlighter.collapsed .toolbar a:hover{color:#aa7700 !important;}
  15 +.syntaxhighlighter .toolbar{color:#a0a0a0 !important;background:#d4d0c8 !important;border:none !important;}
  16 +.syntaxhighlighter .toolbar a{color:#a0a0a0 !important;}
  17 +.syntaxhighlighter .toolbar a:hover{color:red !important;}
  18 +.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:black !important;}
  19 +.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#3f5fbf !important;}
  20 +.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#2a00ff !important;}
  21 +.syntaxhighlighter .keyword{color:#7f0055 !important;}
  22 +.syntaxhighlighter .preprocessor{color:#646464 !important;}
  23 +.syntaxhighlighter .variable{color:#aa7700 !important;}
  24 +.syntaxhighlighter .value{color:#009900 !important;}
  25 +.syntaxhighlighter .functions{color:#ff1493 !important;}
  26 +.syntaxhighlighter .constants{color:#0066cc !important;}
  27 +.syntaxhighlighter .script{font-weight:bold !important;color:#7f0055 !important;background-color:none !important;}
  28 +.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:gray !important;}
  29 +.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#ff1493 !important;}
  30 +.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:red !important;}
  31 +.syntaxhighlighter .keyword{font-weight:bold !important;}
  32 +.syntaxhighlighter .xml .keyword{color:#3f7f7f !important;font-weight:normal !important;}
  33 +.syntaxhighlighter .xml .color1,.syntaxhighlighter .xml .color1 a{color:#7f007f !important;}
  34 +.syntaxhighlighter .xml .string{font-style:italic !important;color:#2a00ff !important;}
  1 +.syntaxhighlighter{background-color:black !important;}
  2 +.syntaxhighlighter .line.alt1{background-color:black !important;}
  3 +.syntaxhighlighter .line.alt2{background-color:black !important;}
  4 +.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#2a3133 !important;}
  5 +.syntaxhighlighter .line.highlighted.number{color:white !important;}
  6 +.syntaxhighlighter table caption{color:#d3d3d3 !important;}
  7 +.syntaxhighlighter .gutter{color:#d3d3d3 !important;}
  8 +.syntaxhighlighter .gutter .line{border-right:3px solid #990000 !important;}
  9 +.syntaxhighlighter .gutter .line.highlighted{background-color:#990000 !important;color:black !important;}
  10 +.syntaxhighlighter.printing .line .content{border:none !important;}
  11 +.syntaxhighlighter.collapsed{overflow:visible !important;}
  12 +.syntaxhighlighter.collapsed .toolbar{color:#ebdb8d !important;background:black !important;border:1px solid #990000 !important;}
  13 +.syntaxhighlighter.collapsed .toolbar a{color:#ebdb8d !important;}
  14 +.syntaxhighlighter.collapsed .toolbar a:hover{color:#ff7d27 !important;}
  15 +.syntaxhighlighter .toolbar{color:white !important;background:#990000 !important;border:none !important;}
  16 +.syntaxhighlighter .toolbar a{color:white !important;}
  17 +.syntaxhighlighter .toolbar a:hover{color:#9ccff4 !important;}
  18 +.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:#d3d3d3 !important;}
  19 +.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#ff7d27 !important;}
  20 +.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#ff9e7b !important;}
  21 +.syntaxhighlighter .keyword{color:aqua !important;}
  22 +.syntaxhighlighter .preprocessor{color:#aec4de !important;}
  23 +.syntaxhighlighter .variable{color:#ffaa3e !important;}
  24 +.syntaxhighlighter .value{color:#009900 !important;}
  25 +.syntaxhighlighter .functions{color:#81cef9 !important;}
  26 +.syntaxhighlighter .constants{color:#ff9e7b !important;}
  27 +.syntaxhighlighter .script{font-weight:bold !important;color:aqua !important;background-color:none !important;}
  28 +.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#ebdb8d !important;}
  29 +.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#ff7d27 !important;}
  30 +.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#aec4de !important;}
  1 +.syntaxhighlighter{background-color:#121212 !important;}
  2 +.syntaxhighlighter .line.alt1{background-color:#121212 !important;}
  3 +.syntaxhighlighter .line.alt2{background-color:#121212 !important;}
  4 +.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#2c2c29 !important;}
  5 +.syntaxhighlighter .line.highlighted.number{color:white !important;}
  6 +.syntaxhighlighter table caption{color:white !important;}
  7 +.syntaxhighlighter .gutter{color:#afafaf !important;}
  8 +.syntaxhighlighter .gutter .line{border-right:3px solid #3185b9 !important;}
  9 +.syntaxhighlighter .gutter .line.highlighted{background-color:#3185b9 !important;color:#121212 !important;}
  10 +.syntaxhighlighter.printing .line .content{border:none !important;}
  11 +.syntaxhighlighter.collapsed{overflow:visible !important;}
  12 +.syntaxhighlighter.collapsed .toolbar{color:#3185b9 !important;background:black !important;border:1px solid #3185b9 !important;}
  13 +.syntaxhighlighter.collapsed .toolbar a{color:#3185b9 !important;}
  14 +.syntaxhighlighter.collapsed .toolbar a:hover{color:#d01d33 !important;}
  15 +.syntaxhighlighter .toolbar{color:white !important;background:#3185b9 !important;border:none !important;}
  16 +.syntaxhighlighter .toolbar a{color:white !important;}
  17 +.syntaxhighlighter .toolbar a:hover{color:#96daff !important;}
  18 +.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:white !important;}
  19 +.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#696854 !important;}
  20 +.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#e3e658 !important;}
  21 +.syntaxhighlighter .keyword{color:#d01d33 !important;}
  22 +.syntaxhighlighter .preprocessor{color:#435a5f !important;}
  23 +.syntaxhighlighter .variable{color:#898989 !important;}
  24 +.syntaxhighlighter .value{color:#009900 !important;}
  25 +.syntaxhighlighter .functions{color:#aaaaaa !important;}
  26 +.syntaxhighlighter .constants{color:#96daff !important;}
  27 +.syntaxhighlighter .script{font-weight:bold !important;color:#d01d33 !important;background-color:none !important;}
  28 +.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#ffc074 !important;}
  29 +.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#4a8cdb !important;}
  30 +.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#96daff !important;}
  31 +.syntaxhighlighter .functions{font-weight:bold !important;}
  1 +.syntaxhighlighter{background-color:#222222 !important;}
  2 +.syntaxhighlighter .line.alt1{background-color:#222222 !important;}
  3 +.syntaxhighlighter .line.alt2{background-color:#222222 !important;}
  4 +.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#253e5a !important;}
  5 +.syntaxhighlighter .line.highlighted.number{color:white !important;}
  6 +.syntaxhighlighter table caption{color:lime !important;}
  7 +.syntaxhighlighter .gutter{color:#38566f !important;}
  8 +.syntaxhighlighter .gutter .line{border-right:3px solid #435a5f !important;}
  9 +.syntaxhighlighter .gutter .line.highlighted{background-color:#435a5f !important;color:#222222 !important;}
  10 +.syntaxhighlighter.printing .line .content{border:none !important;}
  11 +.syntaxhighlighter.collapsed{overflow:visible !important;}
  12 +.syntaxhighlighter.collapsed .toolbar{color:#428bdd !important;background:black !important;border:1px solid #435a5f !important;}
  13 +.syntaxhighlighter.collapsed .toolbar a{color:#428bdd !important;}
  14 +.syntaxhighlighter.collapsed .toolbar a:hover{color:lime !important;}
  15 +.syntaxhighlighter .toolbar{color:#aaaaff !important;background:#435a5f !important;border:none !important;}
  16 +.syntaxhighlighter .toolbar a{color:#aaaaff !important;}
  17 +.syntaxhighlighter .toolbar a:hover{color:#9ccff4 !important;}
  18 +.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:lime !important;}
  19 +.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#428bdd !important;}
  20 +.syntaxhighlighter .string,.syntaxhighlighter .string a{color:lime !important;}
  21 +.syntaxhighlighter .keyword{color:#aaaaff !important;}
  22 +.syntaxhighlighter .preprocessor{color:#8aa6c1 !important;}
  23 +.syntaxhighlighter .variable{color:aqua !important;}
  24 +.syntaxhighlighter .value{color:#f7e741 !important;}
  25 +.syntaxhighlighter .functions{color:#ff8000 !important;}
  26 +.syntaxhighlighter .constants{color:yellow !important;}
  27 +.syntaxhighlighter .script{font-weight:bold !important;color:#aaaaff !important;background-color:none !important;}
  28 +.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:red !important;}
  29 +.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:yellow !important;}
  30 +.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#ffaa3e !important;}
  1 +.syntaxhighlighter{background-color:#0f192a !important;}
  2 +.syntaxhighlighter .line.alt1{background-color:#0f192a !important;}
  3 +.syntaxhighlighter .line.alt2{background-color:#0f192a !important;}
  4 +.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#253e5a !important;}
  5 +.syntaxhighlighter .line.highlighted.number{color:#38566f !important;}
  6 +.syntaxhighlighter table caption{color:#d1edff !important;}
  7 +.syntaxhighlighter .gutter{color:#afafaf !important;}
  8 +.syntaxhighlighter .gutter .line{border-right:3px solid #435a5f !important;}
  9 +.syntaxhighlighter .gutter .line.highlighted{background-color:#435a5f !important;color:#0f192a !important;}
  10 +.syntaxhighlighter.printing .line .content{border:none !important;}
  11 +.syntaxhighlighter.collapsed{overflow:visible !important;}
  12 +.syntaxhighlighter.collapsed .toolbar{color:#428bdd !important;background:black !important;border:1px solid #435a5f !important;}
  13 +.syntaxhighlighter.collapsed .toolbar a{color:#428bdd !important;}
  14 +.syntaxhighlighter.collapsed .toolbar a:hover{color:#1dc116 !important;}
  15 +.syntaxhighlighter .toolbar{color:#d1edff !important;background:#435a5f !important;border:none !important;}
  16 +.syntaxhighlighter .toolbar a{color:#d1edff !important;}
  17 +.syntaxhighlighter .toolbar a:hover{color:#8aa6c1 !important;}
  18 +.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:#d1edff !important;}
  19 +.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#428bdd !important;}
  20 +.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#1dc116 !important;}
  21 +.syntaxhighlighter .keyword{color:#b43d3d !important;}
  22 +.syntaxhighlighter .preprocessor{color:#8aa6c1 !important;}
  23 +.syntaxhighlighter .variable{color:#ffaa3e !important;}
  24 +.syntaxhighlighter .value{color:#f7e741 !important;}
  25 +.syntaxhighlighter .functions{color:#ffaa3e !important;}
  26 +.syntaxhighlighter .constants{color:#e0e8ff !important;}
  27 +.syntaxhighlighter .script{font-weight:bold !important;color:#b43d3d !important;background-color:none !important;}
  28 +.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#f8bb00 !important;}
  29 +.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:white !important;}
  30 +.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#ffaa3e !important;}
  1 +.syntaxhighlighter{background-color:#1b2426 !important;}
  2 +.syntaxhighlighter .line.alt1{background-color:#1b2426 !important;}
  3 +.syntaxhighlighter .line.alt2{background-color:#1b2426 !important;}
  4 +.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#323e41 !important;}
  5 +.syntaxhighlighter .line.highlighted.number{color:#b9bdb6 !important;}
  6 +.syntaxhighlighter table caption{color:#b9bdb6 !important;}
  7 +.syntaxhighlighter .gutter{color:#afafaf !important;}
  8 +.syntaxhighlighter .gutter .line{border-right:3px solid #435a5f !important;}
  9 +.syntaxhighlighter .gutter .line.highlighted{background-color:#435a5f !important;color:#1b2426 !important;}
  10 +.syntaxhighlighter.printing .line .content{border:none !important;}
  11 +.syntaxhighlighter.collapsed{overflow:visible !important;}
  12 +.syntaxhighlighter.collapsed .toolbar{color:#5ba1cf !important;background:black !important;border:1px solid #435a5f !important;}
  13 +.syntaxhighlighter.collapsed .toolbar a{color:#5ba1cf !important;}
  14 +.syntaxhighlighter.collapsed .toolbar a:hover{color:#5ce638 !important;}
  15 +.syntaxhighlighter .toolbar{color:white !important;background:#435a5f !important;border:none !important;}
  16 +.syntaxhighlighter .toolbar a{color:white !important;}
  17 +.syntaxhighlighter .toolbar a:hover{color:#e0e8ff !important;}
  18 +.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:#b9bdb6 !important;}
  19 +.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#878a85 !important;}
  20 +.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#5ce638 !important;}
  21 +.syntaxhighlighter .keyword{color:#5ba1cf !important;}
  22 +.syntaxhighlighter .preprocessor{color:#435a5f !important;}
  23 +.syntaxhighlighter .variable{color:#ffaa3e !important;}
  24 +.syntaxhighlighter .value{color:#009900 !important;}
  25 +.syntaxhighlighter .functions{color:#ffaa3e !important;}
  26 +.syntaxhighlighter .constants{color:#e0e8ff !important;}
  27 +.syntaxhighlighter .script{font-weight:bold !important;color:#5ba1cf !important;background-color:none !important;}
  28 +.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:#e0e8ff !important;}
  29 +.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:white !important;}
  30 +.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:#ffaa3e !important;}
  1 +.syntaxhighlighter{background-color:white !important;}
  2 +.syntaxhighlighter .line.alt1{background-color:white !important;}
  3 +.syntaxhighlighter .line.alt2{background-color:white !important;}
  4 +.syntaxhighlighter .line.highlighted.alt1,.syntaxhighlighter .line.highlighted.alt2{background-color:#e0e0e0 !important;}
  5 +.syntaxhighlighter .line.highlighted.number{color:black !important;}
  6 +.syntaxhighlighter table caption{color:black !important;}
  7 +.syntaxhighlighter .gutter{color:#afafaf !important;}
  8 +.syntaxhighlighter .gutter .line{border-right:3px solid #6ce26c !important;}
  9 +.syntaxhighlighter .gutter .line.highlighted{background-color:#6ce26c !important;color:white !important;}
  10 +.syntaxhighlighter.printing .line .content{border:none !important;}
  11 +.syntaxhighlighter.collapsed{overflow:visible !important;}
  12 +.syntaxhighlighter.collapsed .toolbar{color:blue !important;background:white !important;border:1px solid #6ce26c !important;}
  13 +.syntaxhighlighter.collapsed .toolbar a{color:blue !important;}
  14 +.syntaxhighlighter.collapsed .toolbar a:hover{color:red !important;}
  15 +.syntaxhighlighter .toolbar{color:white !important;background:#6ce26c !important;border:none !important;}
  16 +.syntaxhighlighter .toolbar a{color:white !important;}
  17 +.syntaxhighlighter .toolbar a:hover{color:black !important;}
  18 +.syntaxhighlighter .plain,.syntaxhighlighter .plain a{color:black !important;}
  19 +.syntaxhighlighter .comments,.syntaxhighlighter .comments a{color:#008200 !important;}
  20 +.syntaxhighlighter .string,.syntaxhighlighter .string a{color:#d11010 !important;}
  21 +.syntaxhighlighter .keyword{color:#006699 !important;}
  22 +.syntaxhighlighter .preprocessor{color:gray !important;}
  23 +.syntaxhighlighter .variable{color:#aa7700 !important;}
  24 +.syntaxhighlighter .value{color:#009900 !important;}
  25 +.syntaxhighlighter .functions{color:#ff1493 !important;}
  26 +.syntaxhighlighter .constants{color:#0066cc !important;}
  27 +.syntaxhighlighter .script{font-weight:bold !important;color:#006699 !important;background-color:none !important;}
  28 +.syntaxhighlighter .color1,.syntaxhighlighter .color1 a{color:gray !important;}
  29 +.syntaxhighlighter .color2,.syntaxhighlighter .color2 a{color:#ff1493 !important;}
  30 +.syntaxhighlighter .color3,.syntaxhighlighter .color3 a{color:red !important;}
  31 +.syntaxhighlighter .keyword{font-weight:bold !important;}
  1 +<?php
  2 +
  3 +/* ------------------------------------------------------------------------ */
  4 +/* EasyPeasyICS
  5 +/* ------------------------------------------------------------------------ */
  6 +/* Manuel Reinhard, manu@sprain.ch
  7 +/* Twitter: @sprain
  8 +/* Web: www.sprain.ch
  9 +/*
  10 +/* Built with inspiration by
  11 +/" http://stackoverflow.com/questions/1463480/how-can-i-use-php-to-dynamically-publish-an-ical-file-to-be-read-by-google-calend/1464355#1464355
  12 +/* ------------------------------------------------------------------------ */
  13 +/* History:
  14 +/* 2010/12/17 - Manuel Reinhard - when it all started
  15 +/* ------------------------------------------------------------------------ */
  16 +
  17 +class EasyPeasyICS {
  18 +
  19 + protected $calendarName;
  20 + protected $events = array();
  21 +
  22 +
  23 + /**
  24 + * Constructor
  25 + * @param string $calendarName
  26 + */
  27 + public function __construct($calendarName=""){
  28 + $this->calendarName = $calendarName;
  29 + }//function
  30 +
  31 +
  32 + /**
  33 + * Add event to calendar
  34 + * @param string $calendarName
  35 + */
  36 + public function addEvent($start, $end, $summary="", $description="", $url=""){
  37 + $this->events[] = array(
  38 + "start" => $start,
  39 + "end" => $end,
  40 + "summary" => $summary,
  41 + "description" => $description,
  42 + "url" => $url
  43 + );
  44 + }//function
  45 +
  46 +
  47 + public function render($output = true){
  48 +
  49 + //start Variable
  50 + $ics = "";
  51 +
  52 + //Add header
  53 + $ics .= "BEGIN:VCALENDAR
  54 +METHOD:PUBLISH
  55 +VERSION:2.0
  56 +X-WR-CALNAME:".$this->calendarName."
  57 +PRODID:-//hacksw/handcal//NONSGML v1.0//EN";
  58 +
  59 + //Add events
  60 + foreach($this->events as $event){
  61 + $ics .= "
  62 +BEGIN:VEVENT
  63 +UID:". md5(uniqid(mt_rand(), true)) ."@EasyPeasyICS.php
  64 +DTSTAMP:" . gmdate('Ymd').'T'. gmdate('His') . "Z
  65 +DTSTART:".gmdate('Ymd', $event["start"])."T".gmdate('His', $event["start"])."Z
  66 +DTEND:".gmdate('Ymd', $event["end"])."T".gmdate('His', $event["end"])."Z
  67 +SUMMARY:".str_replace("\n", "\\n", $event['summary'])."
  68 +DESCRIPTION:".str_replace("\n", "\\n", $event['description'])."
  69 +URL;VALUE=URI:".$event['url']."
  70 +END:VEVENT";
  71 + }//foreach
  72 +
  73 +
  74 + //Footer
  75 + $ics .= "
  76 +END:VCALENDAR";
  77 +
  78 +
  79 + if ($output) {
  80 + //Output
  81 + header('Content-type: text/calendar; charset=utf-8');
  82 + header('Content-Disposition: inline; filename='.$this->calendarName.'.ics');
  83 + echo $ics;
  84 + } else {
  85 + return $ics;
  86 + }
  87 +
  88 + }//function
  89 +
  90 +}//class
  1 +<?php
  2 +/*************************************************************************
  3 + * *
  4 + * Converts HTML to formatted plain text *
  5 + * *
  6 + * Portions Copyright (c) 2005-2007 Jon Abernathy <jon@chuggnutt.com> *
  7 + * This version from https://github.com/mtibben/html2text *
  8 + * *
  9 + * This script is free software; you can redistribute it and/or modify *
  10 + * it under the terms of the GNU General Public License as published by *
  11 + * the Free Software Foundation; either version 2 of the License, or *
  12 + * (at your option) any later version. *
  13 + * *
  14 + * The GNU General Public License can be found at *
  15 + * http://www.gnu.org/copyleft/gpl.html. *
  16 + * *
  17 + * This script is distributed in the hope that it will be useful, *
  18 + * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  19 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  20 + * GNU General Public License for more details. *
  21 + * *
  22 + *************************************************************************/
  23 +
  24 +
  25 +class html2text
  26 +{
  27 +
  28 + /**
  29 + * Contains the HTML content to convert.
  30 + *
  31 + * @var string $html
  32 + * @access public
  33 + */
  34 + public $html;
  35 +
  36 + /**
  37 + * Contains the converted, formatted text.
  38 + *
  39 + * @var string $text
  40 + * @access public
  41 + */
  42 + public $text;
  43 +
  44 + /**
  45 + * Maximum width of the formatted text, in columns.
  46 + *
  47 + * Set this value to 0 (or less) to ignore word wrapping
  48 + * and not constrain text to a fixed-width column.
  49 + *
  50 + * @var integer $width
  51 + * @access public
  52 + */
  53 + public $width = 70;
  54 +
  55 + /**
  56 + * List of preg* regular expression patterns to search for,
  57 + * used in conjunction with $replace.
  58 + *
  59 + * @var array $search
  60 + * @access public
  61 + * @see $replace
  62 + */
  63 + public $search = array(
  64 + "/\r/", // Non-legal carriage return
  65 + "/[\n\t]+/", // Newlines and tabs
  66 + '/<head[^>]*>.*?<\/head>/i', // <head>
  67 + '/<script[^>]*>.*?<\/script>/i', // <script>s -- which strip_tags supposedly has problems with
  68 + '/<style[^>]*>.*?<\/style>/i', // <style>s -- which strip_tags supposedly has problems with
  69 + '/<p[^>]*>/i', // <P>
  70 + '/<br[^>]*>/i', // <br>
  71 + '/<i[^>]*>(.*?)<\/i>/i', // <i>
  72 + '/<em[^>]*>(.*?)<\/em>/i', // <em>
  73 + '/(<ul[^>]*>|<\/ul>)/i', // <ul> and </ul>
  74 + '/(<ol[^>]*>|<\/ol>)/i', // <ol> and </ol>
  75 + '/<li[^>]*>(.*?)<\/li>/i', // <li> and </li>
  76 + '/<li[^>]*>/i', // <li>
  77 + '/<hr[^>]*>/i', // <hr>
  78 + '/<div[^>]*>/i', // <div>
  79 + '/(<table[^>]*>|<\/table>)/i', // <table> and </table>
  80 + '/(<tr[^>]*>|<\/tr>)/i', // <tr> and </tr>
  81 + '/<td[^>]*>(.*?)<\/td>/i', // <td> and </td>
  82 + '/<span class="_html2text_ignore">.+?<\/span>/i' // <span class="_html2text_ignore">...</span>
  83 + );
  84 +
  85 + /**
  86 + * List of pattern replacements corresponding to patterns searched.
  87 + *
  88 + * @var array $replace
  89 + * @access public
  90 + * @see $search
  91 + */
  92 + public $replace = array(
  93 + '', // Non-legal carriage return
  94 + ' ', // Newlines and tabs
  95 + '', // <head>
  96 + '', // <script>s -- which strip_tags supposedly has problems with
  97 + '', // <style>s -- which strip_tags supposedly has problems with
  98 + "\n\n", // <P>
  99 + "\n", // <br>
  100 + '_\\1_', // <i>
  101 + '_\\1_', // <em>
  102 + "\n\n", // <ul> and </ul>
  103 + "\n\n", // <ol> and </ol>
  104 + "\t* \\1\n", // <li> and </li>
  105 + "\n\t* ", // <li>
  106 + "\n-------------------------\n", // <hr>
  107 + "<div>\n", // <div>
  108 + "\n\n", // <table> and </table>
  109 + "\n", // <tr> and </tr>
  110 + "\t\t\\1\n", // <td> and </td>
  111 + "" // <span class="_html2text_ignore">...</span>
  112 + );
  113 +
  114 + /**
  115 + * List of preg* regular expression patterns to search for,
  116 + * used in conjunction with $ent_replace.
  117 + *
  118 + * @var array $ent_search
  119 + * @access public
  120 + * @see $ent_replace
  121 + */
  122 + public $ent_search = array(
  123 + '/&(nbsp|#160);/i', // Non-breaking space
  124 + '/&(quot|rdquo|ldquo|#8220|#8221|#147|#148);/i',
  125 + // Double quotes
  126 + '/&(apos|rsquo|lsquo|#8216|#8217);/i', // Single quotes
  127 + '/&gt;/i', // Greater-than
  128 + '/&lt;/i', // Less-than
  129 + '/&(copy|#169);/i', // Copyright
  130 + '/&(trade|#8482|#153);/i', // Trademark
  131 + '/&(reg|#174);/i', // Registered
  132 + '/&(mdash|#151|#8212);/i', // mdash
  133 + '/&(ndash|minus|#8211|#8722);/i', // ndash
  134 + '/&(bull|#149|#8226);/i', // Bullet
  135 + '/&(pound|#163);/i', // Pound sign
  136 + '/&(euro|#8364);/i', // Euro sign
  137 + '/&(amp|#38);/i', // Ampersand: see _converter()
  138 + '/[ ]{2,}/', // Runs of spaces, post-handling
  139 + );
  140 +
  141 + /**
  142 + * List of pattern replacements corresponding to patterns searched.
  143 + *
  144 + * @var array $ent_replace
  145 + * @access public
  146 + * @see $ent_search
  147 + */
  148 + public $ent_replace = array(
  149 + ' ', // Non-breaking space
  150 + '"', // Double quotes
  151 + "'", // Single quotes
  152 + '>',
  153 + '<',
  154 + '(c)',
  155 + '(tm)',
  156 + '(R)',
  157 + '--',
  158 + '-',
  159 + '*',
  160 + '£',
  161 + 'EUR', // Euro sign. € ?
  162 + '|+|amp|+|', // Ampersand: see _converter()
  163 + ' ', // Runs of spaces, post-handling
  164 + );
  165 +
  166 + /**
  167 + * List of preg* regular expression patterns to search for
  168 + * and replace using callback function.
  169 + *
  170 + * @var array $callback_search
  171 + * @access public
  172 + */
  173 + public $callback_search = array(
  174 + '/<(a) [^>]*href=("|\')([^"\']+)\2([^>]*)>(.*?)<\/a>/i', // <a href="">
  175 + '/<(h)[123456]( [^>]*)?>(.*?)<\/h[123456]>/i', // h1 - h6
  176 + '/<(b)( [^>]*)?>(.*?)<\/b>/i', // <b>
  177 + '/<(strong)( [^>]*)?>(.*?)<\/strong>/i', // <strong>
  178 + '/<(th)( [^>]*)?>(.*?)<\/th>/i', // <th> and </th>
  179 + );
  180 +
  181 + /**
  182 + * List of preg* regular expression patterns to search for in PRE body,
  183 + * used in conjunction with $pre_replace.
  184 + *
  185 + * @var array $pre_search
  186 + * @access public
  187 + * @see $pre_replace
  188 + */
  189 + public $pre_search = array(
  190 + "/\n/",
  191 + "/\t/",
  192 + '/ /',
  193 + '/<pre[^>]*>/',
  194 + '/<\/pre>/'
  195 + );
  196 +
  197 + /**
  198 + * List of pattern replacements corresponding to patterns searched for PRE body.
  199 + *
  200 + * @var array $pre_replace
  201 + * @access public
  202 + * @see $pre_search
  203 + */
  204 + public $pre_replace = array(
  205 + '<br>',
  206 + '&nbsp;&nbsp;&nbsp;&nbsp;',
  207 + '&nbsp;',
  208 + '',
  209 + ''
  210 + );
  211 +
  212 + /**
  213 + * Contains a list of HTML tags to allow in the resulting text.
  214 + *
  215 + * @var string $allowed_tags
  216 + * @access public
  217 + * @see set_allowed_tags()
  218 + */
  219 + public $allowed_tags = '';
  220 +
  221 + /**
  222 + * Contains the base URL that relative links should resolve to.
  223 + *
  224 + * @var string $url
  225 + * @access public
  226 + */
  227 + public $url;
  228 +
  229 + /**
  230 + * Indicates whether content in the $html variable has been converted yet.
  231 + *
  232 + * @var boolean $_converted
  233 + * @access private
  234 + * @see $html, $text
  235 + */
  236 + private $_converted = false;
  237 +
  238 + /**
  239 + * Contains URL addresses from links to be rendered in plain text.
  240 + *
  241 + * @var array $_link_list
  242 + * @access private
  243 + * @see _build_link_list()
  244 + */
  245 + private $_link_list = array();
  246 +
  247 +
  248 + /**
  249 + * Various configuration options (able to be set in the constructor)
  250 + *
  251 + * @var array $_options
  252 + * @access private
  253 + */
  254 + private $_options = array(
  255 +
  256 + // 'none'
  257 + // 'inline' (show links inline)
  258 + // 'nextline' (show links on the next line)
  259 + // 'table' (if a table of link URLs should be listed after the text.
  260 + 'do_links' => 'inline',
  261 +
  262 + // Maximum width of the formatted text, in columns.
  263 + // Set this value to 0 (or less) to ignore word wrapping
  264 + // and not constrain text to a fixed-width column.
  265 + 'width' => 70,
  266 + );
  267 +
  268 +
  269 + /**
  270 + * Constructor.
  271 + *
  272 + * If the HTML source string (or file) is supplied, the class
  273 + * will instantiate with that source propagated, all that has
  274 + * to be done it to call get_text().
  275 + *
  276 + * @param string $source HTML content
  277 + * @param boolean $from_file Indicates $source is a file to pull content from
  278 + * @param array $options Set configuration options
  279 + * @access public
  280 + * @return void
  281 + */
  282 + public function __construct( $source = '', $from_file = false, $options = array() )
  283 + {
  284 + $this->_options = array_merge($this->_options, $options);
  285 +
  286 + if ( !empty($source) ) {
  287 + $this->set_html($source, $from_file);
  288 + }
  289 +
  290 + $this->set_base_url();
  291 + }
  292 +
  293 + /**
  294 + * Loads source HTML into memory, either from $source string or a file.
  295 + *
  296 + * @param string $source HTML content
  297 + * @param boolean $from_file Indicates $source is a file to pull content from
  298 + * @access public
  299 + * @return void
  300 + */
  301 + public function set_html( $source, $from_file = false )
  302 + {
  303 + if ( $from_file && file_exists($source) ) {
  304 + $this->html = file_get_contents($source);
  305 + }
  306 + else
  307 + $this->html = $source;
  308 +
  309 + $this->_converted = false;
  310 + }
  311 +
  312 + /**
  313 + * Returns the text, converted from HTML.
  314 + *
  315 + * @access public
  316 + * @return string
  317 + */
  318 + public function get_text()
  319 + {
  320 + if ( !$this->_converted ) {
  321 + $this->_convert();
  322 + }
  323 +
  324 + return $this->text;
  325 + }
  326 +
  327 + /**
  328 + * Prints the text, converted from HTML.
  329 + *
  330 + * @access public
  331 + * @return void
  332 + */
  333 + public function print_text()
  334 + {
  335 + print $this->get_text();
  336 + }
  337 +
  338 + /**
  339 + * Alias to print_text(), operates identically.
  340 + *
  341 + * @access public
  342 + * @return void
  343 + * @see print_text()
  344 + */
  345 + public function p()
  346 + {
  347 + print $this->get_text();
  348 + }
  349 +
  350 + /**
  351 + * Sets the allowed HTML tags to pass through to the resulting text.
  352 + *
  353 + * Tags should be in the form "<p>", with no corresponding closing tag.
  354 + *
  355 + * @access public
  356 + * @return void
  357 + */
  358 + public function set_allowed_tags( $allowed_tags = '' )
  359 + {
  360 + if ( !empty($allowed_tags) ) {
  361 + $this->allowed_tags = $allowed_tags;
  362 + }
  363 + }
  364 +
  365 + /**
  366 + * Sets a base URL to handle relative links.
  367 + *
  368 + * @access public
  369 + * @return void
  370 + */
  371 + public function set_base_url( $url = '' )
  372 + {
  373 + if ( empty($url) ) {
  374 + if ( !empty($_SERVER['HTTP_HOST']) ) {
  375 + $this->url = 'http://' . $_SERVER['HTTP_HOST'];
  376 + } else {
  377 + $this->url = '';
  378 + }
  379 + } else {
  380 + // Strip any trailing slashes for consistency (relative
  381 + // URLs may already start with a slash like "/file.html")
  382 + if ( substr($url, -1) == '/' ) {
  383 + $url = substr($url, 0, -1);
  384 + }
  385 + $this->url = $url;
  386 + }
  387 + }
  388 +
  389 + /**
  390 + * Workhorse function that does actual conversion (calls _converter() method).
  391 + *
  392 + * @access private
  393 + * @return void
  394 + */
  395 + private function _convert()
  396 + {
  397 + // Variables used for building the link list
  398 + $this->_link_list = array();
  399 +
  400 + $text = trim(stripslashes($this->html));
  401 +
  402 + // Convert HTML to TXT
  403 + $this->_converter($text);
  404 +
  405 + // Add link list
  406 + if (!empty($this->_link_list)) {
  407 + $text .= "\n\nLinks:\n------\n";
  408 + foreach ($this->_link_list as $idx => $url) {
  409 + $text .= '[' . ($idx+1) . '] ' . $url . "\n";
  410 + }
  411 + }
  412 +
  413 + $this->text = $text;
  414 +
  415 + $this->_converted = true;
  416 + }
  417 +
  418 + /**
  419 + * Workhorse function that does actual conversion.
  420 + *
  421 + * First performs custom tag replacement specified by $search and
  422 + * $replace arrays. Then strips any remaining HTML tags, reduces whitespace
  423 + * and newlines to a readable format, and word wraps the text to
  424 + * $this->_options['width'] characters.
  425 + *
  426 + * @param string Reference to HTML content string
  427 + *
  428 + * @access private
  429 + * @return void
  430 + */
  431 + private function _converter(&$text)
  432 + {
  433 + // Convert <BLOCKQUOTE> (before PRE!)
  434 + $this->_convert_blockquotes($text);
  435 +
  436 + // Convert <PRE>
  437 + $this->_convert_pre($text);
  438 +
  439 + // Run our defined tags search-and-replace
  440 + $text = preg_replace($this->search, $this->replace, $text);
  441 +
  442 + // Run our defined tags search-and-replace with callback
  443 + $text = preg_replace_callback($this->callback_search, array($this, '_preg_callback'), $text);
  444 +
  445 + // Strip any other HTML tags
  446 + $text = strip_tags($text, $this->allowed_tags);
  447 +
  448 + // Run our defined entities/characters search-and-replace
  449 + $text = preg_replace($this->ent_search, $this->ent_replace, $text);
  450 +
  451 + // Replace known html entities
  452 + $text = html_entity_decode($text, ENT_QUOTES);
  453 +
  454 + // Remove unknown/unhandled entities (this cannot be done in search-and-replace block)
  455 + $text = preg_replace('/&([a-zA-Z0-9]{2,6}|#[0-9]{2,4});/', '', $text);
  456 +
  457 + // Convert "|+|amp|+|" into "&", need to be done after handling of unknown entities
  458 + // This properly handles situation of "&amp;quot;" in input string
  459 + $text = str_replace('|+|amp|+|', '&', $text);
  460 +
  461 + // Bring down number of empty lines to 2 max
  462 + $text = preg_replace("/\n\s+\n/", "\n\n", $text);
  463 + $text = preg_replace("/[\n]{3,}/", "\n\n", $text);
  464 +
  465 + // remove leading empty lines (can be produced by eg. P tag on the beginning)
  466 + $text = ltrim($text, "\n");
  467 +
  468 + // Wrap the text to a readable format
  469 + // for PHP versions >= 4.0.2. Default width is 75
  470 + // If width is 0 or less, don't wrap the text.
  471 + if ( $this->_options['width'] > 0 ) {
  472 + $text = wordwrap($text, $this->_options['width']);
  473 + }
  474 + }
  475 +
  476 + /**
  477 + * Helper function called by preg_replace() on link replacement.
  478 + *
  479 + * Maintains an internal list of links to be displayed at the end of the
  480 + * text, with numeric indices to the original point in the text they
  481 + * appeared. Also makes an effort at identifying and handling absolute
  482 + * and relative links.
  483 + *
  484 + * @param string $link URL of the link
  485 + * @param string $display Part of the text to associate number with
  486 + * @access private
  487 + * @return string
  488 + */
  489 + private function _build_link_list( $link, $display, $link_override = null)
  490 + {
  491 + $link_method = ($link_override) ? $link_override : $this->_options['do_links'];
  492 + if ($link_method == 'none')
  493 + return $display;
  494 +
  495 +
  496 + // Ignored link types
  497 + if (preg_match('!^(javascript:|mailto:|#)!i', $link)) {
  498 + return $display;
  499 + }
  500 + if (preg_match('!^([a-z][a-z0-9.+-]+:)!i', $link)) {
  501 + $url = $link;
  502 + }
  503 + else {
  504 + $url = $this->url;
  505 + if (substr($link, 0, 1) != '/') {
  506 + $url .= '/';
  507 + }
  508 + $url .= "$link";
  509 + }
  510 +
  511 + if ($link_method == 'table')
  512 + {
  513 + if (($index = array_search($url, $this->_link_list)) === false) {
  514 + $index = count($this->_link_list);
  515 + $this->_link_list[] = $url;
  516 + }
  517 +
  518 + return $display . ' [' . ($index+1) . ']';
  519 + }
  520 + elseif ($link_method == 'nextline')
  521 + {
  522 + return $display . "\n[" . $url . ']';
  523 + }
  524 + else // link_method defaults to inline
  525 + {
  526 + return $display . ' [' . $url . ']';
  527 + }
  528 + }
  529 +
  530 + /**
  531 + * Helper function for PRE body conversion.
  532 + *
  533 + * @param string HTML content
  534 + * @access private
  535 + */
  536 + private function _convert_pre(&$text)
  537 + {
  538 + // get the content of PRE element
  539 + while (preg_match('/<pre[^>]*>(.*)<\/pre>/ismU', $text, $matches)) {
  540 + $this->pre_content = $matches[1];
  541 +
  542 + // Run our defined tags search-and-replace with callback
  543 + $this->pre_content = preg_replace_callback($this->callback_search,
  544 + array($this, '_preg_callback'), $this->pre_content);
  545 +
  546 + // convert the content
  547 + $this->pre_content = sprintf('<div><br>%s<br></div>',
  548 + preg_replace($this->pre_search, $this->pre_replace, $this->pre_content));
  549 + // replace the content (use callback because content can contain $0 variable)
  550 + $text = preg_replace_callback('/<pre[^>]*>.*<\/pre>/ismU',
  551 + array($this, '_preg_pre_callback'), $text, 1);
  552 +
  553 + // free memory
  554 + $this->pre_content = '';
  555 + }
  556 + }
  557 +
  558 + /**
  559 + * Helper function for BLOCKQUOTE body conversion.
  560 + *
  561 + * @param string HTML content
  562 + * @access private
  563 + */
  564 + private function _convert_blockquotes(&$text)
  565 + {
  566 + if (preg_match_all('/<\/*blockquote[^>]*>/i', $text, $matches, PREG_OFFSET_CAPTURE)) {
  567 + $level = 0;
  568 + $diff = 0;
  569 + $start = 0;
  570 + $taglen = 0;
  571 + foreach ($matches[0] as $m) {
  572 + if ($m[0][0] == '<' && $m[0][1] == '/') {
  573 + $level--;
  574 + if ($level < 0) {
  575 + $level = 0; // malformed HTML: go to next blockquote
  576 + }
  577 + else if ($level > 0) {
  578 + // skip inner blockquote
  579 + }
  580 + else {
  581 + $end = $m[1];
  582 + $len = $end - $taglen - $start;
  583 + // Get blockquote content
  584 + $body = substr($text, $start + $taglen - $diff, $len);
  585 +
  586 + // Set text width
  587 + $p_width = $this->_options['width'];
  588 + if ($this->_options['width'] > 0) $this->_options['width'] -= 2;
  589 + // Convert blockquote content
  590 + $body = trim($body);
  591 + $this->_converter($body);
  592 + // Add citation markers and create PRE block
  593 + $body = preg_replace('/((^|\n)>*)/', '\\1> ', trim($body));
  594 + $body = '<pre>' . htmlspecialchars($body) . '</pre>';
  595 + // Re-set text width
  596 + $this->_options['width'] = $p_width;
  597 + // Replace content
  598 + $text = substr($text, 0, $start - $diff)
  599 + . $body . substr($text, $end + strlen($m[0]) - $diff);
  600 +
  601 + $diff = $len + $taglen + strlen($m[0]) - strlen($body);
  602 + unset($body);
  603 + }
  604 + }
  605 + else {
  606 + if ($level == 0) {
  607 + $start = $m[1];
  608 + $taglen = strlen($m[0]);
  609 + }
  610 + $level ++;
  611 + }
  612 + }
  613 + }
  614 + }
  615 +
  616 + /**
  617 + * Callback function for preg_replace_callback use.
  618 + *
  619 + * @param array PREG matches
  620 + * @return string
  621 + */
  622 + private function _preg_callback($matches)
  623 + {
  624 + switch (strtolower($matches[1])) {
  625 + case 'b':
  626 + case 'strong':
  627 + return $this->_toupper($matches[3]);
  628 + case 'th':
  629 + return $this->_toupper("\t\t". $matches[3] ."\n");
  630 + case 'h':
  631 + return $this->_toupper("\n\n". $matches[3] ."\n\n");
  632 + case 'a':
  633 + // override the link method
  634 + $link_override = null;
  635 + if (preg_match("/_html2text_link_(\w+)/", $matches[4], $link_override_match))
  636 + {
  637 + $link_override = $link_override_match[1];
  638 + }
  639 + // Remove spaces in URL (#1487805)
  640 + $url = str_replace(' ', '', $matches[3]);
  641 + return $this->_build_link_list($url, $matches[5], $link_override);
  642 + }
  643 + }
  644 +
  645 + /**
  646 + * Callback function for preg_replace_callback use in PRE content handler.
  647 + *
  648 + * @param array PREG matches
  649 + * @return string
  650 + */
  651 + private function _preg_pre_callback($matches)
  652 + {
  653 + return $this->pre_content;
  654 + }
  655 +
  656 + /**
  657 + * Strtoupper function with HTML tags and entities handling.
  658 + *
  659 + * @param string $str Text to convert
  660 + * @return string Converted text
  661 + */
  662 + private function _toupper($str)
  663 + {
  664 + // string can containg HTML tags
  665 + $chunks = preg_split('/(<[^>]*>)/', $str, null, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
  666 +
  667 + // convert toupper only the text between HTML tags
  668 + foreach ($chunks as $idx => $chunk) {
  669 + if ($chunk[0] != '<') {
  670 + $chunks[$idx] = $this->_strtoupper($chunk);
  671 + }
  672 + }
  673 +
  674 + return implode($chunks);
  675 + }
  676 +
  677 + /**
  678 + * Strtoupper multibyte wrapper function with HTML entities handling.
  679 + *
  680 + * @param string $str Text to convert
  681 + * @return string Converted text
  682 + */
  683 + private function _strtoupper($str)
  684 + {
  685 + $str = html_entity_decode($str, ENT_COMPAT);
  686 +
  687 + if (function_exists('mb_strtoupper'))
  688 + $str = mb_strtoupper($str);
  689 + else
  690 + $str = strtoupper($str);
  691 +
  692 + $str = htmlspecialchars($str, ENT_COMPAT);
  693 +
  694 + return $str;
  695 + }
  696 +}
  1 +<?php
  2 +/**
  3 + * htmlfilter.inc
  4 + * ---------------
  5 + * This set of functions allows you to filter html in order to remove
  6 + * any malicious tags from it. Useful in cases when you need to filter
  7 + * user input for any cross-site-scripting attempts.
  8 + *
  9 + * Copyright (C) 2002-2004 by Duke University
  10 + *
  11 + * This library is free software; you can redistribute it and/or
  12 + * modify it under the terms of the GNU Lesser General Public
  13 + * License as published by the Free Software Foundation; either
  14 + * version 2.1 of the License, or (at your option) any later version.
  15 + *
  16 + * This library is distributed in the hope that it will be useful,
  17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  19 + * Lesser General Public License for more details.
  20 + *
  21 + * You should have received a copy of the GNU Lesser General Public
  22 + * License along with this library; if not, write to the Free Software
  23 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  24 + * 02110-1301 USA
  25 + *
  26 + * @Author Konstantin Riabitsev <icon@linux.duke.edu>
  27 + * @Author Jim Jagielski <jim@jaguNET.com / jimjag@gmail.com>
  28 + */
  29 +
  30 +/**
  31 + * This function returns the final tag out of the tag name, an array
  32 + * of attributes, and the type of the tag. This function is called by
  33 + * tln_sanitize internally.
  34 + *
  35 + * @param string $tagname the name of the tag.
  36 + * @param array $attary the array of attributes and their values
  37 + * @param int $tagtype The type of the tag (see in comments).
  38 + * @return string A string with the final tag representation.
  39 + */
  40 +function tln_tagprint($tagname, $attary, $tagtype)
  41 +{
  42 + if ($tagtype == 2) {
  43 + $fulltag = '</' . $tagname . '>';
  44 + } else {
  45 + $fulltag = '<' . $tagname;
  46 + if (is_array($attary) && sizeof($attary)) {
  47 + $atts = array();
  48 + while (list($attname, $attvalue) = each($attary)) {
  49 + array_push($atts, "$attname=$attvalue");
  50 + }
  51 + $fulltag .= ' ' . join(' ', $atts);
  52 + }
  53 + if ($tagtype == 3) {
  54 + $fulltag .= ' /';
  55 + }
  56 + $fulltag .= '>';
  57 + }
  58 + return $fulltag;
  59 +}
  60 +
  61 +/**
  62 + * A small helper function to use with array_walk. Modifies a by-ref
  63 + * value and makes it lowercase.
  64 + *
  65 + * @param string $val a value passed by-ref.
  66 + * @return void since it modifies a by-ref value.
  67 + */
  68 +function tln_casenormalize(&$val)
  69 +{
  70 + $val = strtolower($val);
  71 +}
  72 +
  73 +/**
  74 + * This function skips any whitespace from the current position within
  75 + * a string and to the next non-whitespace value.
  76 + *
  77 + * @param string $body the string
  78 + * @param int $offset the offset within the string where we should start
  79 + * looking for the next non-whitespace character.
  80 + * @return int the location within the $body where the next
  81 + * non-whitespace char is located.
  82 + */
  83 +function tln_skipspace($body, $offset)
  84 +{
  85 + preg_match('/^(\s*)/s', substr($body, $offset), $matches);
  86 + if (sizeof($matches[1])) {
  87 + $count = strlen($matches[1]);
  88 + $offset += $count;
  89 + }
  90 + return $offset;
  91 +}
  92 +
  93 +/**
  94 + * This function looks for the next character within a string. It's
  95 + * really just a glorified "strpos", except it catches the failures
  96 + * nicely.
  97 + *
  98 + * @param string $body The string to look for needle in.
  99 + * @param int $offset Start looking from this position.
  100 + * @param string $needle The character/string to look for.
  101 + * @return int location of the next occurrence of the needle, or
  102 + * strlen($body) if needle wasn't found.
  103 + */
  104 +function tln_findnxstr($body, $offset, $needle)
  105 +{
  106 + $pos = strpos($body, $needle, $offset);
  107 + if ($pos === false) {
  108 + $pos = strlen($body);
  109 + }
  110 + return $pos;
  111 +}
  112 +
  113 +/**
  114 + * This function takes a PCRE-style regexp and tries to match it
  115 + * within the string.
  116 + *
  117 + * @param string $body The string to look for needle in.
  118 + * @param int $offset Start looking from here.
  119 + * @param string $reg A PCRE-style regex to match.
  120 + * @return array|boolean Returns a false if no matches found, or an array
  121 + * with the following members:
  122 + * - integer with the location of the match within $body
  123 + * - string with whatever content between offset and the match
  124 + * - string with whatever it is we matched
  125 + */
  126 +function tln_findnxreg($body, $offset, $reg)
  127 +{
  128 + $matches = array();
  129 + $retarr = array();
  130 + $preg_rule = '%^(.*?)(' . $reg . ')%s';
  131 + preg_match($preg_rule, substr($body, $offset), $matches);
  132 + if (!isset($matches[0])) {
  133 + $retarr = false;
  134 + } else {
  135 + $retarr[0] = $offset + strlen($matches[1]);
  136 + $retarr[1] = $matches[1];
  137 + $retarr[2] = $matches[2];
  138 + }
  139 + return $retarr;
  140 +}
  141 +
  142 +/**
  143 + * This function looks for the next tag.
  144 + *
  145 + * @param string $body String where to look for the next tag.
  146 + * @param int $offset Start looking from here.
  147 + * @return array|boolean false if no more tags exist in the body, or
  148 + * an array with the following members:
  149 + * - string with the name of the tag
  150 + * - array with attributes and their values
  151 + * - integer with tag type (1, 2, or 3)
  152 + * - integer where the tag starts (starting "<")
  153 + * - integer where the tag ends (ending ">")
  154 + * first three members will be false, if the tag is invalid.
  155 + */
  156 +function tln_getnxtag($body, $offset)
  157 +{
  158 + if ($offset > strlen($body)) {
  159 + return false;
  160 + }
  161 + $lt = tln_findnxstr($body, $offset, '<');
  162 + if ($lt == strlen($body)) {
  163 + return false;
  164 + }
  165 + /**
  166 + * We are here:
  167 + * blah blah <tag attribute="value">
  168 + * \---------^
  169 + */
  170 + $pos = tln_skipspace($body, $lt + 1);
  171 + if ($pos >= strlen($body)) {
  172 + return array(false, false, false, $lt, strlen($body));
  173 + }
  174 + /**
  175 + * There are 3 kinds of tags:
  176 + * 1. Opening tag, e.g.:
  177 + * <a href="blah">
  178 + * 2. Closing tag, e.g.:
  179 + * </a>
  180 + * 3. XHTML-style content-less tag, e.g.:
  181 + * <img src="blah"/>
  182 + */
  183 + switch (substr($body, $pos, 1)) {
  184 + case '/':
  185 + $tagtype = 2;
  186 + $pos++;
  187 + break;
  188 + case '!':
  189 + /**
  190 + * A comment or an SGML declaration.
  191 + */
  192 + if (substr($body, $pos + 1, 2) == '--') {
  193 + $gt = strpos($body, '-->', $pos);
  194 + if ($gt === false) {
  195 + $gt = strlen($body);
  196 + } else {
  197 + $gt += 2;
  198 + }
  199 + return array(false, false, false, $lt, $gt);
  200 + } else {
  201 + $gt = tln_findnxstr($body, $pos, '>');
  202 + return array(false, false, false, $lt, $gt);
  203 + }
  204 + break;
  205 + default:
  206 + /**
  207 + * Assume tagtype 1 for now. If it's type 3, we'll switch values
  208 + * later.
  209 + */
  210 + $tagtype = 1;
  211 + break;
  212 + }
  213 +
  214 + /**
  215 + * Look for next [\W-_], which will indicate the end of the tag name.
  216 + */
  217 + $regary = tln_findnxreg($body, $pos, '[^\w\-_]');
  218 + if ($regary == false) {
  219 + return array(false, false, false, $lt, strlen($body));
  220 + }
  221 + list($pos, $tagname, $match) = $regary;
  222 + $tagname = strtolower($tagname);
  223 +
  224 + /**
  225 + * $match can be either of these:
  226 + * '>' indicating the end of the tag entirely.
  227 + * '\s' indicating the end of the tag name.
  228 + * '/' indicating that this is type-3 xhtml tag.
  229 + *
  230 + * Whatever else we find there indicates an invalid tag.
  231 + */
  232 + switch ($match) {
  233 + case '/':
  234 + /**
  235 + * This is an xhtml-style tag with a closing / at the
  236 + * end, like so: <img src="blah"/>. Check if it's followed
  237 + * by the closing bracket. If not, then this tag is invalid
  238 + */
  239 + if (substr($body, $pos, 2) == '/>') {
  240 + $pos++;
  241 + $tagtype = 3;
  242 + } else {
  243 + $gt = tln_findnxstr($body, $pos, '>');
  244 + $retary = array(false, false, false, $lt, $gt);
  245 + return $retary;
  246 + }
  247 + //intentional fall-through
  248 + case '>':
  249 + return array($tagname, false, $tagtype, $lt, $pos);
  250 + break;
  251 + default:
  252 + /**
  253 + * Check if it's whitespace
  254 + */
  255 + if (preg_match('/\s/', $match)) {
  256 + } else {
  257 + /**
  258 + * This is an invalid tag! Look for the next closing ">".
  259 + */
  260 + $gt = tln_findnxstr($body, $lt, '>');
  261 + return array(false, false, false, $lt, $gt);
  262 + }
  263 + }
  264 +
  265 + /**
  266 + * At this point we're here:
  267 + * <tagname attribute='blah'>
  268 + * \-------^
  269 + *
  270 + * At this point we loop in order to find all attributes.
  271 + */
  272 + $attary = array();
  273 +
  274 + while ($pos <= strlen($body)) {
  275 + $pos = tln_skipspace($body, $pos);
  276 + if ($pos == strlen($body)) {
  277 + /**
  278 + * Non-closed tag.
  279 + */
  280 + return array(false, false, false, $lt, $pos);
  281 + }
  282 + /**
  283 + * See if we arrived at a ">" or "/>", which means that we reached
  284 + * the end of the tag.
  285 + */
  286 + $matches = array();
  287 + preg_match('%^(\s*)(>|/>)%s', substr($body, $pos), $matches);
  288 + if (isset($matches[0]) && $matches[0]) {
  289 + /**
  290 + * Yep. So we did.
  291 + */
  292 + $pos += strlen($matches[1]);
  293 + if ($matches[2] == '/>') {
  294 + $tagtype = 3;
  295 + $pos++;
  296 + }
  297 + return array($tagname, $attary, $tagtype, $lt, $pos);
  298 + }
  299 +
  300 + /**
  301 + * There are several types of attributes, with optional
  302 + * [:space:] between members.
  303 + * Type 1:
  304 + * attrname[:space:]=[:space:]'CDATA'
  305 + * Type 2:
  306 + * attrname[:space:]=[:space:]"CDATA"
  307 + * Type 3:
  308 + * attr[:space:]=[:space:]CDATA
  309 + * Type 4:
  310 + * attrname
  311 + *
  312 + * We leave types 1 and 2 the same, type 3 we check for
  313 + * '"' and convert to "&quot" if needed, then wrap in
  314 + * double quotes. Type 4 we convert into:
  315 + * attrname="yes".
  316 + */
  317 + $regary = tln_findnxreg($body, $pos, '[^\w\-_]');
  318 + if ($regary == false) {
  319 + /**
  320 + * Looks like body ended before the end of tag.
  321 + */
  322 + return array(false, false, false, $lt, strlen($body));
  323 + }
  324 + list($pos, $attname, $match) = $regary;
  325 + $attname = strtolower($attname);
  326 + /**
  327 + * We arrived at the end of attribute name. Several things possible
  328 + * here:
  329 + * '>' means the end of the tag and this is attribute type 4
  330 + * '/' if followed by '>' means the same thing as above
  331 + * '\s' means a lot of things -- look what it's followed by.
  332 + * anything else means the attribute is invalid.
  333 + */
  334 + switch ($match) {
  335 + case '/':
  336 + /**
  337 + * This is an xhtml-style tag with a closing / at the
  338 + * end, like so: <img src="blah"/>. Check if it's followed
  339 + * by the closing bracket. If not, then this tag is invalid
  340 + */
  341 + if (substr($body, $pos, 2) == '/>') {
  342 + $pos++;
  343 + $tagtype = 3;
  344 + } else {
  345 + $gt = tln_findnxstr($body, $pos, '>');
  346 + $retary = array(false, false, false, $lt, $gt);
  347 + return $retary;
  348 + }
  349 + //intentional fall-through
  350 + case '>':
  351 + $attary{$attname} = '"yes"';
  352 + return array($tagname, $attary, $tagtype, $lt, $pos);
  353 + break;
  354 + default:
  355 + /**
  356 + * Skip whitespace and see what we arrive at.
  357 + */
  358 + $pos = tln_skipspace($body, $pos);
  359 + $char = substr($body, $pos, 1);
  360 + /**
  361 + * Two things are valid here:
  362 + * '=' means this is attribute type 1 2 or 3.
  363 + * \w means this was attribute type 4.
  364 + * anything else we ignore and re-loop. End of tag and
  365 + * invalid stuff will be caught by our checks at the beginning
  366 + * of the loop.
  367 + */
  368 + if ($char == '=') {
  369 + $pos++;
  370 + $pos = tln_skipspace($body, $pos);
  371 + /**
  372 + * Here are 3 possibilities:
  373 + * "'" attribute type 1
  374 + * '"' attribute type 2
  375 + * everything else is the content of tag type 3
  376 + */
  377 + $quot = substr($body, $pos, 1);
  378 + if ($quot == '\'') {
  379 + $regary = tln_findnxreg($body, $pos + 1, '\'');
  380 + if ($regary == false) {
  381 + return array(false, false, false, $lt, strlen($body));
  382 + }
  383 + list($pos, $attval, $match) = $regary;
  384 + $pos++;
  385 + $attary{$attname} = '\'' . $attval . '\'';
  386 + } else {
  387 + if ($quot == '"') {
  388 + $regary = tln_findnxreg($body, $pos + 1, '\"');
  389 + if ($regary == false) {
  390 + return array(false, false, false, $lt, strlen($body));
  391 + }
  392 + list($pos, $attval, $match) = $regary;
  393 + $pos++;
  394 + $attary{$attname} = '"' . $attval . '"';
  395 + } else {
  396 + /**
  397 + * These are hateful. Look for \s, or >.
  398 + */
  399 + $regary = tln_findnxreg($body, $pos, '[\s>]');
  400 + if ($regary == false) {
  401 + return array(false, false, false, $lt, strlen($body));
  402 + }
  403 + list($pos, $attval, $match) = $regary;
  404 + /**
  405 + * If it's ">" it will be caught at the top.
  406 + */
  407 + $attval = preg_replace('/\"/s', '&quot;', $attval);
  408 + $attary{$attname} = '"' . $attval . '"';
  409 + }
  410 + }
  411 + } else {
  412 + if (preg_match('|[\w/>]|', $char)) {
  413 + /**
  414 + * That was attribute type 4.
  415 + */
  416 + $attary{$attname} = '"yes"';
  417 + } else {
  418 + /**
  419 + * An illegal character. Find next '>' and return.
  420 + */
  421 + $gt = tln_findnxstr($body, $pos, '>');
  422 + return array(false, false, false, $lt, $gt);
  423 + }
  424 + }
  425 + }
  426 + }
  427 + /**
  428 + * The fact that we got here indicates that the tag end was never
  429 + * found. Return invalid tag indication so it gets stripped.
  430 + */
  431 + return array(false, false, false, $lt, strlen($body));
  432 +}
  433 +
  434 +/**
  435 + * Translates entities into literal values so they can be checked.
  436 + *
  437 + * @param string $attvalue the by-ref value to check.
  438 + * @param string $regex the regular expression to check against.
  439 + * @param bool $hex whether the entites are hexadecimal.
  440 + * @return bool True or False depending on whether there were matches.
  441 + */
  442 +function tln_deent(&$attvalue, $regex, $hex = false)
  443 +{
  444 + preg_match_all($regex, $attvalue, $matches);
  445 + if (is_array($matches) && sizeof($matches[0]) > 0) {
  446 + $repl = array();
  447 + for ($i = 0; $i < sizeof($matches[0]); $i++) {
  448 + $numval = $matches[1][$i];
  449 + if ($hex) {
  450 + $numval = hexdec($numval);
  451 + }
  452 + $repl{$matches[0][$i]} = chr($numval);
  453 + }
  454 + $attvalue = strtr($attvalue, $repl);
  455 + return true;
  456 + } else {
  457 + return false;
  458 + }
  459 +}
  460 +
  461 +/**
  462 + * This function checks attribute values for entity-encoded values
  463 + * and returns them translated into 8-bit strings so we can run
  464 + * checks on them.
  465 + *
  466 + * @param string $attvalue A string to run entity check against.
  467 + * @return Void, modifies a reference value.
  468 + */
  469 +function tln_defang(&$attvalue)
  470 +{
  471 + /**
  472 + * Skip this if there aren't ampersands or backslashes.
  473 + */
  474 + if (strpos($attvalue, '&') === false
  475 + && strpos($attvalue, '\\') === false
  476 + ) {
  477 + return;
  478 + }
  479 + do {
  480 + $m = false;
  481 + $m = $m || tln_deent($attvalue, '/\&#0*(\d+);*/s');
  482 + $m = $m || tln_deent($attvalue, '/\&#x0*((\d|[a-f])+);*/si', true);
  483 + $m = $m || tln_deent($attvalue, '/\\\\(\d+)/s', true);
  484 + } while ($m == true);
  485 + $attvalue = stripslashes($attvalue);
  486 +}
  487 +
  488 +/**
  489 + * Kill any tabs, newlines, or carriage returns. Our friends the
  490 + * makers of the browser with 95% market value decided that it'd
  491 + * be funny to make "java[tab]script" be just as good as "javascript".
  492 + *
  493 + * @param string $attvalue The attribute value before extraneous spaces removed.
  494 + * @return Void, modifies a reference value.
  495 + */
  496 +function tln_unspace(&$attvalue)
  497 +{
  498 + if (strcspn($attvalue, "\t\r\n\0 ") != strlen($attvalue)) {
  499 + $attvalue = str_replace(
  500 + array("\t", "\r", "\n", "\0", " "),
  501 + array('', '', '', '', ''),
  502 + $attvalue
  503 + );
  504 + }
  505 +}
  506 +
  507 +/**
  508 + * This function runs various checks against the attributes.
  509 + *
  510 + * @param string $tagname String with the name of the tag.
  511 + * @param array $attary Array with all tag attributes.
  512 + * @param array $rm_attnames See description for tln_sanitize
  513 + * @param array $bad_attvals See description for tln_sanitize
  514 + * @param array $add_attr_to_tag See description for tln_sanitize
  515 + * @return Array with modified attributes.
  516 + */
  517 +function tln_fixatts(
  518 + $tagname,
  519 + $attary,
  520 + $rm_attnames,
  521 + $bad_attvals,
  522 + $add_attr_to_tag
  523 +) {
  524 + while (list($attname, $attvalue) = each($attary)) {
  525 + /**
  526 + * See if this attribute should be removed.
  527 + */
  528 + foreach ($rm_attnames as $matchtag => $matchattrs) {
  529 + if (preg_match($matchtag, $tagname)) {
  530 + foreach ($matchattrs as $matchattr) {
  531 + if (preg_match($matchattr, $attname)) {
  532 + unset($attary{$attname});
  533 + continue;
  534 + }
  535 + }
  536 + }
  537 + }
  538 + /**
  539 + * Remove any backslashes, entities, or extraneous whitespace.
  540 + */
  541 + tln_defang($attvalue);
  542 + tln_unspace($attvalue);
  543 +
  544 + /**
  545 + * Now let's run checks on the attvalues.
  546 + * I don't expect anyone to comprehend this. If you do,
  547 + * get in touch with me so I can drive to where you live and
  548 + * shake your hand personally. :)
  549 + */
  550 + foreach ($bad_attvals as $matchtag => $matchattrs) {
  551 + if (preg_match($matchtag, $tagname)) {
  552 + foreach ($matchattrs as $matchattr => $valary) {
  553 + if (preg_match($matchattr, $attname)) {
  554 + /**
  555 + * There are two arrays in valary.
  556 + * First is matches.
  557 + * Second one is replacements
  558 + */
  559 + list($valmatch, $valrepl) = $valary;
  560 + $newvalue = preg_replace($valmatch, $valrepl, $attvalue);
  561 + if ($newvalue != $attvalue) {
  562 + $attary{$attname} = $newvalue;
  563 + }
  564 + }
  565 + }
  566 + }
  567 + }
  568 + }
  569 + /**
  570 + * See if we need to append any attributes to this tag.
  571 + */
  572 + foreach ($add_attr_to_tag as $matchtag => $addattary) {
  573 + if (preg_match($matchtag, $tagname)) {
  574 + $attary = array_merge($attary, $addattary);
  575 + }
  576 + }
  577 + return $attary;
  578 +}
  579 +
  580 +/**
  581 + *
  582 + * @param string $body The HTML you wish to filter
  583 + * @param array $tag_list see description above
  584 + * @param array $rm_tags_with_content see description above
  585 + * @param array $self_closing_tags see description above
  586 + * @param bool $force_tag_closing see description above
  587 + * @param array $rm_attnames see description above
  588 + * @param array $bad_attvals see description above
  589 + * @param array $add_attr_to_tag see description above
  590 + * @return string Sanitized html safe to show on your pages.
  591 + */
  592 +function tln_sanitize(
  593 + $body,
  594 + $tag_list,
  595 + $rm_tags_with_content,
  596 + $self_closing_tags,
  597 + $force_tag_closing,
  598 + $rm_attnames,
  599 + $bad_attvals,
  600 + $add_attr_to_tag
  601 +) {
  602 + /**
  603 + * Normalize rm_tags and rm_tags_with_content.
  604 + */
  605 + $rm_tags = array_shift($tag_list);
  606 + @array_walk($tag_list, 'tln_casenormalize');
  607 + @array_walk($rm_tags_with_content, 'tln_casenormalize');
  608 + @array_walk($self_closing_tags, 'tln_casenormalize');
  609 + /**
  610 + * See if tag_list is of tags to remove or tags to allow.
  611 + * false means remove these tags
  612 + * true means allow these tags
  613 + */
  614 + $curpos = 0;
  615 + $open_tags = array();
  616 + $trusted = "<!-- begin tln_sanitized html -->\n";
  617 + $skip_content = false;
  618 + /**
  619 + * Take care of netscape's stupid javascript entities like
  620 + * &{alert('boo')};
  621 + */
  622 + $body = preg_replace('/&(\{.*?\};)/si', '&amp;\\1', $body);
  623 + while (($curtag = tln_getnxtag($body, $curpos)) != false) {
  624 + list($tagname, $attary, $tagtype, $lt, $gt) = $curtag;
  625 + $free_content = substr($body, $curpos, $lt - $curpos);
  626 + if ($skip_content == false) {
  627 + $trusted .= $free_content;
  628 + } else {
  629 + }
  630 + if ($tagname != false) {
  631 + if ($tagtype == 2) {
  632 + if ($skip_content == $tagname) {
  633 + /**
  634 + * Got to the end of tag we needed to remove.
  635 + */
  636 + $tagname = false;
  637 + $skip_content = false;
  638 + } else {
  639 + if ($skip_content == false) {
  640 + if (isset($open_tags{$tagname}) &&
  641 + $open_tags{$tagname} > 0
  642 + ) {
  643 + $open_tags{$tagname}--;
  644 + } else {
  645 + $tagname = false;
  646 + }
  647 + } else {
  648 + }
  649 + }
  650 + } else {
  651 + /**
  652 + * $rm_tags_with_content
  653 + */
  654 + if ($skip_content == false) {
  655 + /**
  656 + * See if this is a self-closing type and change
  657 + * tagtype appropriately.
  658 + */
  659 + if ($tagtype == 1
  660 + && in_array($tagname, $self_closing_tags)
  661 + ) {
  662 + $tagtype = 3;
  663 + }
  664 + /**
  665 + * See if we should skip this tag and any content
  666 + * inside it.
  667 + */
  668 + if ($tagtype == 1
  669 + && in_array($tagname, $rm_tags_with_content)
  670 + ) {
  671 + $skip_content = $tagname;
  672 + } else {
  673 + if (($rm_tags == false
  674 + && in_array($tagname, $tag_list)) ||
  675 + ($rm_tags == true
  676 + && !in_array($tagname, $tag_list))
  677 + ) {
  678 + $tagname = false;
  679 + } else {
  680 + if ($tagtype == 1) {
  681 + if (isset($open_tags{$tagname})) {
  682 + $open_tags{$tagname}++;
  683 + } else {
  684 + $open_tags{$tagname} = 1;
  685 + }
  686 + }
  687 + /**
  688 + * This is where we run other checks.
  689 + */
  690 + if (is_array($attary) && sizeof($attary) > 0) {
  691 + $attary = tln_fixatts(
  692 + $tagname,
  693 + $attary,
  694 + $rm_attnames,
  695 + $bad_attvals,
  696 + $add_attr_to_tag
  697 + );
  698 + }
  699 + }
  700 + }
  701 + } else {
  702 + }
  703 + }
  704 + if ($tagname != false && $skip_content == false) {
  705 + $trusted .= tln_tagprint($tagname, $attary, $tagtype);
  706 + }
  707 + } else {
  708 + }
  709 + $curpos = $gt + 1;
  710 + }
  711 + $trusted .= substr($body, $curpos, strlen($body) - $curpos);
  712 + if ($force_tag_closing == true) {
  713 + foreach ($open_tags as $tagname => $opentimes) {
  714 + while ($opentimes > 0) {
  715 + $trusted .= '</' . $tagname . '>';
  716 + $opentimes--;
  717 + }
  718 + }
  719 + $trusted .= "\n";
  720 + }
  721 + $trusted .= "<!-- end tln_sanitized html -->\n";
  722 + return $trusted;
  723 +}
  724 +
  725 +//
  726 +// Use the nifty htmlfilter library
  727 +//
  728 +
  729 +
  730 +function HTMLFilter($body, $trans_image_path, $block_external_images = false)
  731 +{
  732 +
  733 + $tag_list = array(
  734 + false,
  735 + "object",
  736 + "meta",
  737 + "html",
  738 + "head",
  739 + "base",
  740 + "link",
  741 + "frame",
  742 + "iframe",
  743 + "plaintext",
  744 + "marquee"
  745 + );
  746 +
  747 + $rm_tags_with_content = array(
  748 + "script",
  749 + "applet",
  750 + "embed",
  751 + "title",
  752 + "frameset",
  753 + "xmp",
  754 + "xml"
  755 + );
  756 +
  757 + $self_closing_tags = array(
  758 + "img",
  759 + "br",
  760 + "hr",
  761 + "input",
  762 + "outbind"
  763 + );
  764 +
  765 + $force_tag_closing = true;
  766 +
  767 + $rm_attnames = array(
  768 + "/.*/" =>
  769 + array(
  770 + // "/target/i",
  771 + "/^on.*/i",
  772 + "/^dynsrc/i",
  773 + "/^data.*/i",
  774 + "/^lowsrc.*/i"
  775 + )
  776 + );
  777 +
  778 + $bad_attvals = array(
  779 + "/.*/" =>
  780 + array(
  781 + "/^src|background/i" =>
  782 + array(
  783 + array(
  784 + '/^([\'"])\s*\S+script\s*:.*([\'"])/si',
  785 + '/^([\'"])\s*mocha\s*:*.*([\'"])/si',
  786 + '/^([\'"])\s*about\s*:.*([\'"])/si'
  787 + ),
  788 + array(
  789 + "\\1$trans_image_path\\2",
  790 + "\\1$trans_image_path\\2",
  791 + "\\1$trans_image_path\\2",
  792 + "\\1$trans_image_path\\2"
  793 + )
  794 + ),
  795 + "/^href|action/i" =>
  796 + array(
  797 + array(
  798 + '/^([\'"])\s*\S+script\s*:.*([\'"])/si',
  799 + '/^([\'"])\s*mocha\s*:*.*([\'"])/si',
  800 + '/^([\'"])\s*about\s*:.*([\'"])/si'
  801 + ),
  802 + array(
  803 + "\\1#\\1",
  804 + "\\1#\\1",
  805 + "\\1#\\1",
  806 + "\\1#\\1"
  807 + )
  808 + ),
  809 + "/^style/i" =>
  810 + array(
  811 + array(
  812 + "/expression/i",
  813 + "/binding/i",
  814 + "/behaviou*r/i",
  815 + "/include-source/i",
  816 + '/position\s*:\s*absolute/i',
  817 + '/url\s*\(\s*([\'"])\s*\S+script\s*:.*([\'"])\s*\)/si',
  818 + '/url\s*\(\s*([\'"])\s*mocha\s*:.*([\'"])\s*\)/si',
  819 + '/url\s*\(\s*([\'"])\s*about\s*:.*([\'"])\s*\)/si',
  820 + '/(.*)\s*:\s*url\s*\(\s*([\'"]*)\s*\S+script\s*:.*([\'"]*)\s*\)/si'
  821 + ),
  822 + array(
  823 + "idiocy",
  824 + "idiocy",
  825 + "idiocy",
  826 + "idiocy",
  827 + "",
  828 + "url(\\1#\\1)",
  829 + "url(\\1#\\1)",
  830 + "url(\\1#\\1)",
  831 + "url(\\1#\\1)",
  832 + "url(\\1#\\1)",
  833 + "\\1:url(\\2#\\3)"
  834 + )
  835 + )
  836 + )
  837 + );
  838 +
  839 + if ($block_external_images) {
  840 + array_push(
  841 + $bad_attvals{'/.*/'}{'/^src|background/i'}[0],
  842 + '/^([\'\"])\s*https*:.*([\'\"])/si'
  843 + );
  844 + array_push(
  845 + $bad_attvals{'/.*/'}{'/^src|background/i'}[1],
  846 + "\\1$trans_image_path\\1"
  847 + );
  848 + array_push(
  849 + $bad_attvals{'/.*/'}{'/^style/i'}[0],
  850 + '/url\(([\'\"])\s*https*:.*([\'\"])\)/si'
  851 + );
  852 + array_push(
  853 + $bad_attvals{'/.*/'}{'/^style/i'}[1],
  854 + "url(\\1$trans_image_path\\1)"
  855 + );
  856 + }
  857 +
  858 + $add_attr_to_tag = array(
  859 + "/^a$/i" =>
  860 + array('target' => '"_blank"')
  861 + );
  862 +
  863 + $trusted = tln_sanitize(
  864 + $body,
  865 + $tag_list,
  866 + $rm_tags_with_content,
  867 + $self_closing_tags,
  868 + $force_tag_closing,
  869 + $rm_attnames,
  870 + $bad_attvals,
  871 + $add_attr_to_tag
  872 + );
  873 + return $trusted;
  874 +}
  1 +<?php
  2 +/*
  3 + * ntlm_sasl_client.php
  4 + *
  5 + * @(#) $Id: ntlm_sasl_client.php,v 1.3 2004/11/17 08:00:37 mlemos Exp $
  6 + *
  7 + **
  8 + ** Source: http://www.phpclasses.org/browse/file/7495.html
  9 + ** License: BSD (http://www.phpclasses.org/package/1888-PHP-Single-API-for-standard-authentication-mechanisms.html)
  10 + ** Bundled with Permission
  11 + **
  12 + */
  13 +
  14 +define("SASL_NTLM_STATE_START", 0);
  15 +define("SASL_NTLM_STATE_IDENTIFY_DOMAIN", 1);
  16 +define("SASL_NTLM_STATE_RESPOND_CHALLENGE", 2);
  17 +define("SASL_NTLM_STATE_DONE", 3);
  18 +
  19 +class ntlm_sasl_client_class
  20 +{
  21 + var $credentials=array();
  22 + var $state=SASL_NTLM_STATE_START;
  23 +
  24 + Function Initialize(&$client)
  25 + {
  26 + if(!function_exists($function="mcrypt_encrypt")
  27 + || !function_exists($function="mhash"))
  28 + {
  29 + $extensions=array(
  30 + "mcrypt_encrypt"=>"mcrypt",
  31 + "mhash"=>"mhash"
  32 + );
  33 + $client->error="the extension ".$extensions[$function]." required by the NTLM SASL client class is not available in this PHP configuration";
  34 + return(0);
  35 + }
  36 + return(1);
  37 + }
  38 +
  39 + Function ASCIIToUnicode($ascii)
  40 + {
  41 + for($unicode="",$a=0;$a<strlen($ascii);$a++)
  42 + $unicode.=substr($ascii,$a,1).chr(0);
  43 + return($unicode);
  44 + }
  45 +
  46 + Function TypeMsg1($domain,$workstation)
  47 + {
  48 + $domain_length=strlen($domain);
  49 + $workstation_length=strlen($workstation);
  50 + $workstation_offset=32;
  51 + $domain_offset=$workstation_offset+$workstation_length;
  52 + return(
  53 + "NTLMSSP\0".
  54 + "\x01\x00\x00\x00".
  55 + "\x07\x32\x00\x00".
  56 + pack("v",$domain_length).
  57 + pack("v",$domain_length).
  58 + pack("V",$domain_offset).
  59 + pack("v",$workstation_length).
  60 + pack("v",$workstation_length).
  61 + pack("V",$workstation_offset).
  62 + $workstation.
  63 + $domain
  64 + );
  65 + }
  66 +
  67 + Function NTLMResponse($challenge,$password)
  68 + {
  69 + $unicode=$this->ASCIIToUnicode($password);
  70 + $md4=mhash(MHASH_MD4,$unicode);
  71 + $padded=$md4.str_repeat(chr(0),21-strlen($md4));
  72 + $iv_size=mcrypt_get_iv_size(MCRYPT_DES,MCRYPT_MODE_ECB);
  73 + $iv=mcrypt_create_iv($iv_size,MCRYPT_RAND);
  74 + for($response="",$third=0;$third<21;$third+=7)
  75 + {
  76 + for($packed="",$p=$third;$p<$third+7;$p++)
  77 + $packed.=str_pad(decbin(ord(substr($padded,$p,1))),8,"0",STR_PAD_LEFT);
  78 + for($key="",$p=0;$p<strlen($packed);$p+=7)
  79 + {
  80 + $s=substr($packed,$p,7);
  81 + $b=$s.((substr_count($s,"1") % 2) ? "0" : "1");
  82 + $key.=chr(bindec($b));
  83 + }
  84 + $ciphertext=mcrypt_encrypt(MCRYPT_DES,$key,$challenge,MCRYPT_MODE_ECB,$iv);
  85 + $response.=$ciphertext;
  86 + }
  87 + return $response;
  88 + }
  89 +
  90 + Function TypeMsg3($ntlm_response,$user,$domain,$workstation)
  91 + {
  92 + $domain_unicode=$this->ASCIIToUnicode($domain);
  93 + $domain_length=strlen($domain_unicode);
  94 + $domain_offset=64;
  95 + $user_unicode=$this->ASCIIToUnicode($user);
  96 + $user_length=strlen($user_unicode);
  97 + $user_offset=$domain_offset+$domain_length;
  98 + $workstation_unicode=$this->ASCIIToUnicode($workstation);
  99 + $workstation_length=strlen($workstation_unicode);
  100 + $workstation_offset=$user_offset+$user_length;
  101 + $lm="";
  102 + $lm_length=strlen($lm);
  103 + $lm_offset=$workstation_offset+$workstation_length;
  104 + $ntlm=$ntlm_response;
  105 + $ntlm_length=strlen($ntlm);
  106 + $ntlm_offset=$lm_offset+$lm_length;
  107 + $session="";
  108 + $session_length=strlen($session);
  109 + $session_offset=$ntlm_offset+$ntlm_length;
  110 + return(
  111 + "NTLMSSP\0".
  112 + "\x03\x00\x00\x00".
  113 + pack("v",$lm_length).
  114 + pack("v",$lm_length).
  115 + pack("V",$lm_offset).
  116 + pack("v",$ntlm_length).
  117 + pack("v",$ntlm_length).
  118 + pack("V",$ntlm_offset).
  119 + pack("v",$domain_length).
  120 + pack("v",$domain_length).
  121 + pack("V",$domain_offset).
  122 + pack("v",$user_length).
  123 + pack("v",$user_length).
  124 + pack("V",$user_offset).
  125 + pack("v",$workstation_length).
  126 + pack("v",$workstation_length).
  127 + pack("V",$workstation_offset).
  128 + pack("v",$session_length).
  129 + pack("v",$session_length).
  130 + pack("V",$session_offset).
  131 + "\x01\x02\x00\x00".
  132 + $domain_unicode.
  133 + $user_unicode.
  134 + $workstation_unicode.
  135 + $lm.
  136 + $ntlm
  137 + );
  138 + }
  139 +
  140 + Function Start(&$client, &$message, &$interactions)
  141 + {
  142 + if($this->state!=SASL_NTLM_STATE_START)
  143 + {
  144 + $client->error="NTLM authentication state is not at the start";
  145 + return(SASL_FAIL);
  146 + }
  147 + $this->credentials=array(
  148 + "user"=>"",
  149 + "password"=>"",
  150 + "realm"=>"",
  151 + "workstation"=>""
  152 + );
  153 + $defaults=array();
  154 + $status=$client->GetCredentials($this->credentials,$defaults,$interactions);
  155 + if($status==SASL_CONTINUE)
  156 + $this->state=SASL_NTLM_STATE_IDENTIFY_DOMAIN;
  157 + Unset($message);
  158 + return($status);
  159 + }
  160 +
  161 + Function Step(&$client, $response, &$message, &$interactions)
  162 + {
  163 + switch($this->state)
  164 + {
  165 + case SASL_NTLM_STATE_IDENTIFY_DOMAIN:
  166 + $message=$this->TypeMsg1($this->credentials["realm"],$this->credentials["workstation"]);
  167 + $this->state=SASL_NTLM_STATE_RESPOND_CHALLENGE;
  168 + break;
  169 + case SASL_NTLM_STATE_RESPOND_CHALLENGE:
  170 + $ntlm_response=$this->NTLMResponse(substr($response,24,8),$this->credentials["password"]);
  171 + $message=$this->TypeMsg3($ntlm_response,$this->credentials["user"],$this->credentials["realm"],$this->credentials["workstation"]);
  172 + $this->state=SASL_NTLM_STATE_DONE;
  173 + break;
  174 + case SASL_NTLM_STATE_DONE:
  175 + $client->error="NTLM authentication was finished without success";
  176 + return(SASL_FAIL);
  177 + default:
  178 + $client->error="invalid NTLM authentication step state";
  179 + return(SASL_FAIL);
  180 + }
  181 + return(SASL_CONTINUE);
  182 + }
  183 +};
  184 +
  185 +?>
  1 +<?php
  2 +/**
  3 +* PHPMailer language file: refer to English translation for definitive list
  4 +* Arabic Version, UTF-8
  5 +* by : bahjat al mostafa <bahjat983@hotmail.com>
  6 +*/
  7 +
  8 +$PHPMAILER_LANG['authenticate'] = 'SMTP Error: لم نستطع تأكيد الهوية.';
  9 +$PHPMAILER_LANG['connect_host'] = 'SMTP Error: لم نستطع الاتصال بمخدم SMTP.';
  10 +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Error: لم يتم قبول المعلومات .';
  11 +//$PHPMAILER_LANG['empty_message'] = 'Message body empty';
  12 +$PHPMAILER_LANG['encoding'] = 'ترميز غير معروف: ';
  13 +$PHPMAILER_LANG['execute'] = 'لم أستطع تنفيذ : ';
  14 +$PHPMAILER_LANG['file_access'] = 'لم نستطع الوصول للملف: ';
  15 +$PHPMAILER_LANG['file_open'] = 'File Error: لم نستطع فتح الملف: ';
  16 +$PHPMAILER_LANG['from_failed'] = 'البريد التالي لم نستطع ارسال البريد له : ';
  17 +$PHPMAILER_LANG['instantiate'] = 'لم نستطع توفير خدمة البريد.';
  18 +//$PHPMAILER_LANG['invalid_address'] = 'Not sending, email address is invalid: ';
  19 +$PHPMAILER_LANG['mailer_not_supported'] = ' mailer غير مدعوم.';
  20 +//$PHPMAILER_LANG['provide_address'] = 'You must provide at least one recipient email address.';
  21 +$PHPMAILER_LANG['recipients_failed'] = 'SMTP Error: الأخطاء التالية ' .
  22 + 'فشل في الارسال لكل من : ';
  23 +$PHPMAILER_LANG['signing'] = 'خطأ في التوقيع: ';
  24 +//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.';
  25 +//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: ';
  26 +//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: ';
  1 +<?php
  2 +/**
  3 +* PHPMailer language file: refer to English translation for definitive list
  4 +* Belarusian Version by Aleksander Maksymiuk <info@setpro.pl>
  5 +*/
  6 +
  7 +$PHPMAILER_LANG['authenticate'] = 'Памылка SMTP: памылка ідэнтыфікацыі.';
  8 +$PHPMAILER_LANG['connect_host'] = 'Памылка SMTP: нельга ўстанавіць сувязь з SMTP-серверам.';
  9 +$PHPMAILER_LANG['data_not_accepted'] = 'Памылка SMTP: звесткі непрынятыя.';
  10 +$PHPMAILER_LANG['empty_message'] = 'Пустое паведамленне.';
  11 +$PHPMAILER_LANG['encoding'] = 'Невядомая кадыроўка тэксту: ';
  12 +$PHPMAILER_LANG['execute'] = 'Нельга выканаць каманду: ';
  13 +$PHPMAILER_LANG['file_access'] = 'Няма доступу да файла: ';
  14 +$PHPMAILER_LANG['file_open'] = 'Нельга адкрыць файл: ';
  15 +$PHPMAILER_LANG['from_failed'] = 'Няправільны адрас адпраўніка: ';
  16 +$PHPMAILER_LANG['instantiate'] = 'Нельга прымяніць функцыю mail().';
  17 +$PHPMAILER_LANG['invalid_address'] = 'Нельга даслаць паведамленне, няправільны email атрымальніка: ';
  18 +$PHPMAILER_LANG['provide_address'] = 'Запоўніце, калі ласка, правільны email атрымальніка.';
  19 +$PHPMAILER_LANG['mailer_not_supported'] = ' - паштовы сервер не падтрымліваецца.';
  20 +$PHPMAILER_LANG['recipients_failed'] = 'Памылка SMTP: няправільныя атрымальнікі: ';
  21 +$PHPMAILER_LANG['signing'] = 'Памылка подпісу паведамлення: ';
  22 +$PHPMAILER_LANG['smtp_connect_failed'] = 'Памылка сувязі з SMTP-серверам.';
  23 +$PHPMAILER_LANG['smtp_error'] = 'Памылка SMTP: ';
  24 +$PHPMAILER_LANG['variable_set'] = 'Нельга ўстанавіць або перамяніць значэнне пераменнай: ';
  1 +<?php
  2 +/**
  3 +* PHPMailer language file: refer to English translation for definitive list
  4 +* Brazilian Portuguese Version
  5 +* By Paulo Henrique Garcia - paulo@controllerweb.com.br
  6 +* Edited by Lucas Guimarães - lucas@lucasguimaraes.com
  7 +*/
  8 +
  9 +$PHPMAILER_LANG['authenticate'] = 'Erro de SMTP: Não foi possível autenticar.';
  10 +$PHPMAILER_LANG['connect_host'] = 'Erro de SMTP: Não foi possível conectar com o servidor SMTP.';
  11 +$PHPMAILER_LANG['data_not_accepted'] = 'Erro de SMTP: Dados rejeitados.';
  12 +$PHPMAILER_LANG['empty_message'] = 'Corpo da mensagem vazio';
  13 +$PHPMAILER_LANG['encoding'] = 'Codificação desconhecida: ';
  14 +$PHPMAILER_LANG['execute'] = 'Não foi possível executar: ';
  15 +$PHPMAILER_LANG['file_access'] = 'Não foi possível acessar o arquivo: ';
  16 +$PHPMAILER_LANG['file_open'] = 'Erro de Arquivo: Não foi possível abrir o arquivo: ';
  17 +$PHPMAILER_LANG['from_failed'] = 'Os endereços dos remententes a seguir falharam: ';
  18 +$PHPMAILER_LANG['instantiate'] = 'Não foi possível iniciar uma instância da função mail.';
  19 +$PHPMAILER_LANG['invalid_address'] = 'Não enviando, endereço de e-mail inválido: ';
  20 +$PHPMAILER_LANG['mailer_not_supported'] = ' mailer não é suportado.';
  21 +$PHPMAILER_LANG['provide_address'] = 'Você deve fornecer pelo menos um endereço de destinatário de e-mail.';
  22 +$PHPMAILER_LANG['recipients_failed'] = 'Erro de SMTP: Os endereços de destinatário a seguir falharam: ';
  23 +$PHPMAILER_LANG['signing'] = 'Erro ao assinar: ';
  24 +$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() falhou.';
  25 +$PHPMAILER_LANG['smtp_error'] = 'Erro de servidor SMTP: ';
  26 +$PHPMAILER_LANG['variable_set'] = 'Não foi possível definir ou resetar a variável: ';
  1 +<?php
  2 +/**
  3 +* PHPMailer language file: refer to English translation for definitive list
  4 +* Catalan Version
  5 +* By Ivan: web AT microstudi DOT com
  6 +*/
  7 +
  8 +$PHPMAILER_LANG['authenticate'] = 'Error SMTP: No s’ha pogut autenticar.';
  9 +$PHPMAILER_LANG['connect_host'] = 'Error SMTP: No es pot connectar al servidor SMTP.';
  10 +$PHPMAILER_LANG['data_not_accepted'] = 'Error SMTP: Dades no acceptades.';
  11 +$PHPMAILER_LANG['empty_message'] = 'El cos del missatge està buit.';
  12 +$PHPMAILER_LANG['encoding'] = 'Codificació desconeguda: ';
  13 +$PHPMAILER_LANG['execute'] = 'No es pot executar: ';
  14 +$PHPMAILER_LANG['file_access'] = 'No es pot accedir a l’arxiu: ';
  15 +$PHPMAILER_LANG['file_open'] = 'Error d’Arxiu: No es pot obrir l’arxiu: ';
  16 +$PHPMAILER_LANG['from_failed'] = 'La(s) següent(s) adreces de remitent han fallat: ';
  17 +$PHPMAILER_LANG['instantiate'] = 'No s’ha pogut crear una instància de la funció Mail.';
  18 +$PHPMAILER_LANG['invalid_address'] = 'Adreça d’email invalida';
  19 +$PHPMAILER_LANG['mailer_not_supported'] = ' mailer no està suportat';
  20 +$PHPMAILER_LANG['provide_address'] = 'S’ha de proveir almenys una adreça d’email com a destinatari.';
  21 +$PHPMAILER_LANG['recipients_failed'] = 'Error SMTP: Els següents destinataris han fallat: ';
  22 +$PHPMAILER_LANG['signing'] = 'Error al signar: ';
  23 +$PHPMAILER_LANG['smtp_connect_failed'] = 'Ha fallat el SMTP Connect().';
  24 +$PHPMAILER_LANG['smtp_error'] = 'Error del servidor SMTP: ';
  25 +$PHPMAILER_LANG['variable_set'] = 'No s’ha pogut establir o restablir la variable: ';
  1 +<?php
  2 +/**
  3 +* PHPMailer language file: refer to English translation for definitive list
  4 +* Chinese Version
  5 +* By LiuXin: www.80x86.cn/blog/
  6 +*/
  7 +
  8 +$PHPMAILER_LANG['authenticate'] = 'SMTP 错误:身份验证失败。';
  9 +$PHPMAILER_LANG['connect_host'] = 'SMTP 错误: 不能连接SMTP主机。';
  10 +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP 错误: 数据不可接受。';
  11 +//$PHPMAILER_LANG['empty_message'] = 'Message body empty';
  12 +$PHPMAILER_LANG['encoding'] = '未知编码:';
  13 +$PHPMAILER_LANG['execute'] = '不能执行: ';
  14 +$PHPMAILER_LANG['file_access'] = '不能访问文件:';
  15 +$PHPMAILER_LANG['file_open'] = '文件错误:不能打开文件:';
  16 +$PHPMAILER_LANG['from_failed'] = '下面的发送地址邮件发送失败了: ';
  17 +$PHPMAILER_LANG['instantiate'] = '不能实现mail方法。';
  18 +//$PHPMAILER_LANG['invalid_address'] = 'Not sending, email address is invalid: ';
  19 +$PHPMAILER_LANG['mailer_not_supported'] = ' 您所选择的发送邮件的方法并不支持。';
  20 +$PHPMAILER_LANG['provide_address'] = '您必须提供至少一个 收信人的email地址。';
  21 +$PHPMAILER_LANG['recipients_failed'] = 'SMTP 错误: 下面的 收件人失败了: ';
  22 +//$PHPMAILER_LANG['signing'] = 'Signing Error: ';
  23 +//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.';
  24 +//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: ';
  25 +//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: ';
  1 +<?php
  2 +/**
  3 +* PHPMailer language file: refer to English translation for definitive list
  4 +* Czech Version
  5 +*/
  6 +
  7 +$PHPMAILER_LANG['authenticate'] = 'Chyba SMTP: Autentizace selhala.';
  8 +$PHPMAILER_LANG['connect_host'] = 'Chyba SMTP: Nelze navázat spojení se SMTP serverem.';
  9 +$PHPMAILER_LANG['data_not_accepted'] = 'Chyba SMTP: Data nebyla přijata.';
  10 +$PHPMAILER_LANG['empty_message'] = 'Prázdné tělo zprávy';
  11 +$PHPMAILER_LANG['encoding'] = 'Neznámé kódování: ';
  12 +$PHPMAILER_LANG['execute'] = 'Nelze provést: ';
  13 +$PHPMAILER_LANG['file_access'] = 'Nelze získat přístup k souboru: ';
  14 +$PHPMAILER_LANG['file_open'] = 'Chyba souboru: Nelze otevřít soubor pro čtení: ';
  15 +$PHPMAILER_LANG['from_failed'] = 'Následující adresa odesílatele je nesprávná: ';
  16 +$PHPMAILER_LANG['instantiate'] = 'Nelze vytvořit instanci emailové funkce.';
  17 +$PHPMAILER_LANG['invalid_address'] = 'Neplatná adresa: ';
  18 +$PHPMAILER_LANG['mailer_not_supported'] = ' mailer není podporován.';
  19 +$PHPMAILER_LANG['provide_address'] = 'Musíte zadat alespoň jednu emailovou adresu příjemce.';
  20 +$PHPMAILER_LANG['recipients_failed'] = 'Chyba SMTP: Následující adresy příjemců nejsou správně: ';
  21 +$PHPMAILER_LANG['signing'] = 'Chyba přihlašování: ';
  22 +$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() selhal.';
  23 +$PHPMAILER_LANG['smtp_error'] = 'Chyba SMTP serveru: ';
  24 +$PHPMAILER_LANG['variable_set'] = 'Nelze nastavit nebo změnit proměnnou: ';
  1 +<?php
  2 +/**
  3 +* PHPMailer language file: refer to English translation for definitive list
  4 +* German Version
  5 +*/
  6 +
  7 +$PHPMAILER_LANG['authenticate'] = 'SMTP Fehler: Authentifizierung fehlgeschlagen.';
  8 +$PHPMAILER_LANG['connect_host'] = 'SMTP Fehler: Konnte keine Verbindung zum SMTP-Host herstellen.';
  9 +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Fehler: Daten werden nicht akzeptiert.';
  10 +$PHPMAILER_LANG['empty_message'] = 'E-Mail Inhalt ist leer.';
  11 +$PHPMAILER_LANG['encoding'] = 'Unbekanntes Encoding-Format: ';
  12 +$PHPMAILER_LANG['execute'] = 'Konnte folgenden Befehl nicht ausführen: ';
  13 +$PHPMAILER_LANG['file_access'] = 'Zugriff auf folgende Datei fehlgeschlagen: ';
  14 +$PHPMAILER_LANG['file_open'] = 'Datei Fehler: konnte folgende Datei nicht öffnen: ';
  15 +$PHPMAILER_LANG['from_failed'] = 'Die folgende Absenderadresse ist nicht korrekt: ';
  16 +$PHPMAILER_LANG['instantiate'] = 'Mail Funktion konnte nicht initialisiert werden.';
  17 +$PHPMAILER_LANG['invalid_address'] = 'E-Mail wird nicht gesendet, die Adresse ist ungültig.';
  18 +$PHPMAILER_LANG['mailer_not_supported'] = ' mailer wird nicht unterstützt.';
  19 +$PHPMAILER_LANG['provide_address'] = 'Bitte geben Sie mindestens eine Empfänger E-Mailadresse an.';
  20 +$PHPMAILER_LANG['recipients_failed'] = 'SMTP Fehler: Die folgenden Empfänger sind nicht korrekt: ';
  21 +$PHPMAILER_LANG['signing'] = 'Fehler beim Signieren: ';
  22 +$PHPMAILER_LANG['smtp_connect_failed'] = 'Verbindung zu SMTP Server fehlgeschlagen.';
  23 +$PHPMAILER_LANG['smtp_error'] = 'Fehler vom SMTP Server: ';
  24 +$PHPMAILER_LANG['variable_set'] = 'Kann Variable nicht setzen oder zurücksetzen: ';
  1 +<?php
  2 +/**
  3 +* PHPMailer language file: refer to English translation for definitive list
  4 +* Danish Version
  5 +* Author: Mikael Stokkebro <info@stokkebro.dk>
  6 +*/
  7 +
  8 +$PHPMAILER_LANG['authenticate'] = 'SMTP fejl: Kunne ikke logge på.';
  9 +$PHPMAILER_LANG['connect_host'] = 'SMTP fejl: Kunne ikke tilslutte SMTP serveren.';
  10 +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP fejl: Data kunne ikke accepteres.';
  11 +//$PHPMAILER_LANG['empty_message'] = 'Message body empty';
  12 +$PHPMAILER_LANG['encoding'] = 'Ukendt encode-format: ';
  13 +$PHPMAILER_LANG['execute'] = 'Kunne ikke køre: ';
  14 +$PHPMAILER_LANG['file_access'] = 'Ingen adgang til fil: ';
  15 +$PHPMAILER_LANG['file_open'] = 'Fil fejl: Kunne ikke åbne filen: ';
  16 +$PHPMAILER_LANG['from_failed'] = 'Følgende afsenderadresse er forkert: ';
  17 +$PHPMAILER_LANG['instantiate'] = 'Kunne ikke initialisere email funktionen.';
  18 +//$PHPMAILER_LANG['invalid_address'] = 'Not sending, email address is invalid: ';
  19 +$PHPMAILER_LANG['mailer_not_supported'] = ' mailer understøttes ikke.';
  20 +$PHPMAILER_LANG['provide_address'] = 'Du skal indtaste mindst en modtagers emailadresse.';
  21 +$PHPMAILER_LANG['recipients_failed'] = 'SMTP fejl: Følgende modtagere er forkerte: ';
  22 +//$PHPMAILER_LANG['signing'] = 'Signing Error: ';
  23 +//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.';
  24 +//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: ';
  25 +//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: ';
  1 +<?php
  2 +/**
  3 +* PHPMailer language file: refer to English translation for definitive list
  4 +* Greek Version
  5 +*/
  6 +
  7 +$PHPMAILER_LANG['authenticate'] = 'SMTP Σφάλμα: Αδυναμία πιστοποίησης (authentication).';
  8 +$PHPMAILER_LANG['connect_host'] = 'SMTP Σφάλμα: Αδυναμία σύνδεσης στον SMTP-Host.';
  9 +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Σφάλμα: Τα δεδομένα δεν έγιναν αποδεκτά.';
  10 +$PHPMAILER_LANG['empty_message'] = 'Το E-Mail δεν έχει περιεχόμενο .';
  11 +$PHPMAILER_LANG['encoding'] = 'Αγνωστο Encoding-Format: ';
  12 +$PHPMAILER_LANG['execute'] = 'Αδυναμία εκτέλεσης ακόλουθης εντολής: ';
  13 +$PHPMAILER_LANG['file_access'] = 'Αδυναμία προσπέλασης του αρχείου: ';
  14 +$PHPMAILER_LANG['file_open'] = 'Σφάλμα Αρχείου: Δεν είναί δυνατό το άνοιγμα του ακόλουθου αρχείου: ';
  15 +$PHPMAILER_LANG['from_failed'] = 'Η παρακάτω διεύθυνση αποστολέα δεν είναι σωστή: ';
  16 +$PHPMAILER_LANG['instantiate'] = 'Αδυναμία εκκίνησης Mail function.';
  17 +$PHPMAILER_LANG['invalid_address'] = 'Το μήνυμα δεν αποστέλθηκε, η διεύθυνση δεν είναι έγκυρη.';
  18 +$PHPMAILER_LANG['mailer_not_supported'] = ' mailer δεν υποστηρίζεται.';
  19 +$PHPMAILER_LANG['provide_address'] = 'Παρακαλούμε δώστε τουλάχιστον μια e-mail διεύθυνση παραλήπτη.';
  20 +$PHPMAILER_LANG['recipients_failed'] = 'SMTP Σφάλμα: Οι παρακάτων διευθύνσεις παραλήπτη δεν είναι έγκυρες: ';
  21 +$PHPMAILER_LANG['signing'] = 'Σφάλμα υπογραφής: ';
  22 +$PHPMAILER_LANG['smtp_connect_failed'] = 'Αποτυχία σύνδεσης στον SMTP Server.';
  23 +$PHPMAILER_LANG['smtp_error'] = 'Σφάλμα από τον SMTP Server: ';
  24 +$PHPMAILER_LANG['variable_set'] = 'Αδυναμία ορισμού ή αρχικοποίησης μεταβλητής: ';
  1 +<?php
  2 +/**
  3 +* PHPMailer language file: refer to English translation for definitive list
  4 +* Esperanto version
  5 +*/
  6 +
  7 +$PHPMAILER_LANG['authenticate'] = 'Eraro de servilo SMTP : aŭtentigo malsukcesis.';
  8 +$PHPMAILER_LANG['connect_host'] = 'Eraro de servilo SMTP : konektado al servilo malsukcesis.';
  9 +$PHPMAILER_LANG['data_not_accepted'] = 'Eraro de servilo SMTP : neĝustaj datumoj.';
  10 +$PHPMAILER_LANG['empty_message'] = 'Teksto de mesaĝo mankas.';
  11 +$PHPMAILER_LANG['encoding'] = 'Nekonata kodoprezento: ';
  12 +$PHPMAILER_LANG['execute'] = 'Lanĉi rulumadon ne eblis: ';
  13 +$PHPMAILER_LANG['file_access'] = 'Aliro al dosiero ne sukcesis: ';
  14 +$PHPMAILER_LANG['file_open'] = 'Eraro de dosiero: malfermo neeblas: ';
  15 +$PHPMAILER_LANG['from_failed'] = 'Jena adreso de sendinto malsukcesis: ';
  16 +$PHPMAILER_LANG['instantiate'] = 'Genero de retmesaĝa funkcio neeblis.';
  17 +$PHPMAILER_LANG['invalid_address'] = 'Retadreso ne validas: ';
  18 +$PHPMAILER_LANG['mailer_not_supported'] = ' mesaĝilo ne subtenata.';
  19 +$PHPMAILER_LANG['provide_address'] = 'Vi devas tajpi almenaŭ unu recevontan retadreson.';
  20 +$PHPMAILER_LANG['recipients_failed'] = 'Eraro de servilo SMTP : la jenaj poŝtrecivuloj kaŭzis eraron: ';
  21 +$PHPMAILER_LANG['signing'] = 'Eraro de subskribo: ';
  22 +$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP konektado malsukcesis.';
  23 +$PHPMAILER_LANG['smtp_error'] = 'Eraro de servilo SMTP : ';
  24 +$PHPMAILER_LANG['variable_set'] = 'Variablo ne pravalorizeblas aŭ ne repravalorizeblas: ';
  1 +<?php
  2 +/**
  3 +* PHPMailer language file: refer to English translation for definitive list
  4 +* Spanish version
  5 +* Versión en español
  6 +* Edited by Matt Sturdy - matt.sturdy@gmail.com
  7 +*/
  8 +
  9 +$PHPMAILER_LANG['authenticate'] = 'Error SMTP: No se pudo autentificar.';
  10 +$PHPMAILER_LANG['connect_host'] = 'Error SMTP: No se pudo conectar al servidor SMTP.';
  11 +$PHPMAILER_LANG['data_not_accepted'] = 'Error SMTP: Datos no aceptados.';
  12 +$PHPMAILER_LANG['empty_message'] = 'Cuerpo del mensaje vacío';
  13 +$PHPMAILER_LANG['encoding'] = 'Codificación desconocida: ';
  14 +$PHPMAILER_LANG['execute'] = 'No se pudo ejecutar: ';
  15 +$PHPMAILER_LANG['file_access'] = 'No se pudo acceder al archivo: ';
  16 +$PHPMAILER_LANG['file_open'] = 'Error de Archivo: No se pudo abrir el archivo: ';
  17 +$PHPMAILER_LANG['from_failed'] = 'La(s) siguiente(s) direcciones de remitente fallaron: ';
  18 +$PHPMAILER_LANG['instantiate'] = 'No se pudo crear una instancia de la función Mail.';
  19 +$PHPMAILER_LANG['invalid_address'] = 'No se pudo enviar: dirección de email inválido: ';
  20 +$PHPMAILER_LANG['mailer_not_supported'] = ' mailer no está soportado.';
  21 +$PHPMAILER_LANG['provide_address'] = 'Debe proveer al menos una dirección de email como destino.';
  22 +$PHPMAILER_LANG['recipients_failed'] = 'Error SMTP: Los siguientes destinos fallaron: ';
  23 +$PHPMAILER_LANG['signing'] = 'Error al firmar: ';
  24 +$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() se falló.';
  25 +$PHPMAILER_LANG['smtp_error'] = 'Error del servidor SMTP: ';
  26 +$PHPMAILER_LANG['variable_set'] = 'No se pudo ajustar o reajustar la variable: ';
  1 +<?php
  2 +/**
  3 +* PHPMailer language file: refer to English translation for definitive list
  4 +* Estonian Version
  5 +* By Indrek Päri
  6 +* Revised By Elan Ruusamäe <glen@delfi.ee>
  7 +*/
  8 +
  9 +$PHPMAILER_LANG['authenticate'] = 'SMTP Viga: Autoriseerimise viga.';
  10 +$PHPMAILER_LANG['connect_host'] = 'SMTP Viga: Ei õnnestunud luua ühendust SMTP serveriga.';
  11 +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Viga: Vigased andmed.';
  12 +$PHPMAILER_LANG['empty_message'] = 'Tühi kirja sisu';
  13 +$PHPMAILER_LANG["encoding"] = 'Tundmatu kodeering: ';
  14 +$PHPMAILER_LANG['execute'] = 'Tegevus ebaõnnestus: ';
  15 +$PHPMAILER_LANG['file_access'] = 'Pole piisavalt õiguseid järgneva faili avamiseks: ';
  16 +$PHPMAILER_LANG['file_open'] = 'Faili Viga: Faili avamine ebaõnnestus: ';
  17 +$PHPMAILER_LANG['from_failed'] = 'Järgnev saatja e-posti aadress on vigane: ';
  18 +$PHPMAILER_LANG['instantiate'] = 'mail funktiooni käivitamine ebaõnnestus.';
  19 +$PHPMAILER_LANG['invalid_address'] = 'Saatmine peatatud, e-posti address vigane: ';
  20 +$PHPMAILER_LANG['provide_address'] = 'Te peate määrama vähemalt ühe saaja e-posti aadressi.';
  21 +$PHPMAILER_LANG['mailer_not_supported'] = ' maileri tugi puudub.';
  22 +$PHPMAILER_LANG['recipients_failed'] = 'SMTP Viga: Järgnevate saajate e-posti aadressid on vigased: ';
  23 +$PHPMAILER_LANG["signing"] = 'Viga allkirjastamisel: ';
  24 +$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() ebaõnnestus.';
  25 +$PHPMAILER_LANG['smtp_error'] = 'SMTP serveri viga: ';
  26 +$PHPMAILER_LANG['variable_set'] = 'Ei õnnestunud määrata või lähtestada muutujat: ';
  1 +<?php
  2 +/**
  3 +* PHPMailer language file: refer to English translation for definitive list
  4 +* Persian/Farsi Version, UTF-8
  5 +* By: Ali Jazayeri <jaza.ali@gmail.com>
  6 +* Edit: Mohammad Hossein Mojtahedi <mhm5000@gmail.com>
  7 +*/
  8 +
  9 +$PHPMAILER_LANG['authenticate'] = 'خطای SMTP: احراز هویت با شکست مواجه شد.';
  10 +$PHPMAILER_LANG['connect_host'] = 'خطای SMTP: اتصال به سرور SMTP برقرار نشد.';
  11 +$PHPMAILER_LANG['data_not_accepted'] = 'خطای SMTP: داده‌ها نا‌درست هستند.';
  12 +$PHPMAILER_LANG['empty_message'] = 'بخش متن پیام خالی است.';
  13 +$PHPMAILER_LANG['encoding'] = 'کد‌گذاری نا‌شناخته: ';
  14 +$PHPMAILER_LANG['execute'] = 'امکان اجرا وجود ندارد: ';
  15 +$PHPMAILER_LANG['file_access'] = 'امکان دسترسی به فایل وجود ندارد: ';
  16 +$PHPMAILER_LANG['file_open'] = 'خطای File: امکان بازکردن فایل وجود ندارد: ';
  17 +$PHPMAILER_LANG['from_failed'] = 'آدرس فرستنده اشتباه است: ';
  18 +$PHPMAILER_LANG['instantiate'] = 'امکان معرفی تابع ایمیل وجود ندارد.';
  19 +$PHPMAILER_LANG['invalid_address'] = 'آدرس ایمیل معتبر نیست: ';
  20 +$PHPMAILER_LANG['mailer_not_supported'] = ' mailer پشتیبانی نمی‌شود.';
  21 +$PHPMAILER_LANG['provide_address'] = 'باید حداقل یک آدرس گیرنده وارد کنید.';
  22 +$PHPMAILER_LANG['recipients_failed'] = 'خطای SMTP: ارسال به آدرس گیرنده با خطا مواجه شد: ';
  23 +$PHPMAILER_LANG['signing'] = 'خطا در امضا: ';
  24 +$PHPMAILER_LANG['smtp_connect_failed'] = 'خطا در اتصال به SMTP.';
  25 +$PHPMAILER_LANG['smtp_error'] = 'خطا در SMTP Server: ';
  26 +$PHPMAILER_LANG['variable_set'] = 'امکان ارسال یا ارسال مجدد متغیر‌ها وجود ندارد: ';
  1 +<?php
  2 +/**
  3 +* PHPMailer language file: refer to English translation for definitive list
  4 +* Finnish Version
  5 +* By Jyry Kuukanen
  6 +*/
  7 +
  8 +$PHPMAILER_LANG['authenticate'] = 'SMTP-virhe: käyttäjätunnistus epäonnistui.';
  9 +$PHPMAILER_LANG['connect_host'] = 'SMTP-virhe: yhteys palvelimeen ei onnistu.';
  10 +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP-virhe: data on virheellinen.';
  11 +//$PHPMAILER_LANG['empty_message'] = 'Message body empty';
  12 +$PHPMAILER_LANG['encoding'] = 'Tuntematon koodaustyyppi: ';
  13 +$PHPMAILER_LANG['execute'] = 'Suoritus epäonnistui: ';
  14 +$PHPMAILER_LANG['file_access'] = 'Seuraavaan tiedostoon ei ole oikeuksia: ';
  15 +$PHPMAILER_LANG['file_open'] = 'Tiedostovirhe: Ei voida avata tiedostoa: ';
  16 +$PHPMAILER_LANG['from_failed'] = 'Seuraava lähettäjän osoite on virheellinen: ';
  17 +$PHPMAILER_LANG['instantiate'] = 'mail-funktion luonti epäonnistui.';
  18 +//$PHPMAILER_LANG['invalid_address'] = 'Not sending, email address is invalid: ';
  19 +$PHPMAILER_LANG['mailer_not_supported'] = 'postivälitintyyppiä ei tueta.';
  20 +$PHPMAILER_LANG['provide_address'] = 'Aseta vähintään yksi vastaanottajan sähk&ouml;postiosoite.';
  21 +$PHPMAILER_LANG['recipients_failed'] = 'SMTP-virhe: seuraava vastaanottaja osoite on virheellinen.';
  22 +$PHPMAILER_LANG['encoding'] = 'Tuntematon koodaustyyppi: ';
  23 +//$PHPMAILER_LANG['signing'] = 'Signing Error: ';
  24 +//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.';
  25 +//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: ';
  26 +//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: ';
  1 +<?php
  2 +/**
  3 +* PHPMailer language file: refer to English translation for definitive list
  4 +* Faroese Version [language of the Faroe Islands, a Danish dominion]
  5 +* This file created: 11-06-2004
  6 +* Supplied by Dávur Sørensen [www.profo-webdesign.dk]
  7 +*/
  8 +
  9 +$PHPMAILER_LANG['authenticate'] = 'SMTP feilur: Kundi ikki góðkenna.';
  10 +$PHPMAILER_LANG['connect_host'] = 'SMTP feilur: Kundi ikki knýta samband við SMTP vert.';
  11 +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP feilur: Data ikki góðkent.';
  12 +//$PHPMAILER_LANG['empty_message'] = 'Message body empty';
  13 +$PHPMAILER_LANG['encoding'] = 'Ókend encoding: ';
  14 +$PHPMAILER_LANG['execute'] = 'Kundi ikki útføra: ';
  15 +$PHPMAILER_LANG['file_access'] = 'Kundi ikki tilganga fílu: ';
  16 +$PHPMAILER_LANG['file_open'] = 'Fílu feilur: Kundi ikki opna fílu: ';
  17 +$PHPMAILER_LANG['from_failed'] = 'fylgjandi Frá/From adressa miseydnaðist: ';
  18 +$PHPMAILER_LANG['instantiate'] = 'Kuni ikki instantiera mail funktión.';
  19 +//$PHPMAILER_LANG['invalid_address'] = 'Not sending, email address is invalid: ';
  20 +$PHPMAILER_LANG['mailer_not_supported'] = ' er ikki supporterað.';
  21 +$PHPMAILER_LANG['provide_address'] = 'Tú skal uppgeva minst móttakara-emailadressu(r).';
  22 +$PHPMAILER_LANG['recipients_failed'] = 'SMTP Feilur: Fylgjandi móttakarar miseydnaðust: ';
  23 +//$PHPMAILER_LANG['signing'] = 'Signing Error: ';
  24 +//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.';
  25 +//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: ';
  26 +//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: ';
  1 +<?php
  2 +/**
  3 + * PHPMailer language file: refer to English translation for definitive list
  4 + * French Version
  5 + * Some French punctuation requires a thin non-breaking space (U+202F) character before it,
  6 + * for example before a colon or exclamation mark.
  7 + * There is one of these characters between these quotes: " "
  8 + * @link http://unicode.org/udhr/n/notes_fra.html
  9 + *
  10 + */
  11 +
  12 +$PHPMAILER_LANG['authenticate'] = 'Erreur SMTP : échec de l\'authentification.';
  13 +$PHPMAILER_LANG['connect_host'] = 'Erreur SMTP : impossible de se connecter au serveur SMTP.';
  14 +$PHPMAILER_LANG['data_not_accepted'] = 'Erreur SMTP : données incorrectes.';
  15 +$PHPMAILER_LANG['empty_message'] = 'Corps du message vide.';
  16 +$PHPMAILER_LANG['encoding'] = 'Encodage inconnu : ';
  17 +$PHPMAILER_LANG['execute'] = 'Impossible de lancer l\'exécution : ';
  18 +$PHPMAILER_LANG['file_access'] = 'Impossible d\'accéder au fichier : ';
  19 +$PHPMAILER_LANG['file_open'] = 'Ouverture du fichier impossible : ';
  20 +$PHPMAILER_LANG['from_failed'] = 'L\'adresse d\'expéditeur suivante a échoué : ';
  21 +$PHPMAILER_LANG['instantiate'] = 'Impossible d\'instancier la fonction mail.';
  22 +$PHPMAILER_LANG['invalid_address'] = 'L\'adresse courriel n\'est pas valide : ';
  23 +$PHPMAILER_LANG['mailer_not_supported'] = ' client de messagerie non supporté.';
  24 +$PHPMAILER_LANG['provide_address'] = 'Vous devez fournir au moins une adresse de destinataire.';
  25 +$PHPMAILER_LANG['recipients_failed'] = 'Erreur SMTP : les destinataires suivants sont en erreur : ';
  26 +$PHPMAILER_LANG['signing'] = 'Erreur de signature : ';
  27 +$PHPMAILER_LANG['smtp_connect_failed'] = 'Échec de la connexion SMTP.';
  28 +$PHPMAILER_LANG['smtp_error'] = 'Erreur du serveur SMTP : ';
  29 +$PHPMAILER_LANG['variable_set'] = 'Impossible d\'initialiser ou de réinitialiser une variable : ';
  1 +<?php
  2 +/**
  3 +* PHPMailer language file: refer to English translation for definitive list
  4 +* Galician version
  5 +* Versión en galego
  6 +* Edited by Donato Rouco - donatorouco@gmail.com
  7 +*/
  8 +
  9 +$PHPMAILER_LANG['authenticate'] = 'Erro SMTP: Non puido ser autentificado.';
  10 +$PHPMAILER_LANG['connect_host'] = 'Erro SMTP: Non puido conectar co servidor SMTP.';
  11 +$PHPMAILER_LANG['data_not_accepted'] = 'Erro SMTP: Datos non aceptados.';
  12 +$PHPMAILER_LANG['empty_message'] = 'Corpo da mensaxe vacía';
  13 +$PHPMAILER_LANG['encoding'] = 'Codificación descoñecida: ';
  14 +$PHPMAILER_LANG['execute'] = 'Non puido ser executado: ';
  15 +$PHPMAILER_LANG['file_access'] = 'Nob puido acceder ó arquivo: ';
  16 +$PHPMAILER_LANG['file_open'] = 'Erro de Arquivo: No puido abrir o arquivo: ';
  17 +$PHPMAILER_LANG['from_failed'] = 'A(s) seguinte(s) dirección(s) de remitente(s) deron erro: ';
  18 +$PHPMAILER_LANG['instantiate'] = 'Non puido crear unha instancia da función Mail.';
  19 +$PHPMAILER_LANG['invalid_address'] = 'Non puido envia-lo correo: dirección de email inválida: ';
  20 +$PHPMAILER_LANG['mailer_not_supported'] = ' mailer non está soportado.';
  21 +$PHPMAILER_LANG['provide_address'] = 'Debe engadir polo menos unha dirección de email coma destino.';
  22 +$PHPMAILER_LANG['recipients_failed'] = 'Erro SMTP: Os seguintes destinos fallaron: ';
  23 +$PHPMAILER_LANG['signing'] = 'Erro ó firmar: ';
  24 +$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() fallou.';
  25 +$PHPMAILER_LANG['smtp_error'] = 'Erro do servidor SMTP: ';
  26 +$PHPMAILER_LANG['variable_set'] = 'Non puidemos axustar ou reaxustar a variábel: ';
  1 +<?php
  2 +/**
  3 +* PHPMailer language file: refer to English translation for definitive list
  4 +* Hebrew Version, UTF-8
  5 +* by : Ronny Sherer <ronny@hoojima.com>
  6 +*/
  7 +
  8 +$PHPMAILER_LANG['authenticate'] = 'שגיאת SMTP: פעולת האימות נכשלה.';
  9 +$PHPMAILER_LANG['connect_host'] = 'שגיאת SMTP: לא הצלחתי להתחבר לשרת SMTP.';
  10 +$PHPMAILER_LANG['data_not_accepted'] = 'שגיאת SMTP: מידע לא התקבל.';
  11 +$PHPMAILER_LANG['empty_message'] = 'גוף ההודעה ריק';
  12 +$PHPMAILER_LANG['invalid_address'] = 'כתובת שגויה';
  13 +$PHPMAILER_LANG['encoding'] = 'קידוד לא מוכר: ';
  14 +$PHPMAILER_LANG['execute'] = 'לא הצלחתי להפעיל את: ';
  15 +$PHPMAILER_LANG['file_access'] = 'לא ניתן לגשת לקובץ: ';
  16 +$PHPMAILER_LANG['file_open'] = 'שגיאת קובץ: לא ניתן לגשת לקובץ: ';
  17 +$PHPMAILER_LANG['from_failed'] = 'כתובות הנמענים הבאות נכשלו: ';
  18 +$PHPMAILER_LANG['instantiate'] = 'לא הצלחתי להפעיל את פונקציית המייל.';
  19 +$PHPMAILER_LANG['mailer_not_supported'] = ' אינה נתמכת.';
  20 +$PHPMAILER_LANG['provide_address'] = 'חובה לספק לפחות כתובת אחת של מקבל המייל.';
  21 +$PHPMAILER_LANG['recipients_failed'] = 'שגיאת SMTP: הנמענים הבאים נכשלו: ';
  22 +$PHPMAILER_LANG['signing'] = 'שגיאת חתימה: ';
  23 +$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.';
  24 +$PHPMAILER_LANG['smtp_error'] = 'שגיאת שרת SMTP: ';
  25 +$PHPMAILER_LANG['variable_set'] = 'לא ניתן לקבוע או לשנות את המשתנה: ';
  1 +<?php
  2 +/**
  3 + * PHPMailer language file: refer to English translation for definitive list
  4 + * Croatian Version
  5 + * By Hrvoj3e <hrvoj3e@gmail.com>
  6 + */
  7 +
  8 +$PHPMAILER_LANG['authenticate'] = 'SMTP Greška: Neuspjela autentikacija.';
  9 +$PHPMAILER_LANG['connect_host'] = 'SMTP Greška: Ne mogu se spojiti na SMTP poslužitelj.';
  10 +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Greška: Podatci nisu prihvaćeni.';
  11 +$PHPMAILER_LANG['empty_message'] = 'Sadržaj poruke je prazan.';
  12 +$PHPMAILER_LANG['encoding'] = 'Nepoznati encoding: ';
  13 +$PHPMAILER_LANG['execute'] = 'Nije moguće izvršiti naredbu: ';
  14 +$PHPMAILER_LANG['file_access'] = 'Nije moguće pristupiti datoteci: ';
  15 +$PHPMAILER_LANG['file_open'] = 'Nije moguće otvoriti datoteku: ';
  16 +$PHPMAILER_LANG['from_failed'] = 'SMTP Greška: Slanje s navedenih e-mail adresa nije uspjelo: ';
  17 +$PHPMAILER_LANG['recipients_failed'] = 'SMTP Greška: Slanje na navedenih e-mail adresa nije uspjelo: ';
  18 +$PHPMAILER_LANG['instantiate'] = 'Ne mogu pokrenuti mail funkcionalnost.';
  19 +$PHPMAILER_LANG['invalid_address'] = 'E-mail nije poslan. Neispravna e-mail adresa.';
  20 +$PHPMAILER_LANG['mailer_not_supported'] = ' mailer nije podržan.';
  21 +$PHPMAILER_LANG['provide_address'] = 'Definirajte barem jednu adresu primatelja.';
  22 +$PHPMAILER_LANG['signing'] = 'Greška prilikom prijave: ';
  23 +$PHPMAILER_LANG['smtp_connect_failed'] = 'Spajanje na SMTP poslužitelj nije uspjelo.';
  24 +$PHPMAILER_LANG['smtp_error'] = 'Greška SMTP poslužitelja: ';
  25 +$PHPMAILER_LANG['variable_set'] = 'Ne mogu postaviti varijablu niti ju vratiti nazad: ';
  1 +<?php
  2 +/**
  3 +* PHPMailer language file: refer to English translation for definitive list
  4 +* Hungarian Version by @dominicus-75
  5 +*/
  6 +
  7 +$PHPMAILER_LANG['authenticate'] = 'SMTP hiba: az azonosítás sikertelen.';
  8 +$PHPMAILER_LANG['connect_host'] = 'SMTP hiba: nem lehet kapcsolódni az SMTP-szerverhez.';
  9 +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP hiba: adatok visszautasítva.';
  10 +$PHPMAILER_LANG['empty_message'] = 'Üres az üzenettörzs.';
  11 +$PHPMAILER_LANG['encoding'] = 'Ismeretlen kódolás: ';
  12 +$PHPMAILER_LANG['execute'] = 'Nem lehet végrehajtani: ';
  13 +$PHPMAILER_LANG['file_access'] = 'A következő fájl nem elérhető: ';
  14 +$PHPMAILER_LANG['file_open'] = 'Fájl hiba: a következő fájlt nem lehet megnyitni: ';
  15 +$PHPMAILER_LANG['from_failed'] = 'A feladóként megadott következő cím hibás: ';
  16 +$PHPMAILER_LANG['instantiate'] = 'A PHP mail() függvényt nem sikerült végrehajtani.';
  17 +$PHPMAILER_LANG['invalid_address'] = 'Érvénytelen cím: ';
  18 +$PHPMAILER_LANG['mailer_not_supported'] = ' a mailer-osztály nem támogatott.';
  19 +$PHPMAILER_LANG['provide_address'] = 'Legalább egy címzettet fel kell tüntetni.';
  20 +$PHPMAILER_LANG['recipients_failed'] = 'SMTP hiba: a címzettként megadott következő címek hibásak: ';
  21 +$PHPMAILER_LANG['signing'] = 'Hibás aláírás: ';
  22 +$PHPMAILER_LANG['smtp_connect_failed'] = 'Hiba az SMTP-kapcsolatban.';
  23 +$PHPMAILER_LANG['smtp_error'] = 'SMTP-szerver hiba: ';
  24 +$PHPMAILER_LANG['variable_set'] = 'A következő változók beállítása nem sikerült: ';
  1 +<?php
  2 +/**
  3 +* PHPMailer language file: refer to English translation for definitive list
  4 +* Italian version
  5 +* @package PHPMailer
  6 +* @author Ilias Bartolini <brain79@inwind.it>, Stefano Sabatini <sabas88@gmail.com>
  7 +*/
  8 +
  9 +$PHPMAILER_LANG['authenticate'] = 'SMTP Error: Impossibile autenticarsi.';
  10 +$PHPMAILER_LANG['connect_host'] = 'SMTP Error: Impossibile connettersi all\'host SMTP.';
  11 +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Error: Dati non accettati dal server.';
  12 +$PHPMAILER_LANG['empty_message'] = 'Il corpo del messaggio è vuoto';
  13 +$PHPMAILER_LANG['encoding'] = 'Codifica dei caratteri sconosciuta: ';
  14 +$PHPMAILER_LANG['execute'] = 'Impossibile eseguire l\'operazione: ';
  15 +$PHPMAILER_LANG['file_access'] = 'Impossibile accedere al file: ';
  16 +$PHPMAILER_LANG['file_open'] = 'File Error: Impossibile aprire il file: ';
  17 +$PHPMAILER_LANG['from_failed'] = 'I seguenti indirizzi mittenti hanno generato errore: ';
  18 +$PHPMAILER_LANG['instantiate'] = 'Impossibile istanziare la funzione mail';
  19 +$PHPMAILER_LANG['invalid_address'] = 'Impossibile inviare, l\'indirizzo email non è valido: ';
  20 +$PHPMAILER_LANG['provide_address'] = 'Deve essere fornito almeno un indirizzo ricevente';
  21 +$PHPMAILER_LANG['mailer_not_supported'] = 'Mailer non supportato';
  22 +$PHPMAILER_LANG['recipients_failed'] = 'SMTP Error: I seguenti indirizzi destinatari hanno generato un errore: ';
  23 +$PHPMAILER_LANG['signing'] = 'Errore nella firma: ';
  24 +$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() fallita.';
  25 +$PHPMAILER_LANG['smtp_error'] = 'Errore del server SMTP: ';
  26 +$PHPMAILER_LANG['variable_set'] = 'Impossibile impostare o resettare la variabile: ';
  1 +<?php
  2 +/**
  3 +* PHPMailer language file: refer to English translation for definitive list
  4 +* Japanese Version
  5 +* By Mitsuhiro Yoshida - http://mitstek.com/
  6 +* Modified by Yoshi Sakai - http://bluemooninc.jp/
  7 +*/
  8 +
  9 +$PHPMAILER_LANG['authenticate'] = 'SMTPエラー: 認証できませんでした。';
  10 +$PHPMAILER_LANG['connect_host'] = 'SMTPエラー: SMTPホストに接続できませんでした。';
  11 +$PHPMAILER_LANG['data_not_accepted'] = 'SMTPエラー: データが受け付けられませんでした。';
  12 +//$PHPMAILER_LANG['empty_message'] = 'Message body empty';
  13 +$PHPMAILER_LANG['encoding'] = '不明なエンコーディング: ';
  14 +$PHPMAILER_LANG['execute'] = '実行できませんでした: ';
  15 +$PHPMAILER_LANG['file_access'] = 'ファイルにアクセスできません: ';
  16 +$PHPMAILER_LANG['file_open'] = 'ファイルエラー: ファイルを開けません: ';
  17 +$PHPMAILER_LANG['from_failed'] = 'Fromアドレスを登録する際にエラーが発生しました: ';
  18 +$PHPMAILER_LANG['instantiate'] = 'メール関数が正常に動作しませんでした。';
  19 +//$PHPMAILER_LANG['invalid_address'] = 'Not sending, email address is invalid: ';
  20 +$PHPMAILER_LANG['provide_address'] = '少なくとも1つメールアドレスを 指定する必要があります。';
  21 +$PHPMAILER_LANG['mailer_not_supported'] = ' メーラーがサポートされていません。';
  22 +$PHPMAILER_LANG['recipients_failed'] = 'SMTPエラー: 次の受信者アドレスに 間違いがあります: ';
  23 +//$PHPMAILER_LANG['signing'] = 'Signing Error: ';
  24 +//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.';
  25 +//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: ';
  26 +//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: ';
  1 +<?php
  2 +/**
  3 +* PHPMailer language file: refer to English translation for definitive list
  4 +* Georgian Version by Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
  5 +*/
  6 +
  7 +$PHPMAILER_LANG['authenticate'] = 'SMTP შეცდომა: ავტორიზაცია შეუძლებელია.';
  8 +$PHPMAILER_LANG['connect_host'] = 'SMTP შეცდომა: SMTP სერვერთან დაკავშირება შეუძლებელია.';
  9 +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP შეცდომა: მონაცემები არ იქნა მიღებული.';
  10 +$PHPMAILER_LANG['encoding'] = 'კოდირების უცნობი ტიპი: ';
  11 +$PHPMAILER_LANG['execute'] = 'შეუძლებელია შემდეგი ბრძანების შესრულება: ';
  12 +$PHPMAILER_LANG['file_access'] = 'შეუძლებელია წვდომა ფაილთან: ';
  13 +$PHPMAILER_LANG['file_open'] = 'ფაილური სისტემის შეცდომა: არ იხსნება ფაილი: ';
  14 +$PHPMAILER_LANG['from_failed'] = 'გამგზავნის არასწორი მისამართი: ';
  15 +$PHPMAILER_LANG['instantiate'] = 'mail ფუნქციის გაშვება ვერ ხერხდება.';
  16 +$PHPMAILER_LANG['provide_address'] = 'გთხოვთ მიუთითოთ ერთი ადრესატის e-mail მისამართი მაინც.';
  17 +$PHPMAILER_LANG['mailer_not_supported'] = ' - საფოსტო სერვერის მხარდაჭერა არ არის.';
  18 +$PHPMAILER_LANG['recipients_failed'] = 'SMTP შეცდომა: შემდეგ მისამართებზე გაგზავნა ვერ მოხერხდა: ';
  19 +$PHPMAILER_LANG['empty_message'] = 'შეტყობინება ცარიელია';
  20 +$PHPMAILER_LANG['invalid_address'] = 'არ გაიგზავნა, e-mail მისამართის არასწორი ფორმატი: ';
  21 +$PHPMAILER_LANG['signing'] = 'ხელმოწერის შეცდომა: ';
  22 +$PHPMAILER_LANG['smtp_connect_failed'] = 'შეცდომა SMTP სერვერთან დაკავშირებისას';
  23 +$PHPMAILER_LANG['smtp_error'] = 'SMTP სერვერის შეცდომა: ';
  24 +$PHPMAILER_LANG['variable_set'] = 'შეუძლებელია შემდეგი ცვლადის შექმნა ან შეცვლა: ';
  1 +<?php
  2 +/**
  3 +* PHPMailer language file: refer to English translation for definitive list
  4 +* Lithuanian version by Dainius Kaupaitis <dk@sum.lt>
  5 +*/
  6 +
  7 +$PHPMAILER_LANG['authenticate'] = 'SMTP klaida: autentifikacija nepavyko.';
  8 +$PHPMAILER_LANG['connect_host'] = 'SMTP klaida: nepavyksta prisijungti prie SMTP stoties.';
  9 +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP klaida: duomenys nepriimti.';
  10 +$PHPMAILER_LANG['empty_message'] = 'Laiško turinys tuščias';
  11 +$PHPMAILER_LANG['encoding'] = 'Neatpažinta koduotė: ';
  12 +$PHPMAILER_LANG['execute'] = 'Nepavyko įvykdyti komandos: ';
  13 +$PHPMAILER_LANG['file_access'] = 'Byla nepasiekiama: ';
  14 +$PHPMAILER_LANG['file_open'] = 'Bylos klaida: Nepavyksta atidaryti: ';
  15 +$PHPMAILER_LANG['from_failed'] = 'Neteisingas siuntėjo adresas: ';
  16 +$PHPMAILER_LANG['instantiate'] = 'Nepavyko paleisti mail funkcijos.';
  17 +$PHPMAILER_LANG['invalid_address'] = 'Neteisingas adresas';
  18 +$PHPMAILER_LANG['mailer_not_supported'] = ' pašto stotis nepalaikoma.';
  19 +$PHPMAILER_LANG['provide_address'] = 'Nurodykite bent vieną gavėjo adresą.';
  20 +$PHPMAILER_LANG['recipients_failed'] = 'SMTP klaida: nepavyko išsiųsti šiems gavėjams: ';
  21 +$PHPMAILER_LANG['signing'] = 'Prisijungimo klaida: ';
  22 +$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP susijungimo klaida';
  23 +$PHPMAILER_LANG['smtp_error'] = 'SMTP stoties klaida: ';
  24 +$PHPMAILER_LANG['variable_set'] = 'Nepavyko priskirti reikšmės kintamajam: ';
  1 +<?php
  2 +/**
  3 +* PHPMailer language file: refer to English translation for definitive list
  4 +* Latvian version by Eduards M. <e@npd.lv>
  5 +*/
  6 +
  7 +$PHPMAILER_LANG['authenticate'] = 'SMTP kļūda: Autorizācija neizdevās.';
  8 +$PHPMAILER_LANG['connect_host'] = 'SMTP Kļūda: Nevar izveidot savienojumu ar SMTP serveri.';
  9 +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Kļūda: Nepieņem informāciju.';
  10 +$PHPMAILER_LANG['empty_message'] = 'Ziņojuma teksts ir tukšs';
  11 +$PHPMAILER_LANG['encoding'] = 'Neatpazīts kodējums: ';
  12 +$PHPMAILER_LANG['execute'] = 'Neizdevās izpildīt komandu: ';
  13 +$PHPMAILER_LANG['file_access'] = 'Fails nav pieejams: ';
  14 +$PHPMAILER_LANG['file_open'] = 'Faila kļūda: Nevar atvērt failu: ';
  15 +$PHPMAILER_LANG['from_failed'] = 'Nepareiza sūtītāja adrese: ';
  16 +$PHPMAILER_LANG['instantiate'] = 'Nevar palaist sūtīšanas funkciju.';
  17 +$PHPMAILER_LANG['invalid_address'] = 'Nepareiza adrese';
  18 +$PHPMAILER_LANG['mailer_not_supported'] = ' sūtītājs netiek atbalstīts.';
  19 +$PHPMAILER_LANG['provide_address'] = 'Lūdzu, norādiet vismaz vienu adresātu.';
  20 +$PHPMAILER_LANG['recipients_failed'] = 'SMTP kļūda: neizdevās nosūtīt šādiem saņēmējiem: ';
  21 +$PHPMAILER_LANG['signing'] = 'Autorizācijas kļūda: ';
  22 +$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP savienojuma kļūda';
  23 +$PHPMAILER_LANG['smtp_error'] = 'SMTP servera kļūda: ';
  24 +$PHPMAILER_LANG['variable_set'] = 'Nevar piešķirt mainīgā vērtību: ';
  1 +<?php
  2 +/**
  3 +* PHPMailer language file: refer to class.phpmailer.php for definitive list.
  4 +* Dutch Version by Tuxion <team@tuxion.nl>
  5 +*/
  6 +
  7 +$PHPMAILER_LANG['authenticate'] = 'SMTP-fout: authenticatie mislukt.';
  8 +$PHPMAILER_LANG['connect_host'] = 'SMTP-fout: kon niet verbinden met SMTP-host.';
  9 +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP-fout: data niet geaccepteerd.';
  10 +$PHPMAILER_LANG['empty_message'] = 'Berichttekst is leeg';
  11 +$PHPMAILER_LANG['encoding'] = 'Onbekende codering: ';
  12 +$PHPMAILER_LANG['execute'] = 'Kon niet uitvoeren: ';
  13 +$PHPMAILER_LANG['file_access'] = 'Kreeg geen toegang tot bestand: ';
  14 +$PHPMAILER_LANG['file_open'] = 'Bestandsfout: kon bestand niet openen: ';
  15 +$PHPMAILER_LANG['from_failed'] = 'Het volgende afzendersadres is mislukt: ';
  16 +$PHPMAILER_LANG['instantiate'] = 'Kon mailfunctie niet initialiseren.';
  17 +$PHPMAILER_LANG['invalid_address'] = 'Ongeldig adres';
  18 +$PHPMAILER_LANG['mailer_not_supported'] = ' mailer wordt niet ondersteund.';
  19 +$PHPMAILER_LANG['provide_address'] = 'Er moet minstens één ontvanger worden opgegeven.';
  20 +$PHPMAILER_LANG['recipients_failed'] = 'SMTP-fout: de volgende ontvangers zijn mislukt: ';
  21 +$PHPMAILER_LANG['signing'] = 'Signeerfout: ';
  22 +$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Verbinding mislukt.';
  23 +$PHPMAILER_LANG['smtp_error'] = 'SMTP-serverfout: ';
  24 +$PHPMAILER_LANG['variable_set'] = 'Kan de volgende variablen niet instellen of resetten: ';
  1 +<?php
  2 +/**
  3 +* PHPMailer language file: refer to English translation for definitive list
  4 +* Norwegian Version
  5 +*/
  6 +
  7 +$PHPMAILER_LANG['authenticate'] = 'SMTP Feil: Kunne ikke authentisere.';
  8 +$PHPMAILER_LANG['connect_host'] = 'SMTP Feil: Kunne ikke koble til SMTP host.';
  9 +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Feil: Data ble ikke akseptert.';
  10 +$PHPMAILER_LANG['empty_message'] = 'Meldingsinnholdet er tomt';
  11 +$PHPMAILER_LANG['encoding'] = 'Ukjent tegnkoding: ';
  12 +$PHPMAILER_LANG['execute'] = 'Kunne ikke utføre: ';
  13 +$PHPMAILER_LANG['file_access'] = 'Får ikke tilgang til filen: ';
  14 +$PHPMAILER_LANG['file_open'] = 'Fil feil: Kunne ikke åpne filen: ';
  15 +$PHPMAILER_LANG['from_failed'] = 'Følgende avsenderadresse feilet: ';
  16 +$PHPMAILER_LANG['instantiate'] = 'Kunne ikke initialisere mailfunksjonen.';
  17 +$PHPMAILER_LANG['invalid_address'] = 'Meldingen ble ikke sendt, følgende adresse er ugyldig: ';
  18 +$PHPMAILER_LANG['provide_address'] = 'Du må angi minst en mottakeradresse.';
  19 +$PHPMAILER_LANG['mailer_not_supported'] = ' mailer er ikke supportert.';
  20 +$PHPMAILER_LANG['recipients_failed'] = 'SMTP Feil: Følgende mottagere feilet: ';
  21 +$PHPMAILER_LANG['signing'] = 'Signeringsfeil: ';
  22 +$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() feilet.';
  23 +$PHPMAILER_LANG['smtp_error'] = 'SMTP-serverfeil: ';
  24 +$PHPMAILER_LANG['variable_set'] = 'Kan ikke sette eller resette variabelen: ';
  1 +<?php
  2 +/**
  3 +* PHPMailer language file: refer to English translation for definitive list
  4 +* Polish Version
  5 +*/
  6 +
  7 +$PHPMAILER_LANG['authenticate'] = 'Błąd SMTP: Nie można przeprowadzić uwierzytelnienia.';
  8 +$PHPMAILER_LANG['connect_host'] = 'Błąd SMTP: Nie można połączyć się z wybranym hostem.';
  9 +$PHPMAILER_LANG['data_not_accepted'] = 'Błąd SMTP: Dane nie zostały przyjęte.';
  10 +$PHPMAILER_LANG['empty_message'] = 'Wiadomość jest pusta.';
  11 +$PHPMAILER_LANG['encoding'] = 'Nieznany sposób kodowania znaków: ';
  12 +$PHPMAILER_LANG['execute'] = 'Nie można uruchomić: ';
  13 +$PHPMAILER_LANG['file_access'] = 'Brak dostępu do pliku: ';
  14 +$PHPMAILER_LANG['file_open'] = 'Nie można otworzyć pliku: ';
  15 +$PHPMAILER_LANG['from_failed'] = 'Następujący adres Nadawcy jest nieprawidłowy: ';
  16 +$PHPMAILER_LANG['instantiate'] = 'Nie można wywołać funkcji mail(). Sprawdź konfigurację serwera.';
  17 +$PHPMAILER_LANG['invalid_address'] = 'Nie można wysłać wiadomości, '.
  18 + 'następujący adres Odbiorcy jest nieprawidłowy: ';
  19 +$PHPMAILER_LANG['provide_address'] = 'Należy podać prawidłowy adres email Odbiorcy.';
  20 +$PHPMAILER_LANG['mailer_not_supported'] = 'Wybrana metoda wysyłki wiadomości nie jest obsługiwana.';
  21 +$PHPMAILER_LANG['recipients_failed'] = 'Błąd SMTP: Następujący odbiorcy są nieprawidłowi: ';
  22 +$PHPMAILER_LANG['signing'] = 'Błąd podpisywania wiadomości: ';
  23 +$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() zakończone niepowodzeniem.';
  24 +$PHPMAILER_LANG['smtp_error'] = 'Błąd SMTP: ';
  25 +$PHPMAILER_LANG['variable_set'] = 'Nie można ustawić lub zmodyfikować zmiennej: ';
  1 +<?php
  2 +/**
  3 +* PHPMailer language file: refer to English translation for definitive list
  4 +* pt-PT
  5 +* Portuguese (European) Version 1.0
  6 +* By Jonadabe - jonadabe@hotmail.com
  7 +*/
  8 +
  9 +$PHPMAILER_LANG['authenticate'] = 'Erro do SMTP: Não foi possível realizar a autenticação.';
  10 +$PHPMAILER_LANG['connect_host'] = 'Erro do SMTP: Não foi possível realizar ligação com o servidor SMTP.';
  11 +$PHPMAILER_LANG['data_not_accepted'] = 'Erro do SMTP: Os dados foram rejeitados.';
  12 +$PHPMAILER_LANG['empty_message'] = 'A mensagem no e-mail está vazia.';
  13 +$PHPMAILER_LANG['encoding'] = 'Codificação desconhecida: ';
  14 +$PHPMAILER_LANG['execute'] = 'Não foi possível executar: ';
  15 +$PHPMAILER_LANG['file_access'] = 'Não foi possível aceder o ficheiro: ';
  16 +$PHPMAILER_LANG['file_open'] = 'Abertura do ficheiro: Não foi possível abrir o ficheiro: ';
  17 +$PHPMAILER_LANG['from_failed'] = 'Ocorreram falhas nos endereços dos seguintes remententes: ';
  18 +$PHPMAILER_LANG['instantiate'] = 'Não foi possível iniciar uma instância da função mail.';
  19 +$PHPMAILER_LANG['invalid_address'] = 'Não foi enviado nenhum e-mail para o endereço de e-mail inválido: ';
  20 +$PHPMAILER_LANG['mailer_not_supported'] = ' mailer não é suportado.';
  21 +$PHPMAILER_LANG['provide_address'] = 'Tem de fornecer pelo menos um endereço como destinatário do e-mail.';
  22 +$PHPMAILER_LANG['recipients_failed'] = 'Erro do SMTP: O endereço do seguinte destinatário falhou: ';
  23 +$PHPMAILER_LANG['signing'] = 'Erro ao assinar: ';
  24 +$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() falhou.';
  25 +$PHPMAILER_LANG['smtp_error'] = 'Erro de servidor SMTP: ';
  26 +$PHPMAILER_LANG['variable_set'] = 'Não foi possível definir ou redefinir a variável: ';
  1 +<?php
  2 +/**
  3 +* PHPMailer language file: refer to English translation for definitive list
  4 +* Romanian Version
  5 +* @package PHPMailer
  6 +* @author Catalin Constantin <catalin@dazoot.ro>
  7 +*/
  8 +
  9 +$PHPMAILER_LANG['authenticate'] = 'Eroare SMTP: Nu a functionat autentificarea.';
  10 +$PHPMAILER_LANG['connect_host'] = 'Eroare SMTP: Nu m-am putut conecta la adresa SMTP.';
  11 +$PHPMAILER_LANG['data_not_accepted'] = 'Eroare SMTP: Continutul mailului nu a fost acceptat.';
  12 +$PHPMAILER_LANG['empty_message'] = 'Mesajul este gol.';
  13 +$PHPMAILER_LANG['encoding'] = 'Encodare necunoscuta: ';
  14 +$PHPMAILER_LANG['execute'] = 'Nu pot executa: ';
  15 +$PHPMAILER_LANG['file_access'] = 'Nu pot accesa fisierul: ';
  16 +$PHPMAILER_LANG['file_open'] = 'Eroare de fisier: Nu pot deschide fisierul: ';
  17 +$PHPMAILER_LANG['from_failed'] = 'Urmatoarele adrese From au dat eroare: ';
  18 +$PHPMAILER_LANG['instantiate'] = 'Nu am putut instantia functia mail.';
  19 +$PHPMAILER_LANG['invalid_address'] = 'Adresa de email nu este valida. ';
  20 +$PHPMAILER_LANG['mailer_not_supported'] = ' mailer nu este suportat.';
  21 +$PHPMAILER_LANG['provide_address'] = 'Trebuie sa adaugati cel putin un recipient (adresa de mail).';
  22 +$PHPMAILER_LANG['recipients_failed'] = 'Eroare SMTP: Urmatoarele adrese de mail au dat eroare: ';
  23 +$PHPMAILER_LANG['signing'] = 'A aparut o problema la semnarea emailului. ';
  24 +$PHPMAILER_LANG['smtp_connect_failed'] = 'Conectarea la serverul SMTP a esuat.';
  25 +$PHPMAILER_LANG['smtp_error'] = 'A aparut o eroare la serverul SMTP. ';
  26 +$PHPMAILER_LANG['variable_set'] = 'Nu se poate seta/reseta variabila. ';
  1 +<?php
  2 +/**
  3 +* PHPMailer language file: refer to English translation for definitive list
  4 +* Russian Version by Alexey Chumakov <alex@chumakov.ru>
  5 +*/
  6 +
  7 +$PHPMAILER_LANG['authenticate'] = 'Ошибка SMTP: ошибка авторизации.';
  8 +$PHPMAILER_LANG['connect_host'] = 'Ошибка SMTP: не удается подключиться к серверу SMTP.';
  9 +$PHPMAILER_LANG['data_not_accepted'] = 'Ошибка SMTP: данные не приняты.';
  10 +$PHPMAILER_LANG['encoding'] = 'Неизвестный вид кодировки: ';
  11 +$PHPMAILER_LANG['execute'] = 'Невозможно выполнить команду: ';
  12 +$PHPMAILER_LANG['file_access'] = 'Нет доступа к файлу: ';
  13 +$PHPMAILER_LANG['file_open'] = 'Файловая ошибка: не удается открыть файл: ';
  14 +$PHPMAILER_LANG['from_failed'] = 'Неверный адрес отправителя: ';
  15 +$PHPMAILER_LANG['instantiate'] = 'Невозможно запустить функцию mail.';
  16 +$PHPMAILER_LANG['provide_address'] = 'Пожалуйста, введите хотя бы один адрес e-mail получателя.';
  17 +$PHPMAILER_LANG['mailer_not_supported'] = ' - почтовый сервер не поддерживается.';
  18 +$PHPMAILER_LANG['recipients_failed'] = 'Ошибка SMTP: отправка по следующим адресам получателей не удалась: ';
  19 +$PHPMAILER_LANG['empty_message'] = 'Пустое тело сообщения';
  20 +$PHPMAILER_LANG['invalid_address'] = 'Не отослано, неправильный формат email адреса: ';
  21 +$PHPMAILER_LANG['signing'] = 'Ошибка подписывания: ';
  22 +$PHPMAILER_LANG['smtp_connect_failed'] = 'Ошибка соединения с SMTP-сервером';
  23 +$PHPMAILER_LANG['smtp_error'] = 'Ошибка SMTP-сервера: ';
  24 +$PHPMAILER_LANG['variable_set'] = 'Невозможно установить или переустановить переменную: ';
  1 +<?php
  2 +/**
  3 +* PHPMailer language file: refer to English translation for definitive list
  4 +* Swedish Version
  5 +* Author: Johan Linnér <johan@linner.biz>
  6 +*/
  7 +
  8 +$PHPMAILER_LANG['authenticate'] = 'SMTP fel: Kunde inte autentisera.';
  9 +$PHPMAILER_LANG['connect_host'] = 'SMTP fel: Kunde inte ansluta till SMTP-server.';
  10 +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP fel: Data accepterades inte.';
  11 +//$PHPMAILER_LANG['empty_message'] = 'Message body empty';
  12 +$PHPMAILER_LANG['encoding'] = 'Okänt encode-format: ';
  13 +$PHPMAILER_LANG['execute'] = 'Kunde inte köra: ';
  14 +$PHPMAILER_LANG['file_access'] = 'Ingen åtkomst till fil: ';
  15 +$PHPMAILER_LANG['file_open'] = 'Fil fel: Kunde inte öppna fil: ';
  16 +$PHPMAILER_LANG['from_failed'] = 'Följande avsändaradress är felaktig: ';
  17 +$PHPMAILER_LANG['instantiate'] = 'Kunde inte initiera e-postfunktion.';
  18 +//$PHPMAILER_LANG['invalid_address'] = 'Not sending, email address is invalid: ';
  19 +$PHPMAILER_LANG['provide_address'] = 'Du måste ange minst en mottagares e-postadress.';
  20 +$PHPMAILER_LANG['mailer_not_supported'] = ' mailer stöds inte.';
  21 +$PHPMAILER_LANG['recipients_failed'] = 'SMTP fel: Följande mottagare är felaktig: ';
  22 +//$PHPMAILER_LANG['signing'] = 'Signing Error: ';
  23 +//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.';
  24 +//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: ';
  25 +//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: ';
  1 +<?php
  2 +/**
  3 +* PHPMailer language file: refer to English translation for definitive list
  4 +* Slovak Version
  5 +* Author: Michal Tinka <michaltinka@gmail.com>
  6 +*/
  7 +
  8 +$PHPMAILER_LANG['authenticate'] = 'SMTP Error: Chyba autentifikácie.';
  9 +$PHPMAILER_LANG['connect_host'] = 'SMTP Error: Nebolo možné nadviazať spojenie so SMTP serverom.';
  10 +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Error: Dáta neboli prijaté';
  11 +$PHPMAILER_LANG['empty_message'] = 'Prázdne telo správy.';
  12 +$PHPMAILER_LANG['encoding'] = 'Neznáme kódovanie: ';
  13 +$PHPMAILER_LANG['execute'] = 'Nedá sa vykonať: ';
  14 +$PHPMAILER_LANG['file_access'] = 'Súbor nebol nájdený: ';
  15 +$PHPMAILER_LANG['file_open'] = 'File Error: Súbor sa otvoriť pre čítanie: ';
  16 +$PHPMAILER_LANG['from_failed'] = 'Následujúca adresa From je nesprávna: ';
  17 +$PHPMAILER_LANG['instantiate'] = 'Nedá sa vytvoriť inštancia emailovej funkcie.';
  18 +$PHPMAILER_LANG['invalid_address'] = 'Neodoslané, emailová adresa je nesprávna: ';
  19 +$PHPMAILER_LANG['mailer_not_supported'] = ' emailový klient nieje podporovaný.';
  20 +$PHPMAILER_LANG['provide_address'] = 'Musíte zadať aspoň jednu emailovú adresu príjemcu.';
  21 +$PHPMAILER_LANG['recipients_failed'] = 'SMTP Error: Adresy príjemcov niesu správne ';
  22 +$PHPMAILER_LANG['signing'] = 'Chyba prihlasovania: ';
  23 +$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() zlyhalo.';
  24 +$PHPMAILER_LANG['smtp_error'] = 'SMTP chyba serveru: ';
  25 +$PHPMAILER_LANG['variable_set'] = 'Nemožno nastaviť alebo resetovať premennú: ';
  1 +<?php
  2 +/**
  3 + * PHPMailer language file: refer to English translation for definitive list
  4 + * Serbian Version
  5 + * Александар Јевремовић <ajevremovic@gmail.com>
  6 + */
  7 +
  8 +$PHPMAILER_LANG['authenticate'] = 'SMTP грешка: аутентификација није успела.';
  9 +$PHPMAILER_LANG['connect_host'] = 'SMTP грешка: није могуће повезивање са SMTP сервером.';
  10 +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP грешка: подаци нису прихваћени.';
  11 +$PHPMAILER_LANG['empty_message'] = 'Садржај поруке је празан.';
  12 +$PHPMAILER_LANG['encoding'] = 'Непознато кодовање: ';
  13 +$PHPMAILER_LANG['execute'] = 'Није могуће извршити наредбу: ';
  14 +$PHPMAILER_LANG['file_access'] = 'Није могуће приступити датотеци: ';
  15 +$PHPMAILER_LANG['file_open'] = 'Није могуће отворити датотеку: ';
  16 +$PHPMAILER_LANG['from_failed'] = 'SMTP грешка: слање са следећих адреса није успело: ';
  17 +$PHPMAILER_LANG['recipients_failed'] = 'SMTP грешка: слање на следеће адресе није успело: ';
  18 +$PHPMAILER_LANG['instantiate'] = 'Није могуће покренути mail функцију.';
  19 +$PHPMAILER_LANG['invalid_address'] = 'Порука није послата због неисправне адресе.';
  20 +$PHPMAILER_LANG['mailer_not_supported'] = ' мејлер није подржан.';
  21 +$PHPMAILER_LANG['provide_address'] = 'Потребно је задати најмање једну адресу.';
  22 +$PHPMAILER_LANG['signing'] = 'Грешка приликом пријављивања: ';
  23 +$PHPMAILER_LANG['smtp_connect_failed'] = 'Повезивање са SMTP сервером није успело.';
  24 +$PHPMAILER_LANG['smtp_error'] = 'Грешка SMTP сервера: ';
  25 +$PHPMAILER_LANG['variable_set'] = 'Није могуће задати променљиву, нити је вратити уназад: ';
  1 +<?php
  2 +/**
  3 +* PHPMailer language file: refer to English translation for definitive list
  4 +* Turkish version
  5 +* Türkçe Versiyonu
  6 +* Elçin Özel - Can Yılmaz - Mehmet Benlioğlu
  7 +* Updated by: github.com/yasinaydin
  8 +*/
  9 +
  10 +$PHPMAILER_LANG['authenticate'] = 'SMTP Hatası: Oturum açılamadı.';
  11 +$PHPMAILER_LANG['connect_host'] = 'SMTP Hatası: SMTP sunucusuna bağlanılamadı.';
  12 +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Hatası: Veri kabul edilmedi.';
  13 +$PHPMAILER_LANG['empty_message'] = 'Mesajın içeriği boş';
  14 +$PHPMAILER_LANG['encoding'] = 'Bilinmeyen karakter kodlama: ';
  15 +$PHPMAILER_LANG['execute'] = 'Çalıştırılamadı: ';
  16 +$PHPMAILER_LANG['file_access'] = 'Dosyaya erişilemedi: ';
  17 +$PHPMAILER_LANG['file_open'] = 'Dosya Hatası: Dosya açılamadı: ';
  18 +$PHPMAILER_LANG['from_failed'] = 'Belirtilen adreslere gönderme başarısız: ';
  19 +$PHPMAILER_LANG['instantiate'] = 'Örnek e-posta fonksiyonu oluşturulamadı.';
  20 +$PHPMAILER_LANG['invalid_address'] = 'Geçersiz e-posta adresi: ';
  21 +$PHPMAILER_LANG['mailer_not_supported'] = ' e-posta kütüphanesi desteklenmiyor.';
  22 +$PHPMAILER_LANG['provide_address'] = 'En az bir alıcı e-posta adresi belirtmelisiniz.';
  23 +$PHPMAILER_LANG['recipients_failed'] = 'SMTP Hatası: Belirtilen alıcılara ulaşılamadı: ';
  24 +$PHPMAILER_LANG['signing'] = 'İmzalama hatası: ';
  25 +$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP connect() fonksiyonu başarısız.';
  26 +$PHPMAILER_LANG['smtp_error'] = 'SMTP sunucu hatası: ';
  27 +$PHPMAILER_LANG['variable_set'] = 'Değişken ayarlanamadı ya da sıfırlanamadı: ';
  1 +<?php
  2 +/**
  3 +* PHPMailer language file: refer to English translation for definitive list
  4 +* Ukrainian Version by Yuriy Rudyy <yrudyy@prs.net.ua>
  5 +*/
  6 +
  7 +$PHPMAILER_LANG['authenticate'] = 'Помилка SMTP: помилка авторизації.';
  8 +$PHPMAILER_LANG['connect_host'] = 'Помилка SMTP: не вдається підєднатися до серверу SMTP.';
  9 +$PHPMAILER_LANG['data_not_accepted'] = 'Помилка SMTP: дані не прийняті.';
  10 +$PHPMAILER_LANG['encoding'] = 'Невідомий тип кодування: ';
  11 +$PHPMAILER_LANG['execute'] = 'Неможливо виконати команду: ';
  12 +$PHPMAILER_LANG['file_access'] = 'Немає доступу до файлу: ';
  13 +$PHPMAILER_LANG['file_open'] = 'Помилка файлової системи: не вдається відкрити файл: ';
  14 +$PHPMAILER_LANG['from_failed'] = 'Невірна адреса відправника: ';
  15 +$PHPMAILER_LANG['instantiate'] = 'Неможливо запустити функцію mail.';
  16 +$PHPMAILER_LANG['provide_address'] = 'Будь-ласка, введіть хоча б одну адресу e-mail отримувача.';
  17 +$PHPMAILER_LANG['mailer_not_supported'] = ' - поштовий сервер не підтримується.';
  18 +$PHPMAILER_LANG['recipients_failed'] = 'Помилка SMTP: відправти наступним отрмувачам не вдалася: ';
  19 +$PHPMAILER_LANG['empty_message'] = 'Пусте тіло повідомлення';
  20 +$PHPMAILER_LANG['invalid_address'] = 'Не відправлено, невірний формат email адреси: ';
  21 +$PHPMAILER_LANG['signing'] = 'Помилка підпису: ';
  22 +$PHPMAILER_LANG['smtp_connect_failed'] = 'Помилка зєднання із SMTP-сервером';
  23 +$PHPMAILER_LANG['smtp_error'] = 'Помилка SMTP-сервера: ';
  24 +$PHPMAILER_LANG['variable_set'] = 'Неможливо встановити або перевстановити змінну: ';
  1 +<?php
  2 +/**
  3 + * PHPMailer language file: refer to English translation for definitive list.
  4 + * Vietnamese (Tiếng Việt) Version
  5 + * @author VINADES.,JSC <contact@vinades.vn>
  6 + * @license GNU/GPL version 2 or GNU/LGPL version 2.1 or any later version
  7 + */
  8 +$PHPMAILER_LANG['authenticate'] = 'Lỗi SMTP: Không thể xác thực.';
  9 +$PHPMAILER_LANG['connect_host'] = 'Lỗi SMTP: Không thể kết nối máy chủ SMTP.';
  10 +$PHPMAILER_LANG['data_not_accepted'] = 'Lỗi SMTP: Dữ liệu không được chấp nhận.';
  11 +$PHPMAILER_LANG['empty_message'] = 'Không có nội dung';
  12 +$PHPMAILER_LANG['encoding'] = 'Mã hóa không xác định: ';
  13 +$PHPMAILER_LANG['execute'] = 'Không thực hiện được: ';
  14 +$PHPMAILER_LANG['file_access'] = 'Không thể truy cập tệp tin ';
  15 +$PHPMAILER_LANG['file_open'] = 'Lỗi Tập tin: Không thể mở tệp tin: ';
  16 +$PHPMAILER_LANG['from_failed'] = 'Lỗi địa chỉ gửi đi: ';
  17 +$PHPMAILER_LANG['instantiate'] = 'Không dùng được các hàm gửi thư.';
  18 +$PHPMAILER_LANG['invalid_address'] = 'Đại chỉ emai không đúng';
  19 +$PHPMAILER_LANG['mailer_not_supported'] = ' trình gửi thư không được hỗ trợ.';
  20 +$PHPMAILER_LANG['provide_address'] = 'Bạn phải cung cấp ít nhất một địa chỉ người nhận.';
  21 +$PHPMAILER_LANG['recipients_failed'] = 'Lỗi SMTP: lỗi địa chỉ người nhận: ';
  22 +$PHPMAILER_LANG['signing'] = 'Lỗi đăng nhập: ';
  23 +$PHPMAILER_LANG['smtp_connect_failed'] = 'Lỗi kết nối với SMTP';
  24 +$PHPMAILER_LANG['smtp_error'] = 'Lỗi máy chủ smtp ';
  25 +$PHPMAILER_LANG['variable_set'] = 'Không thể thiết lập hoặc thiết lập lại biến: ';
  1 +<?php
  2 +/**
  3 +* PHPMailer language file: refer to English translation for definitive list
  4 +* Traditional Chinese Version
  5 +* @author liqwei <liqwei@liqwei.com>
  6 +* @author Peter Dave Hello <https://github.com/PeterDaveHello/>
  7 +*/
  8 +
  9 +$PHPMAILER_LANG['authenticate'] = 'SMTP 錯誤:登入失敗。';
  10 +$PHPMAILER_LANG['connect_host'] = 'SMTP 錯誤:無法連線到 SMTP 主機。';
  11 +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP 錯誤:無法接受的資料。';
  12 +$PHPMAILER_LANG['empty_message'] = '郵件內容為空';
  13 +$PHPMAILER_LANG['encoding'] = '未知編碼: ';
  14 +$PHPMAILER_LANG['file_access'] = '無法存取檔案:';
  15 +$PHPMAILER_LANG['file_open'] = '檔案錯誤:無法開啟檔案:';
  16 +$PHPMAILER_LANG['from_failed'] = '發送地址錯誤:';
  17 +$PHPMAILER_LANG['execute'] = '無法執行:';
  18 +$PHPMAILER_LANG['instantiate'] = '未知函數呼叫。';
  19 +$PHPMAILER_LANG['invalid_address'] = '因為電子郵件地址無效,無法傳送: ';
  20 +$PHPMAILER_LANG['provide_address'] = '必須提供至少一個收件人地址。';
  21 +$PHPMAILER_LANG['mailer_not_supported'] = '不支援的發信客戶端。';
  22 +$PHPMAILER_LANG['recipients_failed'] = 'SMTP 錯誤:收件人地址錯誤:';
  23 +$PHPMAILER_LANG['signing'] = '登入失敗: ';
  24 +$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP連線失敗';
  25 +$PHPMAILER_LANG['smtp_error'] = 'SMTP伺服器錯誤: ';
  26 +$PHPMAILER_LANG['variable_set'] = '無法設定或重設變數: ';
  1 +<?php
  2 +/**
  3 +* PHPMailer language file: refer to English translation for definitive list
  4 +* Simplified Chinese Version
  5 +* @author liqwei <liqwei@liqwei.com>
  6 +* @author young <masxy@foxmail.com> blog:binaryoung.com
  7 +*/
  8 +
  9 +$PHPMAILER_LANG['authenticate'] = 'SMTP 错误:登录失败。';
  10 +$PHPMAILER_LANG['connect_host'] = 'SMTP 错误:无法连接到 SMTP 主机。';
  11 +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP 错误:数据不被接受。';
  12 +$PHPMAILER_LANG['empty_message'] = '邮件正文为空。';
  13 +$PHPMAILER_LANG['encoding'] = '未知编码: ';
  14 +$PHPMAILER_LANG['execute'] = '无法执行:';
  15 +$PHPMAILER_LANG['file_access'] = '无法访问文件:';
  16 +$PHPMAILER_LANG['file_open'] = '文件错误:无法打开文件:';
  17 +$PHPMAILER_LANG['from_failed'] = '发送地址错误:';
  18 +$PHPMAILER_LANG['instantiate'] = '未知函数调用。';
  19 +$PHPMAILER_LANG['invalid_address'] = '发送失败,电子邮箱地址是无效的。';
  20 +$PHPMAILER_LANG['mailer_not_supported'] = '发信客户端不被支持。';
  21 +$PHPMAILER_LANG['provide_address'] = '必须提供至少一个收件人地址。';
  22 +$PHPMAILER_LANG['recipients_failed'] = 'SMTP 错误:收件人地址错误:';
  23 +$PHPMAILER_LANG['signing'] = '登录失败:';
  24 +$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP服务器连接失败。';
  25 +$PHPMAILER_LANG['smtp_error'] = 'SMTP服务器出错: ';
  26 +$PHPMAILER_LANG['variable_set'] = '无法设置或重置变量:';
  1 +<?php
  2 +require_once 'vendor/autoload.php';
  3 +spl_autoload_register(function ($class) {
  4 + require_once strtr($class, '\\_', '//').'.php';
  5 +});
  1 +#!/usr/bin/env bash
  2 +
  3 +# Fake POP3 server
  4 +# By Marcus Bointon <phpmailer@synchromedia.co.uk>
  5 +# Based on code by 'Frater' found at http://www.linuxquestions.org/questions/programming-9/fake-pop3-server-to-capture-pop3-passwords-933733
  6 +# Does not actually serve any mail, but supports commands sufficient to test POP-before SMTP
  7 +# Can be run directly from a shell like this:
  8 +# mkfifo fifo; nc -l 1100 <fifo |./fakepopserver.sh >fifo; rm fifo
  9 +# It will accept any user name and will return a positive response for the password 'test'
  10 +
  11 +# Licensed under the GNU Lesser General Public License: http://www.gnu.org/copyleft/lesser.html
  12 +
  13 +# Enable debug output
  14 +#set -xv
  15 +export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
  16 +
  17 +LOGFOLDER=/tmp
  18 +
  19 +LOGFILE=${LOGFOLDER}/fakepop.log
  20 +
  21 +LOGGING=1
  22 +DEBUG=1
  23 +TIMEOUT=60
  24 +
  25 +POP_USER=
  26 +POP_PASSWRD=test
  27 +
  28 +LINES=1
  29 +BREAK=0
  30 +
  31 +write_log () {
  32 + if [ ${LINES} -eq 1 ] ; then
  33 + echo '---' >>${LOGFILE}
  34 + fi
  35 + let LINES+=1
  36 + [ ${LOGGING} = 0 ] || echo -e "`date '+%b %d %H:%M'` pop3 $*" >>${LOGFILE}
  37 +}
  38 +
  39 +ANSWER="+OK Fake POP3 Service Ready"
  40 +
  41 +while [ ${BREAK} -eq 0 ] ; do
  42 + echo -en "${ANSWER}\r\n"
  43 +
  44 + REPLY=""
  45 +
  46 + #Input appears in $REPLY
  47 + read -t ${TIMEOUT}
  48 +
  49 + ANSWER="+OK "
  50 + COMMAND=""
  51 + ARGS=""
  52 + TIMEOUT=30
  53 +
  54 + if [ "$REPLY" ] ; then
  55 + write_log "RAW input: '`echo "${REPLY}" | tr -cd '[ -~]'`'"
  56 +
  57 + COMMAND="`echo "${REPLY}" | awk '{print $1}' | tr -cd '\40-\176' | tr 'a-z' 'A-Z'`"
  58 + ARGS="`echo "${REPLY}" | tr -cd '\40-\176' | awk '{for(i=2;i<=NF;i++){printf "%s ", $i};printf "\n"}' | sed 's/ $//'`"
  59 +
  60 + write_log "Command: \"${COMMAND}\""
  61 + write_log "Arguments: \"${ARGS}\""
  62 +
  63 + case "$COMMAND" in
  64 + QUIT)
  65 + break
  66 + ;;
  67 + USER)
  68 + if [ -n "${ARGS}" ] ; then
  69 + POP_USER="${ARGS}"
  70 + ANSWER="+OK Please send PASS command"
  71 + fi
  72 + ;;
  73 + AUTH)
  74 + ANSWER="+OK \r\n."
  75 + ;;
  76 + CAPA)
  77 + ANSWER="+OK Capabilities include\r\nUSER\r\nCAPA\r\n."
  78 + ;;
  79 + PASS)
  80 + if [ "${POP_PASSWRD}" == "${ARGS}" ] ; then
  81 + ANSWER="+OK Logged in."
  82 + AUTH=1
  83 + else
  84 + ANSWER="-ERR Login failed."
  85 + fi
  86 + ;;
  87 + LIST)
  88 + if [ "${AUTH}" = 0 ] ; then
  89 + ANSWER="-ERR Not authenticated"
  90 + else
  91 + if [ -z "${ARGS}" ] ; then
  92 + ANSWER="+OK No messages, really\r\n."
  93 + else
  94 + ANSWER="-ERR No messages, no list, no status"
  95 + fi
  96 + fi
  97 + ;;
  98 + RSET)
  99 + ANSWER="+OK Resetting or whatever\r\n."
  100 + ;;
  101 + LAST)
  102 + if [ "${AUTH}" = 0 ] ; then
  103 + ANSWER="-ERR Not authenticated"
  104 + else
  105 + ANSWER="+OK 0"
  106 + fi
  107 + ;;
  108 + STAT)
  109 + if [ "${AUTH}" = 0 ] ; then
  110 + ANSWER="-ERR Not authenticated"
  111 + else
  112 + ANSWER="+OK 0 0"
  113 + fi
  114 + ;;
  115 + NOOP)
  116 + ANSWER="+OK Hang on, doing nothing"
  117 + ;;
  118 + esac
  119 + else
  120 + echo "+OK Connection timed out"
  121 + break
  122 + fi
  123 +done
  124 +
  125 +echo "+OK Bye!\r\n"
  1 +#!/usr/bin/env bash
  2 +#Fake sendmail script, adapted from:
  3 +#https://github.com/mrded/MNPP/blob/ee64fb2a88efc70ba523b78e9ce61f9f1ed3b4a9/init/fake-sendmail.sh
  4 +
  5 +#Create a temp folder to put messages in
  6 +numPath="${TMPDIR-/tmp/}fakemail"
  7 +umask 037
  8 +mkdir -p $numPath
  9 +
  10 +if [ ! -f $numPath/num ]; then
  11 + echo "0" > $numPath/num
  12 +fi
  13 +num=`cat $numPath/num`
  14 +num=$(($num + 1))
  15 +echo $num > $numPath/num
  16 +
  17 +name="$numPath/message_$num.eml"
  18 +while read line
  19 +do
  20 + echo $line >> $name
  21 +done
  22 +exit 0
  1 +<?php
  2 +/**
  3 + * PHPMailer - language file tests
  4 + * Requires PHPUnit 3.3 or later.
  5 + *
  6 + * PHP version 5.0.0
  7 + *
  8 + * @package PHPMailer
  9 + * @author Andy Prevost
  10 + * @author Marcus Bointon <phpmailer@synchromedia.co.uk>
  11 + * @copyright 2004 - 2009 Andy Prevost
  12 + * @copyright 2010 Marcus Bointon
  13 + * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
  14 + */
  15 +
  16 +require_once '../PHPMailerAutoload.php';
  17 +
  18 +/**
  19 + * PHPMailer - PHP email transport unit test class
  20 + * Performs authentication tests
  21 + */
  22 +class PHPMailerLangTest extends PHPUnit_Framework_TestCase
  23 +{
  24 + /**
  25 + * Holds a phpmailer instance.
  26 + * @private
  27 + * @var PHPMailer
  28 + */
  29 + public $Mail;
  30 +
  31 + /**
  32 + * @var string Default include path
  33 + */
  34 + public $INCLUDE_DIR = '../';
  35 +
  36 + /**
  37 + * Run before each test is started.
  38 + */
  39 + public function setUp()
  40 + {
  41 + $this->Mail = new PHPMailer;
  42 + }
  43 +
  44 + /**
  45 + * Test language files for missing and excess translations
  46 + * All languages are compared with English
  47 + * @group languages
  48 + */
  49 + public function testTranslations()
  50 + {
  51 + $this->Mail->setLanguage('en');
  52 + $definedStrings = $this->Mail->getTranslations();
  53 + $err = '';
  54 + foreach (new DirectoryIterator('../language') as $fileInfo) {
  55 + if ($fileInfo->isDot()) {
  56 + continue;
  57 + }
  58 + $matches = array();
  59 + //Only look at language files, ignore anything else in there
  60 + if (preg_match('/^phpmailer\.lang-([a-z_]{2,})\.php$/', $fileInfo->getFilename(), $matches)) {
  61 + $lang = $matches[1]; //Extract language code
  62 + $PHPMAILER_LANG = array(); //Language strings get put in here
  63 + include $fileInfo->getPathname(); //Get language strings
  64 + $missing = array_diff(array_keys($definedStrings), array_keys($PHPMAILER_LANG));
  65 + $extra = array_diff(array_keys($PHPMAILER_LANG), array_keys($definedStrings));
  66 + if (!empty($missing)) {
  67 + $err .= "\nMissing translations in $lang: " . implode(', ', $missing);
  68 + }
  69 + if (!empty($extra)) {
  70 + $err .= "\nExtra translations in $lang: " . implode(', ', $extra);
  71 + }
  72 + }
  73 + }
  74 + $this->assertEmpty($err, $err);
  75 + }
  76 +}
  1 +<?php
  2 +/**
  3 + * PHPMailer - PHP email transport unit tests
  4 + * Requires PHPUnit 3.3 or later.
  5 + *
  6 + * PHP version 5.0.0
  7 + *
  8 + * @package PHPMailer
  9 + * @author Andy Prevost
  10 + * @author Marcus Bointon <phpmailer@synchromedia.co.uk>
  11 + * @copyright 2004 - 2009 Andy Prevost
  12 + * @copyright 2010 Marcus Bointon
  13 + * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
  14 + */
  15 +
  16 +require_once '../PHPMailerAutoload.php';
  17 +
  18 +/**
  19 + * PHPMailer - PHP email transport unit test class
  20 + * Performs authentication tests
  21 + */
  22 +class PHPMailerTest extends PHPUnit_Framework_TestCase
  23 +{
  24 + /**
  25 + * Holds the default phpmailer instance.
  26 + * @private
  27 + * @type PHPMailer
  28 + */
  29 + public $Mail;
  30 +
  31 + /**
  32 + * Holds the SMTP mail host.
  33 + * @public
  34 + * @type string
  35 + */
  36 + public $Host = '';
  37 +
  38 + /**
  39 + * Holds the change log.
  40 + * @private
  41 + * @type string[]
  42 + */
  43 + public $ChangeLog = array();
  44 +
  45 + /**
  46 + * Holds the note log.
  47 + * @private
  48 + * @type string[]
  49 + */
  50 + public $NoteLog = array();
  51 +
  52 + /**
  53 + * Default include path
  54 + * @type string
  55 + */
  56 + public $INCLUDE_DIR = '../';
  57 +
  58 + /**
  59 + * PIDs of any processes we need to kill
  60 + * @type array
  61 + * @access private
  62 + */
  63 + private $pids = array();
  64 +
  65 + /**
  66 + * Run before each test is started.
  67 + */
  68 + public function setUp()
  69 + {
  70 + if (file_exists('./testbootstrap.php')) {
  71 + include './testbootstrap.php'; //Overrides go in here
  72 + }
  73 + $this->Mail = new PHPMailer;
  74 + $this->Mail->SMTPDebug = 4; //Full debug output
  75 + $this->Mail->Priority = 3;
  76 + $this->Mail->Encoding = '8bit';
  77 + $this->Mail->CharSet = 'iso-8859-1';
  78 + if (array_key_exists('mail_from', $_REQUEST)) {
  79 + $this->Mail->From = $_REQUEST['mail_from'];
  80 + } else {
  81 + $this->Mail->From = 'unit_test@phpmailer.example.com';
  82 + }
  83 + $this->Mail->FromName = 'Unit Tester';
  84 + $this->Mail->Sender = '';
  85 + $this->Mail->Subject = 'Unit Test';
  86 + $this->Mail->Body = '';
  87 + $this->Mail->AltBody = '';
  88 + $this->Mail->WordWrap = 0;
  89 + if (array_key_exists('mail_host', $_REQUEST)) {
  90 + $this->Mail->Host = $_REQUEST['mail_host'];
  91 + } else {
  92 + $this->Mail->Host = 'mail.example.com';
  93 + }
  94 + if (array_key_exists('mail_port', $_REQUEST)) {
  95 + $this->Mail->Port = $_REQUEST['mail_port'];
  96 + } else {
  97 + $this->Mail->Port = 25;
  98 + }
  99 + $this->Mail->Helo = 'localhost.localdomain';
  100 + $this->Mail->SMTPAuth = false;
  101 + $this->Mail->Username = '';
  102 + $this->Mail->Password = '';
  103 + $this->Mail->PluginDir = $this->INCLUDE_DIR;
  104 + $this->Mail->addReplyTo('no_reply@phpmailer.example.com', 'Reply Guy');
  105 + $this->Mail->Sender = 'unit_test@phpmailer.example.com';
  106 + if (strlen($this->Mail->Host) > 0) {
  107 + $this->Mail->Mailer = 'smtp';
  108 + } else {
  109 + $this->Mail->Mailer = 'mail';
  110 + $this->Mail->Sender = 'unit_test@phpmailer.example.com';
  111 + }
  112 + if (array_key_exists('mail_to', $_REQUEST)) {
  113 + $this->setAddress($_REQUEST['mail_to'], 'Test User', 'to');
  114 + }
  115 + if (array_key_exists('mail_cc', $_REQUEST) and strlen($_REQUEST['mail_cc']) > 0) {
  116 + $this->setAddress($_REQUEST['mail_cc'], 'Carbon User', 'cc');
  117 + }
  118 + }
  119 +
  120 + /**
  121 + * Run after each test is completed.
  122 + */
  123 + public function tearDown()
  124 + {
  125 + // Clean global variables
  126 + $this->Mail = null;
  127 + $this->ChangeLog = array();
  128 + $this->NoteLog = array();
  129 +
  130 + foreach ($this->pids as $pid) {
  131 + $p = escapeshellarg($pid);
  132 + shell_exec("ps $p && kill -TERM $p");
  133 + }
  134 + }
  135 +
  136 +
  137 + /**
  138 + * Build the body of the message in the appropriate format.
  139 + *
  140 + * @private
  141 + * @return void
  142 + */
  143 + public function buildBody()
  144 + {
  145 + $this->checkChanges();
  146 +
  147 + // Determine line endings for message
  148 + if ($this->Mail->ContentType == 'text/html' || strlen($this->Mail->AltBody) > 0) {
  149 + $eol = '<br/>';
  150 + $bullet = '<li>';
  151 + $bullet_start = '<ul>';
  152 + $bullet_end = '</ul>';
  153 + } else {
  154 + $eol = "\n";
  155 + $bullet = ' - ';
  156 + $bullet_start = '';
  157 + $bullet_end = '';
  158 + }
  159 +
  160 + $ReportBody = '';
  161 +
  162 + $ReportBody .= '---------------------' . $eol;
  163 + $ReportBody .= 'Unit Test Information' . $eol;
  164 + $ReportBody .= '---------------------' . $eol;
  165 + $ReportBody .= 'phpmailer version: ' . $this->Mail->Version . $eol;
  166 + $ReportBody .= 'Content Type: ' . $this->Mail->ContentType . $eol;
  167 +
  168 + if (strlen($this->Mail->Host) > 0) {
  169 + $ReportBody .= 'Host: ' . $this->Mail->Host . $eol;
  170 + }
  171 +
  172 + // If attachments then create an attachment list
  173 + $attachments = $this->Mail->getAttachments();
  174 + if (count($attachments) > 0) {
  175 + $ReportBody .= 'Attachments:' . $eol;
  176 + $ReportBody .= $bullet_start;
  177 + foreach ($attachments as $attachment) {
  178 + $ReportBody .= $bullet . 'Name: ' . $attachment[1] . ', ';
  179 + $ReportBody .= 'Encoding: ' . $attachment[3] . ', ';
  180 + $ReportBody .= 'Type: ' . $attachment[4] . $eol;
  181 + }
  182 + $ReportBody .= $bullet_end . $eol;
  183 + }
  184 +
  185 + // If there are changes then list them
  186 + if (count($this->ChangeLog) > 0) {
  187 + $ReportBody .= 'Changes' . $eol;
  188 + $ReportBody .= '-------' . $eol;
  189 +
  190 + $ReportBody .= $bullet_start;
  191 + for ($i = 0; $i < count($this->ChangeLog); $i++) {
  192 + $ReportBody .= $bullet . $this->ChangeLog[$i][0] . ' was changed to [' .
  193 + $this->ChangeLog[$i][1] . ']' . $eol;
  194 + }
  195 + $ReportBody .= $bullet_end . $eol . $eol;
  196 + }
  197 +
  198 + // If there are notes then list them
  199 + if (count($this->NoteLog) > 0) {
  200 + $ReportBody .= 'Notes' . $eol;
  201 + $ReportBody .= '-----' . $eol;
  202 +
  203 + $ReportBody .= $bullet_start;
  204 + for ($i = 0; $i < count($this->NoteLog); $i++) {
  205 + $ReportBody .= $bullet . $this->NoteLog[$i] . $eol;
  206 + }
  207 + $ReportBody .= $bullet_end;
  208 + }
  209 +
  210 + // Re-attach the original body
  211 + $this->Mail->Body .= $eol . $eol . $ReportBody;
  212 + }
  213 +
  214 + /**
  215 + * Check which default settings have been changed for the report.
  216 + * @private
  217 + * @return void
  218 + */
  219 + public function checkChanges()
  220 + {
  221 + if ($this->Mail->Priority != 3) {
  222 + $this->addChange('Priority', $this->Mail->Priority);
  223 + }
  224 + if ($this->Mail->Encoding != '8bit') {
  225 + $this->addChange('Encoding', $this->Mail->Encoding);
  226 + }
  227 + if ($this->Mail->CharSet != 'iso-8859-1') {
  228 + $this->addChange('CharSet', $this->Mail->CharSet);
  229 + }
  230 + if ($this->Mail->Sender != '') {
  231 + $this->addChange('Sender', $this->Mail->Sender);
  232 + }
  233 + if ($this->Mail->WordWrap != 0) {
  234 + $this->addChange('WordWrap', $this->Mail->WordWrap);
  235 + }
  236 + if ($this->Mail->Mailer != 'mail') {
  237 + $this->addChange('Mailer', $this->Mail->Mailer);
  238 + }
  239 + if ($this->Mail->Port != 25) {
  240 + $this->addChange('Port', $this->Mail->Port);
  241 + }
  242 + if ($this->Mail->Helo != 'localhost.localdomain') {
  243 + $this->addChange('Helo', $this->Mail->Helo);
  244 + }
  245 + if ($this->Mail->SMTPAuth) {
  246 + $this->addChange('SMTPAuth', 'true');
  247 + }
  248 + }
  249 +
  250 + /**
  251 + * Add a changelog entry.
  252 + * @access private
  253 + * @param string $sName
  254 + * @param string $sNewValue
  255 + * @return void
  256 + */
  257 + public function addChange($sName, $sNewValue)
  258 + {
  259 + $this->ChangeLog[] = array($sName, $sNewValue);
  260 + }
  261 +
  262 + /**
  263 + * Adds a simple note to the message.
  264 + * @public
  265 + * @param string $sValue
  266 + * @return void
  267 + */
  268 + public function addNote($sValue)
  269 + {
  270 + $this->NoteLog[] = $sValue;
  271 + }
  272 +
  273 + /**
  274 + * Adds all of the addresses
  275 + * @access public
  276 + * @param string $sAddress
  277 + * @param string $sName
  278 + * @param string $sType
  279 + * @return boolean
  280 + */
  281 + public function setAddress($sAddress, $sName = '', $sType = 'to')
  282 + {
  283 + switch ($sType) {
  284 + case 'to':
  285 + return $this->Mail->addAddress($sAddress, $sName);
  286 + case 'cc':
  287 + return $this->Mail->addCC($sAddress, $sName);
  288 + case 'bcc':
  289 + return $this->Mail->addBCC($sAddress, $sName);
  290 + }
  291 + return false;
  292 + }
  293 +
  294 + /**
  295 + * Test CRAM-MD5 authentication
  296 + * Needs a connection to a server that supports this auth mechanism, so commented out by default
  297 + */
  298 + public function testAuthCRAMMD5()
  299 + {
  300 + $this->Mail->Host = 'hostname';
  301 + $this->Mail->Port = 587;
  302 + $this->Mail->SMTPAuth = true;
  303 + $this->Mail->SMTPSecure = 'tls';
  304 + $this->Mail->AuthType = 'CRAM-MD5';
  305 + $this->Mail->Username = 'username';
  306 + $this->Mail->Password = 'password';
  307 + $this->Mail->Body = 'Test body';
  308 + $this->Mail->Subject .= ': Auth CRAM-MD5';
  309 + $this->Mail->From = 'from@example.com';
  310 + $this->Mail->Sender = 'from@example.com';
  311 + $this->Mail->clearAllRecipients();
  312 + $this->Mail->addAddress('user@example.com');
  313 + //$this->assertTrue($this->mail->send(), $this->mail->ErrorInfo);
  314 + }
  315 +
  316 + /**
  317 + * Test email address validation
  318 + * Test addresses obtained from http://isemail.info
  319 + * Some failing cases commented out that are apparently up for debate!
  320 + */
  321 + public function testValidate()
  322 + {
  323 + $validaddresses = array(
  324 + 'first@iana.org',
  325 + 'first.last@iana.org',
  326 + '1234567890123456789012345678901234567890123456789012345678901234@iana.org',
  327 + '"first\"last"@iana.org',
  328 + '"first@last"@iana.org',
  329 + '"first\last"@iana.org',
  330 + 'first.last@[12.34.56.78]',
  331 + 'first.last@[IPv6:::12.34.56.78]',
  332 + 'first.last@[IPv6:1111:2222:3333::4444:12.34.56.78]',
  333 + 'first.last@[IPv6:1111:2222:3333:4444:5555:6666:12.34.56.78]',
  334 + 'first.last@[IPv6:::1111:2222:3333:4444:5555:6666]',
  335 + 'first.last@[IPv6:1111:2222:3333::4444:5555:6666]',
  336 + 'first.last@[IPv6:1111:2222:3333:4444:5555:6666::]',
  337 + 'first.last@[IPv6:1111:2222:3333:4444:5555:6666:7777:8888]',
  338 + 'first.last@x23456789012345678901234567890123456789012345678901234567890123.iana.org',
  339 + 'first.last@3com.com',
  340 + 'first.last@123.iana.org',
  341 + '"first\last"@iana.org',
  342 + 'first.last@[IPv6:1111:2222:3333::4444:5555:12.34.56.78]',
  343 + 'first.last@[IPv6:1111:2222:3333::4444:5555:6666:7777]',
  344 + 'first.last@example.123',
  345 + 'first.last@com',
  346 + '"Abc\@def"@iana.org',
  347 + '"Fred\ Bloggs"@iana.org',
  348 + '"Joe.\Blow"@iana.org',
  349 + '"Abc@def"@iana.org',
  350 + '"Fred Bloggs"@iana.org',
  351 + 'user+mailbox@iana.org',
  352 + 'customer/department=shipping@iana.org',
  353 + '$A12345@iana.org',
  354 + '!def!xyz%abc@iana.org',
  355 + '_somename@iana.org',
  356 + 'dclo@us.ibm.com',
  357 + 'peter.piper@iana.org',
  358 + '"Doug \"Ace\" L."@iana.org',
  359 + 'test@iana.org',
  360 + 'TEST@iana.org',
  361 + '1234567890@iana.org',
  362 + 'test+test@iana.org',
  363 + 'test-test@iana.org',
  364 + 't*est@iana.org',
  365 + '+1~1+@iana.org',
  366 + '{_test_}@iana.org',
  367 + '"[[ test ]]"@iana.org',
  368 + 'test.test@iana.org',
  369 + '"test.test"@iana.org',
  370 + 'test."test"@iana.org',
  371 + '"test@test"@iana.org',
  372 + 'test@123.123.123.x123',
  373 + 'test@123.123.123.123',
  374 + 'test@[123.123.123.123]',
  375 + 'test@example.iana.org',
  376 + 'test@example.example.iana.org',
  377 + '"test\test"@iana.org',
  378 + 'test@example',
  379 + '"test\blah"@iana.org',
  380 + '"test\blah"@iana.org',
  381 + '"test\"blah"@iana.org',
  382 + 'customer/department@iana.org',
  383 + '_Yosemite.Sam@iana.org',
  384 + '~@iana.org',
  385 + '"Austin@Powers"@iana.org',
  386 + 'Ima.Fool@iana.org',
  387 + '"Ima.Fool"@iana.org',
  388 + '"Ima Fool"@iana.org',
  389 + '"first"."last"@iana.org',
  390 + '"first".middle."last"@iana.org',
  391 + '"first".last@iana.org',
  392 + 'first."last"@iana.org',
  393 + '"first"."middle"."last"@iana.org',
  394 + '"first.middle"."last"@iana.org',
  395 + '"first.middle.last"@iana.org',
  396 + '"first..last"@iana.org',
  397 + '"first\"last"@iana.org',
  398 + 'first."mid\dle"."last"@iana.org',
  399 + '"test blah"@iana.org',
  400 + '(foo)cal(bar)@(baz)iamcal.com(quux)',
  401 + 'cal@iamcal(woo).(yay)com',
  402 + 'cal(woo(yay)hoopla)@iamcal.com',
  403 + 'cal(foo\@bar)@iamcal.com',
  404 + 'cal(foo\)bar)@iamcal.com',
  405 + 'first().last@iana.org',
  406 + 'pete(his account)@silly.test(his host)',
  407 + 'c@(Chris\'s host.)public.example',
  408 + 'jdoe@machine(comment). example',
  409 + '1234 @ local(blah) .machine .example',
  410 + 'first(abc.def).last@iana.org',
  411 + 'first(a"bc.def).last@iana.org',
  412 + 'first.(")middle.last(")@iana.org',
  413 + 'first(abc\(def)@iana.org',
  414 + 'first.last@x(1234567890123456789012345678901234567890123456789012345678901234567890).com',
  415 + 'a(a(b(c)d(e(f))g)h(i)j)@iana.org',
  416 + 'name.lastname@domain.com',
  417 + 'a@b',
  418 + 'a@bar.com',
  419 + 'aaa@[123.123.123.123]',
  420 + 'a@bar',
  421 + 'a-b@bar.com',
  422 + '+@b.c',
  423 + '+@b.com',
  424 + 'a@b.co-foo.uk',
  425 + '"hello my name is"@stutter.com',
  426 + '"Test \"Fail\" Ing"@iana.org',
  427 + 'valid@about.museum',
  428 + 'shaitan@my-domain.thisisminekthx',
  429 + 'foobar@192.168.0.1',
  430 + '"Joe\Blow"@iana.org',
  431 + 'HM2Kinsists@(that comments are allowed)this.is.ok',
  432 + 'user%uucp!path@berkeley.edu',
  433 + 'first.last @iana.org',
  434 + 'cdburgess+!#$%&\'*-/=?+_{}|~test@gmail.com',
  435 + 'first.last@[IPv6:::a2:a3:a4:b1:b2:b3:b4]',
  436 + 'first.last@[IPv6:a1:a2:a3:a4:b1:b2:b3::]',
  437 + 'first.last@[IPv6:::]',
  438 + 'first.last@[IPv6:::b4]',
  439 + 'first.last@[IPv6:::b3:b4]',
  440 + 'first.last@[IPv6:a1::b4]',
  441 + 'first.last@[IPv6:a1::]',
  442 + 'first.last@[IPv6:a1:a2::]',
  443 + 'first.last@[IPv6:0123:4567:89ab:cdef::]',
  444 + 'first.last@[IPv6:0123:4567:89ab:CDEF::]',
  445 + 'first.last@[IPv6:::a3:a4:b1:ffff:11.22.33.44]',
  446 + 'first.last@[IPv6:::a2:a3:a4:b1:ffff:11.22.33.44]',
  447 + 'first.last@[IPv6:a1:a2:a3:a4::11.22.33.44]',
  448 + 'first.last@[IPv6:a1:a2:a3:a4:b1::11.22.33.44]',
  449 + 'first.last@[IPv6:a1::11.22.33.44]',
  450 + 'first.last@[IPv6:a1:a2::11.22.33.44]',
  451 + 'first.last@[IPv6:0123:4567:89ab:cdef::11.22.33.44]',
  452 + 'first.last@[IPv6:0123:4567:89ab:CDEF::11.22.33.44]',
  453 + 'first.last@[IPv6:a1::b2:11.22.33.44]',
  454 + 'test@test.com',
  455 + 'test@xn--example.com',
  456 + 'test@example.com'
  457 + );
  458 + $invalidaddresses = array(
  459 + 'first.last@sub.do,com',
  460 + 'first\@last@iana.org',
  461 + '123456789012345678901234567890123456789012345678901234567890' .
  462 + '@12345678901234567890123456789012345678901234 [...]',
  463 + 'first.last',
  464 + '12345678901234567890123456789012345678901234567890123456789012345@iana.org',
  465 + '.first.last@iana.org',
  466 + 'first.last.@iana.org',
  467 + 'first..last@iana.org',
  468 + '"first"last"@iana.org',
  469 + '"""@iana.org',
  470 + '"\"@iana.org',
  471 + //'""@iana.org',
  472 + 'first\@last@iana.org',
  473 + 'first.last@',
  474 + 'x@x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.x23456789.' .
  475 + 'x23456789.x23456789.x23456789.x23 [...]',
  476 + 'first.last@[.12.34.56.78]',
  477 + 'first.last@[12.34.56.789]',
  478 + 'first.last@[::12.34.56.78]',
  479 + 'first.last@[IPv5:::12.34.56.78]',
  480 + 'first.last@[IPv6:1111:2222:3333:4444:5555:12.34.56.78]',
  481 + 'first.last@[IPv6:1111:2222:3333:4444:5555:6666:7777:12.34.56.78]',
  482 + 'first.last@[IPv6:1111:2222:3333:4444:5555:6666:7777]',
  483 + 'first.last@[IPv6:1111:2222:3333:4444:5555:6666:7777:8888:9999]',
  484 + 'first.last@[IPv6:1111:2222::3333::4444:5555:6666]',
  485 + 'first.last@[IPv6:1111:2222:333x::4444:5555]',
  486 + 'first.last@[IPv6:1111:2222:33333::4444:5555]',
  487 + 'first.last@-xample.com',
  488 + 'first.last@exampl-.com',
  489 + 'first.last@x234567890123456789012345678901234567890123456789012345678901234.iana.org',
  490 + 'abc\@def@iana.org',
  491 + 'abc\@iana.org',
  492 + 'Doug\ \"Ace\"\ Lovell@iana.org',
  493 + 'abc@def@iana.org',
  494 + 'abc\@def@iana.org',
  495 + 'abc\@iana.org',
  496 + '@iana.org',
  497 + 'doug@',
  498 + '"qu@iana.org',
  499 + 'ote"@iana.org',
  500 + '.dot@iana.org',
  501 + 'dot.@iana.org',
  502 + 'two..dot@iana.org',
  503 + '"Doug "Ace" L."@iana.org',
  504 + 'Doug\ \"Ace\"\ L\.@iana.org',
  505 + 'hello world@iana.org',
  506 + //'helloworld@iana .org',
  507 + 'gatsby@f.sc.ot.t.f.i.tzg.era.l.d.',
  508 + 'test.iana.org',
  509 + 'test.@iana.org',
  510 + 'test..test@iana.org',
  511 + '.test@iana.org',
  512 + 'test@test@iana.org',
  513 + 'test@@iana.org',
  514 + '-- test --@iana.org',
  515 + '[test]@iana.org',
  516 + '"test"test"@iana.org',
  517 + '()[]\;:,><@iana.org',
  518 + 'test@.',
  519 + 'test@example.',
  520 + 'test@.org',
  521 + 'test@12345678901234567890123456789012345678901234567890123456789012345678901234567890' .
  522 + '12345678901234567890 [...]',
  523 + 'test@[123.123.123.123',
  524 + 'test@123.123.123.123]',
  525 + 'NotAnEmail',
  526 + '@NotAnEmail',
  527 + '"test"blah"@iana.org',
  528 + '.wooly@iana.org',
  529 + 'wo..oly@iana.org',
  530 + 'pootietang.@iana.org',
  531 + '.@iana.org',
  532 + 'Ima Fool@iana.org',
  533 + 'phil.h\@\@ck@haacked.com',
  534 + 'foo@[\1.2.3.4]',
  535 + //'first."".last@iana.org',
  536 + 'first\last@iana.org',
  537 + 'Abc\@def@iana.org',
  538 + 'Fred\ Bloggs@iana.org',
  539 + 'Joe.\Blow@iana.org',
  540 + 'first.last@[IPv6:1111:2222:3333:4444:5555:6666:12.34.567.89]',
  541 + '{^c\@**Dog^}@cartoon.com',
  542 + //'"foo"(yay)@(hoopla)[1.2.3.4]',
  543 + 'cal(foo(bar)@iamcal.com',
  544 + 'cal(foo)bar)@iamcal.com',
  545 + 'cal(foo\)@iamcal.com',
  546 + 'first(12345678901234567890123456789012345678901234567890)last@(1234567890123456789' .
  547 + '01234567890123456789012 [...]',
  548 + 'first(middle)last@iana.org',
  549 + 'first(abc("def".ghi).mno)middle(abc("def".ghi).mno).last@(abc("def".ghi).mno)example' .
  550 + '(abc("def".ghi).mno). [...]',
  551 + 'a(a(b(c)d(e(f))g)(h(i)j)@iana.org',
  552 + '.@',
  553 + '@bar.com',
  554 + '@@bar.com',
  555 + 'aaa.com',
  556 + 'aaa@.com',
  557 + 'aaa@.123',
  558 + 'aaa@[123.123.123.123]a',
  559 + 'aaa@[123.123.123.333]',
  560 + 'a@bar.com.',
  561 + 'a@-b.com',
  562 + 'a@b-.com',
  563 + '-@..com',
  564 + '-@a..com',
  565 + 'invalid@about.museum-',
  566 + 'test@...........com',
  567 + '"Unicode NULL' . chr(0) . '"@char.com',
  568 + 'Unicode NULL' . chr(0) . '@char.com',
  569 + 'first.last@[IPv6::]',
  570 + 'first.last@[IPv6::::]',
  571 + 'first.last@[IPv6::b4]',
  572 + 'first.last@[IPv6::::b4]',
  573 + 'first.last@[IPv6::b3:b4]',
  574 + 'first.last@[IPv6::::b3:b4]',
  575 + 'first.last@[IPv6:a1:::b4]',
  576 + 'first.last@[IPv6:a1:]',
  577 + 'first.last@[IPv6:a1:::]',
  578 + 'first.last@[IPv6:a1:a2:]',
  579 + 'first.last@[IPv6:a1:a2:::]',
  580 + 'first.last@[IPv6::11.22.33.44]',
  581 + 'first.last@[IPv6::::11.22.33.44]',
  582 + 'first.last@[IPv6:a1:11.22.33.44]',
  583 + 'first.last@[IPv6:a1:::11.22.33.44]',
  584 + 'first.last@[IPv6:a1:a2:::11.22.33.44]',
  585 + 'first.last@[IPv6:0123:4567:89ab:cdef::11.22.33.xx]',
  586 + 'first.last@[IPv6:0123:4567:89ab:CDEFF::11.22.33.44]',
  587 + 'first.last@[IPv6:a1::a4:b1::b4:11.22.33.44]',
  588 + 'first.last@[IPv6:a1::11.22.33]',
  589 + 'first.last@[IPv6:a1::11.22.33.44.55]',
  590 + 'first.last@[IPv6:a1::b211.22.33.44]',
  591 + 'first.last@[IPv6:a1::b2::11.22.33.44]',
  592 + 'first.last@[IPv6:a1::b3:]',
  593 + 'first.last@[IPv6::a2::b4]',
  594 + 'first.last@[IPv6:a1:a2:a3:a4:b1:b2:b3:]',
  595 + 'first.last@[IPv6::a2:a3:a4:b1:b2:b3:b4]',
  596 + 'first.last@[IPv6:a1:a2:a3:a4::b1:b2:b3:b4]'
  597 + );
  598 + $goodfails = array();
  599 + foreach ($validaddresses as $address) {
  600 + if (!PHPMailer::validateAddress($address)) {
  601 + $goodfails[] = $address;
  602 + }
  603 + }
  604 + $badpasses = array();
  605 + foreach ($invalidaddresses as $address) {
  606 + if (PHPMailer::validateAddress($address)) {
  607 + $badpasses[] = $address;
  608 + }
  609 + }
  610 + $err = '';
  611 + if (count($goodfails) > 0) {
  612 + $err .= "Good addresses that failed validation:\n";
  613 + $err .= implode("\n", $goodfails);
  614 + }
  615 + if (count($badpasses) > 0) {
  616 + if (!empty($err)) {
  617 + $err .= "\n\n";
  618 + }
  619 + $err .= "Bad addresses that passed validation:\n";
  620 + $err .= implode("\n", $badpasses);
  621 + }
  622 + $this->assertEmpty($err, $err);
  623 + //For coverage
  624 + $this->assertTrue(PHPMailer::validateAddress('test@example.com', 'auto'));
  625 + $this->assertFalse(PHPMailer::validateAddress('test@example.com.', 'auto'));
  626 + $this->assertTrue(PHPMailer::validateAddress('test@example.com', 'pcre'));
  627 + $this->assertFalse(PHPMailer::validateAddress('test@example.com.', 'pcre'));
  628 + $this->assertTrue(PHPMailer::validateAddress('test@example.com', 'pcre8'));
  629 + $this->assertFalse(PHPMailer::validateAddress('test@example.com.', 'pcre8'));
  630 + $this->assertTrue(PHPMailer::validateAddress('test@example.com', 'php'));
  631 + $this->assertFalse(PHPMailer::validateAddress('test@example.com.', 'php'));
  632 + $this->assertTrue(PHPMailer::validateAddress('test@example.com', 'noregex'));
  633 + $this->assertFalse(PHPMailer::validateAddress('bad', 'noregex'));
  634 + }
  635 +
  636 + /**
  637 + * Try a plain message.
  638 + */
  639 + public function testWordWrap()
  640 + {
  641 + $this->Mail->WordWrap = 40;
  642 + $my_body = 'Here is the main body of this message. It should ' .
  643 + 'be quite a few lines. It should be wrapped at the ' .
  644 + '40 characters. Make sure that it is.';
  645 + $nBodyLen = strlen($my_body);
  646 + $my_body .= "\n\nThis is the above body length: " . $nBodyLen;
  647 +
  648 + $this->Mail->Body = $my_body;
  649 + $this->Mail->Subject .= ': Wordwrap';
  650 +
  651 + $this->buildBody();
  652 + $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
  653 + }
  654 +
  655 + /**
  656 + * Try a plain message.
  657 + */
  658 + public function testLowPriority()
  659 + {
  660 + $this->Mail->Priority = 5;
  661 + $this->Mail->Body = 'Here is the main body. There should be ' .
  662 + 'a reply to address in this message.';
  663 + $this->Mail->Subject .= ': Low Priority';
  664 + $this->Mail->addReplyTo('nobody@nobody.com', 'Nobody (Unit Test)');
  665 +
  666 + $this->buildBody();
  667 + $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
  668 + }
  669 +
  670 + /**
  671 + * Simple plain file attachment test.
  672 + */
  673 + public function testMultiplePlainFileAttachment()
  674 + {
  675 + $this->Mail->Body = 'Here is the text body';
  676 + $this->Mail->Subject .= ': Plain + Multiple FileAttachments';
  677 +
  678 + if (!$this->Mail->addAttachment('../examples/images/phpmailer.png')) {
  679 + $this->assertTrue(false, $this->Mail->ErrorInfo);
  680 + return;
  681 + }
  682 +
  683 + if (!$this->Mail->addAttachment(__FILE__, 'test.txt')) {
  684 + $this->assertTrue(false, $this->Mail->ErrorInfo);
  685 + return;
  686 + }
  687 +
  688 + $this->buildBody();
  689 + $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
  690 + }
  691 +
  692 + /**
  693 + * Simple plain string attachment test.
  694 + */
  695 + public function testPlainStringAttachment()
  696 + {
  697 + $this->Mail->Body = 'Here is the text body';
  698 + $this->Mail->Subject .= ': Plain + StringAttachment';
  699 +
  700 + $sAttachment = 'These characters are the content of the ' .
  701 + "string attachment.\nThis might be taken from a " .
  702 + 'database or some other such thing. ';
  703 +
  704 + $this->Mail->addStringAttachment($sAttachment, 'string_attach.txt');
  705 +
  706 + $this->buildBody();
  707 + $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
  708 + }
  709 +
  710 + /**
  711 + * Plain quoted-printable message.
  712 + */
  713 + public function testQuotedPrintable()
  714 + {
  715 + $this->Mail->Body = 'Here is the main body';
  716 + $this->Mail->Subject .= ': Plain + Quoted-printable';
  717 + $this->Mail->Encoding = 'quoted-printable';
  718 +
  719 + $this->buildBody();
  720 + $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
  721 +
  722 + //Check that a quoted printable encode and decode results in the same as went in
  723 + $t = file_get_contents(__FILE__); //Use this file as test content
  724 + $this->assertEquals(
  725 + $t,
  726 + quoted_printable_decode($this->Mail->encodeQP($t)),
  727 + 'Quoted-Printable encoding round-trip failed'
  728 + );
  729 + $this->assertEquals(
  730 + $this->Mail->encodeQP($t),
  731 + $this->Mail->encodeQPphp($t),
  732 + 'Quoted-Printable BC wrapper failed'
  733 + );
  734 + }
  735 +
  736 + /**
  737 + * Try a plain message.
  738 + */
  739 + public function testHtml()
  740 + {
  741 + $this->Mail->isHTML(true);
  742 + $this->Mail->Subject .= ": HTML only";
  743 +
  744 + $this->Mail->Body = <<<EOT
  745 +<html>
  746 + <head>
  747 + <title>HTML email test</title>
  748 + </head>
  749 + <body>
  750 + <h1>PHPMailer does HTML!</h1>
  751 + <p>This is a <strong>test message</strong> written in HTML.<br>
  752 + Go to <a href="https://github.com/PHPMailer/PHPMailer/">https://github.com/PHPMailer/PHPMailer/</a>
  753 + for new versions of PHPMailer.</p>
  754 + <p>Thank you!</p>
  755 + </body>
  756 +</html>
  757 +EOT;
  758 + $this->buildBody();
  759 + $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
  760 + }
  761 +
  762 + /**
  763 + * Test simple message builder and html2text converters
  764 + */
  765 + public function testMsgHTML()
  766 + {
  767 + $message = file_get_contents('../examples/contents.html');
  768 + $this->Mail->CharSet = 'utf-8';
  769 + $this->Mail->Body = '';
  770 + $this->Mail->AltBody = '';
  771 + $this->Mail->msgHTML($message, '../examples');
  772 + $this->Mail->Subject .= ': msgHTML';
  773 +
  774 + $this->assertNotEmpty($this->Mail->Body, 'Body not set by msgHTML');
  775 + $this->assertNotEmpty($this->Mail->AltBody, 'AltBody not set by msgHTML');
  776 + $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
  777 +
  778 + //Again, using the advanced HTML to text converter
  779 + $this->Mail->AltBody = '';
  780 + $this->Mail->msgHTML($message, '../examples', true);
  781 + $this->Mail->Subject .= ' + html2text advanced';
  782 + $this->assertNotEmpty($this->Mail->AltBody, 'Advanced AltBody not set by msgHTML');
  783 +
  784 + $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
  785 + }
  786 +
  787 + /**
  788 + * Simple HTML and attachment test
  789 + */
  790 + public function testHTMLAttachment()
  791 + {
  792 + $this->Mail->Body = 'This is the <strong>HTML</strong> part of the email.';
  793 + $this->Mail->Subject .= ': HTML + Attachment';
  794 + $this->Mail->isHTML(true);
  795 +
  796 + if (!$this->Mail->addAttachment(__FILE__, 'test_attach.txt')) {
  797 + $this->assertTrue(false, $this->Mail->ErrorInfo);
  798 + return;
  799 + }
  800 +
  801 + //Make sure that trying to attach a nonexistent file fails
  802 + $this->assertFalse($this->Mail->addAttachment(__FILE__ . md5(microtime()), 'nonexistent_file.txt'));
  803 +
  804 + $this->buildBody();
  805 + $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
  806 + }
  807 +
  808 + /**
  809 + * An embedded attachment test.
  810 + */
  811 + public function testEmbeddedImage()
  812 + {
  813 + $this->Mail->Body = 'Embedded Image: <img alt="phpmailer" src="cid:my-attach">' .
  814 + 'Here is an image!</a>';
  815 + $this->Mail->Subject .= ': Embedded Image';
  816 + $this->Mail->isHTML(true);
  817 +
  818 + if (!$this->Mail->addEmbeddedImage(
  819 + '../examples/images/phpmailer.png',
  820 + 'my-attach',
  821 + 'phpmailer.png',
  822 + 'base64',
  823 + 'image/png'
  824 + )
  825 + ) {
  826 + $this->assertTrue(false, $this->Mail->ErrorInfo);
  827 + return;
  828 + }
  829 +
  830 + $this->buildBody();
  831 + $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
  832 + //For code coverage
  833 + $this->Mail->addEmbeddedImage('thisfiledoesntexist', 'xyz'); //Non-existent file
  834 + $this->Mail->addEmbeddedImage(__FILE__, '123'); //Missing name
  835 + }
  836 +
  837 + /**
  838 + * An embedded attachment test.
  839 + */
  840 + public function testMultiEmbeddedImage()
  841 + {
  842 + $this->Mail->Body = 'Embedded Image: <img alt="phpmailer" src="cid:my-attach">' .
  843 + 'Here is an image!</a>';
  844 + $this->Mail->Subject .= ': Embedded Image + Attachment';
  845 + $this->Mail->isHTML(true);
  846 +
  847 + if (!$this->Mail->addEmbeddedImage(
  848 + '../examples/images/phpmailer.png',
  849 + 'my-attach',
  850 + 'phpmailer.png',
  851 + 'base64',
  852 + 'image/png'
  853 + )
  854 + ) {
  855 + $this->assertTrue(false, $this->Mail->ErrorInfo);
  856 + return;
  857 + }
  858 +
  859 + if (!$this->Mail->addAttachment(__FILE__, 'test.txt')) {
  860 + $this->assertTrue(false, $this->Mail->ErrorInfo);
  861 + return;
  862 + }
  863 +
  864 + $this->buildBody();
  865 + $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
  866 + }
  867 +
  868 + /**
  869 + * Simple multipart/alternative test.
  870 + */
  871 + public function testAltBody()
  872 + {
  873 + $this->Mail->Body = 'This is the <strong>HTML</strong> part of the email.';
  874 + $this->Mail->AltBody = 'Here is the text body of this message. ' .
  875 + 'It should be quite a few lines. It should be wrapped at the ' .
  876 + '40 characters. Make sure that it is.';
  877 + $this->Mail->WordWrap = 40;
  878 + $this->addNote('This is a mulipart alternative email');
  879 + $this->Mail->Subject .= ': AltBody + Word Wrap';
  880 +
  881 + $this->buildBody();
  882 + $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
  883 + }
  884 +
  885 + /**
  886 + * Simple HTML and attachment test
  887 + */
  888 + public function testAltBodyAttachment()
  889 + {
  890 + $this->Mail->Body = 'This is the <strong>HTML</strong> part of the email.';
  891 + $this->Mail->AltBody = 'This is the text part of the email.';
  892 + $this->Mail->Subject .= ': AltBody + Attachment';
  893 + $this->Mail->isHTML(true);
  894 +
  895 + if (!$this->Mail->addAttachment(__FILE__, 'test_attach.txt')) {
  896 + $this->assertTrue(false, $this->Mail->ErrorInfo);
  897 + return;
  898 + }
  899 +
  900 + $this->buildBody();
  901 + $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
  902 + if (is_writable('.')) {
  903 + file_put_contents('message.txt', $this->Mail->createHeader() . $this->Mail->createBody());
  904 + } else {
  905 + $this->assertTrue(false, 'Could not write local file - check permissions');
  906 + }
  907 + }
  908 +
  909 + /**
  910 + * iCal event test
  911 + */
  912 + public function testIcal()
  913 + {
  914 + $this->Mail->Body = 'This is the <strong>HTML</strong> part of the email.';
  915 + $this->Mail->AltBody = 'This is the text part of the email.';
  916 + $this->Mail->Subject .= ': iCal';
  917 + $this->Mail->isHTML(true);
  918 + $this->buildBody();
  919 + require_once '../extras/EasyPeasyICS.php';
  920 + $ICS = new EasyPeasyICS("PHPMailer test calendar");
  921 + $ICS->addEvent(
  922 + strtotime('tomorrow 10:00 Europe/Paris'),
  923 + strtotime('tomorrow 11:00 Europe/Paris'),
  924 + 'PHPMailer iCal test',
  925 + 'A test of PHPMailer iCal support',
  926 + 'https://github.com/PHPMailer/PHPMailer'
  927 + );
  928 + $this->Mail->Ical = $ICS->render(false);
  929 + $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
  930 + $this->Mail->Body = 'Embedded Image: <img alt="phpmailer" src="cid:my-attach">' .
  931 + 'Here is an image!</a>.';
  932 + $this->Mail->AltBody = 'This is the text part of the email.';
  933 + $this->Mail->Subject .= ': iCal + inline';
  934 + $this->Mail->isHTML(true);
  935 + $this->Mail->addEmbeddedImage(
  936 + '../examples/images/phpmailer.png',
  937 + 'my-attach',
  938 + 'phpmailer.png',
  939 + 'base64',
  940 + 'image/png'
  941 + );
  942 + $this->buildBody();
  943 + $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
  944 + }
  945 +
  946 + /**
  947 + * Test sending multiple messages with separate connections
  948 + */
  949 + public function testMultipleSend()
  950 + {
  951 + $this->Mail->Body = 'Sending two messages without keepalive';
  952 + $this->buildBody();
  953 + $subject = $this->Mail->Subject;
  954 +
  955 + $this->Mail->Subject = $subject . ': SMTP 1';
  956 + $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
  957 +
  958 + $this->Mail->Subject = $subject . ': SMTP 2';
  959 + $this->Mail->Sender = 'blah@example.com';
  960 + $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
  961 + }
  962 +
  963 + /**
  964 + * Test sending using SendMail
  965 + */
  966 + public function testSendmailSend()
  967 + {
  968 + $this->Mail->Body = 'Sending via sendmail';
  969 + $this->buildBody();
  970 + $subject = $this->Mail->Subject;
  971 +
  972 + $this->Mail->Subject = $subject . ': sendmail';
  973 + $this->Mail->isSendmail();
  974 + $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
  975 + }
  976 +
  977 + /**
  978 + * Test sending using Qmail
  979 + */
  980 + public function testQmailSend()
  981 + {
  982 + //Only run if we have qmail installed
  983 + if (file_exists('/var/qmail/bin/qmail-inject')) {
  984 + $this->Mail->Body = 'Sending via qmail';
  985 + $this->BuildBody();
  986 + $subject = $this->Mail->Subject;
  987 +
  988 + $this->Mail->Subject = $subject . ': qmail';
  989 + $this->Mail->IsQmail();
  990 + $this->assertTrue($this->Mail->Send(), $this->Mail->ErrorInfo);
  991 + } else {
  992 + $this->markTestSkipped('Qmail is not installed');
  993 + }
  994 + }
  995 +
  996 + /**
  997 + * Test sending using PHP mail() function
  998 + */
  999 + public function testMailSend()
  1000 + {
  1001 + $sendmail = ini_get('sendmail_path');
  1002 + if (strpos($sendmail, '/') === false) { //No path in sendmail_path
  1003 + ini_set('sendmail_path', '/usr/sbin/sendmail -t -i ');
  1004 + }
  1005 + $this->Mail->Body = 'Sending via mail()';
  1006 + $this->buildBody();
  1007 +
  1008 + $this->Mail->Subject = $this->Mail->Subject . ': mail()';
  1009 + $this->Mail->isMail();
  1010 + $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
  1011 + }
  1012 +
  1013 + /**
  1014 + * Test sending an empty body
  1015 + */
  1016 + public function testEmptyBody()
  1017 + {
  1018 + $this->buildBody();
  1019 + $this->Mail->Body = '';
  1020 + $this->Mail->Subject = $this->Mail->Subject . ': Empty Body';
  1021 + $this->Mail->isMail();
  1022 + $this->Mail->AllowEmpty = true;
  1023 + $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
  1024 + $this->Mail->AllowEmpty = false;
  1025 + $this->assertFalse($this->Mail->send(), $this->Mail->ErrorInfo);
  1026 + }
  1027 +
  1028 + /**
  1029 + * Test keepalive (sending multiple messages in a single connection)
  1030 + */
  1031 + public function testSmtpKeepAlive()
  1032 + {
  1033 + $this->Mail->Body = 'This was done using the SMTP keep-alive.';
  1034 + $this->buildBody();
  1035 + $subject = $this->Mail->Subject;
  1036 +
  1037 + $this->Mail->SMTPKeepAlive = true;
  1038 + $this->Mail->Subject = $subject . ': SMTP keep-alive 1';
  1039 + $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
  1040 +
  1041 + $this->Mail->Subject = $subject . ': SMTP keep-alive 2';
  1042 + $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
  1043 + $this->Mail->smtpClose();
  1044 + }
  1045 +
  1046 + /**
  1047 + * Tests this denial of service attack:
  1048 + * http://www.cybsec.com/vuln/PHPMailer-DOS.pdf
  1049 + */
  1050 + public function testDenialOfServiceAttack()
  1051 + {
  1052 + $this->Mail->Body = 'This should no longer cause a denial of service.';
  1053 + $this->buildBody();
  1054 +
  1055 + $this->Mail->Subject = substr(str_repeat('0123456789', 100), 0, 998);
  1056 + $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
  1057 + }
  1058 +
  1059 + /**
  1060 + * Tests this denial of service attack:
  1061 + * https://sourceforge.net/p/phpmailer/bugs/383/
  1062 + * According to the ticket, this should get stuck in a loop, though I can't make it happen.
  1063 + */
  1064 + public function testDenialOfServiceAttack2()
  1065 + {
  1066 + //Encoding name longer than 68 chars
  1067 + $this->Mail->Encoding = '1234567890123456789012345678901234567890123456789012345678901234567890';
  1068 + //Call wrapText with a zero length value
  1069 + $this->Mail->wrapText(str_repeat('This should no longer cause a denial of service. ', 30), 0);
  1070 + }
  1071 +
  1072 + /**
  1073 + * Test error handling
  1074 + */
  1075 + public function testError()
  1076 + {
  1077 + $this->Mail->Subject .= ': This should be sent';
  1078 + $this->buildBody();
  1079 + $this->Mail->clearAllRecipients(); // no addresses should cause an error
  1080 + $this->assertTrue($this->Mail->isError() == false, 'Error found');
  1081 + $this->assertTrue($this->Mail->send() == false, 'send succeeded');
  1082 + $this->assertTrue($this->Mail->isError(), 'No error found');
  1083 + $this->assertEquals('You must provide at least one recipient email address.', $this->Mail->ErrorInfo);
  1084 + $this->Mail->addAddress($_REQUEST['mail_to']);
  1085 + $this->assertTrue($this->Mail->send(), 'send failed');
  1086 + }
  1087 +
  1088 + /**
  1089 + * Test addressing
  1090 + */
  1091 + public function testAddressing()
  1092 + {
  1093 + $this->assertFalse($this->Mail->addAddress(''), 'Empty address accepted');
  1094 + $this->assertFalse($this->Mail->addAddress('', 'Nobody'), 'Empty address with name accepted');
  1095 + $this->assertFalse($this->Mail->addAddress('a@example..com'), 'Invalid address accepted');
  1096 + $this->assertTrue($this->Mail->addAddress('a@example.com'), 'Addressing failed');
  1097 + $this->assertFalse($this->Mail->addAddress('a@example.com'), 'Duplicate addressing failed');
  1098 + $this->assertTrue($this->Mail->addCC('b@example.com'), 'CC addressing failed');
  1099 + $this->assertFalse($this->Mail->addCC('b@example.com'), 'CC duplicate addressing failed');
  1100 + $this->assertFalse($this->Mail->addCC('a@example.com'), 'CC duplicate addressing failed (2)');
  1101 + $this->assertTrue($this->Mail->addBCC('c@example.com'), 'BCC addressing failed');
  1102 + $this->assertFalse($this->Mail->addBCC('c@example.com'), 'BCC duplicate addressing failed');
  1103 + $this->assertFalse($this->Mail->addBCC('a@example.com'), 'BCC duplicate addressing failed (2)');
  1104 + $this->assertTrue($this->Mail->addReplyTo('a@example.com'), 'Replyto Addressing failed');
  1105 + $this->assertFalse($this->Mail->addReplyTo('a@example..com'), 'Invalid Replyto address accepted');
  1106 + $this->assertTrue($this->Mail->setFrom('a@example.com', 'some name'), 'setFrom failed');
  1107 + $this->assertFalse($this->Mail->setFrom('a@example.com.', 'some name'), 'setFrom accepted invalid address');
  1108 + $this->Mail->Sender = '';
  1109 + $this->Mail->setFrom('a@example.com', 'some name', true);
  1110 + $this->assertEquals($this->Mail->Sender, 'a@example.com', 'setFrom failed to set sender');
  1111 + $this->Mail->Sender = '';
  1112 + $this->Mail->setFrom('a@example.com', 'some name', false);
  1113 + $this->assertEquals($this->Mail->Sender, '', 'setFrom should not have set sender');
  1114 + $this->Mail->clearCCs();
  1115 + $this->Mail->clearBCCs();
  1116 + $this->Mail->clearReplyTos();
  1117 + }
  1118 +
  1119 + /**
  1120 + * Test address escaping
  1121 + */
  1122 + public function testAddressEscaping()
  1123 + {
  1124 + $this->Mail->Subject .= ': Address escaping';
  1125 + $this->Mail->clearAddresses();
  1126 + $this->Mail->addAddress('foo@example.com', 'Tim "The Book" O\'Reilly');
  1127 + $this->Mail->Body = 'Test correct escaping of quotes in addresses.';
  1128 + $this->buildBody();
  1129 + $this->Mail->preSend();
  1130 + $b = $this->Mail->getSentMIMEMessage();
  1131 + $this->assertTrue((strpos($b, 'To: "Tim \"The Book\" O\'Reilly" <foo@example.com>') !== false));
  1132 + }
  1133 +
  1134 + /**
  1135 + * Test BCC-only addressing
  1136 + */
  1137 + public function testBCCAddressing()
  1138 + {
  1139 + $this->Mail->Subject .= ': BCC-only addressing';
  1140 + $this->buildBody();
  1141 + $this->Mail->clearAllRecipients();
  1142 + $this->assertTrue($this->Mail->addBCC('a@example.com'), 'BCC addressing failed');
  1143 + $this->assertTrue($this->Mail->send(), 'send failed');
  1144 + }
  1145 +
  1146 + /**
  1147 + * Encoding and charset tests
  1148 + */
  1149 + public function testEncodings()
  1150 + {
  1151 + $this->Mail->CharSet = 'iso-8859-1';
  1152 + $this->assertEquals(
  1153 + '=A1Hola!_Se=F1or!',
  1154 + $this->Mail->encodeQ("\xa1Hola! Se\xf1or!", 'text'),
  1155 + 'Q Encoding (text) failed'
  1156 + );
  1157 + $this->assertEquals(
  1158 + '=A1Hola!_Se=F1or!',
  1159 + $this->Mail->encodeQ("\xa1Hola! Se\xf1or!", 'comment'),
  1160 + 'Q Encoding (comment) failed'
  1161 + );
  1162 + $this->assertEquals(
  1163 + '=A1Hola!_Se=F1or!',
  1164 + $this->Mail->encodeQ("\xa1Hola! Se\xf1or!", 'phrase'),
  1165 + 'Q Encoding (phrase) failed'
  1166 + );
  1167 + $this->Mail->CharSet = 'UTF-8';
  1168 + $this->assertEquals(
  1169 + '=C2=A1Hola!_Se=C3=B1or!',
  1170 + $this->Mail->encodeQ("\xc2\xa1Hola! Se\xc3\xb1or!", 'text'),
  1171 + 'Q Encoding (text) failed'
  1172 + );
  1173 + //Strings containing '=' are a special case
  1174 + $this->assertEquals(
  1175 + 'Nov=C3=A1=3D',
  1176 + $this->Mail->encodeQ("Nov\xc3\xa1=", 'text'),
  1177 + 'Q Encoding (text) failed 2'
  1178 + );
  1179 + }
  1180 +
  1181 + public function testBase64()
  1182 + {
  1183 + $this->Mail->Subject .= ': Base-64 encoding';
  1184 + $this->Mail->Encoding = 'base64';
  1185 + $this->buildBody();
  1186 + $this->assertTrue($this->Mail->send(), 'Base64 encoding failed');
  1187 + }
  1188 + /**
  1189 + * S/MIME Signing tests
  1190 + */
  1191 + public function testSigning()
  1192 + {
  1193 + $this->Mail->Subject .= ': S/MIME signing';
  1194 + $this->Mail->Body = 'This message is S/MIME signed.';
  1195 + $this->buildBody();
  1196 +
  1197 + $dn = array(
  1198 + 'countryName' => 'UK',
  1199 + 'stateOrProvinceName' => 'Here',
  1200 + 'localityName' => 'There',
  1201 + 'organizationName' => 'PHP',
  1202 + 'organizationalUnitName' => 'PHPMailer',
  1203 + 'commonName' => 'PHPMailer Test',
  1204 + 'emailAddress' => 'phpmailer@example.com'
  1205 + );
  1206 + $password = 'password';
  1207 + $certfile = 'certfile.txt';
  1208 + $keyfile = 'keyfile.txt';
  1209 +
  1210 + //Make a new key pair
  1211 + $pk = openssl_pkey_new();
  1212 + //Create a certificate signing request
  1213 + $csr = openssl_csr_new($dn, $pk);
  1214 + //Create a self-signed cert
  1215 + $cert = openssl_csr_sign($csr, null, $pk, 1);
  1216 + //Save the cert
  1217 + openssl_x509_export($cert, $certout);
  1218 + file_put_contents($certfile, $certout);
  1219 + //Save the key
  1220 + openssl_pkey_export($pk, $pkeyout, $password);
  1221 + file_put_contents($keyfile, $pkeyout);
  1222 +
  1223 + $this->Mail->sign(
  1224 + $certfile,
  1225 + $keyfile,
  1226 + $password
  1227 + );
  1228 + $this->assertTrue($this->Mail->send(), 'S/MIME signing failed');
  1229 + unlink($certfile);
  1230 + unlink($keyfile);
  1231 + }
  1232 +
  1233 + /**
  1234 + * DKIM Signing tests
  1235 + */
  1236 + public function testDKIM()
  1237 + {
  1238 + $this->Mail->Subject .= ': DKIM signing';
  1239 + $this->Mail->Body = 'This message is DKIM signed.';
  1240 + $this->buildBody();
  1241 + $privatekeyfile = 'dkim_private.key';
  1242 + //Make a new key pair
  1243 + //(2048 bits is the recommended minimum key length -
  1244 + //gmail won't accept less than 1024 bits)
  1245 + $pk = openssl_pkey_new(
  1246 + array(
  1247 + 'private_key_bits' => 2048,
  1248 + 'private_key_type' => OPENSSL_KEYTYPE_RSA
  1249 + )
  1250 + );
  1251 + openssl_pkey_export_to_file($pk, $privatekeyfile);
  1252 + $this->Mail->DKIM_domain = 'example.com';
  1253 + $this->Mail->DKIM_private = $privatekeyfile;
  1254 + $this->Mail->DKIM_selector = 'phpmailer';
  1255 + $this->Mail->DKIM_passphrase = ''; //key is not encrypted
  1256 + $this->assertTrue($this->Mail->send(), 'DKIM signed mail failed');
  1257 + unlink($privatekeyfile);
  1258 + }
  1259 +
  1260 + /**
  1261 + * Test line break reformatting
  1262 + */
  1263 + public function testLineBreaks()
  1264 + {
  1265 + $unixsrc = "hello\nWorld\nAgain\n";
  1266 + $macsrc = "hello\rWorld\rAgain\r";
  1267 + $windowssrc = "hello\r\nWorld\r\nAgain\r\n";
  1268 + $mixedsrc = "hello\nWorld\rAgain\r\n";
  1269 + $target = "hello\r\nWorld\r\nAgain\r\n";
  1270 + $this->assertEquals($target, PHPMailer::normalizeBreaks($unixsrc), 'UNIX break reformatting failed');
  1271 + $this->assertEquals($target, PHPMailer::normalizeBreaks($macsrc), 'Mac break reformatting failed');
  1272 + $this->assertEquals($target, PHPMailer::normalizeBreaks($windowssrc), 'Windows break reformatting failed');
  1273 + $this->assertEquals($target, PHPMailer::normalizeBreaks($mixedsrc), 'Mixed break reformatting failed');
  1274 + }
  1275 +
  1276 + /**
  1277 + * Test setting and retrieving message ID
  1278 + */
  1279 + public function testMessageID()
  1280 + {
  1281 + $this->Mail->Body = 'Test message ID.';
  1282 + $id = md5(12345);
  1283 + $this->Mail->MessageID = $id;
  1284 + $this->buildBody();
  1285 + $this->Mail->preSend();
  1286 + $lastid = $this->Mail->getLastMessageID();
  1287 + $this->assertEquals($lastid, $id, 'Custom Message ID mismatch');
  1288 + }
  1289 +
  1290 + /**
  1291 + * Miscellaneous calls to improve test coverage and some small tests
  1292 + */
  1293 + public function testMiscellaneous()
  1294 + {
  1295 + $this->assertEquals('application/pdf', PHPMailer::_mime_types('pdf'), 'MIME TYPE lookup failed');
  1296 + $this->Mail->addCustomHeader('SomeHeader: Some Value');
  1297 + $this->Mail->clearCustomHeaders();
  1298 + $this->Mail->clearAttachments();
  1299 + $this->Mail->isHTML(false);
  1300 + $this->Mail->isSMTP();
  1301 + $this->Mail->isMail();
  1302 + $this->Mail->isSendmail();
  1303 + $this->Mail->isQmail();
  1304 + $this->Mail->setLanguage('fr');
  1305 + $this->Mail->Sender = '';
  1306 + $this->Mail->createHeader();
  1307 + $this->assertFalse($this->Mail->set('x', 'y'), 'Invalid property set succeeded');
  1308 + $this->assertTrue($this->Mail->set('Timeout', 11), 'Valid property set failed');
  1309 + //Test pathinfo
  1310 + $a = '/mnt/files/飛兒樂 團光茫.mp3';
  1311 + $q = PHPMailer::mb_pathinfo($a);
  1312 + $this->assertEquals($q['dirname'], '/mnt/files', 'UNIX dirname not matched');
  1313 + $this->assertEquals($q['basename'], '飛兒樂 團光茫.mp3', 'UNIX basename not matched');
  1314 + $this->assertEquals($q['extension'], 'mp3', 'UNIX extension not matched');
  1315 + $this->assertEquals($q['filename'], '飛兒樂 團光茫', 'UNIX filename not matched');
  1316 + $this->assertEquals(
  1317 + PHPMailer::mb_pathinfo($a, PATHINFO_DIRNAME),
  1318 + '/mnt/files',
  1319 + 'Dirname path element not matched'
  1320 + );
  1321 + $this->assertEquals(PHPMailer::mb_pathinfo($a, 'filename'), '飛兒樂 團光茫', 'Filename path element not matched');
  1322 + $a = 'c:\mnt\files\飛兒樂 團光茫.mp3';
  1323 + $q = PHPMailer::mb_pathinfo($a);
  1324 + $this->assertEquals($q['dirname'], 'c:\mnt\files', 'Windows dirname not matched');
  1325 + $this->assertEquals($q['basename'], '飛兒樂 團光茫.mp3', 'Windows basename not matched');
  1326 + $this->assertEquals($q['extension'], 'mp3', 'Windows extension not matched');
  1327 + $this->assertEquals($q['filename'], '飛兒樂 團光茫', 'Windows filename not matched');
  1328 + }
  1329 +
  1330 + /**
  1331 + * Use a fake POP3 server to test POP-before-SMTP auth
  1332 + * With a known-good login
  1333 + */
  1334 + public function testPopBeforeSmtpGood()
  1335 + {
  1336 + //Start a fake POP server
  1337 + $pid = shell_exec('nohup ./runfakepopserver.sh >/dev/null 2>/dev/null & printf "%u" $!');
  1338 + $this->pids[] = $pid;
  1339 +
  1340 + sleep(2);
  1341 + //Test a known-good login
  1342 + $this->assertTrue(
  1343 + POP3::popBeforeSmtp('localhost', 1100, 10, 'user', 'test', 0),
  1344 + 'POP before SMTP failed'
  1345 + );
  1346 + //Kill the fake server
  1347 + shell_exec('kill -TERM '.escapeshellarg($pid));
  1348 + sleep(2);
  1349 + }
  1350 +
  1351 + /**
  1352 + * Use a fake POP3 server to test POP-before-SMTP auth
  1353 + * With a known-bad login
  1354 + */
  1355 + public function testPopBeforeSmtpBad()
  1356 + {
  1357 + //Start a fake POP server on a different port
  1358 + //so we don't inadvertently connect to the previous instance
  1359 + $pid = shell_exec('nohup ./runfakepopserver.sh 1101 >/dev/null 2>/dev/null & printf "%u" $!');
  1360 + $this->pids[] = $pid;
  1361 +
  1362 + sleep(2);
  1363 + //Test a known-bad login
  1364 + $this->assertFalse(
  1365 + POP3::popBeforeSmtp('localhost', 1101, 10, 'user', 'xxx', 0),
  1366 + 'POP before SMTP should have failed'
  1367 + );
  1368 + shell_exec('kill -TERM '.escapeshellarg($pid));
  1369 + sleep(2);
  1370 + }
  1371 +
  1372 + /**
  1373 + * Test SMTP host connections.
  1374 + * This test can take a long time, so run it last
  1375 + */
  1376 + public function testSmtpConnect()
  1377 + {
  1378 + $this->assertTrue($this->Mail->smtpConnect(), 'SMTP single connect failed');
  1379 + $this->Mail->smtpClose();
  1380 + $this->Mail->Host = "ssl://localhost:12345;tls://localhost:587;10.10.10.10:54321;localhost:12345;10.10.10.10";
  1381 + $this->assertFalse($this->Mail->smtpConnect(), 'SMTP bad multi-connect succeeded');
  1382 + $this->Mail->smtpClose();
  1383 + $this->Mail->Host = "localhost:12345;10.10.10.10:54321;" . $_REQUEST['mail_host'];
  1384 + $this->assertTrue($this->Mail->smtpConnect(), 'SMTP multi-connect failed');
  1385 + $this->Mail->smtpClose();
  1386 + $this->Mail->Host = " localhost:12345 ; " . $_REQUEST['mail_host'] . ' ';
  1387 + $this->assertTrue($this->Mail->smtpConnect(), 'SMTP hosts with stray spaces failed');
  1388 + $this->Mail->smtpClose();
  1389 + $this->Mail->Host = $_REQUEST['mail_host'];
  1390 + //Need to pick a harmless option so as not cause problems of its own! socket:bind doesn't work with Travis-CI
  1391 + $this->assertTrue(
  1392 + $this->Mail->smtpConnect(array('ssl' => array('verify_depth' => 10))),
  1393 + 'SMTP connect with options failed'
  1394 + );
  1395 + }
  1396 +}
  1397 +
  1398 +/**
  1399 + * This is a sample form for setting appropriate test values through a browser
  1400 + * These values can also be set using a file called testbootstrap.php (not in svn) in the same folder as this script
  1401 + * which is probably more useful if you run these tests a lot
  1402 + * <html>
  1403 + * <body>
  1404 + * <h3>phpmailer Unit Test</h3>
  1405 + * By entering a SMTP hostname it will automatically perform tests with SMTP.
  1406 + *
  1407 + * <form name="phpmailer_unit" action=__FILE__ method="get">
  1408 + * <input type="hidden" name="submitted" value="1"/>
  1409 + * From Address: <input type="text" size="50" name="mail_from" value="<?php echo get("mail_from"); ?>"/>
  1410 + * <br/>
  1411 + * To Address: <input type="text" size="50" name="mail_to" value="<?php echo get("mail_to"); ?>"/>
  1412 + * <br/>
  1413 + * Cc Address: <input type="text" size="50" name="mail_cc" value="<?php echo get("mail_cc"); ?>"/>
  1414 + * <br/>
  1415 + * SMTP Hostname: <input type="text" size="50" name="mail_host" value="<?php echo get("mail_host"); ?>"/>
  1416 + * <p/>
  1417 + * <input type="submit" value="Run Test"/>
  1418 + *
  1419 + * </form>
  1420 + * </body>
  1421 + * </html>
  1422 + */
  1 +#!/usr/bin/env bash
  2 +
  3 +# Run the fake pop server from bash
  4 +# Idea from http://blog.ale-re.net/2007/09/ipersimple-remote-shell-with-netcat.html
  5 +# Defaults to port 1100 so it can be run by unpriv users and not clash with a real server
  6 +# Optionally, pass in in a port number as the first arg
  7 +
  8 +mkfifo fifo
  9 +nc -l ${1:-1100} <fifo |bash ./fakepopserver.sh >fifo
  10 +rm fifo
  1 +<html>
  2 +<head>
  3 + <title>PHPMailer Lite - DKIM and Callback Function test</title>
  4 +</head>
  5 +<body>
  6 +
  7 +<?php
  8 +/* This is a sample callback function for PHPMailer Lite.
  9 + * This callback function will echo the results of PHPMailer processing.
  10 + */
  11 +
  12 +/* Callback (action) function
  13 + * bool $result result of the send action
  14 + * string $to email address of the recipient
  15 + * string $cc cc email addresses
  16 + * string $bcc bcc email addresses
  17 + * string $subject the subject
  18 + * string $body the email body
  19 + * @return boolean
  20 + */
  21 +function callbackAction($result, $to, $cc, $bcc, $subject, $body)
  22 +{
  23 + /*
  24 + this callback example echos the results to the screen - implement to
  25 + post to databases, build CSV log files, etc., with minor changes
  26 + */
  27 + $to = cleanEmails($to, 'to');
  28 + $cc = cleanEmails($cc[0], 'cc');
  29 + $bcc = cleanEmails($bcc[0], 'cc');
  30 + echo $result . "\tTo: " . $to['Name'] . "\tTo: " . $to['Email'] . "\tCc: " . $cc['Name'] .
  31 + "\tCc: " . $cc['Email'] . "\tBcc: " . $bcc['Name'] . "\tBcc: " . $bcc['Email'] .
  32 + "\t" . $subject . "\n\n". $body . "\n";
  33 + return true;
  34 +}
  35 +
  36 +require_once '../class.phpmailer.php';
  37 +$mail = new PHPMailer();
  38 +
  39 +try {
  40 + $mail->isMail();
  41 + $mail->setFrom('you@example.com', 'Your Name');
  42 + $mail->addAddress('another@example.com', 'John Doe');
  43 + $mail->Subject = 'PHPMailer Lite Test Subject via mail()';
  44 + // optional - msgHTML will create an alternate automatically
  45 + $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!';
  46 + $mail->msgHTML(file_get_contents('../examples/contents.html'));
  47 + $mail->addAttachment('../examples/images/phpmailer.png'); // attachment
  48 + $mail->addAttachment('../examples/images/phpmailer_mini.png'); // attachment
  49 + $mail->action_function = 'callbackAction';
  50 + $mail->send();
  51 + echo "Message Sent OK</p>\n";
  52 +} catch (phpmailerException $e) {
  53 + echo $e->errorMessage(); //Pretty error messages from PHPMailer
  54 +} catch (Exception $e) {
  55 + echo $e->getMessage(); //Boring error messages from anything else!
  56 +}
  57 +
  58 +function cleanEmails($str, $type)
  59 +{
  60 + if ($type == 'cc') {
  61 + $addy['Email'] = $str[0];
  62 + $addy['Name'] = $str[1];
  63 + return $addy;
  64 + }
  65 + if (!strstr($str, ' <')) {
  66 + $addy['Name'] = '';
  67 + $addy['Email'] = $addy;
  68 + return $addy;
  69 + }
  70 + $addyArr = explode(' <', $str);
  71 + if (substr($addyArr[1], -1) == '>') {
  72 + $addyArr[1] = substr($addyArr[1], 0, -1);
  73 + }
  74 + $addy['Name'] = $addyArr[0];
  75 + $addy['Email'] = $addyArr[1];
  76 + $addy['Email'] = str_replace('@', '&#64;', $addy['Email']);
  77 + return $addy;
  78 +}
  79 +
  80 +?>
  81 +</body>
  82 +</html>
  1 +<?php
  2 +$_REQUEST['submitted'] = 1;
  3 +$_REQUEST['mail_to'] = 'somebody@example.com';
  4 +$_REQUEST['mail_from'] = 'phpunit@example.com';
  5 +$_REQUEST['mail_cc'] = 'cc@example.com';
  6 +$_REQUEST['mail_host'] = 'localhost';
  7 +$_REQUEST['mail_port'] = 2500;
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<phpunit
  3 + verbose="false"
  4 + stopOnError="false"
  5 + stopOnFailure="false"
  6 + stopOnIncomplete="false"
  7 + stopOnSkipped="false"
  8 + convertErrorsToExceptions="true"
  9 + convertNoticesToExceptions="true"
  10 + convertWarningsToExceptions="true"
  11 + colors="false"
  12 + forceCoversAnnotation="false"
  13 + strict="false"
  14 + processIsolation="false">
  15 + <testsuites>
  16 + <testsuite name="PHPMailer Tests">
  17 + <directory>./test/</directory>
  18 + </testsuite>
  19 + </testsuites>
  20 + <filter>
  21 + <blacklist>
  22 + <directory suffix=".php">./extras</directory>
  23 + </blacklist>
  24 + </filter>
  25 + <groups>
  26 + <exclude>
  27 + <group>languages</group>
  28 + </exclude>
  29 + </groups>
  30 + <logging>
  31 + <log type="coverage-text" target="php://stdout" showUncoveredFiles="true"/>
  32 + <log type="coverage-clover" target="build/logs/clover.xml"/>
  33 + <log type="junit" target="build/logs/junit.xml" logIncompleteSkipped="false"/>
  34 + </logging>
  35 +</phpunit>
  1 +<?php
  2 + require "./sendmail.php";
  3 +
  4 + $MAIL = "noreply@mail-ni-pon.net";
  5 + $PASS = "NATkeSgdz86CuaA";
  6 + $HOST = "imap.media-tek.conoha.io";
  7 + $PORT = 143;
  8 +
  9 + $MATCHWORD = "「め~るNiポン」";
  10 + run();
  11 +
  12 + function run()
  13 + {
  14 + global $MAIL, $PASS, $HOST, $PORT;
  15 +
  16 + if (($mbox = imap_open("{" . $HOST . ":" . $PORT . "/imap/notls}", $MAIL, $PASS)) == false) {
  17 + echo "接続失敗";
  18 + } else {
  19 + // 未読
  20 + $mail_id_list = imap_search($mbox, "UNFLAGGED");
  21 +
  22 + if ($mail_id_list) {
  23 + foreach ($mail_id_list as $id) {
  24 + if (!bounce_check($mbox, $id)) {
  25 + // mail 送信
  26 + $result = send_bounce_mail($mbox, $id);
  27 + if ($result === true) {
  28 + imap_setflag_full($mbox, $id,"\\Flagged");
  29 + } else {
  30 + echo $result; // console out exception
  31 + }
  32 + }
  33 + }
  34 + }
  35 +
  36 + // 3ヶ月以上経過したメールを削除
  37 + $delete_mail_id_list = imap_search($mbox, '"BEFORE '. date('j-M-Y', strtotime('-3 month')) . '"');
  38 + //$delete_mail_id_list = imap_search($mbox, "BEFORE 1 September 2019");
  39 + var_dump($delete_mail_id_list);
  40 + if ($delete_mail_id_list) {
  41 + foreach ($delete_mail_id_list as $id) {
  42 + // 処理したメールに削除フラグをセット
  43 + echo 'delete ' . $id . "\n";
  44 + imap_delete($mbox, $id);
  45 + }
  46 + imap_expunge($mbox);
  47 + }
  48 + }
  49 + }
  50 +
  51 + function bounce_check($mbox, $id)
  52 + {
  53 + // header check
  54 + $header = imap_headerinfo($mbox, $id);
  55 + if (returnpath_check($header)) {
  56 + return true;
  57 + }
  58 + // body check
  59 + $body = get_body($mbox, $id);
  60 + if (body_check($body)) {
  61 + return true;
  62 + }
  63 + return false;
  64 + }
  65 +
  66 + function returnpath_check($header)
  67 + {
  68 + // return path が空のものはbounce mail判定とする
  69 + // return path を取得できなさそうなので、fromが MAILER DAEMON となっているものをbounce mail判定する
  70 + $from = $header->from[0]->mailbox;
  71 + if (mb_strtolower($from) === "mailer-daemon") {
  72 + return false;
  73 + } else {
  74 + return true;
  75 + }
  76 + }
  77 +
  78 + function body_check($body)
  79 + {
  80 + global $MATCHWORD;
  81 + if (mb_strpos($body, $MATCHWORD)) {
  82 + echo 'match';
  83 + // match
  84 + return false;
  85 + } else {
  86 + return true;
  87 + }
  88 + }
  89 +
  90 + function get_body($mbox, $id)
  91 + {
  92 + $body = imap_body($mbox, $id, FT_INTERNAL);
  93 + $body = imap_qprint($body);
  94 + $body = str_replace('〜', '~', mb_convert_encoding($body, "UTF-8", "ISO-2022-JP"));
  95 + //echo "\n";
  96 + //global $MATCHWORD;
  97 + //echo bin2hex($MATCHWORD);
  98 + //echo "\n";
  99 + //echo bin2hex($body); exit;
  100 + return $body;
  101 + }
  102 +
  103 + function send_bounce_mail($mbox, $id)
  104 + {
  105 + $body = get_body($mbox, $id);
  106 + $to_mail = get_customer_admin_mail($body);
  107 +
  108 + $sendmail = new SendMail();
  109 + $sendmail->to = $to_mail;
  110 + $sendmail->body = $body;
  111 + return $sendmail->send();
  112 + }
  113 +
  114 + function get_customer_admin_mail($body)
  115 + {
  116 + preg_match("/「+[A-Za-z0-9\-\.\_]+@[A-Za-z0-9\-\_]+\.[A-Za-z0-9\-\.\_]+」/", $body, $mail_list);
  117 + $mail = $mail_list[0];
  118 + $mail = ltrim($mail, "「");
  119 + $mail = rtrim($mail, "」");
  120 + return $mail;
  121 + }
  1 +<?php
  2 +
  3 +require "PHPMailer/PHPMailerAutoload.php";
  4 +
  5 +class SendMail
  6 +{
  7 + public $to, $body;
  8 +
  9 + private $from, $from_name, $subject;
  10 + private $host, $smtp_user, $smtp_password;
  11 +
  12 + public function __construct()
  13 + {
  14 + $this->from = "noreply@mail-ni-pon.net";
  15 + $this->from_name = "め~るNiポン";
  16 + $this->subject = "め~るNiポン 自動転送メール";
  17 + $this->host = "email-smtp.us-west-2.amazonaws.com";
  18 + $this->smtp_user = "AKIA44WSXVI4JODGPXGH";
  19 + $this->smtp_password = "BG8I+bxDftyJcQYv2APx1RHWcDN0sQlhm+wXkE5ZQKJb";
  20 + }
  21 +
  22 + public function send()
  23 + {
  24 + $mail = new PHPMailer();
  25 +
  26 + try {
  27 + $mail->CharSet = "UTF-8";
  28 + $mail->Encoding = "base64";
  29 + $mail->IsSMTP();
  30 + $mail->SMTPAuth = true;
  31 + $mail->SMTPSecure = "tls";
  32 + $mail->Port = 587;
  33 + $mail->Host = $this->host;
  34 + $mail->Username = $this->smtp_user;
  35 + $mail->Password = $this->smtp_password;
  36 + $mail->From = $this->from;
  37 + $mail->FromName = $this->from_name;
  38 +
  39 + $mail->addAddress($this->to);
  40 + $mail->isHTML(true);
  41 + $mail->Subject = $this->subject;
  42 + $mail->Body = $this->body;
  43 + //$mail->addAddress("n.oyamada1219@gmail.com");
  44 + //$mail->isHTML(true);
  45 + //$mail->Subject = "test";
  46 + //$mail->Body = "test";
  47 +
  48 +
  49 + $mail->Send();
  50 +
  51 +echo "ok";
  52 + return true;
  53 + } catch (phpmailerException $e) {
  54 +echo "ng";
  55 + var_dump($e);
  56 + return $e;
  57 + } catch (Exception $e) {
  58 +echo "ng2";
  59 + var_dump($e);
  60 + return $e;
  61 + }
  62 + }
  63 +}
Please register or login to post a comment