Initial commit
This code is provided for archival purposes only. New features will not be added.
|
@ -0,0 +1,2 @@
|
|||
settings.php
|
||||
templates_c
|
|
@ -0,0 +1,661 @@
|
|||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
|
@ -0,0 +1,9 @@
|
|||
# Zoopz - Classic multiplayer game
|
||||
[![Donate via LiberaPay](https://img.shields.io/liberapay/receives/rocketnine.space.svg?logo=liberapay)](https://liberapay.com/rocketnine.space)
|
||||
[![Donate via Patreon](https://img.shields.io/badge/dynamic/json?color=%23e85b46&label=Patreon&query=data.attributes.patron_count&suffix=%20patrons&url=https%3A%2F%2Fwww.patreon.com%2Fapi%2Fcampaigns%2F5252223)](https://www.patreon.com/rocketnine)
|
||||
|
||||
This code is provided for archival purposes only. New features will not be added.
|
||||
|
||||
## Play
|
||||
|
||||
Visit https://zoopz.org to play.
|
|
@ -0,0 +1,6 @@
|
|||
<img src="/img/zoop_white.png" alt="White">
|
||||
<img src="/img/zoop_blue.png" alt="Blue">
|
||||
<img src="/img/zoop_green.png" alt="Green">
|
||||
<img src="/img/zoop_orange.png" alt="Orange">
|
||||
<img src="/img/zoop_red.png" alt="Red">
|
||||
<img src="/img/zoop_yellow.png" alt="Yellow">
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"require": {
|
||||
"smarty/smarty": "^4.2"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
{
|
||||
"_readme": [
|
||||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "85fbe2d6e046e0ac70dca0d396641a42",
|
||||
"packages": [
|
||||
{
|
||||
"name": "smarty/smarty",
|
||||
"version": "v4.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/smarty-php/smarty.git",
|
||||
"reference": "97aeb14c6fc2fb733938809926e2f9d6c581a70d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/smarty-php/smarty/zipball/97aeb14c6fc2fb733938809926e2f9d6c581a70d",
|
||||
"reference": "97aeb14c6fc2fb733938809926e2f9d6c581a70d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^8.5 || ^7.5",
|
||||
"smarty/smarty-lexer": "^3.1"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "4.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"libs/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"LGPL-3.0"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Monte Ohrt",
|
||||
"email": "monte@ohrt.com"
|
||||
},
|
||||
{
|
||||
"name": "Uwe Tews",
|
||||
"email": "uwe.tews@googlemail.com"
|
||||
},
|
||||
{
|
||||
"name": "Rodney Rehm",
|
||||
"email": "rodney.rehm@medialize.de"
|
||||
},
|
||||
{
|
||||
"name": "Simon Wisselink",
|
||||
"homepage": "https://www.iwink.nl/"
|
||||
}
|
||||
],
|
||||
"description": "Smarty - the compiling PHP template engine",
|
||||
"homepage": "https://smarty-php.github.io/smarty/",
|
||||
"keywords": [
|
||||
"templating"
|
||||
],
|
||||
"support": {
|
||||
"forum": "https://github.com/smarty-php/smarty/discussions",
|
||||
"issues": "https://github.com/smarty-php/smarty/issues",
|
||||
"source": "https://github.com/smarty-php/smarty/tree/v4.2.0"
|
||||
},
|
||||
"time": "2022-08-01T21:57:38+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": [],
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": [],
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "2.1.0"
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
ini_set("log_errors", 1);
|
||||
ini_set("error_log", ZOOPZ_LOG);
|
||||
ini_set('display_errors', 0);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting( E_ALL);
|
||||
|
||||
$dblink = mysqli_connect(ZOOPZ_HOST, ZOOPZ_USERNAME, ZOOPZ_PASSWORD);
|
||||
if (!$dblink) {
|
||||
die('Zoopz! We are currently experiencing issues, please try again later.');
|
||||
}
|
||||
mysqli_select_db($dblink, ZOOPZ_DATABASE);
|
||||
|
||||
function zoopz_query($string){
|
||||
global $dblink;
|
||||
$result = mysqli_query($dblink, $string);
|
||||
$mysql_error = mysqli_error($dblink);
|
||||
if ($mysql_error != '') {
|
||||
error_log( $mysql_error . "\n" . print_r(debug_backtrace(), true));
|
||||
}
|
||||
return $result;
|
||||
}
|
After Width: | Height: | Size: 2.0 KiB |
|
@ -0,0 +1,509 @@
|
|||
<?php
|
||||
function TimeAgo($timestamp, $type = 'ago') {
|
||||
// Store the current time
|
||||
$current_time = time();
|
||||
|
||||
// Determine the difference, between the time now and the timestamp
|
||||
if ($type=='ago') {
|
||||
$difference = $current_time - $timestamp;
|
||||
} elseif ($type=='until') {
|
||||
$difference = $timestamp - $current_time;
|
||||
}
|
||||
|
||||
// Set the periods of time
|
||||
$periods = array('second', 'minute', 'hour', 'day', 'week', 'month', 'year', 'decade');
|
||||
|
||||
// Set the number of seconds per period
|
||||
$lengths = array(1, 60, 3600, 86400, 604800, 2630880, 31570560, 315705600);
|
||||
|
||||
// Determine which period we should use, based on the number of seconds lapsed.
|
||||
// If the difference divided by the seconds is more than 1, we use that. Eg 1 year / 1 decade = 0.1, so we move on
|
||||
// Go from decades backwards to seconds
|
||||
for ($val = sizeof($lengths) - 1; ($val >= 0) && (($number = $difference / $lengths[$val]) <= 1); $val--);
|
||||
|
||||
// Ensure the script has found a match
|
||||
if ($val < 0) $val = 0;
|
||||
|
||||
// Determine the minor value, to recurse through
|
||||
$new_time = $current_time - ($difference % $lengths[$val]);
|
||||
|
||||
// Set the current value to be floored
|
||||
$number = floor($number);
|
||||
|
||||
// If required create a plural
|
||||
if($number != 1) $periods[$val].= "s";
|
||||
|
||||
// Return text
|
||||
$text = sprintf("%d %s ", $number, $periods[$val]);
|
||||
|
||||
// Ensure there is still something to recurse through, and we have not found 1 minute and 0 seconds.
|
||||
if (($val >= 1) && (($current_time - $new_time) > 0)){
|
||||
$text .= TimeAgo($new_time);
|
||||
}
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
function do_updates($type, $nextrun) {
|
||||
global $dblink, $update_halfhour_nextrun, $update_day_nextrun;
|
||||
|
||||
if ($type == 'halfhour') {
|
||||
$numupdates = floor((time()-$nextrun)/1800)+1;
|
||||
$result = zoopz_query('SELECT * FROM `accounts`');
|
||||
while ($line = $result->fetch_assoc()) {
|
||||
$newattackturns = $line['attackturns'] + ($numupdates * 5);
|
||||
if ($newattackturns > 400) {
|
||||
$newattackturns = 400;
|
||||
}
|
||||
$maxhp = calculateMaxHP($line['zoop_level'], $line['zoop_stamina']);
|
||||
if ($line['zoop_hp'] < $maxhp) {
|
||||
$newhp = min(floor($line['zoop_hp'] + ($maxhp / 3)), $maxhp);
|
||||
} else {
|
||||
$newhp = $line['zoop_hp'];
|
||||
}
|
||||
$potatoesmined = $line['potatoesmined'];
|
||||
if ($line['potatominers'] > 0) {
|
||||
$potatoesmined += $line['potatominers'] * $numupdates;
|
||||
$newpotatoes = $line['potatoes'] + ($line['potatominers'] * $numupdates);
|
||||
} else {
|
||||
$newpotatoes = $line['potatoes'];
|
||||
}
|
||||
|
||||
zoopz_query('UPDATE `accounts` SET `potatoes` = ' . $newpotatoes . ' , `attackturns` = ' . $newattackturns . ' , `zoop_hp` = ' . $newhp . ' , `potatoesmined` = ' . $potatoesmined . ' WHERE `id` = ' . $line['id']);
|
||||
}
|
||||
|
||||
$newnextrun = $nextrun+($numupdates*1800);
|
||||
zoopz_query("UPDATE `updates` SET `nextrun` = '".$newnextrun."' WHERE `name` = '".$type."'");
|
||||
$update_halfhour_nextrun = $newnextrun;
|
||||
} elseif ($type=='day') {
|
||||
$numupdates = floor((time()-$nextrun)/86400)+1;
|
||||
$result = zoopz_query("SELECT * FROM `accounts`");
|
||||
while ($line = $result->fetch_assoc()) {
|
||||
$newtrainingpoints = $line['trainingpoints']+($numupdates*10);
|
||||
if ($newtrainingpoints>100) {
|
||||
$newtrainingpoints = 100;
|
||||
}
|
||||
$newpeopleabletobehired = min(100,$line['peopleabletobehired']+1);
|
||||
zoopz_query("UPDATE `accounts` SET `trainingpoints` = '".$newtrainingpoints."' , `peopleabletobehired` = ".$newpeopleabletobehired." WHERE `id` = '".$line['id']."'");
|
||||
}
|
||||
zoopz_query("DELETE FROM `attacks`");
|
||||
zoopz_query("DELETE FROM `votes`");
|
||||
zoopz_query("UPDATE `accounts` SET `bank_deposits` = '0', `potato_sells` = '0'");
|
||||
|
||||
// Lint collection
|
||||
zoopz_query('UPDATE `accounts` SET `zoop_lint` = `zoop_lint` + FLOOR(1 + (RAND() * 5))');
|
||||
|
||||
// Old accounts deletion - TODO: Reactivate? no
|
||||
//zoopz_query('DELETE FROM `accounts` WHERE (' . time() . ' - `lastactive`) > 15778463');
|
||||
|
||||
// Week old events deletion
|
||||
zoopz_query('DELETE FROM `events` WHERE (' . time() . ' - `timestamp`) > 604800');
|
||||
|
||||
$newnextrun = $nextrun+($numupdates*86400);
|
||||
zoopz_query("UPDATE `updates` SET `nextrun` = '".$newnextrun."' WHERE `name` = '".$type."'");
|
||||
$update_day_nextrun = $newnextrun;
|
||||
}
|
||||
}
|
||||
|
||||
function calculateLint($lint) {
|
||||
return str_pad(($lint * 0.09991) + ($lint * 0.001327), 8, '0');
|
||||
}
|
||||
|
||||
function userInfo($userid) {
|
||||
global $dblink;
|
||||
$result = zoopz_query("SELECT * FROM `accounts` WHERE `id` = '".mysqli_real_escape_string($dblink, $userid)."'");
|
||||
$rows = $result->num_rows;
|
||||
if ($rows>0) {
|
||||
while ($line = $result->fetch_assoc()) {
|
||||
return $line;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function zoopImage($user, $flip = false) {
|
||||
$return = '<img src="/zoop.php?id=' . $user['id'];
|
||||
|
||||
if ($flip) {
|
||||
$return .= '&flip';
|
||||
}
|
||||
|
||||
$return .= '" border="0" alt="' . $user['zoop_name'] . '" title="' . $user['zoop_name'] . ' Level ' . $user['zoop_level'] . ' (Owned by ' . $user['username'] . ')">';
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
function itemImage($item) {
|
||||
return '<img src="/img/items/' . $item['renderimage'] . '.png" border="0" alt="' . $item['name'] . '" title="' . $item['name'] . '">';
|
||||
}
|
||||
|
||||
function itemInformation($item) {
|
||||
$return = '<b>' . $item['name'] . '</b><br>' . "\n" .
|
||||
$item['desc'];
|
||||
|
||||
if ($item['offense'] > 0) {
|
||||
$return .= '<br>Offense: <b>+' . $item['offense'] . '</b>';
|
||||
}
|
||||
|
||||
if ($item['defense'] > 0) {
|
||||
$return .= '<br>Defense: <b>+' . $item['defense'] . '</b>';
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
function itemEquip($user, $itemid) {
|
||||
global $dblink;
|
||||
zoopz_query('UPDATE `inventory` SET `equipped` = 1 WHERE `userid` = ' . $user['id'] . ' AND `itemid` = ' . mysqli_real_escape_string($dblink, $itemid) . ' LIMIT 1');
|
||||
}
|
||||
|
||||
function itemUnequip($user, $itemid) {
|
||||
global $dblink;
|
||||
zoopz_query('UPDATE `inventory` SET `equipped` = 0 WHERE `userid` = ' . $user['id'] . ' AND `itemid` = ' . mysqli_real_escape_string($dblink, $itemid) . ' LIMIT 1');
|
||||
}
|
||||
|
||||
function getUserItems($user, $onlyequipped = false, $type = '') {
|
||||
$query = 'SELECT * FROM `inventory` WHERE `userid` = ' . $user['id'];
|
||||
|
||||
if ($onlyequipped) {
|
||||
$query .= ' AND `equipped` = 1';
|
||||
}
|
||||
|
||||
$query .= ' ORDER BY `equipped` DESC';
|
||||
|
||||
$result = zoopz_query($query);
|
||||
$rows = $result->num_rows;
|
||||
if ($rows>0) {
|
||||
$return = array();
|
||||
|
||||
if ($type != '') {
|
||||
while ($line = $result->fetch_assoc()) {
|
||||
$item = getItem($line['itemid']);
|
||||
|
||||
if ($item['type'] == $type) {
|
||||
$return[] = $line;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
while ($line = $result->fetch_assoc()) {
|
||||
$return[] = $line;
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
function getItem($itemid) {
|
||||
global $dblink;
|
||||
$result = zoopz_query('SELECT * FROM `items` WHERE `id` = ' . mysqli_real_escape_string($dblink, $itemid) . ' LIMIT 1');
|
||||
$rows = $result->num_rows;
|
||||
if ($rows>0) {
|
||||
while ($line = $result->fetch_assoc()) {
|
||||
return $line;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function hasItem($user, $itemid) {
|
||||
global $dblink;
|
||||
$result = zoopz_query('SELECT * FROM `inventory` WHERE `itemid` = ' . mysqli_real_escape_string($dblink, $itemid) . ' AND `userid` = ' . $user['id'] . ' LIMIT 1');
|
||||
$itemsheld = $result->num_rows;
|
||||
|
||||
if ($itemsheld > 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function hasItemTypeEquipped($user, $itemtype) {
|
||||
$result = zoopz_query('SELECT * FROM `inventory` JOIN `items` ON `inventory`.`itemid` = `items`.`id` AND `items`.`type` = \'' . $itemtype . '\' WHERE `inventory`.`userid` = ' . $user['id'] . ' AND `inventory`.`equipped` = 1 LIMIT 1');
|
||||
$itemsheld = $result->num_rows;
|
||||
|
||||
if ($itemsheld > 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function giveItem($user, $itemid) {
|
||||
zoopz_query('INSERT INTO `inventory` ( `userid`, `itemid` ) VALUES ( \'' . $user['id'] . '\', \'' . $itemid . '\' )');
|
||||
}
|
||||
|
||||
function deleteItem($user, $itemid) {
|
||||
zoopz_query('DELETE FROM `inventory` WHERE `userid` = \'' . $user['id'] . '\' AND `itemid` = \'' . $itemid . '\' LIMIT 1');
|
||||
}
|
||||
|
||||
function insertEvent($user, $message, $category = 0) {
|
||||
global $dblink;
|
||||
/*
|
||||
1 - ?
|
||||
2 - Fight
|
||||
3 - Items
|
||||
*/
|
||||
zoopz_query('INSERT INTO `events` ( `userid`, `category`, `timestamp`, `message` ) VALUES ( \'' . $user['id'] . '\', \'' . $category . '\', \'' . time() . '\', \'' . mysqli_real_escape_string($dblink, $message) . '\' )');
|
||||
}
|
||||
|
||||
function rewardLevelUp() {
|
||||
global $user;
|
||||
|
||||
zoopz_query('UPDATE `accounts` SET `trainingpoints` = (`trainingpoints` + ' . ($user['zoop_level'] * 10) . ') WHERE `id` = ' . $user['id'] . '');
|
||||
}
|
||||
|
||||
function canFight($user) {
|
||||
$halfhp = (calculateMaxHP($user['zoop_level'], $user['zoop_stamina']) / 2);
|
||||
if ($user['zoop_hp'] >= $halfhp) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function calculateMaxHP($level, $stamina) {
|
||||
return ($level * 50 + calculateStaminaHPBonus($stamina, $level));
|
||||
}
|
||||
|
||||
function calculateStaminaHPBonus($stamina, $level) {
|
||||
return floor($stamina * ($level * 0.25));
|
||||
}
|
||||
|
||||
function battleEndMessage($won, $money, $potatoes, $xp) {
|
||||
$return = 'You have ';
|
||||
$return .= ($won) ? 'gained' : 'lost';
|
||||
$return .= ' <b>' . $money . '</b> Quetzals';
|
||||
|
||||
if ($potatoes > 0) {
|
||||
$return .= ', <b>' . $potatoes . '</b> potatoes';
|
||||
}
|
||||
|
||||
if ($xp > 0) {
|
||||
$return .= ', <b>' . $xp . '</b> XP';
|
||||
}
|
||||
|
||||
$return .= ' from the fight.';
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
function battleEndEvent($won, $username, $money, $potatoes, $xp) {
|
||||
$return = $username . ' attacked your zoop and ';
|
||||
$return .= ($won) ? 'lost!' : 'won!';
|
||||
|
||||
$return .= ' You ';
|
||||
$return .= ($won) ? 'gained' : 'lost';
|
||||
$return .= ' ' . $money . ' Quetzals';
|
||||
|
||||
if ($potatoes > 0) {
|
||||
$return .= ' and ' . $potatoes . ' potatoes';
|
||||
}
|
||||
|
||||
$return .= ' from the fight.';
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
function potatoSackCapacity($user) {
|
||||
$useritems = getUserItems($user, true, 'potatosack');
|
||||
|
||||
foreach ($useritems as $useritem) {
|
||||
$item = getItem($useritem['itemid']);
|
||||
|
||||
return $item['special'];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
function handleBattlePotatoes($winner, $loser) {
|
||||
$potatoesgained = 0;
|
||||
|
||||
if ($loser['potatoes'] > 0) {
|
||||
$potatosackcapacity = potatoSackCapacity($winner);
|
||||
|
||||
if ($potatosackcapacity > 0) {
|
||||
$potatoesgained = min($potatosackcapacity, $loser['potatoes']);
|
||||
}
|
||||
}
|
||||
|
||||
return $potatoesgained;
|
||||
}
|
||||
|
||||
function handleBattleItems($user, $attacker = true) {
|
||||
$useritems = getUserItems($user, true);
|
||||
$attack_buff = 0;
|
||||
$defend_buff = 0;
|
||||
|
||||
foreach ($useritems as $useritem) {
|
||||
$item = getItem($useritem['itemid']);
|
||||
|
||||
if ($item['type'] == 'offense') {
|
||||
if ($attacker) {
|
||||
$attack_buff += rand(floor($item['offense'] / 3), $item['offense']);
|
||||
}
|
||||
}
|
||||
|
||||
if ($item['type'] == 'defense') {
|
||||
if (!$attacker) {
|
||||
$defend_buff += rand(floor($item['defense'] / 3), $item['defense']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return array('atk' => $attack_buff, 'def' => $defend_buff);
|
||||
}
|
||||
|
||||
function handleBreakableItems($user) {
|
||||
$useritems = getUserItems($user, true);
|
||||
|
||||
foreach ($useritems as $useritem) {
|
||||
$item = getItem($useritem['itemid']);
|
||||
|
||||
if ($item['type'] == 'offense' || $item['type'] == 'defense') {
|
||||
$rand = rand(1, 333);
|
||||
if ($rand == 111) {
|
||||
insertEvent($user, 'Your ' . $item['name'] . ' fell apart! It wasn\'t the best of quality; it was most likely made by a zoop.', 3);
|
||||
deleteItem($user, $item['id']);
|
||||
}
|
||||
} elseif ($item['type'] == 'potatosack') {
|
||||
$rand = rand(1, 200);
|
||||
if ($rand == 9) {
|
||||
insertEvent($user, 'Your ' . $item['name'] . ' fell apart! You should probably go buy a new one in the market.', 3);
|
||||
deleteItem($user, $item['id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function checkCaptcha() {
|
||||
// CAPTCHA is currently disabled.
|
||||
return true;
|
||||
}
|
||||
|
||||
function resetCaptchaTimer() {
|
||||
global $user;
|
||||
|
||||
zoopz_query('UPDATE `accounts` SET `nextcaptcha` = ' . (time() + 1200) . ' WHERE `id` = ' . $user['id'] . ' LIMIT 1');
|
||||
}
|
||||
|
||||
function do_display() {
|
||||
global $smarty, $page_main, $page_infobar, $page_menu, $page_notification_bad, $page_notification_good, $update_halfhour_nextrun, $user_isloggedin, $user;
|
||||
|
||||
$page_menu .= '<p class="sideBarTitle">Menu</p>
|
||||
<ul>';
|
||||
if ($user_isloggedin) {
|
||||
$numevents = zoopz_query('SELECT *FROM `events` WHERE `userid` = ' . $user['id'] . ' AND `read` = 0');
|
||||
$numevents = $numevents->num_rows;
|
||||
|
||||
$page_menu .= '<li><a href="?act=zoop">Your Zoop</a></li>
|
||||
<li><a href="?act=events">Events';
|
||||
if ($numevents > 0) {
|
||||
$page_menu .= ' <b>(' . $numevents . ')</b>';
|
||||
}
|
||||
$page_menu .= '</a></li>
|
||||
<li><a href="?act=inventory">Inventory</a></li>
|
||||
<li><a href="?act=buildings">Buildings</a></li>';
|
||||
} else {
|
||||
$page_menu .= '<li><a href="?act=login">Log in</a></li>
|
||||
<li><a href="?act=signup">Sign up</a></li>';
|
||||
}
|
||||
$page_menu .= '</ul>';
|
||||
$page_menu .= '<p class="sideBarTitle">Game</p>
|
||||
<ul>
|
||||
<li><a href="?act=lore">Lore</a></li>
|
||||
<li><a href="?act=howtoplay">How to Play</a></li>
|
||||
<li><a href="?act=top">Top Zoopz</a></li>
|
||||
<li><a href="?act=stats">Zoopz Stats</a></li>
|
||||
<li><a href="?act=art">Artwork</a></li>
|
||||
<!--<li><a href="http://www.printfection.com/zoopz" target="_blank">Merchandise</a></li>-->
|
||||
</ul>';
|
||||
if ($user_isloggedin) {
|
||||
$page_menu .= '<p class="sideBarTitle">Places</p>
|
||||
<ul>';
|
||||
if ($user['potatomine_built']) {
|
||||
$page_menu .= '<li><a href="?act=potatomine">Potato Mine</a></li>';
|
||||
}
|
||||
$page_menu .= '<li><a href="?act=arena">Arena</a></li>
|
||||
<li><a href="?act=gym">Gym</a></li>
|
||||
<li><a href="?act=market">Market</a></li>
|
||||
<li><a href="?act=hireworkers">Hire Workers</a></li>
|
||||
<li><a href="?act=hospital">Hospital</a></li>
|
||||
<li><a href="?act=bank">Bank</a></li>
|
||||
</ul>
|
||||
<p class="sideBarTitle">Account</p>
|
||||
<ul>
|
||||
<!--<li><a href="?act=account">Options</a></li>-->
|
||||
<li><a href="?act=rewards">Rewards</a></li>
|
||||
<!-- <li><a href="?act=upgrade">Upgrade</a></li> -->
|
||||
<li><a href="?act=logout">Log out</a></li>
|
||||
</ul>';
|
||||
}
|
||||
$page_menu .= '<p class="sideBarTitle">Updates</p>
|
||||
<ul>
|
||||
<li>Next turn:<br>' . TimeAgo($update_halfhour_nextrun,'until') . '</li>
|
||||
</ul>';
|
||||
|
||||
/* Calculate at the end to provide up to date stats when the page is loaded, instead of requiring the user to get a new page */
|
||||
if ($user_isloggedin) {
|
||||
$hp_percentage = round($user['zoop_hp'] / $user['zoop_maxhp'], 2) * 100;
|
||||
$bars_filled = floor($hp_percentage / 10);
|
||||
$bars_notfilled = 10 - $bars_filled;
|
||||
|
||||
$page_infobar .= '<b>Zoop: ' . $user['zoop_name'] .
|
||||
' | HP: ';
|
||||
|
||||
if ($bars_filled > 0) {
|
||||
$page_infobar .= '<span style="background-color: green;">';
|
||||
for ($i = 0; $i < $bars_filled; $i++) {
|
||||
$page_infobar .= ' ';
|
||||
}
|
||||
$page_infobar .= '</span>';
|
||||
}
|
||||
|
||||
if ($bars_notfilled > 0) {
|
||||
$page_infobar .= '<span style="background-color: red;">';
|
||||
for ($i = 0; $i < $bars_notfilled; $i++) {
|
||||
$page_infobar .= ' ';
|
||||
}
|
||||
$page_infobar .= '</span>';
|
||||
}
|
||||
|
||||
$page_infobar .= ' ' . $user['zoop_hp'] . '/' . $user['zoop_maxhp'] . ' [' . $hp_percentage . '%]' .
|
||||
' | Level: ' . $user['zoop_level'] .
|
||||
' | XP: ' . $user['zoop_xp'] . '/' . $user['zoop_xp_nextlevel'] .
|
||||
' | Attack Turns: ' . $user['attackturns'] .
|
||||
' | Quetzals: ' . $user['money'].'</b>';
|
||||
} else {
|
||||
$page_infobar .= '<a href="?act=login">Log in or sign up to view your Zoop\'s stats!</a>';
|
||||
}
|
||||
$page_notification = '';
|
||||
if ($page_notification_bad != array()) {
|
||||
$page_notification .= '<div style="background-color: #FF3333; layer-background-color: #FF3333; text-align: center;">';
|
||||
foreach ($page_notification_bad as $notification) {
|
||||
$page_notification .= '<h3>'.$notification.'</h3>';
|
||||
}
|
||||
$page_notification .= '</div>';
|
||||
}
|
||||
if ($page_notification_good != array()) {
|
||||
$page_notification .= '<div style="background-color: #33FF00; layer-background-color: #33FF00; text-align: center;">';
|
||||
foreach ($page_notification_good as $notification) {
|
||||
$page_notification .= '<h3>' . $notification . '</h3>';
|
||||
}
|
||||
$page_notification .= '</div>';
|
||||
}
|
||||
|
||||
$smarty->assign('main', $page_main);
|
||||
$smarty->assign('infobar', $page_infobar);
|
||||
$smarty->assign('menu', $page_menu);
|
||||
$smarty->assign('notification', $page_notification);
|
||||
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
die();
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
function flipImage($image, $vertical, $horizontal) {
|
||||
$w = imagesx($image);
|
||||
$h = imagesy($image);
|
||||
|
||||
if (!$vertical && !$horizontal) return $image;
|
||||
|
||||
$flipped = imagecreatetruecolor($w, $h);
|
||||
imageAlphaBlending($flipped, false);
|
||||
imageSaveAlpha($flipped, true);
|
||||
|
||||
if ($vertical) {
|
||||
for ($y=0; $y<$h; $y++) {
|
||||
imagecopy($flipped, $image, 0, $y, 0, $h - $y - 1, $w, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if ($horizontal) {
|
||||
if ($vertical) {
|
||||
$image = $flipped;
|
||||
$flipped = imagecreatetruecolor($w, $h);
|
||||
}
|
||||
|
||||
for ($x=0; $x<$w; $x++) {
|
||||
imagecopy($flipped, $image, $x, 0, $w - $x - 1, 0, 1, $h);
|
||||
}
|
||||
}
|
||||
|
||||
return $flipped;
|
||||
}
|
|
@ -0,0 +1,131 @@
|
|||
/**********************************
|
||||
* TITLE: Gila Print Stylesheet *
|
||||
* URI : gila/gila-print.css *
|
||||
* MODIF: 2003-Apr-30 19:09 +0800 *
|
||||
**********************************/
|
||||
|
||||
|
||||
/* ##### Common Styles ##### */
|
||||
|
||||
body {
|
||||
color: black;
|
||||
background-color: white;
|
||||
font-family: "times new roman", times, roman, serif;
|
||||
font-size: 12pt;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
acronym, .titleTip {
|
||||
font-style: italic;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
acronym:after, .titleTip:after { /* Prints titles after the acronyms/titletips. Doesn't work in MSIE */
|
||||
content: "(" attr(title) ")";
|
||||
font-size: 90%;
|
||||
font-style: normal;
|
||||
padding-left: 1ex;
|
||||
}
|
||||
|
||||
.doNotPrint {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
|
||||
/* ##### Header ##### */
|
||||
|
||||
#header {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border-bottom: 1px solid black;
|
||||
}
|
||||
|
||||
.headerTitle {
|
||||
font-size: 200%;
|
||||
margin: 0;
|
||||
padding: 0 0 0.5ex 0;
|
||||
}
|
||||
|
||||
.headerTitle a {
|
||||
color: black;
|
||||
background-color: transparent;
|
||||
font-family: "trebuchet ms", verdana, helvetica, arial, sans-serif;
|
||||
font-weight: normal;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.subHeader {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
/* ##### Side Bars ##### */
|
||||
|
||||
#side-bar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
/* ##### Main Copy ##### */
|
||||
|
||||
#main-copy {
|
||||
text-align: justify;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#main-copy h1 {
|
||||
font-family: "trebuchet ms", verdana, helvetica, arial, sans-serif;
|
||||
font-size: 120%;
|
||||
margin: 2ex 0 1ex 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#main-copy a {
|
||||
color: black;
|
||||
background-color: transparent;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#main-copy a:after { /* Prints the links' URIs after the links' texts. Doesn't work in MSIE */
|
||||
content: "<" attr(href) ">";
|
||||
font-size: 90%;
|
||||
padding-left: 1ex;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0 0 2ex 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
dl {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
dt {
|
||||
font-weight: bold;
|
||||
margin: 0;
|
||||
padding: 0 0 1ex 0;
|
||||
}
|
||||
|
||||
dd {
|
||||
margin: 0 0 2ex 1.5em;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
|
||||
/* ##### Footer ##### */
|
||||
|
||||
#footer {
|
||||
margin: 2em 0 0 0;
|
||||
padding: 1ex 0 0 0;
|
||||
border-top: 1px solid black;
|
||||
}
|
||||
|
||||
#footer a {
|
||||
color: black;
|
||||
background-color: transparent;
|
||||
text-decoration: none;
|
||||
}
|
|
@ -0,0 +1,381 @@
|
|||
/**********************************
|
||||
* TITLE: Gila Screen Stylesheet *
|
||||
* URI : gila/gila-screen.css *
|
||||
* MODIF: 2003-Apr-30 19:09 +0800 *
|
||||
**********************************/
|
||||
|
||||
|
||||
/* ##### Common Styles ##### */
|
||||
|
||||
body {
|
||||
color: black;
|
||||
font-family: verdana, helvetica, arial, sans-serif;
|
||||
font-size: 73%; /* Enables font size scaling in MSIE */
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
html > body {
|
||||
font-size: 9pt;
|
||||
}
|
||||
|
||||
acronym, .titleTip {
|
||||
border-bottom: 1px dotted rgb(168,140,83);
|
||||
cursor: help;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.doNotDisplay {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
|
||||
.smallCaps {
|
||||
font-size: 117%;
|
||||
font-variant: small-caps;
|
||||
}
|
||||
|
||||
|
||||
/* ##### Header ##### */
|
||||
|
||||
#header {
|
||||
color: inherit;
|
||||
background-color: rgb(184,38,25);
|
||||
}
|
||||
|
||||
.headerTitle {
|
||||
margin: 0;
|
||||
padding: 0.25em 4mm 0.25em 4mm;
|
||||
height: 71px;
|
||||
}
|
||||
|
||||
.headerTitle a {
|
||||
color: black;
|
||||
background-color: transparent;
|
||||
text-decoration: none;
|
||||
font-size: 110%; /* For MSIE */
|
||||
font-weight: bold;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.headerTitle > a {
|
||||
font-size: 138%; /* For fully standards-compliant user agents */
|
||||
}
|
||||
|
||||
.headerTitle span {
|
||||
color: white;
|
||||
background-color: transparent;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.subHeader {
|
||||
color: white;
|
||||
background-color: black;
|
||||
font-size: 109%;
|
||||
text-align: center;
|
||||
margin: 0;
|
||||
padding: 0.5ex 0;
|
||||
}
|
||||
|
||||
.subHeader a {
|
||||
color: white;
|
||||
background-color: black;
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
margin: 0;
|
||||
padding: 0 1ex;
|
||||
}
|
||||
|
||||
.subHeader a:hover {
|
||||
color: black;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
|
||||
/* ##### Left Side Bar ##### */
|
||||
|
||||
.leftSideBar {
|
||||
width: 12.5em;
|
||||
float: left;
|
||||
clear: left;
|
||||
background-color: rgb(243,242,235);
|
||||
border-right: 1px solid rgb(216,210,195);
|
||||
border-bottom: 1px solid rgb(216,210,195);
|
||||
}
|
||||
|
||||
.leftSideBar .sideBarTitle {
|
||||
color: rgb(64,64,64);
|
||||
background-color: rgb(230,223,207);
|
||||
font-weight: bold;
|
||||
margin: 0;
|
||||
padding: 0.8ex 1ex;
|
||||
}
|
||||
|
||||
.leftSideBar ul {
|
||||
list-style-type: none;
|
||||
list-style-position: outside;
|
||||
margin: 0 0 1em 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.leftSideBar li {
|
||||
margin: 1ex;
|
||||
padding: 0 0 1.25ex 0.75ex;
|
||||
}
|
||||
|
||||
.leftSideBar a {
|
||||
color: rgb(166,140,83);
|
||||
background-color: transparent;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.leftSideBar a:hover {
|
||||
color: rgb(64,64,64);
|
||||
background-color: transparent;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.leftSideBar .sideBarText {
|
||||
color: rgb(166,140,83);
|
||||
background-color: transparent;
|
||||
line-height: 1.25em;
|
||||
margin: 1ex 0.25ex 1.5em 0.75ex;
|
||||
padding: 0;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.leftSideBar .sideBarText a {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.leftSideBar .sideBarText a:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.leftSideBar .thisPage {
|
||||
color: rgb(64,64,64);
|
||||
background-color: transparent;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
||||
/* ##### Right Side Bar ##### */
|
||||
|
||||
.rightSideBar {
|
||||
width: 13em;
|
||||
margin: 2ex 0.75ex 0 0;
|
||||
padding: 0;
|
||||
float: right;
|
||||
clear: right;
|
||||
border: 1px solid rgb(216,210,195);
|
||||
}
|
||||
|
||||
[class~="rightSideBar"] {
|
||||
margin-right: 1.5ex;
|
||||
}
|
||||
|
||||
.rightSideBar .sideBarTitle {
|
||||
color: black;
|
||||
background-color: rgb(230,223,207);
|
||||
font-weight: bold;
|
||||
margin: 1.25ex 1ex;
|
||||
padding: 0.9ex 1ex;
|
||||
}
|
||||
|
||||
.rightSideBar a {
|
||||
color: rgb(166,140,83);
|
||||
background-color: transparent;
|
||||
text-decoration: underline;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.rightSideBar a:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.rightSideBar .sideBarText {
|
||||
line-height: 1.5em;
|
||||
margin: 0;
|
||||
padding: 0 2ex 1em 2ex;
|
||||
}
|
||||
|
||||
.rightSideBar .more {
|
||||
text-decoration: none;
|
||||
text-align: right;
|
||||
margin: 0;
|
||||
padding: 0 2ex 1em 2ex;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.rightSideBar .more:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
|
||||
/* ##### Main Copy ##### */
|
||||
|
||||
#main-copy {
|
||||
color: black;
|
||||
background-color: white;
|
||||
text-align: justify;
|
||||
line-height: 1.5em;
|
||||
margin: 0 0 0 12.5em;
|
||||
padding: 0.5ex 15em 1em 1em;
|
||||
/*border-left: 1px solid rgb(216,210,195);*/
|
||||
/*min-height: 700px;*/
|
||||
}
|
||||
|
||||
#main-copy h1 {
|
||||
color: rgb(166,140,83);
|
||||
background-color: transparent;
|
||||
font-family: arial, verdana, helvetica, sans-serif;
|
||||
font-size: 175%;
|
||||
font-weight: bold;
|
||||
font-style: italic;
|
||||
text-align: left;
|
||||
margin: 1em 0 0 0;
|
||||
padding: 1em 0 0 0;
|
||||
border-top: 1px solid rgb(216,210,195);
|
||||
}
|
||||
|
||||
#main-copy a {
|
||||
color: rgb(168,140,83);
|
||||
background-color: transparent;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#main-copy a:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 1em 0 1.5em 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
dt {
|
||||
font-weight: bold;
|
||||
margin: 0;
|
||||
padding: 0 0 0.5ex 0;
|
||||
}
|
||||
|
||||
dd {
|
||||
margin: 0 0 1.5em 1.5em;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
|
||||
/* ##### Footer ##### */
|
||||
|
||||
#footer {
|
||||
color: black;
|
||||
background-color: rgb(230,223,207);
|
||||
font-size: 92%;
|
||||
text-align: center;
|
||||
line-height: 1.25em;
|
||||
margin: 0;
|
||||
padding: 1em 4mm 1em 4mm;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
#footer div {
|
||||
margin: 0;
|
||||
padding: 0 0 1ex 0;
|
||||
}
|
||||
|
||||
#footer a {
|
||||
color: black;
|
||||
background-color: transparent;
|
||||
text-decoration: underline;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#footer a:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* Custom */
|
||||
|
||||
fieldset {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
legend {
|
||||
padding: 0 2px;
|
||||
font-weight: bold;
|
||||
}
|
||||
label {
|
||||
display: inline-block;
|
||||
line-height: 1.8;
|
||||
vertical-align: top;
|
||||
}
|
||||
fieldset ol {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
fieldset li {
|
||||
list-style: none;
|
||||
padding: 5px;
|
||||
margin: 0;
|
||||
}
|
||||
fieldset fieldset {
|
||||
border: none;
|
||||
margin: 3px 0 0;
|
||||
}
|
||||
fieldset fieldset legend {
|
||||
padding: 0 0 5px;
|
||||
font-weight: normal;
|
||||
}
|
||||
fieldset fieldset label {
|
||||
display: block;
|
||||
width: auto;
|
||||
}
|
||||
em {
|
||||
font-weight: bold;
|
||||
font-style: normal;
|
||||
color: #f00;
|
||||
}
|
||||
label {
|
||||
width: 120px; /* Width of labels */
|
||||
}
|
||||
fieldset fieldset label {
|
||||
margin-left: 123px; /* Width plus 3 (html space) */
|
||||
}
|
||||
|
||||
table.prettytable {
|
||||
font-family: Verdana;
|
||||
font-weight: normal;
|
||||
color: #404040;
|
||||
background-color: #fafafa;
|
||||
border: 1px #000000 solid;
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0px;
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
|
||||
table.prettytable th {
|
||||
border: 1px solid #000000;
|
||||
border-bottom: 2px solid #000000;
|
||||
background-color: #B82623;
|
||||
text-align: center;
|
||||
font-family: Verdana;
|
||||
font-weight: bold;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
table.prettytable td {
|
||||
border-bottom: 1px solid #000000;
|
||||
border-left: 1px dotted #000000;
|
||||
border-right: 1px dotted #000000;
|
||||
font-family: Verdana, sans-serif, Arial;
|
||||
font-weight: normal;
|
||||
color: #404040;
|
||||
background-color: #FFFFFF;
|
||||
text-align: left;
|
||||
padding-left: 3px;
|
||||
}
|
||||
|
||||
.oddrow td {
|
||||
background-color: #FBEFEF !important;
|
||||
}
|
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 62 KiB |
After Width: | Height: | Size: 60 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 866 B |
After Width: | Height: | Size: 871 B |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 8.5 KiB |
After Width: | Height: | Size: 8.8 KiB |
After Width: | Height: | Size: 8.7 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 8.8 KiB |
After Width: | Height: | Size: 8.9 KiB |
After Width: | Height: | Size: 8.5 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 8.9 KiB |
After Width: | Height: | Size: 9.3 KiB |
After Width: | Height: | Size: 9.2 KiB |
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
define('ZOOPZ_LOG', '');
|
||||
define('ZOOPZ_HOST', '');
|
||||
define('ZOOPZ_USERNAME', '');
|
||||
define('ZOOPZ_PASSWORD', '');
|
||||
define('ZOOPZ_DATABASE', '');
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
|
||||
<url>
|
||||
<loc>http://zoopz.org</loc>
|
||||
<changefreq>hourly</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://zoopz.org/?act=lore</loc>
|
||||
<changefreq>hourly</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://zoopz.org/?act=howtoplay</loc>
|
||||
<changefreq>hourly</changefreq>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://zoopz.org/?act=artwork</loc>
|
||||
<changefreq>hourly</changefreq>
|
||||
</url>
|
||||
</urlset>
|
|
@ -0,0 +1,85 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
|
||||
<html height="100%" style="height: 100%">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="/gila-screen.css" media="screen" title="Gila (screen)">
|
||||
<link rel="stylesheet" type="text/css" href="/gila-print.css" media="print">
|
||||
|
||||
<title>Zoopz</title>
|
||||
|
||||
<style type="text/css">
|
||||
body {
|
||||
font-size: 11pt !important;
|
||||
}
|
||||
.prettytable th {
|
||||
font-size: 2em;
|
||||
padding: 0.25em;
|
||||
}
|
||||
.prettytable td {
|
||||
padding: 0.25em;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body height="100%" style="height: 100%">
|
||||
<!-- For non-visual user agents: -->
|
||||
<div id="top"><a href="#main-copy" class="doNotDisplay doNotPrint">Skip to main content.</a></div>
|
||||
|
||||
<table border="0" width="100%" height="100%" cellspacing="0" cellpadding="0">
|
||||
<tr><td valign="top">
|
||||
<!-- ##### Header ##### -->
|
||||
|
||||
<div id="header">
|
||||
<h1 class="headerTitle" style="font-size: 3em;">
|
||||
<a href="?" title="Index">Zoopz</a>
|
||||
</h1>
|
||||
|
||||
<div class="subHeader">
|
||||
<span class="doNotDisplay">Information: </span>{$infobar}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="side-bar">
|
||||
|
||||
<!-- ##### Left Sidebar ##### -->
|
||||
|
||||
<div class="leftSideBar">
|
||||
{$menu}
|
||||
</div>
|
||||
|
||||
<!-- ##### Right Sidebar ##### -->
|
||||
|
||||
<!--
|
||||
<div class="rightSideBar">
|
||||
<br>
|
||||
<div class="sideBarText">
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
|
||||
<!-- ##### Main Copy ##### -->
|
||||
|
||||
<div id="main-copy">
|
||||
{$notification}{$main}
|
||||
</div>
|
||||
</td></tr>
|
||||
<tr><td valign="bottom">
|
||||
<!-- ##### Footer ##### -->
|
||||
|
||||
<div id="footer">
|
||||
<div class="doNotPrint">
|
||||
<span class="nocopyright">
|
||||
Developed by <a href="https://rocketnine.space" target="_blank">Trevor Slocum</a> Design by <a href="http://www.openwebdesign.org" target="_blank">Open Web Design</a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
// autoload.php @generated by Composer
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit96a5d7b7309f95647e6b754221160087::getLoader();
|
|
@ -0,0 +1,572 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
/**
|
||||
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
|
||||
*
|
||||
* $loader = new \Composer\Autoload\ClassLoader();
|
||||
*
|
||||
* // register classes with namespaces
|
||||
* $loader->add('Symfony\Component', __DIR__.'/component');
|
||||
* $loader->add('Symfony', __DIR__.'/framework');
|
||||
*
|
||||
* // activate the autoloader
|
||||
* $loader->register();
|
||||
*
|
||||
* // to enable searching the include path (eg. for PEAR packages)
|
||||
* $loader->setUseIncludePath(true);
|
||||
*
|
||||
* In this example, if you try to use a class in the Symfony\Component
|
||||
* namespace or one of its children (Symfony\Component\Console for instance),
|
||||
* the autoloader will first look for the class under the component/
|
||||
* directory, and it will then fallback to the framework/ directory if not
|
||||
* found before giving up.
|
||||
*
|
||||
* This class is loosely based on the Symfony UniversalClassLoader.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
* @see https://www.php-fig.org/psr/psr-0/
|
||||
* @see https://www.php-fig.org/psr/psr-4/
|
||||
*/
|
||||
class ClassLoader
|
||||
{
|
||||
/** @var ?string */
|
||||
private $vendorDir;
|
||||
|
||||
// PSR-4
|
||||
/**
|
||||
* @var array[]
|
||||
* @psalm-var array<string, array<string, int>>
|
||||
*/
|
||||
private $prefixLengthsPsr4 = array();
|
||||
/**
|
||||
* @var array[]
|
||||
* @psalm-var array<string, array<int, string>>
|
||||
*/
|
||||
private $prefixDirsPsr4 = array();
|
||||
/**
|
||||
* @var array[]
|
||||
* @psalm-var array<string, string>
|
||||
*/
|
||||
private $fallbackDirsPsr4 = array();
|
||||
|
||||
// PSR-0
|
||||
/**
|
||||
* @var array[]
|
||||
* @psalm-var array<string, array<string, string[]>>
|
||||
*/
|
||||
private $prefixesPsr0 = array();
|
||||
/**
|
||||
* @var array[]
|
||||
* @psalm-var array<string, string>
|
||||
*/
|
||||
private $fallbackDirsPsr0 = array();
|
||||
|
||||
/** @var bool */
|
||||
private $useIncludePath = false;
|
||||
|
||||
/**
|
||||
* @var string[]
|
||||
* @psalm-var array<string, string>
|
||||
*/
|
||||
private $classMap = array();
|
||||
|
||||
/** @var bool */
|
||||
private $classMapAuthoritative = false;
|
||||
|
||||
/**
|
||||
* @var bool[]
|
||||
* @psalm-var array<string, bool>
|
||||
*/
|
||||
private $missingClasses = array();
|
||||
|
||||
/** @var ?string */
|
||||
private $apcuPrefix;
|
||||
|
||||
/**
|
||||
* @var self[]
|
||||
*/
|
||||
private static $registeredLoaders = array();
|
||||
|
||||
/**
|
||||
* @param ?string $vendorDir
|
||||
*/
|
||||
public function __construct($vendorDir = null)
|
||||
{
|
||||
$this->vendorDir = $vendorDir;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getPrefixes()
|
||||
{
|
||||
if (!empty($this->prefixesPsr0)) {
|
||||
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array[]
|
||||
* @psalm-return array<string, array<int, string>>
|
||||
*/
|
||||
public function getPrefixesPsr4()
|
||||
{
|
||||
return $this->prefixDirsPsr4;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array[]
|
||||
* @psalm-return array<string, string>
|
||||
*/
|
||||
public function getFallbackDirs()
|
||||
{
|
||||
return $this->fallbackDirsPsr0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array[]
|
||||
* @psalm-return array<string, string>
|
||||
*/
|
||||
public function getFallbackDirsPsr4()
|
||||
{
|
||||
return $this->fallbackDirsPsr4;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[] Array of classname => path
|
||||
* @psalm-var array<string, string>
|
||||
*/
|
||||
public function getClassMap()
|
||||
{
|
||||
return $this->classMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string[] $classMap Class to filename map
|
||||
* @psalm-param array<string, string> $classMap
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addClassMap(array $classMap)
|
||||
{
|
||||
if ($this->classMap) {
|
||||
$this->classMap = array_merge($this->classMap, $classMap);
|
||||
} else {
|
||||
$this->classMap = $classMap;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-0 directories for a given prefix, either
|
||||
* appending or prepending to the ones previously set for this prefix.
|
||||
*
|
||||
* @param string $prefix The prefix
|
||||
* @param string[]|string $paths The PSR-0 root directories
|
||||
* @param bool $prepend Whether to prepend the directories
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function add($prefix, $paths, $prepend = false)
|
||||
{
|
||||
if (!$prefix) {
|
||||
if ($prepend) {
|
||||
$this->fallbackDirsPsr0 = array_merge(
|
||||
(array) $paths,
|
||||
$this->fallbackDirsPsr0
|
||||
);
|
||||
} else {
|
||||
$this->fallbackDirsPsr0 = array_merge(
|
||||
$this->fallbackDirsPsr0,
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$first = $prefix[0];
|
||||
if (!isset($this->prefixesPsr0[$first][$prefix])) {
|
||||
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
|
||||
|
||||
return;
|
||||
}
|
||||
if ($prepend) {
|
||||
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||
(array) $paths,
|
||||
$this->prefixesPsr0[$first][$prefix]
|
||||
);
|
||||
} else {
|
||||
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||
$this->prefixesPsr0[$first][$prefix],
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-4 directories for a given namespace, either
|
||||
* appending or prepending to the ones previously set for this namespace.
|
||||
*
|
||||
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||
* @param string[]|string $paths The PSR-4 base directories
|
||||
* @param bool $prepend Whether to prepend the directories
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addPsr4($prefix, $paths, $prepend = false)
|
||||
{
|
||||
if (!$prefix) {
|
||||
// Register directories for the root namespace.
|
||||
if ($prepend) {
|
||||
$this->fallbackDirsPsr4 = array_merge(
|
||||
(array) $paths,
|
||||
$this->fallbackDirsPsr4
|
||||
);
|
||||
} else {
|
||||
$this->fallbackDirsPsr4 = array_merge(
|
||||
$this->fallbackDirsPsr4,
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
|
||||
// Register directories for a new namespace.
|
||||
$length = strlen($prefix);
|
||||
if ('\\' !== $prefix[$length - 1]) {
|
||||
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||
}
|
||||
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
||||
} elseif ($prepend) {
|
||||
// Prepend directories for an already registered namespace.
|
||||
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||
(array) $paths,
|
||||
$this->prefixDirsPsr4[$prefix]
|
||||
);
|
||||
} else {
|
||||
// Append directories for an already registered namespace.
|
||||
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||
$this->prefixDirsPsr4[$prefix],
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-0 directories for a given prefix,
|
||||
* replacing any others previously set for this prefix.
|
||||
*
|
||||
* @param string $prefix The prefix
|
||||
* @param string[]|string $paths The PSR-0 base directories
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function set($prefix, $paths)
|
||||
{
|
||||
if (!$prefix) {
|
||||
$this->fallbackDirsPsr0 = (array) $paths;
|
||||
} else {
|
||||
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-4 directories for a given namespace,
|
||||
* replacing any others previously set for this namespace.
|
||||
*
|
||||
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||
* @param string[]|string $paths The PSR-4 base directories
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setPsr4($prefix, $paths)
|
||||
{
|
||||
if (!$prefix) {
|
||||
$this->fallbackDirsPsr4 = (array) $paths;
|
||||
} else {
|
||||
$length = strlen($prefix);
|
||||
if ('\\' !== $prefix[$length - 1]) {
|
||||
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||
}
|
||||
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns on searching the include path for class files.
|
||||
*
|
||||
* @param bool $useIncludePath
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setUseIncludePath($useIncludePath)
|
||||
{
|
||||
$this->useIncludePath = $useIncludePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can be used to check if the autoloader uses the include path to check
|
||||
* for classes.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getUseIncludePath()
|
||||
{
|
||||
return $this->useIncludePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns off searching the prefix and fallback directories for classes
|
||||
* that have not been registered with the class map.
|
||||
*
|
||||
* @param bool $classMapAuthoritative
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setClassMapAuthoritative($classMapAuthoritative)
|
||||
{
|
||||
$this->classMapAuthoritative = $classMapAuthoritative;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should class lookup fail if not found in the current class map?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isClassMapAuthoritative()
|
||||
{
|
||||
return $this->classMapAuthoritative;
|
||||
}
|
||||
|
||||
/**
|
||||
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
|
||||
*
|
||||
* @param string|null $apcuPrefix
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setApcuPrefix($apcuPrefix)
|
||||
{
|
||||
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The APCu prefix in use, or null if APCu caching is not enabled.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getApcuPrefix()
|
||||
{
|
||||
return $this->apcuPrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers this instance as an autoloader.
|
||||
*
|
||||
* @param bool $prepend Whether to prepend the autoloader or not
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register($prepend = false)
|
||||
{
|
||||
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
||||
|
||||
if (null === $this->vendorDir) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($prepend) {
|
||||
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
|
||||
} else {
|
||||
unset(self::$registeredLoaders[$this->vendorDir]);
|
||||
self::$registeredLoaders[$this->vendorDir] = $this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters this instance as an autoloader.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function unregister()
|
||||
{
|
||||
spl_autoload_unregister(array($this, 'loadClass'));
|
||||
|
||||
if (null !== $this->vendorDir) {
|
||||
unset(self::$registeredLoaders[$this->vendorDir]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the given class or interface.
|
||||
*
|
||||
* @param string $class The name of the class
|
||||
* @return true|null True if loaded, null otherwise
|
||||
*/
|
||||
public function loadClass($class)
|
||||
{
|
||||
if ($file = $this->findFile($class)) {
|
||||
includeFile($file);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the path to the file where the class is defined.
|
||||
*
|
||||
* @param string $class The name of the class
|
||||
*
|
||||
* @return string|false The path if found, false otherwise
|
||||
*/
|
||||
public function findFile($class)
|
||||
{
|
||||
// class map lookup
|
||||
if (isset($this->classMap[$class])) {
|
||||
return $this->classMap[$class];
|
||||
}
|
||||
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
|
||||
return false;
|
||||
}
|
||||
if (null !== $this->apcuPrefix) {
|
||||
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
|
||||
if ($hit) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
$file = $this->findFileWithExtension($class, '.php');
|
||||
|
||||
// Search for Hack files if we are running on HHVM
|
||||
if (false === $file && defined('HHVM_VERSION')) {
|
||||
$file = $this->findFileWithExtension($class, '.hh');
|
||||
}
|
||||
|
||||
if (null !== $this->apcuPrefix) {
|
||||
apcu_add($this->apcuPrefix.$class, $file);
|
||||
}
|
||||
|
||||
if (false === $file) {
|
||||
// Remember that this class does not exist.
|
||||
$this->missingClasses[$class] = true;
|
||||
}
|
||||
|
||||
return $file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the currently registered loaders indexed by their corresponding vendor directories.
|
||||
*
|
||||
* @return self[]
|
||||
*/
|
||||
public static function getRegisteredLoaders()
|
||||
{
|
||||
return self::$registeredLoaders;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $class
|
||||
* @param string $ext
|
||||
* @return string|false
|
||||
*/
|
||||
private function findFileWithExtension($class, $ext)
|
||||
{
|
||||
// PSR-4 lookup
|
||||
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
|
||||
|
||||
$first = $class[0];
|
||||
if (isset($this->prefixLengthsPsr4[$first])) {
|
||||
$subPath = $class;
|
||||
while (false !== $lastPos = strrpos($subPath, '\\')) {
|
||||
$subPath = substr($subPath, 0, $lastPos);
|
||||
$search = $subPath . '\\';
|
||||
if (isset($this->prefixDirsPsr4[$search])) {
|
||||
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
|
||||
foreach ($this->prefixDirsPsr4[$search] as $dir) {
|
||||
if (file_exists($file = $dir . $pathEnd)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-4 fallback dirs
|
||||
foreach ($this->fallbackDirsPsr4 as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 lookup
|
||||
if (false !== $pos = strrpos($class, '\\')) {
|
||||
// namespaced class name
|
||||
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
|
||||
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
|
||||
} else {
|
||||
// PEAR-like class name
|
||||
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
|
||||
}
|
||||
|
||||
if (isset($this->prefixesPsr0[$first])) {
|
||||
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
||||
if (0 === strpos($class, $prefix)) {
|
||||
foreach ($dirs as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 fallback dirs
|
||||
foreach ($this->fallbackDirsPsr0 as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 include paths.
|
||||
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope isolated include.
|
||||
*
|
||||
* Prevents access to $this/self from included files.
|
||||
*
|
||||
* @param string $file
|
||||
* @return void
|
||||
* @private
|
||||
*/
|
||||
function includeFile($file)
|
||||
{
|
||||
include $file;
|
||||
}
|
|
@ -0,0 +1,350 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer;
|
||||
|
||||
use Composer\Autoload\ClassLoader;
|
||||
use Composer\Semver\VersionParser;
|
||||
|
||||
/**
|
||||
* This class is copied in every Composer installed project and available to all
|
||||
*
|
||||
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
|
||||
*
|
||||
* To require its presence, you can require `composer-runtime-api ^2.0`
|
||||
*/
|
||||
class InstalledVersions
|
||||
{
|
||||
/**
|
||||
* @var mixed[]|null
|
||||
* @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}|array{}|null
|
||||
*/
|
||||
private static $installed;
|
||||
|
||||
/**
|
||||
* @var bool|null
|
||||
*/
|
||||
private static $canGetVendors;
|
||||
|
||||
/**
|
||||
* @var array[]
|
||||
* @psalm-var array<string, array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
|
||||
*/
|
||||
private static $installedByVendor = array();
|
||||
|
||||
/**
|
||||
* Returns a list of all package names which are present, either by being installed, replaced or provided
|
||||
*
|
||||
* @return string[]
|
||||
* @psalm-return list<string>
|
||||
*/
|
||||
public static function getInstalledPackages()
|
||||
{
|
||||
$packages = array();
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
$packages[] = array_keys($installed['versions']);
|
||||
}
|
||||
|
||||
if (1 === \count($packages)) {
|
||||
return $packages[0];
|
||||
}
|
||||
|
||||
return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of all package names with a specific type e.g. 'library'
|
||||
*
|
||||
* @param string $type
|
||||
* @return string[]
|
||||
* @psalm-return list<string>
|
||||
*/
|
||||
public static function getInstalledPackagesByType($type)
|
||||
{
|
||||
$packagesByType = array();
|
||||
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
foreach ($installed['versions'] as $name => $package) {
|
||||
if (isset($package['type']) && $package['type'] === $type) {
|
||||
$packagesByType[] = $name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $packagesByType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the given package is installed
|
||||
*
|
||||
* This also returns true if the package name is provided or replaced by another package
|
||||
*
|
||||
* @param string $packageName
|
||||
* @param bool $includeDevRequirements
|
||||
* @return bool
|
||||
*/
|
||||
public static function isInstalled($packageName, $includeDevRequirements = true)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (isset($installed['versions'][$packageName])) {
|
||||
return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the given package satisfies a version constraint
|
||||
*
|
||||
* e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
|
||||
*
|
||||
* Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
|
||||
*
|
||||
* @param VersionParser $parser Install composer/semver to have access to this class and functionality
|
||||
* @param string $packageName
|
||||
* @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
|
||||
* @return bool
|
||||
*/
|
||||
public static function satisfies(VersionParser $parser, $packageName, $constraint)
|
||||
{
|
||||
$constraint = $parser->parseConstraints($constraint);
|
||||
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
|
||||
|
||||
return $provided->matches($constraint);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a version constraint representing all the range(s) which are installed for a given package
|
||||
*
|
||||
* It is easier to use this via isInstalled() with the $constraint argument if you need to check
|
||||
* whether a given version of a package is installed, and not just whether it exists
|
||||
*
|
||||
* @param string $packageName
|
||||
* @return string Version constraint usable with composer/semver
|
||||
*/
|
||||
public static function getVersionRanges($packageName)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (!isset($installed['versions'][$packageName])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$ranges = array();
|
||||
if (isset($installed['versions'][$packageName]['pretty_version'])) {
|
||||
$ranges[] = $installed['versions'][$packageName]['pretty_version'];
|
||||
}
|
||||
if (array_key_exists('aliases', $installed['versions'][$packageName])) {
|
||||
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
|
||||
}
|
||||
if (array_key_exists('replaced', $installed['versions'][$packageName])) {
|
||||
$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
|
||||
}
|
||||
if (array_key_exists('provided', $installed['versions'][$packageName])) {
|
||||
$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
|
||||
}
|
||||
|
||||
return implode(' || ', $ranges);
|
||||
}
|
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $packageName
|
||||
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
|
||||
*/
|
||||
public static function getVersion($packageName)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (!isset($installed['versions'][$packageName])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($installed['versions'][$packageName]['version'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $installed['versions'][$packageName]['version'];
|
||||
}
|
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $packageName
|
||||
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
|
||||
*/
|
||||
public static function getPrettyVersion($packageName)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (!isset($installed['versions'][$packageName])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($installed['versions'][$packageName]['pretty_version'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $installed['versions'][$packageName]['pretty_version'];
|
||||
}
|
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $packageName
|
||||
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
|
||||
*/
|
||||
public static function getReference($packageName)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (!isset($installed['versions'][$packageName])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($installed['versions'][$packageName]['reference'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $installed['versions'][$packageName]['reference'];
|
||||
}
|
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $packageName
|
||||
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
|
||||
*/
|
||||
public static function getInstallPath($packageName)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (!isset($installed['versions'][$packageName])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
|
||||
}
|
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}
|
||||
*/
|
||||
public static function getRootPackage()
|
||||
{
|
||||
$installed = self::getInstalled();
|
||||
|
||||
return $installed[0]['root'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the raw installed.php data for custom implementations
|
||||
*
|
||||
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
|
||||
* @return array[]
|
||||
* @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}
|
||||
*/
|
||||
public static function getRawData()
|
||||
{
|
||||
@trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
|
||||
|
||||
if (null === self::$installed) {
|
||||
// only require the installed.php file if this file is loaded from its dumped location,
|
||||
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
|
||||
if (substr(__DIR__, -8, 1) !== 'C') {
|
||||
self::$installed = include __DIR__ . '/installed.php';
|
||||
} else {
|
||||
self::$installed = array();
|
||||
}
|
||||
}
|
||||
|
||||
return self::$installed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the raw data of all installed.php which are currently loaded for custom implementations
|
||||
*
|
||||
* @return array[]
|
||||
* @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
|
||||
*/
|
||||
public static function getAllRawData()
|
||||
{
|
||||
return self::getInstalled();
|
||||
}
|
||||
|
||||
/**
|
||||
* Lets you reload the static array from another file
|
||||
*
|
||||
* This is only useful for complex integrations in which a project needs to use
|
||||
* this class but then also needs to execute another project's autoloader in process,
|
||||
* and wants to ensure both projects have access to their version of installed.php.
|
||||
*
|
||||
* A typical case would be PHPUnit, where it would need to make sure it reads all
|
||||
* the data it needs from this class, then call reload() with
|
||||
* `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
|
||||
* the project in which it runs can then also use this class safely, without
|
||||
* interference between PHPUnit's dependencies and the project's dependencies.
|
||||
*
|
||||
* @param array[] $data A vendor/composer/installed.php data set
|
||||
* @return void
|
||||
*
|
||||
* @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} $data
|
||||
*/
|
||||
public static function reload($data)
|
||||
{
|
||||
self::$installed = $data;
|
||||
self::$installedByVendor = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array[]
|
||||
* @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
|
||||
*/
|
||||
private static function getInstalled()
|
||||
{
|
||||
if (null === self::$canGetVendors) {
|
||||
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
|
||||
}
|
||||
|
||||
$installed = array();
|
||||
|
||||
if (self::$canGetVendors) {
|
||||
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
|
||||
if (isset(self::$installedByVendor[$vendorDir])) {
|
||||
$installed[] = self::$installedByVendor[$vendorDir];
|
||||
} elseif (is_file($vendorDir.'/composer/installed.php')) {
|
||||
$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
|
||||
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
|
||||
self::$installed = $installed[count($installed) - 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (null === self::$installed) {
|
||||
// only require the installed.php file if this file is loaded from its dumped location,
|
||||
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
|
||||
if (substr(__DIR__, -8, 1) !== 'C') {
|
||||
self::$installed = require __DIR__ . '/installed.php';
|
||||
} else {
|
||||
self::$installed = array();
|
||||
}
|
||||
}
|
||||
$installed[] = self::$installed;
|
||||
|
||||
return $installed;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
Copyright (c) Nils Adermann, Jordi Boggiano
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
|
@ -0,0 +1,179 @@
|
|||
<?php
|
||||
|
||||
// autoload_classmap.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
|
||||
'Smarty' => $vendorDir . '/smarty/smarty/libs/Smarty.class.php',
|
||||
'SmartyCompilerException' => $vendorDir . '/smarty/smarty/libs/sysplugins/smartycompilerexception.php',
|
||||
'SmartyException' => $vendorDir . '/smarty/smarty/libs/sysplugins/smartyexception.php',
|
||||
'Smarty_Autoloader' => $vendorDir . '/smarty/smarty/libs/Autoloader.php',
|
||||
'Smarty_CacheResource' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_cacheresource.php',
|
||||
'Smarty_CacheResource_Custom' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_cacheresource_custom.php',
|
||||
'Smarty_CacheResource_KeyValueStore' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_cacheresource_keyvaluestore.php',
|
||||
'Smarty_Data' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_data.php',
|
||||
'Smarty_Internal_Block' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_block.php',
|
||||
'Smarty_Internal_CacheResource_File' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_cacheresource_file.php',
|
||||
'Smarty_Internal_CompileBase' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compilebase.php',
|
||||
'Smarty_Internal_Compile_Append' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_append.php',
|
||||
'Smarty_Internal_Compile_Assign' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_assign.php',
|
||||
'Smarty_Internal_Compile_Block' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_block.php',
|
||||
'Smarty_Internal_Compile_Block_Child' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_block_child.php',
|
||||
'Smarty_Internal_Compile_Block_Parent' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_block_parent.php',
|
||||
'Smarty_Internal_Compile_Blockclose' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_block.php',
|
||||
'Smarty_Internal_Compile_Break' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_break.php',
|
||||
'Smarty_Internal_Compile_Call' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_call.php',
|
||||
'Smarty_Internal_Compile_Capture' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_capture.php',
|
||||
'Smarty_Internal_Compile_CaptureClose' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_capture.php',
|
||||
'Smarty_Internal_Compile_Child' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_child.php',
|
||||
'Smarty_Internal_Compile_Config_Load' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_config_load.php',
|
||||
'Smarty_Internal_Compile_Continue' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_continue.php',
|
||||
'Smarty_Internal_Compile_Debug' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_debug.php',
|
||||
'Smarty_Internal_Compile_Else' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_if.php',
|
||||
'Smarty_Internal_Compile_Elseif' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_if.php',
|
||||
'Smarty_Internal_Compile_Eval' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_eval.php',
|
||||
'Smarty_Internal_Compile_Extends' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_extends.php',
|
||||
'Smarty_Internal_Compile_For' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_for.php',
|
||||
'Smarty_Internal_Compile_Forclose' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_for.php',
|
||||
'Smarty_Internal_Compile_Foreach' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_foreach.php',
|
||||
'Smarty_Internal_Compile_Foreachclose' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_foreach.php',
|
||||
'Smarty_Internal_Compile_Foreachelse' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_foreach.php',
|
||||
'Smarty_Internal_Compile_Forelse' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_for.php',
|
||||
'Smarty_Internal_Compile_Function' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_function.php',
|
||||
'Smarty_Internal_Compile_Functionclose' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_function.php',
|
||||
'Smarty_Internal_Compile_If' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_if.php',
|
||||
'Smarty_Internal_Compile_Ifclose' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_if.php',
|
||||
'Smarty_Internal_Compile_Include' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_include.php',
|
||||
'Smarty_Internal_Compile_Insert' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_insert.php',
|
||||
'Smarty_Internal_Compile_Ldelim' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_ldelim.php',
|
||||
'Smarty_Internal_Compile_Make_Nocache' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_make_nocache.php',
|
||||
'Smarty_Internal_Compile_Nocache' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_nocache.php',
|
||||
'Smarty_Internal_Compile_Nocacheclose' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_nocache.php',
|
||||
'Smarty_Internal_Compile_Parent' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_parent.php',
|
||||
'Smarty_Internal_Compile_Private_Block_Plugin' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_block_plugin.php',
|
||||
'Smarty_Internal_Compile_Private_ForeachSection' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_foreachsection.php',
|
||||
'Smarty_Internal_Compile_Private_Function_Plugin' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_function_plugin.php',
|
||||
'Smarty_Internal_Compile_Private_Modifier' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php',
|
||||
'Smarty_Internal_Compile_Private_Object_Block_Function' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_object_block_function.php',
|
||||
'Smarty_Internal_Compile_Private_Object_Function' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_object_function.php',
|
||||
'Smarty_Internal_Compile_Private_Print_Expression' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_print_expression.php',
|
||||
'Smarty_Internal_Compile_Private_Registered_Block' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_registered_block.php',
|
||||
'Smarty_Internal_Compile_Private_Registered_Function' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_registered_function.php',
|
||||
'Smarty_Internal_Compile_Private_Special_Variable' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_special_variable.php',
|
||||
'Smarty_Internal_Compile_Rdelim' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_rdelim.php',
|
||||
'Smarty_Internal_Compile_Section' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_section.php',
|
||||
'Smarty_Internal_Compile_Sectionclose' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_section.php',
|
||||
'Smarty_Internal_Compile_Sectionelse' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_section.php',
|
||||
'Smarty_Internal_Compile_Setfilter' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_setfilter.php',
|
||||
'Smarty_Internal_Compile_Setfilterclose' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_setfilter.php',
|
||||
'Smarty_Internal_Compile_Shared_Inheritance' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_shared_inheritance.php',
|
||||
'Smarty_Internal_Compile_While' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_while.php',
|
||||
'Smarty_Internal_Compile_Whileclose' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_while.php',
|
||||
'Smarty_Internal_Config_File_Compiler' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_config_file_compiler.php',
|
||||
'Smarty_Internal_Configfilelexer' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_configfilelexer.php',
|
||||
'Smarty_Internal_Configfileparser' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_configfileparser.php',
|
||||
'Smarty_Internal_Data' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_data.php',
|
||||
'Smarty_Internal_Debug' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_debug.php',
|
||||
'Smarty_Internal_ErrorHandler' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_errorhandler.php',
|
||||
'Smarty_Internal_Extension_Handler' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_extension_handler.php',
|
||||
'Smarty_Internal_Method_AddAutoloadFilters' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_addautoloadfilters.php',
|
||||
'Smarty_Internal_Method_AddDefaultModifiers' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_adddefaultmodifiers.php',
|
||||
'Smarty_Internal_Method_Append' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_append.php',
|
||||
'Smarty_Internal_Method_AppendByRef' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_appendbyref.php',
|
||||
'Smarty_Internal_Method_AssignByRef' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_assignbyref.php',
|
||||
'Smarty_Internal_Method_AssignGlobal' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_assignglobal.php',
|
||||
'Smarty_Internal_Method_ClearAllAssign' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_clearallassign.php',
|
||||
'Smarty_Internal_Method_ClearAllCache' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_clearallcache.php',
|
||||
'Smarty_Internal_Method_ClearAssign' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_clearassign.php',
|
||||
'Smarty_Internal_Method_ClearCache' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_clearcache.php',
|
||||
'Smarty_Internal_Method_ClearCompiledTemplate' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php',
|
||||
'Smarty_Internal_Method_ClearConfig' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_clearconfig.php',
|
||||
'Smarty_Internal_Method_CompileAllConfig' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_compileallconfig.php',
|
||||
'Smarty_Internal_Method_CompileAllTemplates' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_compilealltemplates.php',
|
||||
'Smarty_Internal_Method_ConfigLoad' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_configload.php',
|
||||
'Smarty_Internal_Method_CreateData' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_createdata.php',
|
||||
'Smarty_Internal_Method_GetAutoloadFilters' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_getautoloadfilters.php',
|
||||
'Smarty_Internal_Method_GetConfigVariable' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_getconfigvariable.php',
|
||||
'Smarty_Internal_Method_GetConfigVars' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_getconfigvars.php',
|
||||
'Smarty_Internal_Method_GetDebugTemplate' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_getdebugtemplate.php',
|
||||
'Smarty_Internal_Method_GetDefaultModifiers' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_getdefaultmodifiers.php',
|
||||
'Smarty_Internal_Method_GetGlobal' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_getglobal.php',
|
||||
'Smarty_Internal_Method_GetRegisteredObject' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_getregisteredobject.php',
|
||||
'Smarty_Internal_Method_GetStreamVariable' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_getstreamvariable.php',
|
||||
'Smarty_Internal_Method_GetTags' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_gettags.php',
|
||||
'Smarty_Internal_Method_GetTemplateVars' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_gettemplatevars.php',
|
||||
'Smarty_Internal_Method_Literals' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_literals.php',
|
||||
'Smarty_Internal_Method_LoadFilter' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_loadfilter.php',
|
||||
'Smarty_Internal_Method_LoadPlugin' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_loadplugin.php',
|
||||
'Smarty_Internal_Method_MustCompile' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_mustcompile.php',
|
||||
'Smarty_Internal_Method_RegisterCacheResource' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_registercacheresource.php',
|
||||
'Smarty_Internal_Method_RegisterClass' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_registerclass.php',
|
||||
'Smarty_Internal_Method_RegisterDefaultConfigHandler' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_registerdefaultconfighandler.php',
|
||||
'Smarty_Internal_Method_RegisterDefaultPluginHandler' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_registerdefaultpluginhandler.php',
|
||||
'Smarty_Internal_Method_RegisterDefaultTemplateHandler' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_registerdefaulttemplatehandler.php',
|
||||
'Smarty_Internal_Method_RegisterFilter' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_registerfilter.php',
|
||||
'Smarty_Internal_Method_RegisterObject' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_registerobject.php',
|
||||
'Smarty_Internal_Method_RegisterPlugin' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_registerplugin.php',
|
||||
'Smarty_Internal_Method_RegisterResource' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_registerresource.php',
|
||||
'Smarty_Internal_Method_SetAutoloadFilters' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_setautoloadfilters.php',
|
||||
'Smarty_Internal_Method_SetDebugTemplate' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_setdebugtemplate.php',
|
||||
'Smarty_Internal_Method_SetDefaultModifiers' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_setdefaultmodifiers.php',
|
||||
'Smarty_Internal_Method_UnloadFilter' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_unloadfilter.php',
|
||||
'Smarty_Internal_Method_UnregisterCacheResource' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_unregistercacheresource.php',
|
||||
'Smarty_Internal_Method_UnregisterFilter' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterfilter.php',
|
||||
'Smarty_Internal_Method_UnregisterObject' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterobject.php',
|
||||
'Smarty_Internal_Method_UnregisterPlugin' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterplugin.php',
|
||||
'Smarty_Internal_Method_UnregisterResource' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterresource.php',
|
||||
'Smarty_Internal_Nocache_Insert' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_nocache_insert.php',
|
||||
'Smarty_Internal_ParseTree' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_parsetree.php',
|
||||
'Smarty_Internal_ParseTree_Code' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_code.php',
|
||||
'Smarty_Internal_ParseTree_Dq' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_dq.php',
|
||||
'Smarty_Internal_ParseTree_DqContent' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_dqcontent.php',
|
||||
'Smarty_Internal_ParseTree_Tag' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_tag.php',
|
||||
'Smarty_Internal_ParseTree_Template' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_template.php',
|
||||
'Smarty_Internal_ParseTree_Text' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_text.php',
|
||||
'Smarty_Internal_Resource_Eval' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_resource_eval.php',
|
||||
'Smarty_Internal_Resource_Extends' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_resource_extends.php',
|
||||
'Smarty_Internal_Resource_File' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_resource_file.php',
|
||||
'Smarty_Internal_Resource_Php' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_resource_php.php',
|
||||
'Smarty_Internal_Resource_Stream' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_resource_stream.php',
|
||||
'Smarty_Internal_Resource_String' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_resource_string.php',
|
||||
'Smarty_Internal_Runtime_CacheModify' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_cachemodify.php',
|
||||
'Smarty_Internal_Runtime_CacheResourceFile' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_cacheresourcefile.php',
|
||||
'Smarty_Internal_Runtime_Capture' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_capture.php',
|
||||
'Smarty_Internal_Runtime_CodeFrame' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php',
|
||||
'Smarty_Internal_Runtime_FilterHandler' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_filterhandler.php',
|
||||
'Smarty_Internal_Runtime_Foreach' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_foreach.php',
|
||||
'Smarty_Internal_Runtime_GetIncludePath' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_getincludepath.php',
|
||||
'Smarty_Internal_Runtime_Inheritance' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php',
|
||||
'Smarty_Internal_Runtime_Make_Nocache' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_make_nocache.php',
|
||||
'Smarty_Internal_Runtime_TplFunction' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_tplfunction.php',
|
||||
'Smarty_Internal_Runtime_UpdateCache' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_updatecache.php',
|
||||
'Smarty_Internal_Runtime_UpdateScope' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_updatescope.php',
|
||||
'Smarty_Internal_Runtime_WriteFile' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_writefile.php',
|
||||
'Smarty_Internal_SmartyTemplateCompiler' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_smartytemplatecompiler.php',
|
||||
'Smarty_Internal_Template' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_template.php',
|
||||
'Smarty_Internal_TemplateBase' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php',
|
||||
'Smarty_Internal_TemplateCompilerBase' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php',
|
||||
'Smarty_Internal_Templatelexer' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_templatelexer.php',
|
||||
'Smarty_Internal_Templateparser' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_templateparser.php',
|
||||
'Smarty_Internal_TestInstall' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_testinstall.php',
|
||||
'Smarty_Internal_Undefined' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_undefined.php',
|
||||
'Smarty_Resource' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_resource.php',
|
||||
'Smarty_Resource_Custom' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_resource_custom.php',
|
||||
'Smarty_Resource_Recompiled' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_resource_recompiled.php',
|
||||
'Smarty_Resource_Uncompiled' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_resource_uncompiled.php',
|
||||
'Smarty_Security' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_security.php',
|
||||
'Smarty_Template_Cached' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_template_cached.php',
|
||||
'Smarty_Template_Compiled' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_template_compiled.php',
|
||||
'Smarty_Template_Config' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_template_config.php',
|
||||
'Smarty_Template_Resource_Base' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php',
|
||||
'Smarty_Template_Source' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_template_source.php',
|
||||
'Smarty_Undefined_Variable' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_undefined_variable.php',
|
||||
'Smarty_Variable' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_variable.php',
|
||||
'TPC_yyStackEntry' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_configfileparser.php',
|
||||
'TP_yyStackEntry' => $vendorDir . '/smarty/smarty/libs/sysplugins/smarty_internal_templateparser.php',
|
||||
);
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
// autoload_namespaces.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
);
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
// autoload_psr4.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
);
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit96a5d7b7309f95647e6b754221160087
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
public static function loadClassLoader($class)
|
||||
{
|
||||
if ('Composer\Autoload\ClassLoader' === $class) {
|
||||
require __DIR__ . '/ClassLoader.php';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Composer\Autoload\ClassLoader
|
||||
*/
|
||||
public static function getLoader()
|
||||
{
|
||||
if (null !== self::$loader) {
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
require __DIR__ . '/platform_check.php';
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit96a5d7b7309f95647e6b754221160087', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit96a5d7b7309f95647e6b754221160087', 'loadClassLoader'));
|
||||
|
||||
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
||||
if ($useStaticLoader) {
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit96a5d7b7309f95647e6b754221160087::getInitializer($loader));
|
||||
} else {
|
||||
$map = require __DIR__ . '/autoload_namespaces.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->set($namespace, $path);
|
||||
}
|
||||
|
||||
$map = require __DIR__ . '/autoload_psr4.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->setPsr4($namespace, $path);
|
||||
}
|
||||
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
$loader->addClassMap($classMap);
|
||||
}
|
||||
}
|
||||
|
||||
$loader->register(true);
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,189 @@
|
|||
<?php
|
||||
|
||||
// autoload_static.php @generated by Composer
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit96a5d7b7309f95647e6b754221160087
|
||||
{
|
||||
public static $classMap = array (
|
||||
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
||||
'Smarty' => __DIR__ . '/..' . '/smarty/smarty/libs/Smarty.class.php',
|
||||
'SmartyCompilerException' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smartycompilerexception.php',
|
||||
'SmartyException' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smartyexception.php',
|
||||
'Smarty_Autoloader' => __DIR__ . '/..' . '/smarty/smarty/libs/Autoloader.php',
|
||||
'Smarty_CacheResource' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_cacheresource.php',
|
||||
'Smarty_CacheResource_Custom' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_cacheresource_custom.php',
|
||||
'Smarty_CacheResource_KeyValueStore' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_cacheresource_keyvaluestore.php',
|
||||
'Smarty_Data' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_data.php',
|
||||
'Smarty_Internal_Block' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_block.php',
|
||||
'Smarty_Internal_CacheResource_File' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_cacheresource_file.php',
|
||||
'Smarty_Internal_CompileBase' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compilebase.php',
|
||||
'Smarty_Internal_Compile_Append' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_append.php',
|
||||
'Smarty_Internal_Compile_Assign' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_assign.php',
|
||||
'Smarty_Internal_Compile_Block' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_block.php',
|
||||
'Smarty_Internal_Compile_Block_Child' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_block_child.php',
|
||||
'Smarty_Internal_Compile_Block_Parent' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_block_parent.php',
|
||||
'Smarty_Internal_Compile_Blockclose' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_block.php',
|
||||
'Smarty_Internal_Compile_Break' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_break.php',
|
||||
'Smarty_Internal_Compile_Call' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_call.php',
|
||||
'Smarty_Internal_Compile_Capture' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_capture.php',
|
||||
'Smarty_Internal_Compile_CaptureClose' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_capture.php',
|
||||
'Smarty_Internal_Compile_Child' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_child.php',
|
||||
'Smarty_Internal_Compile_Config_Load' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_config_load.php',
|
||||
'Smarty_Internal_Compile_Continue' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_continue.php',
|
||||
'Smarty_Internal_Compile_Debug' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_debug.php',
|
||||
'Smarty_Internal_Compile_Else' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_if.php',
|
||||
'Smarty_Internal_Compile_Elseif' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_if.php',
|
||||
'Smarty_Internal_Compile_Eval' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_eval.php',
|
||||
'Smarty_Internal_Compile_Extends' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_extends.php',
|
||||
'Smarty_Internal_Compile_For' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_for.php',
|
||||
'Smarty_Internal_Compile_Forclose' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_for.php',
|
||||
'Smarty_Internal_Compile_Foreach' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_foreach.php',
|
||||
'Smarty_Internal_Compile_Foreachclose' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_foreach.php',
|
||||
'Smarty_Internal_Compile_Foreachelse' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_foreach.php',
|
||||
'Smarty_Internal_Compile_Forelse' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_for.php',
|
||||
'Smarty_Internal_Compile_Function' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_function.php',
|
||||
'Smarty_Internal_Compile_Functionclose' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_function.php',
|
||||
'Smarty_Internal_Compile_If' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_if.php',
|
||||
'Smarty_Internal_Compile_Ifclose' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_if.php',
|
||||
'Smarty_Internal_Compile_Include' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_include.php',
|
||||
'Smarty_Internal_Compile_Insert' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_insert.php',
|
||||
'Smarty_Internal_Compile_Ldelim' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_ldelim.php',
|
||||
'Smarty_Internal_Compile_Make_Nocache' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_make_nocache.php',
|
||||
'Smarty_Internal_Compile_Nocache' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_nocache.php',
|
||||
'Smarty_Internal_Compile_Nocacheclose' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_nocache.php',
|
||||
'Smarty_Internal_Compile_Parent' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_parent.php',
|
||||
'Smarty_Internal_Compile_Private_Block_Plugin' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_block_plugin.php',
|
||||
'Smarty_Internal_Compile_Private_ForeachSection' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_foreachsection.php',
|
||||
'Smarty_Internal_Compile_Private_Function_Plugin' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_function_plugin.php',
|
||||
'Smarty_Internal_Compile_Private_Modifier' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php',
|
||||
'Smarty_Internal_Compile_Private_Object_Block_Function' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_object_block_function.php',
|
||||
'Smarty_Internal_Compile_Private_Object_Function' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_object_function.php',
|
||||
'Smarty_Internal_Compile_Private_Print_Expression' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_print_expression.php',
|
||||
'Smarty_Internal_Compile_Private_Registered_Block' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_registered_block.php',
|
||||
'Smarty_Internal_Compile_Private_Registered_Function' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_registered_function.php',
|
||||
'Smarty_Internal_Compile_Private_Special_Variable' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_special_variable.php',
|
||||
'Smarty_Internal_Compile_Rdelim' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_rdelim.php',
|
||||
'Smarty_Internal_Compile_Section' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_section.php',
|
||||
'Smarty_Internal_Compile_Sectionclose' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_section.php',
|
||||
'Smarty_Internal_Compile_Sectionelse' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_section.php',
|
||||
'Smarty_Internal_Compile_Setfilter' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_setfilter.php',
|
||||
'Smarty_Internal_Compile_Setfilterclose' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_setfilter.php',
|
||||
'Smarty_Internal_Compile_Shared_Inheritance' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_shared_inheritance.php',
|
||||
'Smarty_Internal_Compile_While' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_while.php',
|
||||
'Smarty_Internal_Compile_Whileclose' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_compile_while.php',
|
||||
'Smarty_Internal_Config_File_Compiler' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_config_file_compiler.php',
|
||||
'Smarty_Internal_Configfilelexer' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_configfilelexer.php',
|
||||
'Smarty_Internal_Configfileparser' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_configfileparser.php',
|
||||
'Smarty_Internal_Data' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_data.php',
|
||||
'Smarty_Internal_Debug' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_debug.php',
|
||||
'Smarty_Internal_ErrorHandler' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_errorhandler.php',
|
||||
'Smarty_Internal_Extension_Handler' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_extension_handler.php',
|
||||
'Smarty_Internal_Method_AddAutoloadFilters' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_addautoloadfilters.php',
|
||||
'Smarty_Internal_Method_AddDefaultModifiers' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_adddefaultmodifiers.php',
|
||||
'Smarty_Internal_Method_Append' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_append.php',
|
||||
'Smarty_Internal_Method_AppendByRef' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_appendbyref.php',
|
||||
'Smarty_Internal_Method_AssignByRef' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_assignbyref.php',
|
||||
'Smarty_Internal_Method_AssignGlobal' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_assignglobal.php',
|
||||
'Smarty_Internal_Method_ClearAllAssign' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_clearallassign.php',
|
||||
'Smarty_Internal_Method_ClearAllCache' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_clearallcache.php',
|
||||
'Smarty_Internal_Method_ClearAssign' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_clearassign.php',
|
||||
'Smarty_Internal_Method_ClearCache' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_clearcache.php',
|
||||
'Smarty_Internal_Method_ClearCompiledTemplate' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php',
|
||||
'Smarty_Internal_Method_ClearConfig' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_clearconfig.php',
|
||||
'Smarty_Internal_Method_CompileAllConfig' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_compileallconfig.php',
|
||||
'Smarty_Internal_Method_CompileAllTemplates' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_compilealltemplates.php',
|
||||
'Smarty_Internal_Method_ConfigLoad' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_configload.php',
|
||||
'Smarty_Internal_Method_CreateData' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_createdata.php',
|
||||
'Smarty_Internal_Method_GetAutoloadFilters' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_getautoloadfilters.php',
|
||||
'Smarty_Internal_Method_GetConfigVariable' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_getconfigvariable.php',
|
||||
'Smarty_Internal_Method_GetConfigVars' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_getconfigvars.php',
|
||||
'Smarty_Internal_Method_GetDebugTemplate' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_getdebugtemplate.php',
|
||||
'Smarty_Internal_Method_GetDefaultModifiers' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_getdefaultmodifiers.php',
|
||||
'Smarty_Internal_Method_GetGlobal' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_getglobal.php',
|
||||
'Smarty_Internal_Method_GetRegisteredObject' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_getregisteredobject.php',
|
||||
'Smarty_Internal_Method_GetStreamVariable' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_getstreamvariable.php',
|
||||
'Smarty_Internal_Method_GetTags' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_gettags.php',
|
||||
'Smarty_Internal_Method_GetTemplateVars' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_gettemplatevars.php',
|
||||
'Smarty_Internal_Method_Literals' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_literals.php',
|
||||
'Smarty_Internal_Method_LoadFilter' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_loadfilter.php',
|
||||
'Smarty_Internal_Method_LoadPlugin' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_loadplugin.php',
|
||||
'Smarty_Internal_Method_MustCompile' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_mustcompile.php',
|
||||
'Smarty_Internal_Method_RegisterCacheResource' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_registercacheresource.php',
|
||||
'Smarty_Internal_Method_RegisterClass' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_registerclass.php',
|
||||
'Smarty_Internal_Method_RegisterDefaultConfigHandler' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_registerdefaultconfighandler.php',
|
||||
'Smarty_Internal_Method_RegisterDefaultPluginHandler' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_registerdefaultpluginhandler.php',
|
||||
'Smarty_Internal_Method_RegisterDefaultTemplateHandler' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_registerdefaulttemplatehandler.php',
|
||||
'Smarty_Internal_Method_RegisterFilter' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_registerfilter.php',
|
||||
'Smarty_Internal_Method_RegisterObject' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_registerobject.php',
|
||||
'Smarty_Internal_Method_RegisterPlugin' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_registerplugin.php',
|
||||
'Smarty_Internal_Method_RegisterResource' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_registerresource.php',
|
||||
'Smarty_Internal_Method_SetAutoloadFilters' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_setautoloadfilters.php',
|
||||
'Smarty_Internal_Method_SetDebugTemplate' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_setdebugtemplate.php',
|
||||
'Smarty_Internal_Method_SetDefaultModifiers' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_setdefaultmodifiers.php',
|
||||
'Smarty_Internal_Method_UnloadFilter' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_unloadfilter.php',
|
||||
'Smarty_Internal_Method_UnregisterCacheResource' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_unregistercacheresource.php',
|
||||
'Smarty_Internal_Method_UnregisterFilter' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterfilter.php',
|
||||
'Smarty_Internal_Method_UnregisterObject' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterobject.php',
|
||||
'Smarty_Internal_Method_UnregisterPlugin' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterplugin.php',
|
||||
'Smarty_Internal_Method_UnregisterResource' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterresource.php',
|
||||
'Smarty_Internal_Nocache_Insert' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_nocache_insert.php',
|
||||
'Smarty_Internal_ParseTree' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_parsetree.php',
|
||||
'Smarty_Internal_ParseTree_Code' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_code.php',
|
||||
'Smarty_Internal_ParseTree_Dq' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_dq.php',
|
||||
'Smarty_Internal_ParseTree_DqContent' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_dqcontent.php',
|
||||
'Smarty_Internal_ParseTree_Tag' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_tag.php',
|
||||
'Smarty_Internal_ParseTree_Template' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_template.php',
|
||||
'Smarty_Internal_ParseTree_Text' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_text.php',
|
||||
'Smarty_Internal_Resource_Eval' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_resource_eval.php',
|
||||
'Smarty_Internal_Resource_Extends' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_resource_extends.php',
|
||||
'Smarty_Internal_Resource_File' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_resource_file.php',
|
||||
'Smarty_Internal_Resource_Php' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_resource_php.php',
|
||||
'Smarty_Internal_Resource_Stream' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_resource_stream.php',
|
||||
'Smarty_Internal_Resource_String' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_resource_string.php',
|
||||
'Smarty_Internal_Runtime_CacheModify' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_cachemodify.php',
|
||||
'Smarty_Internal_Runtime_CacheResourceFile' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_cacheresourcefile.php',
|
||||
'Smarty_Internal_Runtime_Capture' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_capture.php',
|
||||
'Smarty_Internal_Runtime_CodeFrame' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php',
|
||||
'Smarty_Internal_Runtime_FilterHandler' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_filterhandler.php',
|
||||
'Smarty_Internal_Runtime_Foreach' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_foreach.php',
|
||||
'Smarty_Internal_Runtime_GetIncludePath' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_getincludepath.php',
|
||||
'Smarty_Internal_Runtime_Inheritance' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php',
|
||||
'Smarty_Internal_Runtime_Make_Nocache' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_make_nocache.php',
|
||||
'Smarty_Internal_Runtime_TplFunction' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_tplfunction.php',
|
||||
'Smarty_Internal_Runtime_UpdateCache' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_updatecache.php',
|
||||
'Smarty_Internal_Runtime_UpdateScope' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_updatescope.php',
|
||||
'Smarty_Internal_Runtime_WriteFile' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_runtime_writefile.php',
|
||||
'Smarty_Internal_SmartyTemplateCompiler' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_smartytemplatecompiler.php',
|
||||
'Smarty_Internal_Template' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_template.php',
|
||||
'Smarty_Internal_TemplateBase' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php',
|
||||
'Smarty_Internal_TemplateCompilerBase' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php',
|
||||
'Smarty_Internal_Templatelexer' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_templatelexer.php',
|
||||
'Smarty_Internal_Templateparser' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_templateparser.php',
|
||||
'Smarty_Internal_TestInstall' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_testinstall.php',
|
||||
'Smarty_Internal_Undefined' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_undefined.php',
|
||||
'Smarty_Resource' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_resource.php',
|
||||
'Smarty_Resource_Custom' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_resource_custom.php',
|
||||
'Smarty_Resource_Recompiled' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_resource_recompiled.php',
|
||||
'Smarty_Resource_Uncompiled' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_resource_uncompiled.php',
|
||||
'Smarty_Security' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_security.php',
|
||||
'Smarty_Template_Cached' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_template_cached.php',
|
||||
'Smarty_Template_Compiled' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_template_compiled.php',
|
||||
'Smarty_Template_Config' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_template_config.php',
|
||||
'Smarty_Template_Resource_Base' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php',
|
||||
'Smarty_Template_Source' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_template_source.php',
|
||||
'Smarty_Undefined_Variable' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_undefined_variable.php',
|
||||
'Smarty_Variable' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_variable.php',
|
||||
'TPC_yyStackEntry' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_configfileparser.php',
|
||||
'TP_yyStackEntry' => __DIR__ . '/..' . '/smarty/smarty/libs/sysplugins/smarty_internal_templateparser.php',
|
||||
);
|
||||
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->classMap = ComposerStaticInit96a5d7b7309f95647e6b754221160087::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
{
|
||||
"packages": [
|
||||
{
|
||||
"name": "smarty/smarty",
|
||||
"version": "v4.2.0",
|
||||
"version_normalized": "4.2.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/smarty-php/smarty.git",
|
||||
"reference": "97aeb14c6fc2fb733938809926e2f9d6c581a70d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/smarty-php/smarty/zipball/97aeb14c6fc2fb733938809926e2f9d6c581a70d",
|
||||
"reference": "97aeb14c6fc2fb733938809926e2f9d6c581a70d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^8.5 || ^7.5",
|
||||
"smarty/smarty-lexer": "^3.1"
|
||||
},
|
||||
"time": "2022-08-01T21:57:38+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "4.0.x-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"libs/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"LGPL-3.0"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Monte Ohrt",
|
||||
"email": "monte@ohrt.com"
|
||||
},
|
||||
{
|
||||
"name": "Uwe Tews",
|
||||
"email": "uwe.tews@googlemail.com"
|
||||
},
|
||||
{
|
||||
"name": "Rodney Rehm",
|
||||
"email": "rodney.rehm@medialize.de"
|
||||
},
|
||||
{
|
||||
"name": "Simon Wisselink",
|
||||
"homepage": "https://www.iwink.nl/"
|
||||
}
|
||||
],
|
||||
"description": "Smarty - the compiling PHP template engine",
|
||||
"homepage": "https://smarty-php.github.io/smarty/",
|
||||
"keywords": [
|
||||
"templating"
|
||||
],
|
||||
"support": {
|
||||
"forum": "https://github.com/smarty-php/smarty/discussions",
|
||||
"issues": "https://github.com/smarty-php/smarty/issues",
|
||||
"source": "https://github.com/smarty-php/smarty/tree/v4.2.0"
|
||||
},
|
||||
"install-path": "../smarty/smarty"
|
||||
}
|
||||
],
|
||||
"dev": true,
|
||||
"dev-package-names": []
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
<?php return array(
|
||||
'root' => array(
|
||||
'pretty_version' => '1.0.0+no-version-set',
|
||||
'version' => '1.0.0.0',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
'reference' => NULL,
|
||||
'name' => '__root__',
|
||||
'dev' => true,
|
||||
),
|
||||
'versions' => array(
|
||||
'__root__' => array(
|
||||
'pretty_version' => '1.0.0+no-version-set',
|
||||
'version' => '1.0.0.0',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
'reference' => NULL,
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'smarty/smarty' => array(
|
||||
'pretty_version' => 'v4.2.0',
|
||||
'version' => '4.2.0.0',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../smarty/smarty',
|
||||
'aliases' => array(),
|
||||
'reference' => '97aeb14c6fc2fb733938809926e2f9d6c581a70d',
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
),
|
||||
);
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
// platform_check.php @generated by Composer
|
||||
|
||||
$issues = array();
|
||||
|
||||
if (!(PHP_VERSION_ID >= 70100)) {
|
||||
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.1.0". You are running ' . PHP_VERSION . '.';
|
||||
}
|
||||
|
||||
if ($issues) {
|
||||
if (!headers_sent()) {
|
||||
header('HTTP/1.1 500 Internal Server Error');
|
||||
}
|
||||
if (!ini_get('display_errors')) {
|
||||
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
|
||||
fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
|
||||
} elseif (!headers_sent()) {
|
||||
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
|
||||
}
|
||||
}
|
||||
trigger_error(
|
||||
'Composer detected issues in your platform: ' . implode(' ', $issues),
|
||||
E_USER_ERROR
|
||||
);
|
||||
}
|
|
@ -0,0 +1,179 @@
|
|||
Smarty: the PHP compiling template engine
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3.0 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU Lesser General Public License below for more details.
|
||||
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
|
@ -0,0 +1,20 @@
|
|||
# Smarty template engine
|
||||
Smarty is a template engine for PHP, facilitating the separation of presentation (HTML/CSS) from application logic.
|
||||
|
||||
![CI](https://github.com/smarty-php/smarty/workflows/CI/badge.svg)
|
||||
|
||||
## Documentation
|
||||
Read the [documentation](https://smarty-php.github.io/smarty/) to find out how to use it.
|
||||
|
||||
## Requirements
|
||||
Smarty can be run with PHP 7.1 to PHP 8.1.
|
||||
|
||||
## Installation
|
||||
Smarty versions 3.1.11 or later can be installed with [Composer](https://getcomposer.org/).
|
||||
|
||||
To get the latest stable version of Smarty use:
|
||||
```bash
|
||||
composer require smarty/smarty
|
||||
````
|
||||
|
||||
More in the [Getting Started](./docs/getting-started.md) section of the docs.
|
|
@ -0,0 +1,19 @@
|
|||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
Smarty currently supports the latest minor version of Smarty 3 and Smarty 4. (Smarty 4 has not been released yet.)
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| 4.0.x | :white_check_mark: |
|
||||
| 3.1.x | :white_check_mark: |
|
||||
| < 3.1 | :x: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
If you have discovered a security issue with Smarty, please contact us at mail [at] simonwisselink.nl. Do not
|
||||
disclose your findings publicly and PLEASE PLEASE do not file an Issue.
|
||||
|
||||
We will try to confirm the vulnerability and develop a fix if appropriate. When we release the fix, we will publish
|
||||
a security release. Please let us know if you want to be credited.
|
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
"name": "smarty/smarty",
|
||||
"type": "library",
|
||||
"description": "Smarty - the compiling PHP template engine",
|
||||
"keywords": [
|
||||
"templating"
|
||||
],
|
||||
"homepage": "https://smarty-php.github.io/smarty/",
|
||||
"license": "LGPL-3.0",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Monte Ohrt",
|
||||
"email": "monte@ohrt.com"
|
||||
},
|
||||
{
|
||||
"name": "Uwe Tews",
|
||||
"email": "uwe.tews@googlemail.com"
|
||||
},
|
||||
{
|
||||
"name": "Rodney Rehm",
|
||||
"email": "rodney.rehm@medialize.de"
|
||||
},
|
||||
{
|
||||
"name": "Simon Wisselink",
|
||||
"homepage": "https://www.iwink.nl/"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/smarty-php/smarty/issues",
|
||||
"forum": "https://github.com/smarty-php/smarty/discussions"
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1 || ^8.0"
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"libs/"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "4.0.x-dev"
|
||||
}
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^8.5 || ^7.5",
|
||||
"smarty/smarty-lexer": "^3.1"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,318 @@
|
|||
<?php
|
||||
/**
|
||||
* Smarty Internal Plugin Configfilelexer
|
||||
*
|
||||
* This is the lexer to break the config file source into tokens
|
||||
* @package Smarty
|
||||
* @subpackage Config
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
/**
|
||||
* Smarty_Internal_Configfilelexer
|
||||
*
|
||||
* This is the config file lexer.
|
||||
* It is generated from the smarty_internal_configfilelexer.plex file
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
class Smarty_Internal_Configfilelexer
|
||||
{
|
||||
/**
|
||||
* Source
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $data;
|
||||
/**
|
||||
* Source length
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $dataLength = null;
|
||||
/**
|
||||
* byte counter
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $counter;
|
||||
/**
|
||||
* token number
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $token;
|
||||
/**
|
||||
* token value
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $value;
|
||||
/**
|
||||
* current line
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $line;
|
||||
/**
|
||||
* state number
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $state = 1;
|
||||
/**
|
||||
* Smarty object
|
||||
*
|
||||
* @var Smarty
|
||||
*/
|
||||
public $smarty = null;
|
||||
/**
|
||||
* compiler object
|
||||
*
|
||||
* @var Smarty_Internal_Config_File_Compiler
|
||||
*/
|
||||
private $compiler = null;
|
||||
/**
|
||||
* copy of config_booleanize
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $configBooleanize = false;
|
||||
/**
|
||||
* trace file
|
||||
*
|
||||
* @var resource
|
||||
*/
|
||||
public $yyTraceFILE;
|
||||
/**
|
||||
* trace prompt
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $yyTracePrompt;
|
||||
/**
|
||||
* state names
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $state_name = array(1 => 'START', 2 => 'VALUE', 3 => 'NAKED_STRING_VALUE', 4 => 'COMMENT', 5 => 'SECTION', 6 => 'TRIPPLE');
|
||||
|
||||
/**
|
||||
* storage for assembled token patterns
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $yy_global_pattern1 = null;
|
||||
private $yy_global_pattern2 = null;
|
||||
private $yy_global_pattern3 = null;
|
||||
private $yy_global_pattern4 = null;
|
||||
private $yy_global_pattern5 = null;
|
||||
private $yy_global_pattern6 = null;
|
||||
|
||||
/**
|
||||
* token names
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $smarty_token_names = array( // Text for parser error messages
|
||||
);
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
* @param string $data template source
|
||||
* @param Smarty_Internal_Config_File_Compiler $compiler
|
||||
*/
|
||||
public function __construct($data, Smarty_Internal_Config_File_Compiler $compiler)
|
||||
{
|
||||
$this->data = $data . "\n"; //now all lines are \n-terminated
|
||||
$this->dataLength = strlen($data);
|
||||
$this->counter = 0;
|
||||
if (preg_match('/^\xEF\xBB\xBF/', $this->data, $match)) {
|
||||
$this->counter += strlen($match[0]);
|
||||
}
|
||||
$this->line = 1;
|
||||
$this->compiler = $compiler;
|
||||
$this->smarty = $compiler->smarty;
|
||||
$this->configBooleanize = $this->smarty->config_booleanize;
|
||||
}
|
||||
|
||||
public function replace ($input) {
|
||||
return $input;
|
||||
}
|
||||
|
||||
public function PrintTrace()
|
||||
{
|
||||
$this->yyTraceFILE = fopen('php://output', 'w');
|
||||
$this->yyTracePrompt = '<br>';
|
||||
}
|
||||
|
||||
|
||||
/*!lex2php
|
||||
%input $this->data
|
||||
%counter $this->counter
|
||||
%token $this->token
|
||||
%value $this->value
|
||||
%line $this->line
|
||||
commentstart = /#|;/
|
||||
openB = /\[/
|
||||
closeB = /\]/
|
||||
section = /.*?(?=[\.=\[\]\r\n])/
|
||||
equal = /=/
|
||||
whitespace = /[ \t\r]+/
|
||||
dot = /\./
|
||||
id = /[0-9]*[a-zA-Z_]\w*/
|
||||
newline = /\n/
|
||||
single_quoted_string = /'[^'\\]*(?:\\.[^'\\]*)*'(?=[ \t\r]*[\n#;])/
|
||||
double_quoted_string = /"[^"\\]*(?:\\.[^"\\]*)*"(?=[ \t\r]*[\n#;])/
|
||||
tripple_quotes = /"""/
|
||||
tripple_quotes_end = /"""(?=[ \t\r]*[\n#;])/
|
||||
text = /[\S\s]/
|
||||
float = /\d+\.\d+(?=[ \t\r]*[\n#;])/
|
||||
int = /\d+(?=[ \t\r]*[\n#;])/
|
||||
maybe_bool = /[a-zA-Z]+(?=[ \t\r]*[\n#;])/
|
||||
naked_string = /[^\n]+?(?=[ \t\r]*\n)/
|
||||
*/
|
||||
|
||||
/*!lex2php
|
||||
%statename START
|
||||
|
||||
commentstart {
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_COMMENTSTART;
|
||||
$this->yypushstate(self::COMMENT);
|
||||
}
|
||||
openB {
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_OPENB;
|
||||
$this->yypushstate(self::SECTION);
|
||||
}
|
||||
closeB {
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_CLOSEB;
|
||||
}
|
||||
equal {
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_EQUAL;
|
||||
$this->yypushstate(self::VALUE);
|
||||
}
|
||||
whitespace {
|
||||
return false;
|
||||
}
|
||||
newline {
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE;
|
||||
}
|
||||
id {
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_ID;
|
||||
}
|
||||
text {
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_OTHER;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/*!lex2php
|
||||
%statename VALUE
|
||||
|
||||
whitespace {
|
||||
return false;
|
||||
}
|
||||
float {
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_FLOAT;
|
||||
$this->yypopstate();
|
||||
}
|
||||
int {
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_INT;
|
||||
$this->yypopstate();
|
||||
}
|
||||
tripple_quotes {
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES;
|
||||
$this->yypushstate(self::TRIPPLE);
|
||||
}
|
||||
single_quoted_string {
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_SINGLE_QUOTED_STRING;
|
||||
$this->yypopstate();
|
||||
}
|
||||
double_quoted_string {
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_DOUBLE_QUOTED_STRING;
|
||||
$this->yypopstate();
|
||||
}
|
||||
maybe_bool {
|
||||
if (!$this->configBooleanize || !in_array(strtolower($this->value), array('true', 'false', 'on', 'off', 'yes', 'no')) ) {
|
||||
$this->yypopstate();
|
||||
$this->yypushstate(self::NAKED_STRING_VALUE);
|
||||
return true; //reprocess in new state
|
||||
} else {
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_BOOL;
|
||||
$this->yypopstate();
|
||||
}
|
||||
}
|
||||
naked_string {
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
|
||||
$this->yypopstate();
|
||||
}
|
||||
newline {
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
|
||||
$this->value = '';
|
||||
$this->yypopstate();
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/*!lex2php
|
||||
%statename NAKED_STRING_VALUE
|
||||
|
||||
naked_string {
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
|
||||
$this->yypopstate();
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/*!lex2php
|
||||
%statename COMMENT
|
||||
|
||||
whitespace {
|
||||
return false;
|
||||
}
|
||||
naked_string {
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
|
||||
}
|
||||
newline {
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE;
|
||||
$this->yypopstate();
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/*!lex2php
|
||||
%statename SECTION
|
||||
|
||||
dot {
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_DOT;
|
||||
}
|
||||
section {
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_SECTION;
|
||||
$this->yypopstate();
|
||||
}
|
||||
|
||||
*/
|
||||
/*!lex2php
|
||||
%statename TRIPPLE
|
||||
|
||||
tripple_quotes_end {
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES_END;
|
||||
$this->yypopstate();
|
||||
$this->yypushstate(self::START);
|
||||
}
|
||||
text {
|
||||
$to = strlen($this->data);
|
||||
preg_match("/\"\"\"[ \t\r]*[\n#;]/",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter);
|
||||
if (isset($match[0][1])) {
|
||||
$to = $match[0][1];
|
||||
} else {
|
||||
$this->compiler->trigger_config_file_error ('missing or misspelled literal closing tag');
|
||||
}
|
||||
$this->value = substr($this->data,$this->counter,$to-$this->counter);
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_TEXT;
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
|
@ -0,0 +1,346 @@
|
|||
/**
|
||||
* Smarty Internal Plugin Configfileparser
|
||||
*
|
||||
* This is the config file parser
|
||||
*
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage Config
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
%name TPC_
|
||||
%declare_class {
|
||||
/**
|
||||
* Smarty Internal Plugin Configfileparse
|
||||
*
|
||||
* This is the config file parser.
|
||||
* It is generated from the smarty_internal_configfileparser.y file
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
class Smarty_Internal_Configfileparser
|
||||
}
|
||||
%include_class
|
||||
{
|
||||
/**
|
||||
* result status
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $successful = true;
|
||||
/**
|
||||
* return value
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
public $retvalue = 0;
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
public $yymajor;
|
||||
/**
|
||||
* lexer object
|
||||
*
|
||||
* @var Smarty_Internal_Configfilelexer
|
||||
*/
|
||||
private $lex;
|
||||
/**
|
||||
* internal error flag
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $internalError = false;
|
||||
/**
|
||||
* compiler object
|
||||
*
|
||||
* @var Smarty_Internal_Config_File_Compiler
|
||||
*/
|
||||
public $compiler = null;
|
||||
/**
|
||||
* smarty object
|
||||
*
|
||||
* @var Smarty
|
||||
*/
|
||||
public $smarty = null;
|
||||
/**
|
||||
* copy of config_overwrite property
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $configOverwrite = false;
|
||||
/**
|
||||
* copy of config_read_hidden property
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $configReadHidden = false;
|
||||
/**
|
||||
* helper map
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $escapes_single = array('\\' => '\\',
|
||||
'\'' => '\'');
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
* @param Smarty_Internal_Configfilelexer $lex
|
||||
* @param Smarty_Internal_Config_File_Compiler $compiler
|
||||
*/
|
||||
public function __construct(Smarty_Internal_Configfilelexer $lex, Smarty_Internal_Config_File_Compiler $compiler)
|
||||
{
|
||||
$this->lex = $lex;
|
||||
$this->smarty = $compiler->smarty;
|
||||
$this->compiler = $compiler;
|
||||
$this->configOverwrite = $this->smarty->config_overwrite;
|
||||
$this->configReadHidden = $this->smarty->config_read_hidden;
|
||||
}
|
||||
|
||||
/**
|
||||
* parse optional boolean keywords
|
||||
*
|
||||
* @param string $str
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function parse_bool($str)
|
||||
{
|
||||
$str = strtolower($str);
|
||||
if (in_array($str, array('on', 'yes', 'true'))) {
|
||||
$res = true;
|
||||
} else {
|
||||
$res = false;
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* parse single quoted string
|
||||
* remove outer quotes
|
||||
* unescape inner quotes
|
||||
*
|
||||
* @param string $qstr
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private static function parse_single_quoted_string($qstr)
|
||||
{
|
||||
$escaped_string = substr($qstr, 1, strlen($qstr) - 2); //remove outer quotes
|
||||
|
||||
$ss = preg_split('/(\\\\.)/', $escaped_string, - 1, PREG_SPLIT_DELIM_CAPTURE);
|
||||
|
||||
$str = '';
|
||||
foreach ($ss as $s) {
|
||||
if (strlen($s) === 2 && $s[0] === '\\') {
|
||||
if (isset(self::$escapes_single[$s[1]])) {
|
||||
$s = self::$escapes_single[$s[1]];
|
||||
}
|
||||
}
|
||||
$str .= $s;
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* parse double quoted string
|
||||
*
|
||||
* @param string $qstr
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private static function parse_double_quoted_string($qstr)
|
||||
{
|
||||
$inner_str = substr($qstr, 1, strlen($qstr) - 2);
|
||||
return stripcslashes($inner_str);
|
||||
}
|
||||
|
||||
/**
|
||||
* parse triple quoted string
|
||||
*
|
||||
* @param string $qstr
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private static function parse_tripple_double_quoted_string($qstr)
|
||||
{
|
||||
return stripcslashes($qstr);
|
||||
}
|
||||
|
||||
/**
|
||||
* set a config variable in target array
|
||||
*
|
||||
* @param array $var
|
||||
* @param array $target_array
|
||||
*/
|
||||
private function set_var(array $var, array &$target_array)
|
||||
{
|
||||
$key = $var['key'];
|
||||
$value = $var['value'];
|
||||
|
||||
if ($this->configOverwrite || !isset($target_array['vars'][$key])) {
|
||||
$target_array['vars'][$key] = $value;
|
||||
} else {
|
||||
settype($target_array['vars'][$key], 'array');
|
||||
$target_array['vars'][$key][] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* add config variable to global vars
|
||||
*
|
||||
* @param array $vars
|
||||
*/
|
||||
private function add_global_vars(array $vars)
|
||||
{
|
||||
if (!isset($this->compiler->config_data['vars'])) {
|
||||
$this->compiler->config_data['vars'] = array();
|
||||
}
|
||||
foreach ($vars as $var) {
|
||||
$this->set_var($var, $this->compiler->config_data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* add config variable to section
|
||||
*
|
||||
* @param string $section_name
|
||||
* @param array $vars
|
||||
*/
|
||||
private function add_section_vars($section_name, array $vars)
|
||||
{
|
||||
if (!isset($this->compiler->config_data['sections'][$section_name]['vars'])) {
|
||||
$this->compiler->config_data['sections'][$section_name]['vars'] = array();
|
||||
}
|
||||
foreach ($vars as $var) {
|
||||
$this->set_var($var, $this->compiler->config_data['sections'][$section_name]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
%token_prefix TPC_
|
||||
|
||||
%parse_accept
|
||||
{
|
||||
$this->successful = !$this->internalError;
|
||||
$this->internalError = false;
|
||||
$this->retvalue = $this->_retvalue;
|
||||
}
|
||||
|
||||
%syntax_error
|
||||
{
|
||||
$this->internalError = true;
|
||||
$this->yymajor = $yymajor;
|
||||
$this->compiler->trigger_config_file_error();
|
||||
}
|
||||
|
||||
%stack_overflow
|
||||
{
|
||||
$this->internalError = true;
|
||||
$this->compiler->trigger_config_file_error('Stack overflow in configfile parser');
|
||||
}
|
||||
|
||||
// Complete config file
|
||||
start(res) ::= global_vars sections. {
|
||||
res = null;
|
||||
}
|
||||
|
||||
// Global vars
|
||||
global_vars(res) ::= var_list(vl). {
|
||||
$this->add_global_vars(vl);
|
||||
res = null;
|
||||
}
|
||||
|
||||
// Sections
|
||||
sections(res) ::= sections section. {
|
||||
res = null;
|
||||
}
|
||||
|
||||
sections(res) ::= . {
|
||||
res = null;
|
||||
}
|
||||
|
||||
section(res) ::= OPENB SECTION(i) CLOSEB newline var_list(vars). {
|
||||
$this->add_section_vars(i, vars);
|
||||
res = null;
|
||||
}
|
||||
|
||||
section(res) ::= OPENB DOT SECTION(i) CLOSEB newline var_list(vars). {
|
||||
if ($this->configReadHidden) {
|
||||
$this->add_section_vars(i, vars);
|
||||
}
|
||||
res = null;
|
||||
}
|
||||
|
||||
// Var list
|
||||
var_list(res) ::= var_list(vl) newline. {
|
||||
res = vl;
|
||||
}
|
||||
|
||||
var_list(res) ::= var_list(vl) var(v). {
|
||||
res = array_merge(vl, array(v));
|
||||
}
|
||||
|
||||
var_list(res) ::= . {
|
||||
res = array();
|
||||
}
|
||||
|
||||
|
||||
// Var
|
||||
var(res) ::= ID(id) EQUAL value(v). {
|
||||
res = array('key' => id, 'value' => v);
|
||||
}
|
||||
|
||||
|
||||
value(res) ::= FLOAT(i). {
|
||||
res = (float) i;
|
||||
}
|
||||
|
||||
value(res) ::= INT(i). {
|
||||
res = (int) i;
|
||||
}
|
||||
|
||||
value(res) ::= BOOL(i). {
|
||||
res = $this->parse_bool(i);
|
||||
}
|
||||
|
||||
value(res) ::= SINGLE_QUOTED_STRING(i). {
|
||||
res = self::parse_single_quoted_string(i);
|
||||
}
|
||||
|
||||
value(res) ::= DOUBLE_QUOTED_STRING(i). {
|
||||
res = self::parse_double_quoted_string(i);
|
||||
}
|
||||
|
||||
value(res) ::= TRIPPLE_QUOTES(i) TRIPPLE_TEXT(c) TRIPPLE_QUOTES_END(ii). {
|
||||
res = self::parse_tripple_double_quoted_string(c);
|
||||
}
|
||||
|
||||
value(res) ::= TRIPPLE_QUOTES(i) TRIPPLE_QUOTES_END(ii). {
|
||||
res = '';
|
||||
}
|
||||
|
||||
value(res) ::= NAKED_STRING(i). {
|
||||
res = i;
|
||||
}
|
||||
|
||||
// NOTE: this is not a valid rule
|
||||
// It is added hier to produce a usefull error message on a missing '=';
|
||||
value(res) ::= OTHER(i). {
|
||||
res = i;
|
||||
}
|
||||
|
||||
|
||||
// Newline and comments
|
||||
newline(res) ::= NEWLINE. {
|
||||
res = null;
|
||||
}
|
||||
|
||||
newline(res) ::= COMMENTSTART NEWLINE. {
|
||||
res = null;
|
||||
}
|
||||
|
||||
newline(res) ::= COMMENTSTART NAKED_STRING NEWLINE. {
|
||||
res = null;
|
||||
}
|
|
@ -0,0 +1,688 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of Smarty.
|
||||
*
|
||||
* (c) 2015 Uwe Tews
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty_Internal_Templatelexer
|
||||
* This is the template file lexer.
|
||||
* It is generated from the smarty_internal_templatelexer.plex file
|
||||
*
|
||||
*
|
||||
* @author Uwe Tews <uwe.tews@googlemail.com>
|
||||
*/
|
||||
class Smarty_Internal_Templatelexer
|
||||
{
|
||||
/**
|
||||
* Source
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $data;
|
||||
|
||||
/**
|
||||
* Source length
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $dataLength = null;
|
||||
|
||||
/**
|
||||
* byte counter
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $counter;
|
||||
|
||||
/**
|
||||
* token number
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $token;
|
||||
|
||||
/**
|
||||
* token value
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $value;
|
||||
|
||||
/**
|
||||
* current line
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $line;
|
||||
|
||||
/**
|
||||
* tag start line
|
||||
*
|
||||
* @var
|
||||
*/
|
||||
public $taglineno;
|
||||
|
||||
/**
|
||||
* php code type
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $phpType = '';
|
||||
|
||||
/**
|
||||
* state number
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $state = 1;
|
||||
|
||||
/**
|
||||
* Smarty object
|
||||
*
|
||||
* @var Smarty
|
||||
*/
|
||||
public $smarty = null;
|
||||
|
||||
/**
|
||||
* compiler object
|
||||
*
|
||||
* @var Smarty_Internal_TemplateCompilerBase
|
||||
*/
|
||||
public $compiler = null;
|
||||
|
||||
/**
|
||||
* trace file
|
||||
*
|
||||
* @var resource
|
||||
*/
|
||||
public $yyTraceFILE;
|
||||
|
||||
/**
|
||||
* trace prompt
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $yyTracePrompt;
|
||||
|
||||
/**
|
||||
* XML flag true while processing xml
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $is_xml = false;
|
||||
|
||||
/**
|
||||
* state names
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $state_name = array(1 => 'TEXT', 2 => 'TAG', 3 => 'TAGBODY', 4 => 'LITERAL', 5 => 'DOUBLEQUOTEDSTRING',);
|
||||
|
||||
/**
|
||||
* token names
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $smarty_token_names = array( // Text for parser error messages
|
||||
'NOT' => '(!,not)',
|
||||
'OPENP' => '(',
|
||||
'CLOSEP' => ')',
|
||||
'OPENB' => '[',
|
||||
'CLOSEB' => ']',
|
||||
'PTR' => '->',
|
||||
'APTR' => '=>',
|
||||
'EQUAL' => '=',
|
||||
'NUMBER' => 'number',
|
||||
'UNIMATH' => '+" , "-',
|
||||
'MATH' => '*" , "/" , "%',
|
||||
'INCDEC' => '++" , "--',
|
||||
'SPACE' => ' ',
|
||||
'DOLLAR' => '$',
|
||||
'SEMICOLON' => ';',
|
||||
'COLON' => ':',
|
||||
'DOUBLECOLON' => '::',
|
||||
'AT' => '@',
|
||||
'HATCH' => '#',
|
||||
'QUOTE' => '"',
|
||||
'BACKTICK' => '`',
|
||||
'VERT' => '"|" modifier',
|
||||
'DOT' => '.',
|
||||
'COMMA' => '","',
|
||||
'QMARK' => '"?"',
|
||||
'ID' => 'id, name',
|
||||
'TEXT' => 'text',
|
||||
'LDELSLASH' => '{/..} closing tag',
|
||||
'LDEL' => '{...} Smarty tag',
|
||||
'COMMENT' => 'comment',
|
||||
'AS' => 'as',
|
||||
'TO' => 'to',
|
||||
'PHP' => '"<?php", "<%", "{php}" tag',
|
||||
'LOGOP' => '"<", "==" ... logical operator',
|
||||
'TLOGOP' => '"lt", "eq" ... logical operator; "is div by" ... if condition',
|
||||
'SCOND' => '"is even" ... if condition',
|
||||
);
|
||||
|
||||
/**
|
||||
* literal tag nesting level
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $literal_cnt = 0;
|
||||
|
||||
/**
|
||||
* preg token pattern for state TEXT
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $yy_global_pattern1 = null;
|
||||
|
||||
/**
|
||||
* preg token pattern for state TAG
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $yy_global_pattern2 = null;
|
||||
|
||||
/**
|
||||
* preg token pattern for state TAGBODY
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $yy_global_pattern3 = null;
|
||||
|
||||
/**
|
||||
* preg token pattern for state LITERAL
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $yy_global_pattern4 = null;
|
||||
|
||||
/**
|
||||
* preg token pattern for state DOUBLEQUOTEDSTRING
|
||||
*
|
||||
* @var null
|
||||
*/
|
||||
private $yy_global_pattern5 = null;
|
||||
|
||||
/**
|
||||
* preg token pattern for text
|
||||
*
|
||||
* @var null
|
||||
*/
|
||||
private $yy_global_text = null;
|
||||
|
||||
/**
|
||||
* preg token pattern for literal
|
||||
*
|
||||
* @var null
|
||||
*/
|
||||
private $yy_global_literal = null;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
* @param string $source template source
|
||||
* @param Smarty_Internal_TemplateCompilerBase $compiler
|
||||
*/
|
||||
public function __construct($source, Smarty_Internal_TemplateCompilerBase $compiler)
|
||||
{
|
||||
$this->data = $source;
|
||||
$this->dataLength = strlen($this->data);
|
||||
$this->counter = 0;
|
||||
if (preg_match('/^\xEF\xBB\xBF/i', $this->data, $match)) {
|
||||
$this->counter += strlen($match[0]);
|
||||
}
|
||||
$this->line = 1;
|
||||
$this->smarty = $compiler->template->smarty;
|
||||
$this->compiler = $compiler;
|
||||
$this->compiler->initDelimiterPreg();
|
||||
$this->smarty_token_names['LDEL'] = $this->smarty->getLeftDelimiter();
|
||||
$this->smarty_token_names['RDEL'] = $this->smarty->getRightDelimiter();
|
||||
}
|
||||
|
||||
/**
|
||||
* open lexer/parser trace file
|
||||
*
|
||||
*/
|
||||
public function PrintTrace()
|
||||
{
|
||||
$this->yyTraceFILE = fopen('php://output', 'w');
|
||||
$this->yyTracePrompt = '<br>';
|
||||
}
|
||||
|
||||
/**
|
||||
* replace placeholders with runtime preg code
|
||||
*
|
||||
* @param string $preg
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function replace($preg)
|
||||
{
|
||||
return $this->compiler->replaceDelimiter($preg);
|
||||
}
|
||||
|
||||
/**
|
||||
* check if current value is an autoliteral left delimiter
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isAutoLiteral()
|
||||
{
|
||||
return $this->smarty->getAutoLiteral() && isset($this->value[ $this->compiler->getLdelLength() ]) ?
|
||||
strpos(" \n\t\r", $this->value[ $this->compiler->getLdelLength() ]) !== false : false;
|
||||
}
|
||||
|
||||
/*!lex2php
|
||||
%input $this->data
|
||||
%counter $this->counter
|
||||
%token $this->token
|
||||
%value $this->value
|
||||
%line $this->line
|
||||
userliteral = ~(SMARTYldel)SMARTYautoliteral\s+SMARTYliteral~
|
||||
char = ~[\S\s]~
|
||||
textdoublequoted = ~([^"\\]*?)((?:\\.[^"\\]*?)*?)(?=((SMARTYldel)SMARTYal|\$|`\$|"SMARTYliteral))~
|
||||
namespace = ~([0-9]*[a-zA-Z_]\w*)?(\\[0-9]*[a-zA-Z_]\w*)+~
|
||||
emptyjava = ~[{][}]~
|
||||
slash = ~[/]~
|
||||
ldel = ~(SMARTYldel)SMARTYal~
|
||||
rdel = ~\s*SMARTYrdel~
|
||||
nocacherdel = ~(\s+nocache)?\s*SMARTYrdel~
|
||||
smartyblockchildparent = ~[\$]smarty\.block\.(child|parent)~
|
||||
integer = ~\d+~
|
||||
hex = ~0[xX][0-9a-fA-F]+~
|
||||
math = ~\s*([*]{1,2}|[%/^&]|[<>]{2})\s*~
|
||||
comment = ~(SMARTYldel)SMARTYal[*]~
|
||||
incdec = ~([+]|[-]){2}~
|
||||
unimath = ~\s*([+]|[-])\s*~
|
||||
openP = ~\s*[(]\s*~
|
||||
closeP = ~\s*[)]~
|
||||
openB = ~\[\s*~
|
||||
closeB = ~\s*\]~
|
||||
dollar = ~[$]~
|
||||
dot = ~[.]~
|
||||
comma = ~\s*[,]\s*~
|
||||
doublecolon = ~[:]{2}~
|
||||
colon = ~\s*[:]\s*~
|
||||
at = ~[@]~
|
||||
hatch = ~[#]~
|
||||
semicolon = ~\s*[;]\s*~
|
||||
equal = ~\s*[=]\s*~
|
||||
space = ~\s+~
|
||||
ptr = ~\s*[-][>]\s*~
|
||||
aptr = ~\s*[=][>]\s*~
|
||||
singlequotestring = ~'[^'\\]*(?:\\.[^'\\]*)*'~
|
||||
backtick = ~[`]~
|
||||
vert = ~[|][@]?~
|
||||
qmark = ~\s*[?]\s*~
|
||||
constant = ~[_]+[A-Z0-9][0-9A-Z_]*|[A-Z][0-9A-Z_]*(?![0-9A-Z_]*[a-z])~
|
||||
attr = ~\s+[0-9]*[a-zA-Z_][a-zA-Z0-9_\-:]*\s*[=]\s*~
|
||||
id = ~[0-9]*[a-zA-Z_]\w*~
|
||||
literal = ~literal~
|
||||
strip = ~strip~
|
||||
lop = ~\s*([!=][=]{1,2}|[<][=>]?|[>][=]?|[&|]{2})\s*~
|
||||
slop = ~\s+(eq|ne|neq|gt|ge|gte|lt|le|lte|mod|and|or|xor)\s+~
|
||||
tlop = ~\s+is\s+(not\s+)?(odd|even|div)\s+by\s+~
|
||||
scond = ~\s+is\s+(not\s+)?(odd|even)~
|
||||
isin = ~\s+is\s+in\s+~
|
||||
as = ~\s+as\s+~
|
||||
to = ~\s+to\s+~
|
||||
step = ~\s+step\s+~
|
||||
if = ~(if|elseif|else if|while)\s+~
|
||||
for = ~for\s+~
|
||||
makenocache = ~make_nocache\s+~
|
||||
array = ~array~
|
||||
foreach = ~foreach(?![^\s])~
|
||||
setfilter = ~setfilter\s+~
|
||||
instanceof = ~\s+instanceof\s+~
|
||||
not = ~[!]\s*|not\s+~
|
||||
typecast = ~[(](int(eger)?|bool(ean)?|float|double|real|string|binary|array|object)[)]\s*~
|
||||
double_quote = ~["]~
|
||||
*/
|
||||
/*!lex2php
|
||||
%statename TEXT
|
||||
emptyjava {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
comment {
|
||||
$to = $this->dataLength;
|
||||
preg_match("/[*]{$this->compiler->getRdelPreg()}[\n]?/",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter);
|
||||
if (isset($match[0][1])) {
|
||||
$to = $match[0][1] + strlen($match[0][0]);
|
||||
} else {
|
||||
$this->compiler->trigger_template_error ("missing or misspelled comment closing tag '{$this->smarty->getRightDelimiter()}'");
|
||||
}
|
||||
$this->value = substr($this->data,$this->counter,$to-$this->counter);
|
||||
return false;
|
||||
}
|
||||
userliteral {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
ldel literal rdel {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LITERALSTART;
|
||||
$this->yypushstate(self::LITERAL);
|
||||
}
|
||||
ldel slash literal rdel {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LITERALEND;
|
||||
$this->yypushstate(self::LITERAL);
|
||||
}
|
||||
ldel {
|
||||
$this->yypushstate(self::TAG);
|
||||
return true;
|
||||
}
|
||||
char {
|
||||
if (!isset($this->yy_global_text)) {
|
||||
$this->yy_global_text = $this->replace('/(SMARTYldel)SMARTYal/isS');
|
||||
}
|
||||
$to = $this->dataLength;
|
||||
preg_match($this->yy_global_text, $this->data,$match,PREG_OFFSET_CAPTURE,$this->counter);
|
||||
if (isset($match[0][1])) {
|
||||
$to = $match[0][1];
|
||||
}
|
||||
$this->value = substr($this->data,$this->counter,$to-$this->counter);
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
*/
|
||||
/*!lex2php
|
||||
%statename TAG
|
||||
ldel if {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDELIF;
|
||||
$this->yybegin(self::TAGBODY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
ldel for {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDELFOR;
|
||||
$this->yybegin(self::TAGBODY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
ldel foreach {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;
|
||||
$this->yybegin(self::TAGBODY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
ldel setfilter {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDELSETFILTER;
|
||||
$this->yybegin(self::TAGBODY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
ldel makenocache {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDELMAKENOCACHE;
|
||||
$this->yybegin(self::TAGBODY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
ldel id nocacherdel {
|
||||
$this->yypopstate();
|
||||
$this->token = Smarty_Internal_Templateparser::TP_SIMPLETAG;
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
ldel smartyblockchildparent rdel {
|
||||
$this->yypopstate();
|
||||
$this->token = Smarty_Internal_Templateparser::TP_SMARTYBLOCKCHILDPARENT;
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
ldel slash id rdel {
|
||||
$this->yypopstate();
|
||||
$this->token = Smarty_Internal_Templateparser::TP_CLOSETAG;
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
ldel dollar id nocacherdel {
|
||||
if ($this->_yy_stack[count($this->_yy_stack)-1] === self::TEXT) {
|
||||
$this->yypopstate();
|
||||
$this->token = Smarty_Internal_Templateparser::TP_SIMPELOUTPUT;
|
||||
$this->taglineno = $this->line;
|
||||
} else {
|
||||
$this->value = $this->smarty->getLeftDelimiter();
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDEL;
|
||||
$this->yybegin(self::TAGBODY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
}
|
||||
ldel slash {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
|
||||
$this->yybegin(self::TAGBODY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
ldel {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDEL;
|
||||
$this->yybegin(self::TAGBODY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
*/
|
||||
/*!lex2php
|
||||
%statename TAGBODY
|
||||
rdel {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_RDEL;
|
||||
$this->yypopstate();
|
||||
}
|
||||
ldel {
|
||||
$this->yypushstate(self::TAG);
|
||||
return true;
|
||||
}
|
||||
double_quote {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_QUOTE;
|
||||
$this->yypushstate(self::DOUBLEQUOTEDSTRING);
|
||||
$this->compiler->enterDoubleQuote();
|
||||
}
|
||||
singlequotestring {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING;
|
||||
}
|
||||
dollar id {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
|
||||
}
|
||||
dollar {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_DOLLAR;
|
||||
}
|
||||
isin {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_ISIN;
|
||||
}
|
||||
as {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_AS;
|
||||
}
|
||||
to {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TO;
|
||||
}
|
||||
step {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_STEP;
|
||||
}
|
||||
instanceof {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_INSTANCEOF;
|
||||
}
|
||||
lop {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LOGOP;
|
||||
}
|
||||
slop {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_SLOGOP;
|
||||
}
|
||||
tlop {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TLOGOP;
|
||||
}
|
||||
scond {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_SINGLECOND;
|
||||
}
|
||||
not{
|
||||
$this->token = Smarty_Internal_Templateparser::TP_NOT;
|
||||
}
|
||||
typecast {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TYPECAST;
|
||||
}
|
||||
openP {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_OPENP;
|
||||
}
|
||||
closeP {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_CLOSEP;
|
||||
}
|
||||
openB {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_OPENB;
|
||||
}
|
||||
closeB {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_CLOSEB;
|
||||
}
|
||||
ptr {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_PTR;
|
||||
}
|
||||
aptr {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_APTR;
|
||||
}
|
||||
equal {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_EQUAL;
|
||||
}
|
||||
incdec {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_INCDEC;
|
||||
}
|
||||
unimath {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_UNIMATH;
|
||||
}
|
||||
math {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_MATH;
|
||||
}
|
||||
at {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_AT;
|
||||
}
|
||||
array openP {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_ARRAYOPEN;
|
||||
}
|
||||
hatch {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_HATCH;
|
||||
}
|
||||
attr {
|
||||
// resolve conflicts with shorttag and right_delimiter starting with '='
|
||||
if (substr($this->data, $this->counter + strlen($this->value) - 1, $this->compiler->getRdelLength()) === $this->smarty->getRightDelimiter()) {
|
||||
preg_match('/\s+/',$this->value,$match);
|
||||
$this->value = $match[0];
|
||||
$this->token = Smarty_Internal_Templateparser::TP_SPACE;
|
||||
} else {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_ATTR;
|
||||
}
|
||||
}
|
||||
namespace {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_NAMESPACE;
|
||||
}
|
||||
id {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_ID;
|
||||
}
|
||||
integer {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_INTEGER;
|
||||
}
|
||||
backtick {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
|
||||
$this->yypopstate();
|
||||
}
|
||||
vert {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_VERT;
|
||||
}
|
||||
dot {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_DOT;
|
||||
}
|
||||
comma {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_COMMA;
|
||||
}
|
||||
semicolon {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_SEMICOLON;
|
||||
}
|
||||
doublecolon {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON;
|
||||
}
|
||||
colon {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_COLON;
|
||||
}
|
||||
qmark {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_QMARK;
|
||||
}
|
||||
hex {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_HEX;
|
||||
}
|
||||
space {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_SPACE;
|
||||
}
|
||||
char {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
*/
|
||||
|
||||
/*!lex2php
|
||||
%statename LITERAL
|
||||
ldel literal rdel {
|
||||
$this->literal_cnt++;
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LITERAL;
|
||||
}
|
||||
ldel slash literal rdel {
|
||||
if ($this->literal_cnt) {
|
||||
$this->literal_cnt--;
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LITERAL;
|
||||
} else {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LITERALEND;
|
||||
$this->yypopstate();
|
||||
}
|
||||
}
|
||||
char {
|
||||
if (!isset($this->yy_global_literal)) {
|
||||
$this->yy_global_literal = $this->replace('/(SMARTYldel)SMARTYal[\/]?literalSMARTYrdel/isS');
|
||||
}
|
||||
$to = $this->dataLength;
|
||||
preg_match($this->yy_global_literal, $this->data,$match,PREG_OFFSET_CAPTURE,$this->counter);
|
||||
if (isset($match[0][1])) {
|
||||
$to = $match[0][1];
|
||||
} else {
|
||||
$this->compiler->trigger_template_error ("missing or misspelled literal closing tag");
|
||||
}
|
||||
$this->value = substr($this->data,$this->counter,$to-$this->counter);
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LITERAL;
|
||||
}
|
||||
*/
|
||||
/*!lex2php
|
||||
%statename DOUBLEQUOTEDSTRING
|
||||
userliteral {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
ldel literal rdel {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
ldel slash literal rdel {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
ldel slash {
|
||||
$this->yypushstate(self::TAG);
|
||||
return true;
|
||||
}
|
||||
ldel id {
|
||||
$this->yypushstate(self::TAG);
|
||||
return true;
|
||||
}
|
||||
ldel {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDEL;
|
||||
$this->taglineno = $this->line;
|
||||
$this->yypushstate(self::TAGBODY);
|
||||
}
|
||||
double_quote {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_QUOTE;
|
||||
$this->yypopstate();
|
||||
}
|
||||
backtick dollar {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
|
||||
$this->value = substr($this->value,0,-1);
|
||||
$this->yypushstate(self::TAGBODY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
dollar id {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
|
||||
}
|
||||
dollar {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
textdoublequoted {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
char {
|
||||
$to = $this->dataLength;
|
||||
$this->value = substr($this->data,$this->counter,$to-$this->counter);
|
||||
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
<?php
|
||||
/**
|
||||
* Smarty Autoloader
|
||||
*
|
||||
* @package Smarty
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty Autoloader
|
||||
*
|
||||
* @package Smarty
|
||||
* @author Uwe Tews
|
||||
* Usage:
|
||||
* require_once '...path/Autoloader.php';
|
||||
* Smarty_Autoloader::register();
|
||||
* or
|
||||
* include '...path/bootstrap.php';
|
||||
*
|
||||
* $smarty = new Smarty();
|
||||
*/
|
||||
class Smarty_Autoloader
|
||||
{
|
||||
/**
|
||||
* Filepath to Smarty root
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public static $SMARTY_DIR = null;
|
||||
|
||||
/**
|
||||
* Filepath to Smarty internal plugins
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public static $SMARTY_SYSPLUGINS_DIR = null;
|
||||
|
||||
/**
|
||||
* Array with Smarty core classes and their filename
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $rootClasses = array('smarty' => 'Smarty.class.php');
|
||||
|
||||
/**
|
||||
* Registers Smarty_Autoloader backward compatible to older installations.
|
||||
*
|
||||
* @param bool $prepend Whether to prepend the autoloader or not.
|
||||
*/
|
||||
public static function registerBC($prepend = false)
|
||||
{
|
||||
/**
|
||||
* register the class autoloader
|
||||
*/
|
||||
if (!defined('SMARTY_SPL_AUTOLOAD')) {
|
||||
define('SMARTY_SPL_AUTOLOAD', 0);
|
||||
}
|
||||
if (SMARTY_SPL_AUTOLOAD
|
||||
&& set_include_path(get_include_path() . PATH_SEPARATOR . SMARTY_SYSPLUGINS_DIR) !== false
|
||||
) {
|
||||
$registeredAutoLoadFunctions = spl_autoload_functions();
|
||||
if (!isset($registeredAutoLoadFunctions[ 'spl_autoload' ])) {
|
||||
spl_autoload_register();
|
||||
}
|
||||
} else {
|
||||
self::register($prepend);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers Smarty_Autoloader as an SPL autoloader.
|
||||
*
|
||||
* @param bool $prepend Whether to prepend the autoloader or not.
|
||||
*/
|
||||
public static function register($prepend = false)
|
||||
{
|
||||
self::$SMARTY_DIR = defined('SMARTY_DIR') ? SMARTY_DIR : dirname(__FILE__) . DIRECTORY_SEPARATOR;
|
||||
self::$SMARTY_SYSPLUGINS_DIR = defined('SMARTY_SYSPLUGINS_DIR') ? SMARTY_SYSPLUGINS_DIR :
|
||||
self::$SMARTY_DIR . 'sysplugins' . DIRECTORY_SEPARATOR;
|
||||
spl_autoload_register(array(__CLASS__, 'autoload'), true, $prepend);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles auto loading of classes.
|
||||
*
|
||||
* @param string $class A class name.
|
||||
*/
|
||||
public static function autoload($class)
|
||||
{
|
||||
if ($class[ 0 ] !== 'S' || strpos($class, 'Smarty') !== 0) {
|
||||
return;
|
||||
}
|
||||
$_class = strtolower($class);
|
||||
if (isset(self::$rootClasses[ $_class ])) {
|
||||
$file = self::$SMARTY_DIR . self::$rootClasses[ $_class ];
|
||||
if (is_file($file)) {
|
||||
include $file;
|
||||
}
|
||||
} else {
|
||||
$file = self::$SMARTY_SYSPLUGINS_DIR . $_class . '.php';
|
||||
if (is_file($file)) {
|
||||
include $file;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of the Smarty package.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
/**
|
||||
* Load and register Smarty Autoloader
|
||||
*/
|
||||
if (!class_exists('Smarty_Autoloader')) {
|
||||
include dirname(__FILE__) . '/Autoloader.php';
|
||||
}
|
||||
Smarty_Autoloader::register(true);
|
|
@ -0,0 +1,175 @@
|
|||
{capture name='_smarty_debug' assign=debug_output}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Smarty Debug Console</title>
|
||||
<style>
|
||||
{literal}
|
||||
body, h1, h2, h3, td, th, p {
|
||||
font-family: sans-serif;
|
||||
font-weight: normal;
|
||||
font-size: 0.9em;
|
||||
margin: 1px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
text-align: left;
|
||||
padding: 2px;
|
||||
background-color: #f0c040;
|
||||
color: black;
|
||||
font-weight: bold;
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
h2 {
|
||||
background-color: #9B410E;
|
||||
color: white;
|
||||
text-align: left;
|
||||
font-weight: bold;
|
||||
padding: 2px;
|
||||
border-top: 1px solid black;
|
||||
}
|
||||
|
||||
h3 {
|
||||
text-align: left;
|
||||
font-weight: bold;
|
||||
color: black;
|
||||
font-size: 0.7em;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
body {
|
||||
background: black;
|
||||
}
|
||||
|
||||
p, table, div {
|
||||
background: #f0ead8;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
font-style: italic;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
th, td {
|
||||
font-family: monospace;
|
||||
vertical-align: top;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
td {
|
||||
color: green;
|
||||
}
|
||||
|
||||
tr:nth-child(odd) {
|
||||
background-color: #eeeeee;
|
||||
}
|
||||
|
||||
tr:nth-child(even) {
|
||||
background-color: #fafafa;
|
||||
}
|
||||
|
||||
.exectime {
|
||||
font-size: 0.8em;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
#bold div {
|
||||
color: black;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#blue h3 {
|
||||
color: blue;
|
||||
}
|
||||
|
||||
#normal div {
|
||||
color: black;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
#table_assigned_vars th {
|
||||
color: blue;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#table_config_vars th {
|
||||
color: maroon;
|
||||
}
|
||||
{/literal}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Smarty {Smarty::SMARTY_VERSION} Debug Console
|
||||
- {if isset($template_name)}{$template_name|debug_print_var nofilter} {/if}{if !empty($template_data)}Total Time {$execution_time|string_format:"%.5f"}{/if}</h1>
|
||||
|
||||
{if !empty($template_data)}
|
||||
<h2>included templates & config files (load time in seconds)</h2>
|
||||
<div>
|
||||
{foreach $template_data as $template}
|
||||
<span style="color: brown;">{$template.name}</span>
|
||||
<br> <span class="exectime">
|
||||
(compile {$template['compile_time']|string_format:"%.5f"}) (render {$template['render_time']|string_format:"%.5f"}) (cache {$template['cache_time']|string_format:"%.5f"})
|
||||
</span>
|
||||
<br>
|
||||
{/foreach}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<h2>assigned template variables</h2>
|
||||
|
||||
<table id="table_assigned_vars">
|
||||
{foreach $assigned_vars as $vars}
|
||||
<tr>
|
||||
<td>
|
||||
<h3 style="color: blue;">${$vars@key}</h3>
|
||||
{if isset($vars['nocache'])}<strong>Nocache</strong><br>{/if}
|
||||
{if isset($vars['scope'])}<strong>Origin:</strong> {$vars['scope']|debug_print_var nofilter}{/if}
|
||||
</td>
|
||||
<td>
|
||||
<h3>Value</h3>
|
||||
{$vars['value']|debug_print_var:10:80 nofilter}
|
||||
</td>
|
||||
<td>
|
||||
{if isset($vars['attributes'])}
|
||||
<h3>Attributes</h3>
|
||||
{$vars['attributes']|debug_print_var nofilter}
|
||||
{/if}
|
||||
</td>
|
||||
{/foreach}
|
||||
</table>
|
||||
|
||||
<h2>assigned config file variables</h2>
|
||||
|
||||
<table id="table_config_vars">
|
||||
{foreach $config_vars as $vars}
|
||||
<tr>
|
||||
<td>
|
||||
<h3 style="color: blue;">#{$vars@key}#</h3>
|
||||
{if isset($vars['scope'])}<strong>Origin:</strong> {$vars['scope']|debug_print_var nofilter}{/if}
|
||||
</td>
|
||||
<td>
|
||||
{$vars['value']|debug_print_var:10:80 nofilter}
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
{/capture}
|
||||
<script type="text/javascript">
|
||||
{$id = '__Smarty__'}
|
||||
{if $display_mode}{$id = "$offset$template_name"|md5}{/if}
|
||||
_smarty_console = window.open("", "console{$id}", "width=1024,height=600,left={$offset},top={$offset},resizable,scrollbars=yes");
|
||||
_smarty_console.document.write("{$debug_output|escape:'javascript' nofilter}");
|
||||
_smarty_console.document.close();
|
||||
</script>
|
|
@ -0,0 +1,121 @@
|
|||
<?php
|
||||
/**
|
||||
* Smarty plugin to format text blocks
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage PluginsBlock
|
||||
*/
|
||||
/**
|
||||
* Smarty {textformat}{/textformat} block plugin
|
||||
* Type: block function
|
||||
* Name: textformat
|
||||
* Purpose: format text a certain way with preset styles
|
||||
* or custom wrap/indent settings
|
||||
* Params:
|
||||
*
|
||||
* - style - string (email)
|
||||
* - indent - integer (0)
|
||||
* - wrap - integer (80)
|
||||
* - wrap_char - string ("\n")
|
||||
* - indent_char - string (" ")
|
||||
* - wrap_boundary - boolean (true)
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.function.textformat.php {textformat}
|
||||
* (Smarty online manual)
|
||||
*
|
||||
* @param array $params parameters
|
||||
* @param string $content contents of the block
|
||||
* @param Smarty_Internal_Template $template template object
|
||||
* @param boolean &$repeat repeat flag
|
||||
*
|
||||
* @return string content re-formatted
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
* @throws \SmartyException
|
||||
*/
|
||||
function smarty_block_textformat($params, $content, Smarty_Internal_Template $template, &$repeat)
|
||||
{
|
||||
if (is_null($content)) {
|
||||
return;
|
||||
}
|
||||
if (Smarty::$_MBSTRING) {
|
||||
$template->_checkPlugins(
|
||||
array(
|
||||
array(
|
||||
'function' => 'smarty_modifier_mb_wordwrap',
|
||||
'file' => SMARTY_PLUGINS_DIR . 'modifier.mb_wordwrap.php'
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
$style = null;
|
||||
$indent = 0;
|
||||
$indent_first = 0;
|
||||
$indent_char = ' ';
|
||||
$wrap = 80;
|
||||
$wrap_char = "\n";
|
||||
$wrap_cut = false;
|
||||
$assign = null;
|
||||
foreach ($params as $_key => $_val) {
|
||||
switch ($_key) {
|
||||
case 'style':
|
||||
case 'indent_char':
|
||||
case 'wrap_char':
|
||||
case 'assign':
|
||||
$$_key = (string)$_val;
|
||||
break;
|
||||
case 'indent':
|
||||
case 'indent_first':
|
||||
case 'wrap':
|
||||
$$_key = (int)$_val;
|
||||
break;
|
||||
case 'wrap_cut':
|
||||
$$_key = (bool)$_val;
|
||||
break;
|
||||
default:
|
||||
trigger_error("textformat: unknown attribute '{$_key}'");
|
||||
}
|
||||
}
|
||||
if ($style === 'email') {
|
||||
$wrap = 72;
|
||||
}
|
||||
// split into paragraphs
|
||||
$_paragraphs = preg_split('![\r\n]{2}!', $content);
|
||||
foreach ($_paragraphs as &$_paragraph) {
|
||||
if (!$_paragraph) {
|
||||
continue;
|
||||
}
|
||||
// convert mult. spaces & special chars to single space
|
||||
$_paragraph =
|
||||
preg_replace(
|
||||
array(
|
||||
'!\s+!' . Smarty::$_UTF8_MODIFIER,
|
||||
'!(^\s+)|(\s+$)!' . Smarty::$_UTF8_MODIFIER
|
||||
),
|
||||
array(
|
||||
' ',
|
||||
''
|
||||
),
|
||||
$_paragraph
|
||||
);
|
||||
// indent first line
|
||||
if ($indent_first > 0) {
|
||||
$_paragraph = str_repeat($indent_char, $indent_first) . $_paragraph;
|
||||
}
|
||||
// wordwrap sentences
|
||||
if (Smarty::$_MBSTRING) {
|
||||
$_paragraph = smarty_modifier_mb_wordwrap($_paragraph, $wrap - $indent, $wrap_char, $wrap_cut);
|
||||
} else {
|
||||
$_paragraph = wordwrap($_paragraph, $wrap - $indent, $wrap_char, $wrap_cut);
|
||||
}
|
||||
// indent lines
|
||||
if ($indent > 0) {
|
||||
$_paragraph = preg_replace('!^!m', str_repeat($indent_char, $indent), $_paragraph);
|
||||
}
|
||||
}
|
||||
$_output = implode($wrap_char . $wrap_char, $_paragraphs);
|
||||
if ($assign) {
|
||||
$template->assign($assign, $_output);
|
||||
} else {
|
||||
return $_output;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
/**
|
||||
* Smarty plugin
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage PluginsFunction
|
||||
*/
|
||||
/**
|
||||
* Smarty {counter} function plugin
|
||||
* Type: function
|
||||
* Name: counter
|
||||
* Purpose: print out a counter value
|
||||
*
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
* @link https://www.smarty.net/manual/en/language.function.counter.php {counter}
|
||||
* (Smarty online manual)
|
||||
*
|
||||
* @param array $params parameters
|
||||
* @param Smarty_Internal_Template $template template object
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
function smarty_function_counter($params, $template)
|
||||
{
|
||||
static $counters = array();
|
||||
$name = (isset($params[ 'name' ])) ? $params[ 'name' ] : 'default';
|
||||
if (!isset($counters[ $name ])) {
|
||||
$counters[ $name ] = array('start' => 1, 'skip' => 1, 'direction' => 'up', 'count' => 1);
|
||||
}
|
||||
$counter =& $counters[ $name ];
|
||||
if (isset($params[ 'start' ])) {
|
||||
$counter[ 'start' ] = $counter[ 'count' ] = (int)$params[ 'start' ];
|
||||
}
|
||||
if (!empty($params[ 'assign' ])) {
|
||||
$counter[ 'assign' ] = $params[ 'assign' ];
|
||||
}
|
||||
if (isset($counter[ 'assign' ])) {
|
||||
$template->assign($counter[ 'assign' ], $counter[ 'count' ]);
|
||||
}
|
||||
if (isset($params[ 'print' ])) {
|
||||
$print = (bool)$params[ 'print' ];
|
||||
} else {
|
||||
$print = empty($counter[ 'assign' ]);
|
||||
}
|
||||
if ($print) {
|
||||
$retval = $counter[ 'count' ];
|
||||
} else {
|
||||
$retval = null;
|
||||
}
|
||||
if (isset($params[ 'skip' ])) {
|
||||
$counter[ 'skip' ] = $params[ 'skip' ];
|
||||
}
|
||||
if (isset($params[ 'direction' ])) {
|
||||
$counter[ 'direction' ] = $params[ 'direction' ];
|
||||
}
|
||||
if ($counter[ 'direction' ] === 'down') {
|
||||
$counter[ 'count' ] -= $counter[ 'skip' ];
|
||||
} else {
|
||||
$counter[ 'count' ] += $counter[ 'skip' ];
|
||||
}
|
||||
return $retval;
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
<?php
|
||||
/**
|
||||
* Smarty plugin
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage PluginsFunction
|
||||
*/
|
||||
/**
|
||||
* Smarty {cycle} function plugin
|
||||
* Type: function
|
||||
* Name: cycle
|
||||
* Date: May 3, 2002
|
||||
* Purpose: cycle through given values
|
||||
* Params:
|
||||
*
|
||||
* - name - name of cycle (optional)
|
||||
* - values - comma separated list of values to cycle, or an array of values to cycle
|
||||
* (this can be left out for subsequent calls)
|
||||
* - reset - boolean - resets given var to true
|
||||
* - print - boolean - print var or not. default is true
|
||||
* - advance - boolean - whether or not to advance the cycle
|
||||
* - delimiter - the value delimiter, default is ","
|
||||
* - assign - boolean, assigns to template var instead of printed.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* {cycle values="#eeeeee,#d0d0d0d"}
|
||||
* {cycle name=row values="one,two,three" reset=true}
|
||||
* {cycle name=row}
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.function.cycle.php {cycle}
|
||||
* (Smarty online manual)
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
* @author credit to Mark Priatel <mpriatel@rogers.com>
|
||||
* @author credit to Gerard <gerard@interfold.com>
|
||||
* @author credit to Jason Sweat <jsweat_php@yahoo.com>
|
||||
* @version 1.3
|
||||
*
|
||||
* @param array $params parameters
|
||||
* @param Smarty_Internal_Template $template template object
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
function smarty_function_cycle($params, $template)
|
||||
{
|
||||
static $cycle_vars;
|
||||
$name = (empty($params[ 'name' ])) ? 'default' : $params[ 'name' ];
|
||||
$print = (isset($params[ 'print' ])) ? (bool)$params[ 'print' ] : true;
|
||||
$advance = (isset($params[ 'advance' ])) ? (bool)$params[ 'advance' ] : true;
|
||||
$reset = (isset($params[ 'reset' ])) ? (bool)$params[ 'reset' ] : false;
|
||||
if (!isset($params[ 'values' ])) {
|
||||
if (!isset($cycle_vars[ $name ][ 'values' ])) {
|
||||
trigger_error('cycle: missing \'values\' parameter');
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (isset($cycle_vars[ $name ][ 'values' ]) && $cycle_vars[ $name ][ 'values' ] !== $params[ 'values' ]) {
|
||||
$cycle_vars[ $name ][ 'index' ] = 0;
|
||||
}
|
||||
$cycle_vars[ $name ][ 'values' ] = $params[ 'values' ];
|
||||
}
|
||||
if (isset($params[ 'delimiter' ])) {
|
||||
$cycle_vars[ $name ][ 'delimiter' ] = $params[ 'delimiter' ];
|
||||
} elseif (!isset($cycle_vars[ $name ][ 'delimiter' ])) {
|
||||
$cycle_vars[ $name ][ 'delimiter' ] = ',';
|
||||
}
|
||||
if (is_array($cycle_vars[ $name ][ 'values' ])) {
|
||||
$cycle_array = $cycle_vars[ $name ][ 'values' ];
|
||||
} else {
|
||||
$cycle_array = explode($cycle_vars[ $name ][ 'delimiter' ], $cycle_vars[ $name ][ 'values' ]);
|
||||
}
|
||||
if (!isset($cycle_vars[ $name ][ 'index' ]) || $reset) {
|
||||
$cycle_vars[ $name ][ 'index' ] = 0;
|
||||
}
|
||||
if (isset($params[ 'assign' ])) {
|
||||
$print = false;
|
||||
$template->assign($params[ 'assign' ], $cycle_array[ $cycle_vars[ $name ][ 'index' ] ]);
|
||||
}
|
||||
if ($print) {
|
||||
$retval = $cycle_array[ $cycle_vars[ $name ][ 'index' ] ];
|
||||
} else {
|
||||
$retval = null;
|
||||
}
|
||||
if ($advance) {
|
||||
if ($cycle_vars[ $name ][ 'index' ] >= count($cycle_array) - 1) {
|
||||
$cycle_vars[ $name ][ 'index' ] = 0;
|
||||
} else {
|
||||
$cycle_vars[ $name ][ 'index' ]++;
|
||||
}
|
||||
}
|
||||
return $retval;
|
||||
}
|
|
@ -0,0 +1,204 @@
|
|||
<?php
|
||||
/**
|
||||
* Smarty plugin
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage PluginsFunction
|
||||
*/
|
||||
/**
|
||||
* Smarty {fetch} plugin
|
||||
* Type: function
|
||||
* Name: fetch
|
||||
* Purpose: fetch file, web or ftp data and display results
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.function.fetch.php {fetch}
|
||||
* (Smarty online manual)
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
*
|
||||
* @param array $params parameters
|
||||
* @param Smarty_Internal_Template $template template object
|
||||
*
|
||||
* @throws SmartyException
|
||||
* @return string|null if the assign parameter is passed, Smarty assigns the result to a template variable
|
||||
*/
|
||||
function smarty_function_fetch($params, $template)
|
||||
{
|
||||
if (empty($params[ 'file' ])) {
|
||||
trigger_error('[plugin] fetch parameter \'file\' cannot be empty', E_USER_NOTICE);
|
||||
return;
|
||||
}
|
||||
// strip file protocol
|
||||
if (stripos($params[ 'file' ], 'file://') === 0) {
|
||||
$params[ 'file' ] = substr($params[ 'file' ], 7);
|
||||
}
|
||||
$protocol = strpos($params[ 'file' ], '://');
|
||||
if ($protocol !== false) {
|
||||
$protocol = strtolower(substr($params[ 'file' ], 0, $protocol));
|
||||
}
|
||||
if (isset($template->smarty->security_policy)) {
|
||||
if ($protocol) {
|
||||
// remote resource (or php stream, …)
|
||||
if (!$template->smarty->security_policy->isTrustedUri($params[ 'file' ])) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// local file
|
||||
if (!$template->smarty->security_policy->isTrustedResourceDir($params[ 'file' ])) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
$content = '';
|
||||
if ($protocol === 'http') {
|
||||
// http fetch
|
||||
if ($uri_parts = parse_url($params[ 'file' ])) {
|
||||
// set defaults
|
||||
$host = $server_name = $uri_parts[ 'host' ];
|
||||
$timeout = 30;
|
||||
$accept = 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*';
|
||||
$agent = 'Smarty Template Engine ' . Smarty::SMARTY_VERSION;
|
||||
$referer = '';
|
||||
$uri = !empty($uri_parts[ 'path' ]) ? $uri_parts[ 'path' ] : '/';
|
||||
$uri .= !empty($uri_parts[ 'query' ]) ? '?' . $uri_parts[ 'query' ] : '';
|
||||
$_is_proxy = false;
|
||||
if (empty($uri_parts[ 'port' ])) {
|
||||
$port = 80;
|
||||
} else {
|
||||
$port = $uri_parts[ 'port' ];
|
||||
}
|
||||
if (!empty($uri_parts[ 'user' ])) {
|
||||
$user = $uri_parts[ 'user' ];
|
||||
}
|
||||
if (!empty($uri_parts[ 'pass' ])) {
|
||||
$pass = $uri_parts[ 'pass' ];
|
||||
}
|
||||
// loop through parameters, setup headers
|
||||
foreach ($params as $param_key => $param_value) {
|
||||
switch ($param_key) {
|
||||
case 'file':
|
||||
case 'assign':
|
||||
case 'assign_headers':
|
||||
break;
|
||||
case 'user':
|
||||
if (!empty($param_value)) {
|
||||
$user = $param_value;
|
||||
}
|
||||
break;
|
||||
case 'pass':
|
||||
if (!empty($param_value)) {
|
||||
$pass = $param_value;
|
||||
}
|
||||
break;
|
||||
case 'accept':
|
||||
if (!empty($param_value)) {
|
||||
$accept = $param_value;
|
||||
}
|
||||
break;
|
||||
case 'header':
|
||||
if (!empty($param_value)) {
|
||||
if (!preg_match('![\w\d-]+: .+!', $param_value)) {
|
||||
trigger_error("[plugin] invalid header format '{$param_value}'", E_USER_NOTICE);
|
||||
return;
|
||||
} else {
|
||||
$extra_headers[] = $param_value;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'proxy_host':
|
||||
if (!empty($param_value)) {
|
||||
$proxy_host = $param_value;
|
||||
}
|
||||
break;
|
||||
case 'proxy_port':
|
||||
if (!preg_match('!\D!', $param_value)) {
|
||||
$proxy_port = (int)$param_value;
|
||||
} else {
|
||||
trigger_error("[plugin] invalid value for attribute '{$param_key }'", E_USER_NOTICE);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case 'agent':
|
||||
if (!empty($param_value)) {
|
||||
$agent = $param_value;
|
||||
}
|
||||
break;
|
||||
case 'referer':
|
||||
if (!empty($param_value)) {
|
||||
$referer = $param_value;
|
||||
}
|
||||
break;
|
||||
case 'timeout':
|
||||
if (!preg_match('!\D!', $param_value)) {
|
||||
$timeout = (int)$param_value;
|
||||
} else {
|
||||
trigger_error("[plugin] invalid value for attribute '{$param_key}'", E_USER_NOTICE);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
trigger_error("[plugin] unrecognized attribute '{$param_key}'", E_USER_NOTICE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!empty($proxy_host) && !empty($proxy_port)) {
|
||||
$_is_proxy = true;
|
||||
$fp = fsockopen($proxy_host, $proxy_port, $errno, $errstr, $timeout);
|
||||
} else {
|
||||
$fp = fsockopen($server_name, $port, $errno, $errstr, $timeout);
|
||||
}
|
||||
if (!$fp) {
|
||||
trigger_error("[plugin] unable to fetch: $errstr ($errno)", E_USER_NOTICE);
|
||||
return;
|
||||
} else {
|
||||
if ($_is_proxy) {
|
||||
fputs($fp, 'GET ' . $params[ 'file' ] . " HTTP/1.0\r\n");
|
||||
} else {
|
||||
fputs($fp, "GET $uri HTTP/1.0\r\n");
|
||||
}
|
||||
if (!empty($host)) {
|
||||
fputs($fp, "Host: $host\r\n");
|
||||
}
|
||||
if (!empty($accept)) {
|
||||
fputs($fp, "Accept: $accept\r\n");
|
||||
}
|
||||
if (!empty($agent)) {
|
||||
fputs($fp, "User-Agent: $agent\r\n");
|
||||
}
|
||||
if (!empty($referer)) {
|
||||
fputs($fp, "Referer: $referer\r\n");
|
||||
}
|
||||
if (isset($extra_headers) && is_array($extra_headers)) {
|
||||
foreach ($extra_headers as $curr_header) {
|
||||
fputs($fp, $curr_header . "\r\n");
|
||||
}
|
||||
}
|
||||
if (!empty($user) && !empty($pass)) {
|
||||
fputs($fp, 'Authorization: BASIC ' . base64_encode("$user:$pass") . "\r\n");
|
||||
}
|
||||
fputs($fp, "\r\n");
|
||||
while (!feof($fp)) {
|
||||
$content .= fgets($fp, 4096);
|
||||
}
|
||||
fclose($fp);
|
||||
$csplit = preg_split("!\r\n\r\n!", $content, 2);
|
||||
$content = $csplit[ 1 ];
|
||||
if (!empty($params[ 'assign_headers' ])) {
|
||||
$template->assign($params[ 'assign_headers' ], preg_split("!\r\n!", $csplit[ 0 ]));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
trigger_error("[plugin fetch] unable to parse URL, check syntax", E_USER_NOTICE);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
$content = @file_get_contents($params[ 'file' ]);
|
||||
if ($content === false) {
|
||||
throw new SmartyException("{fetch} cannot read resource '" . $params[ 'file' ] . "'");
|
||||
}
|
||||
}
|
||||
if (!empty($params[ 'assign' ])) {
|
||||
$template->assign($params[ 'assign' ], $content);
|
||||
} else {
|
||||
return $content;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,286 @@
|
|||
<?php
|
||||
/**
|
||||
* Smarty plugin
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage PluginsFunction
|
||||
*/
|
||||
/**
|
||||
* Smarty {html_checkboxes} function plugin
|
||||
* File: function.html_checkboxes.php
|
||||
* Type: function
|
||||
* Name: html_checkboxes
|
||||
* Date: 24.Feb.2003
|
||||
* Purpose: Prints out a list of checkbox input types
|
||||
* Examples:
|
||||
*
|
||||
* {html_checkboxes values=$ids output=$names}
|
||||
* {html_checkboxes values=$ids name='box' separator='<br>' output=$names}
|
||||
* {html_checkboxes values=$ids checked=$checked separator='<br>' output=$names}
|
||||
*
|
||||
* Params:
|
||||
*
|
||||
* - name (optional) - string default "checkbox"
|
||||
* - values (required) - array
|
||||
* - options (optional) - associative array
|
||||
* - checked (optional) - array default not set
|
||||
* - separator (optional) - ie <br> or
|
||||
* - output (optional) - the output next to each checkbox
|
||||
* - assign (optional) - assign the output as an array to this variable
|
||||
* - escape (optional) - escape the content (not value), defaults to true
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.function.html.checkboxes.php {html_checkboxes}
|
||||
* (Smarty online manual)
|
||||
* @author Christopher Kvarme <christopher.kvarme@flashjab.com>
|
||||
* @author credits to Monte Ohrt <monte at ohrt dot com>
|
||||
* @version 1.0
|
||||
*
|
||||
* @param array $params parameters
|
||||
* @param Smarty_Internal_Template $template template object
|
||||
*
|
||||
* @return string
|
||||
* @uses smarty_function_escape_special_chars()
|
||||
* @throws \SmartyException
|
||||
*/
|
||||
function smarty_function_html_checkboxes($params, Smarty_Internal_Template $template)
|
||||
{
|
||||
$template->_checkPlugins(
|
||||
array(
|
||||
array(
|
||||
'function' => 'smarty_function_escape_special_chars',
|
||||
'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'
|
||||
)
|
||||
)
|
||||
);
|
||||
$name = 'checkbox';
|
||||
$values = null;
|
||||
$options = null;
|
||||
$selected = array();
|
||||
$separator = '';
|
||||
$escape = true;
|
||||
$labels = true;
|
||||
$label_ids = false;
|
||||
$output = null;
|
||||
$extra = '';
|
||||
foreach ($params as $_key => $_val) {
|
||||
switch ($_key) {
|
||||
case 'name':
|
||||
case 'separator':
|
||||
$$_key = (string)$_val;
|
||||
break;
|
||||
case 'escape':
|
||||
case 'labels':
|
||||
case 'label_ids':
|
||||
$$_key = (bool)$_val;
|
||||
break;
|
||||
case 'options':
|
||||
$$_key = (array)$_val;
|
||||
break;
|
||||
case 'values':
|
||||
case 'output':
|
||||
$$_key = array_values((array)$_val);
|
||||
break;
|
||||
case 'checked':
|
||||
case 'selected':
|
||||
if (is_array($_val)) {
|
||||
$selected = array();
|
||||
foreach ($_val as $_sel) {
|
||||
if (is_object($_sel)) {
|
||||
if (method_exists($_sel, '__toString')) {
|
||||
$_sel = smarty_function_escape_special_chars((string)$_sel->__toString());
|
||||
} else {
|
||||
trigger_error(
|
||||
'html_checkboxes: selected attribute contains an object of class \'' .
|
||||
get_class($_sel) . '\' without __toString() method',
|
||||
E_USER_NOTICE
|
||||
);
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
$_sel = smarty_function_escape_special_chars((string)$_sel);
|
||||
}
|
||||
$selected[ $_sel ] = true;
|
||||
}
|
||||
} elseif (is_object($_val)) {
|
||||
if (method_exists($_val, '__toString')) {
|
||||
$selected = smarty_function_escape_special_chars((string)$_val->__toString());
|
||||
} else {
|
||||
trigger_error(
|
||||
'html_checkboxes: selected attribute is an object of class \'' . get_class($_val) .
|
||||
'\' without __toString() method',
|
||||
E_USER_NOTICE
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$selected = smarty_function_escape_special_chars((string)$_val);
|
||||
}
|
||||
break;
|
||||
case 'checkboxes':
|
||||
trigger_error(
|
||||
'html_checkboxes: the use of the "checkboxes" attribute is deprecated, use "options" instead',
|
||||
E_USER_WARNING
|
||||
);
|
||||
$options = (array)$_val;
|
||||
break;
|
||||
case 'assign':
|
||||
break;
|
||||
case 'strict':
|
||||
break;
|
||||
case 'disabled':
|
||||
case 'readonly':
|
||||
if (!empty($params[ 'strict' ])) {
|
||||
if (!is_scalar($_val)) {
|
||||
trigger_error(
|
||||
"html_options: {$_key} attribute must be a scalar, only boolean true or string '{$_key}' will actually add the attribute",
|
||||
E_USER_NOTICE
|
||||
);
|
||||
}
|
||||
if ($_val === true || $_val === $_key) {
|
||||
$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"';
|
||||
}
|
||||
break;
|
||||
}
|
||||
// omit break; to fall through!
|
||||
// no break
|
||||
default:
|
||||
if (!is_array($_val)) {
|
||||
$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
|
||||
} else {
|
||||
trigger_error("html_checkboxes: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isset($options) && !isset($values)) {
|
||||
return '';
|
||||
} /* raise error here? */
|
||||
$_html_result = array();
|
||||
if (isset($options)) {
|
||||
foreach ($options as $_key => $_val) {
|
||||
$_html_result[] =
|
||||
smarty_function_html_checkboxes_output(
|
||||
$name,
|
||||
$_key,
|
||||
$_val,
|
||||
$selected,
|
||||
$extra,
|
||||
$separator,
|
||||
$labels,
|
||||
$label_ids,
|
||||
$escape
|
||||
);
|
||||
}
|
||||
} else {
|
||||
foreach ($values as $_i => $_key) {
|
||||
$_val = isset($output[ $_i ]) ? $output[ $_i ] : '';
|
||||
$_html_result[] =
|
||||
smarty_function_html_checkboxes_output(
|
||||
$name,
|
||||
$_key,
|
||||
$_val,
|
||||
$selected,
|
||||
$extra,
|
||||
$separator,
|
||||
$labels,
|
||||
$label_ids,
|
||||
$escape
|
||||
);
|
||||
}
|
||||
}
|
||||
if (!empty($params[ 'assign' ])) {
|
||||
$template->assign($params[ 'assign' ], $_html_result);
|
||||
} else {
|
||||
return implode("\n", $_html_result);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param $value
|
||||
* @param $output
|
||||
* @param $selected
|
||||
* @param $extra
|
||||
* @param $separator
|
||||
* @param $labels
|
||||
* @param $label_ids
|
||||
* @param bool $escape
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function smarty_function_html_checkboxes_output(
|
||||
$name,
|
||||
$value,
|
||||
$output,
|
||||
$selected,
|
||||
$extra,
|
||||
$separator,
|
||||
$labels,
|
||||
$label_ids,
|
||||
$escape = true
|
||||
) {
|
||||
$_output = '';
|
||||
if (is_object($value)) {
|
||||
if (method_exists($value, '__toString')) {
|
||||
$value = (string)$value->__toString();
|
||||
} else {
|
||||
trigger_error(
|
||||
'html_options: value is an object of class \'' . get_class($value) .
|
||||
'\' without __toString() method',
|
||||
E_USER_NOTICE
|
||||
);
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
$value = (string)$value;
|
||||
}
|
||||
if (is_object($output)) {
|
||||
if (method_exists($output, '__toString')) {
|
||||
$output = (string)$output->__toString();
|
||||
} else {
|
||||
trigger_error(
|
||||
'html_options: output is an object of class \'' . get_class($output) .
|
||||
'\' without __toString() method',
|
||||
E_USER_NOTICE
|
||||
);
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
$output = (string)$output;
|
||||
}
|
||||
if ($labels) {
|
||||
if ($label_ids) {
|
||||
$_id = smarty_function_escape_special_chars(
|
||||
preg_replace(
|
||||
'![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER,
|
||||
'_',
|
||||
$name . '_' . $value
|
||||
)
|
||||
);
|
||||
$_output .= '<label for="' . $_id . '">';
|
||||
} else {
|
||||
$_output .= '<label>';
|
||||
}
|
||||
}
|
||||
$name = smarty_function_escape_special_chars($name);
|
||||
$value = smarty_function_escape_special_chars($value);
|
||||
if ($escape) {
|
||||
$output = smarty_function_escape_special_chars($output);
|
||||
}
|
||||
$_output .= '<input type="checkbox" name="' . $name . '[]" value="' . $value . '"';
|
||||
if ($labels && $label_ids) {
|
||||
$_output .= ' id="' . $_id . '"';
|
||||
}
|
||||
if (is_array($selected)) {
|
||||
if (isset($selected[ $value ])) {
|
||||
$_output .= ' checked="checked"';
|
||||
}
|
||||
} elseif ($value === $selected) {
|
||||
$_output .= ' checked="checked"';
|
||||
}
|
||||
$_output .= $extra . ' />' . $output;
|
||||
if ($labels) {
|
||||
$_output .= '</label>';
|
||||
}
|
||||
$_output .= $separator;
|
||||
return $_output;
|
||||
}
|
|
@ -0,0 +1,158 @@
|
|||
<?php
|
||||
/**
|
||||
* Smarty plugin
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage PluginsFunction
|
||||
*/
|
||||
/**
|
||||
* Smarty {html_image} function plugin
|
||||
* Type: function
|
||||
* Name: html_image
|
||||
* Date: Feb 24, 2003
|
||||
* Purpose: format HTML tags for the image
|
||||
* Examples: {html_image file="/images/masthead.gif"}
|
||||
* Output: <img src="/images/masthead.gif" width=400 height=23>
|
||||
* Params:
|
||||
*
|
||||
* - file - (required) - file (and path) of image
|
||||
* - height - (optional) - image height (default actual height)
|
||||
* - width - (optional) - image width (default actual width)
|
||||
* - basedir - (optional) - base directory for absolute paths, default is environment variable DOCUMENT_ROOT
|
||||
* - path_prefix - prefix for path output (optional, default empty)
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.function.html.image.php {html_image}
|
||||
* (Smarty online manual)
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
* @author credits to Duda <duda@big.hu>
|
||||
* @version 1.0
|
||||
*
|
||||
* @param array $params parameters
|
||||
* @param Smarty_Internal_Template $template template object
|
||||
*
|
||||
* @throws SmartyException
|
||||
* @return string
|
||||
* @uses smarty_function_escape_special_chars()
|
||||
*/
|
||||
function smarty_function_html_image($params, Smarty_Internal_Template $template)
|
||||
{
|
||||
$template->_checkPlugins(
|
||||
array(
|
||||
array(
|
||||
'function' => 'smarty_function_escape_special_chars',
|
||||
'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'
|
||||
)
|
||||
)
|
||||
);
|
||||
$alt = '';
|
||||
$file = '';
|
||||
$height = '';
|
||||
$width = '';
|
||||
$extra = '';
|
||||
$prefix = '';
|
||||
$suffix = '';
|
||||
$path_prefix = '';
|
||||
$basedir = isset($_SERVER[ 'DOCUMENT_ROOT' ]) ? $_SERVER[ 'DOCUMENT_ROOT' ] : '';
|
||||
foreach ($params as $_key => $_val) {
|
||||
switch ($_key) {
|
||||
case 'file':
|
||||
case 'height':
|
||||
case 'width':
|
||||
case 'dpi':
|
||||
case 'path_prefix':
|
||||
case 'basedir':
|
||||
$$_key = $_val;
|
||||
break;
|
||||
case 'alt':
|
||||
if (!is_array($_val)) {
|
||||
$$_key = smarty_function_escape_special_chars($_val);
|
||||
} else {
|
||||
throw new SmartyException(
|
||||
"html_image: extra attribute '{$_key}' cannot be an array",
|
||||
E_USER_NOTICE
|
||||
);
|
||||
}
|
||||
break;
|
||||
case 'link':
|
||||
case 'href':
|
||||
$prefix = '<a href="' . $_val . '">';
|
||||
$suffix = '</a>';
|
||||
break;
|
||||
default:
|
||||
if (!is_array($_val)) {
|
||||
$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
|
||||
} else {
|
||||
throw new SmartyException(
|
||||
"html_image: extra attribute '{$_key}' cannot be an array",
|
||||
E_USER_NOTICE
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (empty($file)) {
|
||||
trigger_error('html_image: missing \'file\' parameter', E_USER_NOTICE);
|
||||
return;
|
||||
}
|
||||
if ($file[ 0 ] === '/') {
|
||||
$_image_path = $basedir . $file;
|
||||
} else {
|
||||
$_image_path = $file;
|
||||
}
|
||||
// strip file protocol
|
||||
if (stripos($params[ 'file' ], 'file://') === 0) {
|
||||
$params[ 'file' ] = substr($params[ 'file' ], 7);
|
||||
}
|
||||
$protocol = strpos($params[ 'file' ], '://');
|
||||
if ($protocol !== false) {
|
||||
$protocol = strtolower(substr($params[ 'file' ], 0, $protocol));
|
||||
}
|
||||
if (isset($template->smarty->security_policy)) {
|
||||
if ($protocol) {
|
||||
// remote resource (or php stream, …)
|
||||
if (!$template->smarty->security_policy->isTrustedUri($params[ 'file' ])) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// local file
|
||||
if (!$template->smarty->security_policy->isTrustedResourceDir($_image_path)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isset($params[ 'width' ]) || !isset($params[ 'height' ])) {
|
||||
// FIXME: (rodneyrehm) getimagesize() loads the complete file off a remote resource, use custom [jpg,png,gif]header reader!
|
||||
if (!$_image_data = @getimagesize($_image_path)) {
|
||||
if (!file_exists($_image_path)) {
|
||||
trigger_error("html_image: unable to find '{$_image_path}'", E_USER_NOTICE);
|
||||
return;
|
||||
} elseif (!is_readable($_image_path)) {
|
||||
trigger_error("html_image: unable to read '{$_image_path}'", E_USER_NOTICE);
|
||||
return;
|
||||
} else {
|
||||
trigger_error("html_image: '{$_image_path}' is not a valid image file", E_USER_NOTICE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!isset($params[ 'width' ])) {
|
||||
$width = $_image_data[ 0 ];
|
||||
}
|
||||
if (!isset($params[ 'height' ])) {
|
||||
$height = $_image_data[ 1 ];
|
||||
}
|
||||
}
|
||||
if (isset($params[ 'dpi' ])) {
|
||||
if (strstr($_SERVER[ 'HTTP_USER_AGENT' ], 'Mac')) {
|
||||
// FIXME: (rodneyrehm) wrong dpi assumption
|
||||
// don't know who thought this up… even if it was true in 1998, it's definitely wrong in 2011.
|
||||
$dpi_default = 72;
|
||||
} else {
|
||||
$dpi_default = 96;
|
||||
}
|
||||
$_resize = $dpi_default / $params[ 'dpi' ];
|
||||
$width = round($width * $_resize);
|
||||
$height = round($height * $_resize);
|
||||
}
|
||||
return $prefix . '<img src="' . $path_prefix . $file . '" alt="' . $alt . '" width="' . $width . '" height="' .
|
||||
$height . '"' . $extra . ' />' . $suffix;
|
||||
}
|
|
@ -0,0 +1,230 @@
|
|||
<?php
|
||||
/**
|
||||
* Smarty plugin
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage PluginsFunction
|
||||
*/
|
||||
/**
|
||||
* Smarty {html_options} function plugin
|
||||
* Type: function
|
||||
* Name: html_options
|
||||
* Purpose: Prints the list of <option> tags generated from
|
||||
* the passed parameters
|
||||
* Params:
|
||||
*
|
||||
* - name (optional) - string default "select"
|
||||
* - values (required) - if no options supplied) - array
|
||||
* - options (required) - if no values supplied) - associative array
|
||||
* - selected (optional) - string default not set
|
||||
* - output (required) - if not options supplied) - array
|
||||
* - id (optional) - string default not set
|
||||
* - class (optional) - string default not set
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.function.html.options.php {html_image}
|
||||
* (Smarty online manual)
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
* @author Ralf Strehle (minor optimization) <ralf dot strehle at yahoo dot de>
|
||||
*
|
||||
* @param array $params parameters
|
||||
*
|
||||
* @param \Smarty_Internal_Template $template
|
||||
*
|
||||
* @return string
|
||||
* @uses smarty_function_escape_special_chars()
|
||||
* @throws \SmartyException
|
||||
*/
|
||||
function smarty_function_html_options($params, Smarty_Internal_Template $template)
|
||||
{
|
||||
$template->_checkPlugins(
|
||||
array(
|
||||
array(
|
||||
'function' => 'smarty_function_escape_special_chars',
|
||||
'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'
|
||||
)
|
||||
)
|
||||
);
|
||||
$name = null;
|
||||
$values = null;
|
||||
$options = null;
|
||||
$selected = null;
|
||||
$output = null;
|
||||
$id = null;
|
||||
$class = null;
|
||||
$extra = '';
|
||||
foreach ($params as $_key => $_val) {
|
||||
switch ($_key) {
|
||||
case 'name':
|
||||
case 'class':
|
||||
case 'id':
|
||||
$$_key = (string)$_val;
|
||||
break;
|
||||
case 'options':
|
||||
$options = (array)$_val;
|
||||
break;
|
||||
case 'values':
|
||||
case 'output':
|
||||
$$_key = array_values((array)$_val);
|
||||
break;
|
||||
case 'selected':
|
||||
if (is_array($_val)) {
|
||||
$selected = array();
|
||||
foreach ($_val as $_sel) {
|
||||
if (is_object($_sel)) {
|
||||
if (method_exists($_sel, '__toString')) {
|
||||
$_sel = smarty_function_escape_special_chars((string)$_sel->__toString());
|
||||
} else {
|
||||
trigger_error(
|
||||
'html_options: selected attribute contains an object of class \'' .
|
||||
get_class($_sel) . '\' without __toString() method',
|
||||
E_USER_NOTICE
|
||||
);
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
$_sel = smarty_function_escape_special_chars((string)$_sel);
|
||||
}
|
||||
$selected[ $_sel ] = true;
|
||||
}
|
||||
} elseif (is_object($_val)) {
|
||||
if (method_exists($_val, '__toString')) {
|
||||
$selected = smarty_function_escape_special_chars((string)$_val->__toString());
|
||||
} else {
|
||||
trigger_error(
|
||||
'html_options: selected attribute is an object of class \'' . get_class($_val) .
|
||||
'\' without __toString() method',
|
||||
E_USER_NOTICE
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$selected = smarty_function_escape_special_chars((string)$_val);
|
||||
}
|
||||
break;
|
||||
case 'strict':
|
||||
break;
|
||||
case 'disabled':
|
||||
case 'readonly':
|
||||
if (!empty($params[ 'strict' ])) {
|
||||
if (!is_scalar($_val)) {
|
||||
trigger_error(
|
||||
"html_options: {$_key} attribute must be a scalar, only boolean true or string '{$_key}' will actually add the attribute",
|
||||
E_USER_NOTICE
|
||||
);
|
||||
}
|
||||
if ($_val === true || $_val === $_key) {
|
||||
$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"';
|
||||
}
|
||||
break;
|
||||
}
|
||||
// omit break; to fall through!
|
||||
// no break
|
||||
default:
|
||||
if (!is_array($_val)) {
|
||||
$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
|
||||
} else {
|
||||
trigger_error("html_options: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isset($options) && !isset($values)) {
|
||||
/* raise error here? */
|
||||
return '';
|
||||
}
|
||||
$_html_result = '';
|
||||
$_idx = 0;
|
||||
if (isset($options)) {
|
||||
foreach ($options as $_key => $_val) {
|
||||
$_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected, $id, $class, $_idx);
|
||||
}
|
||||
} else {
|
||||
foreach ($values as $_i => $_key) {
|
||||
$_val = isset($output[ $_i ]) ? $output[ $_i ] : '';
|
||||
$_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected, $id, $class, $_idx);
|
||||
}
|
||||
}
|
||||
if (!empty($name)) {
|
||||
$_html_class = !empty($class) ? ' class="' . $class . '"' : '';
|
||||
$_html_id = !empty($id) ? ' id="' . $id . '"' : '';
|
||||
$_html_result =
|
||||
'<select name="' . $name . '"' . $_html_class . $_html_id . $extra . '>' . "\n" . $_html_result .
|
||||
'</select>' . "\n";
|
||||
}
|
||||
return $_html_result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $key
|
||||
* @param $value
|
||||
* @param $selected
|
||||
* @param $id
|
||||
* @param $class
|
||||
* @param $idx
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function smarty_function_html_options_optoutput($key, $value, $selected, $id, $class, &$idx)
|
||||
{
|
||||
if (!is_array($value)) {
|
||||
$_key = smarty_function_escape_special_chars($key);
|
||||
$_html_result = '<option value="' . $_key . '"';
|
||||
if (is_array($selected)) {
|
||||
if (isset($selected[ $_key ])) {
|
||||
$_html_result .= ' selected="selected"';
|
||||
}
|
||||
} elseif ($_key === $selected) {
|
||||
$_html_result .= ' selected="selected"';
|
||||
}
|
||||
$_html_class = !empty($class) ? ' class="' . $class . ' option"' : '';
|
||||
$_html_id = !empty($id) ? ' id="' . $id . '-' . $idx . '"' : '';
|
||||
if (is_object($value)) {
|
||||
if (method_exists($value, '__toString')) {
|
||||
$value = smarty_function_escape_special_chars((string)$value->__toString());
|
||||
} else {
|
||||
trigger_error(
|
||||
'html_options: value is an object of class \'' . get_class($value) .
|
||||
'\' without __toString() method',
|
||||
E_USER_NOTICE
|
||||
);
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
$value = smarty_function_escape_special_chars((string)$value);
|
||||
}
|
||||
$_html_result .= $_html_class . $_html_id . '>' . $value . '</option>' . "\n";
|
||||
$idx++;
|
||||
} else {
|
||||
$_idx = 0;
|
||||
$_html_result =
|
||||
smarty_function_html_options_optgroup(
|
||||
$key,
|
||||
$value,
|
||||
$selected,
|
||||
!empty($id) ? ($id . '-' . $idx) : null,
|
||||
$class,
|
||||
$_idx
|
||||
);
|
||||
$idx++;
|
||||
}
|
||||
return $_html_result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $key
|
||||
* @param $values
|
||||
* @param $selected
|
||||
* @param $id
|
||||
* @param $class
|
||||
* @param $idx
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function smarty_function_html_options_optgroup($key, $values, $selected, $id, $class, &$idx)
|
||||
{
|
||||
$optgroup_html = '<optgroup label="' . smarty_function_escape_special_chars($key) . '">' . "\n";
|
||||
foreach ($values as $key => $value) {
|
||||
$optgroup_html .= smarty_function_html_options_optoutput($key, $value, $selected, $id, $class, $idx);
|
||||
}
|
||||
$optgroup_html .= "</optgroup>\n";
|
||||
return $optgroup_html;
|
||||
}
|
|
@ -0,0 +1,266 @@
|
|||
<?php
|
||||
/**
|
||||
* Smarty plugin
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage PluginsFunction
|
||||
*/
|
||||
/**
|
||||
* Smarty {html_radios} function plugin
|
||||
* File: function.html_radios.php
|
||||
* Type: function
|
||||
* Name: html_radios
|
||||
* Date: 24.Feb.2003
|
||||
* Purpose: Prints out a list of radio input types
|
||||
* Params:
|
||||
*
|
||||
* - name (optional) - string default "radio"
|
||||
* - values (required) - array
|
||||
* - options (required) - associative array
|
||||
* - checked (optional) - array default not set
|
||||
* - separator (optional) - ie <br> or
|
||||
* - output (optional) - the output next to each radio button
|
||||
* - assign (optional) - assign the output as an array to this variable
|
||||
* - escape (optional) - escape the content (not value), defaults to true
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* {html_radios values=$ids output=$names}
|
||||
* {html_radios values=$ids name='box' separator='<br>' output=$names}
|
||||
* {html_radios values=$ids checked=$checked separator='<br>' output=$names}
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.function.html.radios.php {html_radios}
|
||||
* (Smarty online manual)
|
||||
* @author Christopher Kvarme <christopher.kvarme@flashjab.com>
|
||||
* @author credits to Monte Ohrt <monte at ohrt dot com>
|
||||
* @version 1.0
|
||||
*
|
||||
* @param array $params parameters
|
||||
* @param Smarty_Internal_Template $template template object
|
||||
*
|
||||
* @return string
|
||||
* @uses smarty_function_escape_special_chars()
|
||||
* @throws \SmartyException
|
||||
*/
|
||||
function smarty_function_html_radios($params, Smarty_Internal_Template $template)
|
||||
{
|
||||
$template->_checkPlugins(
|
||||
array(
|
||||
array(
|
||||
'function' => 'smarty_function_escape_special_chars',
|
||||
'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'
|
||||
)
|
||||
)
|
||||
);
|
||||
$name = 'radio';
|
||||
$values = null;
|
||||
$options = null;
|
||||
$selected = null;
|
||||
$separator = '';
|
||||
$escape = true;
|
||||
$labels = true;
|
||||
$label_ids = false;
|
||||
$output = null;
|
||||
$extra = '';
|
||||
foreach ($params as $_key => $_val) {
|
||||
switch ($_key) {
|
||||
case 'name':
|
||||
case 'separator':
|
||||
$$_key = (string)$_val;
|
||||
break;
|
||||
case 'checked':
|
||||
case 'selected':
|
||||
if (is_array($_val)) {
|
||||
trigger_error('html_radios: the "' . $_key . '" attribute cannot be an array', E_USER_WARNING);
|
||||
} elseif (is_object($_val)) {
|
||||
if (method_exists($_val, '__toString')) {
|
||||
$selected = smarty_function_escape_special_chars((string)$_val->__toString());
|
||||
} else {
|
||||
trigger_error(
|
||||
'html_radios: selected attribute is an object of class \'' . get_class($_val) .
|
||||
'\' without __toString() method',
|
||||
E_USER_NOTICE
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$selected = (string)$_val;
|
||||
}
|
||||
break;
|
||||
case 'escape':
|
||||
case 'labels':
|
||||
case 'label_ids':
|
||||
$$_key = (bool)$_val;
|
||||
break;
|
||||
case 'options':
|
||||
$$_key = (array)$_val;
|
||||
break;
|
||||
case 'values':
|
||||
case 'output':
|
||||
$$_key = array_values((array)$_val);
|
||||
break;
|
||||
case 'radios':
|
||||
trigger_error(
|
||||
'html_radios: the use of the "radios" attribute is deprecated, use "options" instead',
|
||||
E_USER_WARNING
|
||||
);
|
||||
$options = (array)$_val;
|
||||
break;
|
||||
case 'assign':
|
||||
break;
|
||||
case 'strict':
|
||||
break;
|
||||
case 'disabled':
|
||||
case 'readonly':
|
||||
if (!empty($params[ 'strict' ])) {
|
||||
if (!is_scalar($_val)) {
|
||||
trigger_error(
|
||||
"html_options: {$_key} attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute",
|
||||
E_USER_NOTICE
|
||||
);
|
||||
}
|
||||
if ($_val === true || $_val === $_key) {
|
||||
$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"';
|
||||
}
|
||||
break;
|
||||
}
|
||||
// omit break; to fall through!
|
||||
// no break
|
||||
default:
|
||||
if (!is_array($_val)) {
|
||||
$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
|
||||
} else {
|
||||
trigger_error("html_radios: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isset($options) && !isset($values)) {
|
||||
/* raise error here? */
|
||||
return '';
|
||||
}
|
||||
$_html_result = array();
|
||||
if (isset($options)) {
|
||||
foreach ($options as $_key => $_val) {
|
||||
$_html_result[] =
|
||||
smarty_function_html_radios_output(
|
||||
$name,
|
||||
$_key,
|
||||
$_val,
|
||||
$selected,
|
||||
$extra,
|
||||
$separator,
|
||||
$labels,
|
||||
$label_ids,
|
||||
$escape
|
||||
);
|
||||
}
|
||||
} else {
|
||||
foreach ($values as $_i => $_key) {
|
||||
$_val = isset($output[ $_i ]) ? $output[ $_i ] : '';
|
||||
$_html_result[] =
|
||||
smarty_function_html_radios_output(
|
||||
$name,
|
||||
$_key,
|
||||
$_val,
|
||||
$selected,
|
||||
$extra,
|
||||
$separator,
|
||||
$labels,
|
||||
$label_ids,
|
||||
$escape
|
||||
);
|
||||
}
|
||||
}
|
||||
if (!empty($params[ 'assign' ])) {
|
||||
$template->assign($params[ 'assign' ], $_html_result);
|
||||
} else {
|
||||
return implode("\n", $_html_result);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param $value
|
||||
* @param $output
|
||||
* @param $selected
|
||||
* @param $extra
|
||||
* @param $separator
|
||||
* @param $labels
|
||||
* @param $label_ids
|
||||
* @param $escape
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function smarty_function_html_radios_output(
|
||||
$name,
|
||||
$value,
|
||||
$output,
|
||||
$selected,
|
||||
$extra,
|
||||
$separator,
|
||||
$labels,
|
||||
$label_ids,
|
||||
$escape
|
||||
) {
|
||||
$_output = '';
|
||||
if (is_object($value)) {
|
||||
if (method_exists($value, '__toString')) {
|
||||
$value = (string)$value->__toString();
|
||||
} else {
|
||||
trigger_error(
|
||||
'html_options: value is an object of class \'' . get_class($value) .
|
||||
'\' without __toString() method',
|
||||
E_USER_NOTICE
|
||||
);
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
$value = (string)$value;
|
||||
}
|
||||
if (is_object($output)) {
|
||||
if (method_exists($output, '__toString')) {
|
||||
$output = (string)$output->__toString();
|
||||
} else {
|
||||
trigger_error(
|
||||
'html_options: output is an object of class \'' . get_class($output) .
|
||||
'\' without __toString() method',
|
||||
E_USER_NOTICE
|
||||
);
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
$output = (string)$output;
|
||||
}
|
||||
if ($labels) {
|
||||
if ($label_ids) {
|
||||
$_id = smarty_function_escape_special_chars(
|
||||
preg_replace(
|
||||
'![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER,
|
||||
'_',
|
||||
$name . '_' . $value
|
||||
)
|
||||
);
|
||||
$_output .= '<label for="' . $_id . '">';
|
||||
} else {
|
||||
$_output .= '<label>';
|
||||
}
|
||||
}
|
||||
$name = smarty_function_escape_special_chars($name);
|
||||
$value = smarty_function_escape_special_chars($value);
|
||||
if ($escape) {
|
||||
$output = smarty_function_escape_special_chars($output);
|
||||
}
|
||||
$_output .= '<input type="radio" name="' . $name . '" value="' . $value . '"';
|
||||
if ($labels && $label_ids) {
|
||||
$_output .= ' id="' . $_id . '"';
|
||||
}
|
||||
if ($value === $selected) {
|
||||
$_output .= ' checked="checked"';
|
||||
}
|
||||
$_output .= $extra . ' />' . $output;
|
||||
if ($labels) {
|
||||
$_output .= '</label>';
|
||||
}
|
||||
$_output .= $separator;
|
||||
return $_output;
|
||||
}
|
|
@ -0,0 +1,388 @@
|
|||
<?php
|
||||
/**
|
||||
* Smarty plugin
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage PluginsFunction
|
||||
*/
|
||||
/**
|
||||
* Smarty {html_select_date} plugin
|
||||
* Type: function
|
||||
* Name: html_select_date
|
||||
* Purpose: Prints the dropdowns for date selection.
|
||||
* ChangeLog:
|
||||
*
|
||||
* - 1.0 initial release
|
||||
* - 1.1 added support for +/- N syntax for begin
|
||||
* and end year values. (Monte)
|
||||
* - 1.2 added support for yyyy-mm-dd syntax for
|
||||
* time value. (Jan Rosier)
|
||||
* - 1.3 added support for choosing format for
|
||||
* month values (Gary Loescher)
|
||||
* - 1.3.1 added support for choosing format for
|
||||
* day values (Marcus Bointon)
|
||||
* - 1.3.2 support negative timestamps, force year
|
||||
* dropdown to include given date unless explicitly set (Monte)
|
||||
* - 1.3.4 fix behaviour of 0000-00-00 00:00:00 dates to match that
|
||||
* of 0000-00-00 dates (cybot, boots)
|
||||
* - 2.0 complete rewrite for performance,
|
||||
* added attributes month_names, *_id
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.function.html.select.date.php {html_select_date}
|
||||
* (Smarty online manual)
|
||||
* @version 2.0
|
||||
* @author Andrei Zmievski
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
* @author Rodney Rehm
|
||||
*
|
||||
* @param array $params parameters
|
||||
*
|
||||
* @param \Smarty_Internal_Template $template
|
||||
*
|
||||
* @return string
|
||||
* @throws \SmartyException
|
||||
*/
|
||||
function smarty_function_html_select_date($params, Smarty_Internal_Template $template)
|
||||
{
|
||||
$template->_checkPlugins(
|
||||
array(
|
||||
array(
|
||||
'function' => 'smarty_function_escape_special_chars',
|
||||
'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'
|
||||
)
|
||||
)
|
||||
);
|
||||
// generate timestamps used for month names only
|
||||
static $_month_timestamps = null;
|
||||
static $_current_year = null;
|
||||
if ($_month_timestamps === null) {
|
||||
$_current_year = date('Y');
|
||||
$_month_timestamps = array();
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$_month_timestamps[ $i ] = mktime(0, 0, 0, $i, 1, 2000);
|
||||
}
|
||||
}
|
||||
/* Default values. */
|
||||
$prefix = 'Date_';
|
||||
$start_year = null;
|
||||
$end_year = null;
|
||||
$display_days = true;
|
||||
$display_months = true;
|
||||
$display_years = true;
|
||||
$month_format = '%B';
|
||||
/* Write months as numbers by default GL */
|
||||
$month_value_format = '%m';
|
||||
$day_format = '%02d';
|
||||
/* Write day values using this format MB */
|
||||
$day_value_format = '%d';
|
||||
$year_as_text = false;
|
||||
/* Display years in reverse order? Ie. 2000,1999,.... */
|
||||
$reverse_years = false;
|
||||
/* Should the select boxes be part of an array when returned from PHP?
|
||||
e.g. setting it to "birthday", would create "birthday[Day]",
|
||||
"birthday[Month]" & "birthday[Year]". Can be combined with prefix */
|
||||
$field_array = null;
|
||||
/* <select size>'s of the different <select> tags.
|
||||
If not set, uses default dropdown. */
|
||||
$day_size = null;
|
||||
$month_size = null;
|
||||
$year_size = null;
|
||||
/* Unparsed attributes common to *ALL* the <select>/<input> tags.
|
||||
An example might be in the template: all_extra ='class ="foo"'. */
|
||||
$all_extra = null;
|
||||
/* Separate attributes for the tags. */
|
||||
$day_extra = null;
|
||||
$month_extra = null;
|
||||
$year_extra = null;
|
||||
/* Order in which to display the fields.
|
||||
"D" -> day, "M" -> month, "Y" -> year. */
|
||||
$field_order = 'MDY';
|
||||
/* String printed between the different fields. */
|
||||
$field_separator = "\n";
|
||||
$option_separator = "\n";
|
||||
$time = null;
|
||||
// $all_empty = null;
|
||||
// $day_empty = null;
|
||||
// $month_empty = null;
|
||||
// $year_empty = null;
|
||||
$extra_attrs = '';
|
||||
$all_id = null;
|
||||
$day_id = null;
|
||||
$month_id = null;
|
||||
$year_id = null;
|
||||
foreach ($params as $_key => $_value) {
|
||||
switch ($_key) {
|
||||
case 'time':
|
||||
if (!is_array($_value) && $_value !== null) {
|
||||
$template->_checkPlugins(
|
||||
array(
|
||||
array(
|
||||
'function' => 'smarty_make_timestamp',
|
||||
'file' => SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php'
|
||||
)
|
||||
)
|
||||
);
|
||||
$time = smarty_make_timestamp($_value);
|
||||
}
|
||||
break;
|
||||
case 'month_names':
|
||||
if (is_array($_value) && count($_value) === 12) {
|
||||
$$_key = $_value;
|
||||
} else {
|
||||
trigger_error('html_select_date: month_names must be an array of 12 strings', E_USER_NOTICE);
|
||||
}
|
||||
break;
|
||||
case 'prefix':
|
||||
case 'field_array':
|
||||
case 'start_year':
|
||||
case 'end_year':
|
||||
case 'day_format':
|
||||
case 'day_value_format':
|
||||
case 'month_format':
|
||||
case 'month_value_format':
|
||||
case 'day_size':
|
||||
case 'month_size':
|
||||
case 'year_size':
|
||||
case 'all_extra':
|
||||
case 'day_extra':
|
||||
case 'month_extra':
|
||||
case 'year_extra':
|
||||
case 'field_order':
|
||||
case 'field_separator':
|
||||
case 'option_separator':
|
||||
case 'all_empty':
|
||||
case 'month_empty':
|
||||
case 'day_empty':
|
||||
case 'year_empty':
|
||||
case 'all_id':
|
||||
case 'month_id':
|
||||
case 'day_id':
|
||||
case 'year_id':
|
||||
$$_key = (string)$_value;
|
||||
break;
|
||||
case 'display_days':
|
||||
case 'display_months':
|
||||
case 'display_years':
|
||||
case 'year_as_text':
|
||||
case 'reverse_years':
|
||||
$$_key = (bool)$_value;
|
||||
break;
|
||||
default:
|
||||
if (!is_array($_value)) {
|
||||
$extra_attrs .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_value) . '"';
|
||||
} else {
|
||||
trigger_error("html_select_date: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Note: date() is faster than strftime()
|
||||
// Note: explode(date()) is faster than date() date() date()
|
||||
if (isset($params[ 'time' ]) && is_array($params[ 'time' ])) {
|
||||
if (isset($params[ 'time' ][ $prefix . 'Year' ])) {
|
||||
// $_REQUEST[$field_array] given
|
||||
foreach (array(
|
||||
'Y' => 'Year',
|
||||
'm' => 'Month',
|
||||
'd' => 'Day'
|
||||
) as $_elementKey => $_elementName) {
|
||||
$_variableName = '_' . strtolower($_elementName);
|
||||
$$_variableName =
|
||||
isset($params[ 'time' ][ $prefix . $_elementName ]) ? $params[ 'time' ][ $prefix . $_elementName ] :
|
||||
date($_elementKey);
|
||||
}
|
||||
} elseif (isset($params[ 'time' ][ $field_array ][ $prefix . 'Year' ])) {
|
||||
// $_REQUEST given
|
||||
foreach (array(
|
||||
'Y' => 'Year',
|
||||
'm' => 'Month',
|
||||
'd' => 'Day'
|
||||
) as $_elementKey => $_elementName) {
|
||||
$_variableName = '_' . strtolower($_elementName);
|
||||
$$_variableName = isset($params[ 'time' ][ $field_array ][ $prefix . $_elementName ]) ?
|
||||
$params[ 'time' ][ $field_array ][ $prefix . $_elementName ] : date($_elementKey);
|
||||
}
|
||||
} else {
|
||||
// no date found, use NOW
|
||||
list($_year, $_month, $_day) = $time = explode('-', date('Y-m-d'));
|
||||
}
|
||||
} elseif ($time === null) {
|
||||
if (array_key_exists('time', $params)) {
|
||||
$_year = $_month = $_day = $time = null;
|
||||
} else {
|
||||
list($_year, $_month, $_day) = $time = explode('-', date('Y-m-d'));
|
||||
}
|
||||
} else {
|
||||
list($_year, $_month, $_day) = $time = explode('-', date('Y-m-d', $time));
|
||||
}
|
||||
// make syntax "+N" or "-N" work with $start_year and $end_year
|
||||
// Note preg_match('!^(\+|\-)\s*(\d+)$!', $end_year, $match) is slower than trim+substr
|
||||
foreach (array(
|
||||
'start',
|
||||
'end'
|
||||
) as $key) {
|
||||
$key .= '_year';
|
||||
$t = $$key;
|
||||
if ($t === null) {
|
||||
$$key = (int)$_current_year;
|
||||
} elseif ($t[ 0 ] === '+') {
|
||||
$$key = (int)($_current_year + (int)trim(substr($t, 1)));
|
||||
} elseif ($t[ 0 ] === '-') {
|
||||
$$key = (int)($_current_year - (int)trim(substr($t, 1)));
|
||||
} else {
|
||||
$$key = (int)$$key;
|
||||
}
|
||||
}
|
||||
// flip for ascending or descending
|
||||
if (($start_year > $end_year && !$reverse_years) || ($start_year < $end_year && $reverse_years)) {
|
||||
$t = $end_year;
|
||||
$end_year = $start_year;
|
||||
$start_year = $t;
|
||||
}
|
||||
// generate year <select> or <input>
|
||||
if ($display_years) {
|
||||
$_extra = '';
|
||||
$_name = $field_array ? ($field_array . '[' . $prefix . 'Year]') : ($prefix . 'Year');
|
||||
if ($all_extra) {
|
||||
$_extra .= ' ' . $all_extra;
|
||||
}
|
||||
if ($year_extra) {
|
||||
$_extra .= ' ' . $year_extra;
|
||||
}
|
||||
if ($year_as_text) {
|
||||
$_html_years =
|
||||
'<input type="text" name="' . $_name . '" value="' . $_year . '" size="4" maxlength="4"' . $_extra .
|
||||
$extra_attrs . ' />';
|
||||
} else {
|
||||
$_html_years = '<select name="' . $_name . '"';
|
||||
if ($year_id !== null || $all_id !== null) {
|
||||
$_html_years .= ' id="' . smarty_function_escape_special_chars(
|
||||
$year_id !== null ?
|
||||
($year_id ? $year_id : $_name) :
|
||||
($all_id ? ($all_id . $_name) :
|
||||
$_name)
|
||||
) . '"';
|
||||
}
|
||||
if ($year_size) {
|
||||
$_html_years .= ' size="' . $year_size . '"';
|
||||
}
|
||||
$_html_years .= $_extra . $extra_attrs . '>' . $option_separator;
|
||||
if (isset($year_empty) || isset($all_empty)) {
|
||||
$_html_years .= '<option value="">' . (isset($year_empty) ? $year_empty : $all_empty) . '</option>' .
|
||||
$option_separator;
|
||||
}
|
||||
$op = $start_year > $end_year ? -1 : 1;
|
||||
for ($i = $start_year; $op > 0 ? $i <= $end_year : $i >= $end_year; $i += $op) {
|
||||
$_html_years .= '<option value="' . $i . '"' . ($_year == $i ? ' selected="selected"' : '') . '>' . $i .
|
||||
'</option>' . $option_separator;
|
||||
}
|
||||
$_html_years .= '</select>';
|
||||
}
|
||||
}
|
||||
// generate month <select> or <input>
|
||||
if ($display_months) {
|
||||
$_extra = '';
|
||||
$_name = $field_array ? ($field_array . '[' . $prefix . 'Month]') : ($prefix . 'Month');
|
||||
if ($all_extra) {
|
||||
$_extra .= ' ' . $all_extra;
|
||||
}
|
||||
if ($month_extra) {
|
||||
$_extra .= ' ' . $month_extra;
|
||||
}
|
||||
$_html_months = '<select name="' . $_name . '"';
|
||||
if ($month_id !== null || $all_id !== null) {
|
||||
$_html_months .= ' id="' . smarty_function_escape_special_chars(
|
||||
$month_id !== null ?
|
||||
($month_id ? $month_id : $_name) :
|
||||
($all_id ? ($all_id . $_name) :
|
||||
$_name)
|
||||
) . '"';
|
||||
}
|
||||
if ($month_size) {
|
||||
$_html_months .= ' size="' . $month_size . '"';
|
||||
}
|
||||
$_html_months .= $_extra . $extra_attrs . '>' . $option_separator;
|
||||
if (isset($month_empty) || isset($all_empty)) {
|
||||
$_html_months .= '<option value="">' . (isset($month_empty) ? $month_empty : $all_empty) . '</option>' .
|
||||
$option_separator;
|
||||
}
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$_val = sprintf('%02d', $i);
|
||||
$_text = isset($month_names) ? smarty_function_escape_special_chars($month_names[ $i ]) :
|
||||
($month_format === '%m' ? $_val : strftime($month_format, $_month_timestamps[ $i ]));
|
||||
$_value = $month_value_format === '%m' ? $_val : strftime($month_value_format, $_month_timestamps[ $i ]);
|
||||
$_html_months .= '<option value="' . $_value . '"' . ($_val == $_month ? ' selected="selected"' : '') .
|
||||
'>' . $_text . '</option>' . $option_separator;
|
||||
}
|
||||
$_html_months .= '</select>';
|
||||
}
|
||||
// generate day <select> or <input>
|
||||
if ($display_days) {
|
||||
$_extra = '';
|
||||
$_name = $field_array ? ($field_array . '[' . $prefix . 'Day]') : ($prefix . 'Day');
|
||||
if ($all_extra) {
|
||||
$_extra .= ' ' . $all_extra;
|
||||
}
|
||||
if ($day_extra) {
|
||||
$_extra .= ' ' . $day_extra;
|
||||
}
|
||||
$_html_days = '<select name="' . $_name . '"';
|
||||
if ($day_id !== null || $all_id !== null) {
|
||||
$_html_days .= ' id="' .
|
||||
smarty_function_escape_special_chars(
|
||||
$day_id !== null ? ($day_id ? $day_id : $_name) :
|
||||
($all_id ? ($all_id . $_name) : $_name)
|
||||
) . '"';
|
||||
}
|
||||
if ($day_size) {
|
||||
$_html_days .= ' size="' . $day_size . '"';
|
||||
}
|
||||
$_html_days .= $_extra . $extra_attrs . '>' . $option_separator;
|
||||
if (isset($day_empty) || isset($all_empty)) {
|
||||
$_html_days .= '<option value="">' . (isset($day_empty) ? $day_empty : $all_empty) . '</option>' .
|
||||
$option_separator;
|
||||
}
|
||||
for ($i = 1; $i <= 31; $i++) {
|
||||
$_val = sprintf('%02d', $i);
|
||||
$_text = $day_format === '%02d' ? $_val : sprintf($day_format, $i);
|
||||
$_value = $day_value_format === '%02d' ? $_val : sprintf($day_value_format, $i);
|
||||
$_html_days .= '<option value="' . $_value . '"' . ($_val == $_day ? ' selected="selected"' : '') . '>' .
|
||||
$_text . '</option>' . $option_separator;
|
||||
}
|
||||
$_html_days .= '</select>';
|
||||
}
|
||||
// order the fields for output
|
||||
$_html = '';
|
||||
for ($i = 0; $i <= 2; $i++) {
|
||||
switch ($field_order[ $i ]) {
|
||||
case 'Y':
|
||||
case 'y':
|
||||
if (isset($_html_years)) {
|
||||
if ($_html) {
|
||||
$_html .= $field_separator;
|
||||
}
|
||||
$_html .= $_html_years;
|
||||
}
|
||||
break;
|
||||
case 'm':
|
||||
case 'M':
|
||||
if (isset($_html_months)) {
|
||||
if ($_html) {
|
||||
$_html .= $field_separator;
|
||||
}
|
||||
$_html .= $_html_months;
|
||||
}
|
||||
break;
|
||||
case 'd':
|
||||
case 'D':
|
||||
if (isset($_html_days)) {
|
||||
if ($_html) {
|
||||
$_html .= $field_separator;
|
||||
}
|
||||
$_html .= $_html_days;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $_html;
|
||||
}
|
|
@ -0,0 +1,354 @@
|
|||
<?php
|
||||
/**
|
||||
* Smarty plugin
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage PluginsFunction
|
||||
*/
|
||||
/**
|
||||
* Smarty {html_select_time} function plugin
|
||||
* Type: function
|
||||
* Name: html_select_time
|
||||
* Purpose: Prints the dropdowns for time selection
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.function.html.select.time.php {html_select_time}
|
||||
* (Smarty online manual)
|
||||
* @author Roberto Berto <roberto@berto.net>
|
||||
* @author Monte Ohrt <monte AT ohrt DOT com>
|
||||
*
|
||||
* @param array $params parameters
|
||||
*
|
||||
* @param \Smarty_Internal_Template $template
|
||||
*
|
||||
* @return string
|
||||
* @uses smarty_make_timestamp()
|
||||
* @throws \SmartyException
|
||||
*/
|
||||
function smarty_function_html_select_time($params, Smarty_Internal_Template $template)
|
||||
{
|
||||
$template->_checkPlugins(
|
||||
array(
|
||||
array(
|
||||
'function' => 'smarty_function_escape_special_chars',
|
||||
'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'
|
||||
)
|
||||
)
|
||||
);
|
||||
$prefix = 'Time_';
|
||||
$field_array = null;
|
||||
$field_separator = "\n";
|
||||
$option_separator = "\n";
|
||||
$time = null;
|
||||
$display_hours = true;
|
||||
$display_minutes = true;
|
||||
$display_seconds = true;
|
||||
$display_meridian = true;
|
||||
$hour_format = '%02d';
|
||||
$hour_value_format = '%02d';
|
||||
$minute_format = '%02d';
|
||||
$minute_value_format = '%02d';
|
||||
$second_format = '%02d';
|
||||
$second_value_format = '%02d';
|
||||
$hour_size = null;
|
||||
$minute_size = null;
|
||||
$second_size = null;
|
||||
$meridian_size = null;
|
||||
$all_empty = null;
|
||||
$hour_empty = null;
|
||||
$minute_empty = null;
|
||||
$second_empty = null;
|
||||
$meridian_empty = null;
|
||||
$all_id = null;
|
||||
$hour_id = null;
|
||||
$minute_id = null;
|
||||
$second_id = null;
|
||||
$meridian_id = null;
|
||||
$use_24_hours = true;
|
||||
$minute_interval = 1;
|
||||
$second_interval = 1;
|
||||
$extra_attrs = '';
|
||||
$all_extra = null;
|
||||
$hour_extra = null;
|
||||
$minute_extra = null;
|
||||
$second_extra = null;
|
||||
$meridian_extra = null;
|
||||
foreach ($params as $_key => $_value) {
|
||||
switch ($_key) {
|
||||
case 'time':
|
||||
if (!is_array($_value) && $_value !== null) {
|
||||
$template->_checkPlugins(
|
||||
array(
|
||||
array(
|
||||
'function' => 'smarty_make_timestamp',
|
||||
'file' => SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php'
|
||||
)
|
||||
)
|
||||
);
|
||||
$time = smarty_make_timestamp($_value);
|
||||
}
|
||||
break;
|
||||
case 'prefix':
|
||||
case 'field_array':
|
||||
case 'field_separator':
|
||||
case 'option_separator':
|
||||
case 'all_extra':
|
||||
case 'hour_extra':
|
||||
case 'minute_extra':
|
||||
case 'second_extra':
|
||||
case 'meridian_extra':
|
||||
case 'all_empty':
|
||||
case 'hour_empty':
|
||||
case 'minute_empty':
|
||||
case 'second_empty':
|
||||
case 'meridian_empty':
|
||||
case 'all_id':
|
||||
case 'hour_id':
|
||||
case 'minute_id':
|
||||
case 'second_id':
|
||||
case 'meridian_id':
|
||||
case 'hour_format':
|
||||
case 'hour_value_format':
|
||||
case 'minute_format':
|
||||
case 'minute_value_format':
|
||||
case 'second_format':
|
||||
case 'second_value_format':
|
||||
$$_key = (string)$_value;
|
||||
break;
|
||||
case 'display_hours':
|
||||
case 'display_minutes':
|
||||
case 'display_seconds':
|
||||
case 'display_meridian':
|
||||
case 'use_24_hours':
|
||||
$$_key = (bool)$_value;
|
||||
break;
|
||||
case 'minute_interval':
|
||||
case 'second_interval':
|
||||
case 'hour_size':
|
||||
case 'minute_size':
|
||||
case 'second_size':
|
||||
case 'meridian_size':
|
||||
$$_key = (int)$_value;
|
||||
break;
|
||||
default:
|
||||
if (!is_array($_value)) {
|
||||
$extra_attrs .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_value) . '"';
|
||||
} else {
|
||||
trigger_error("html_select_date: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isset($params[ 'time' ]) && is_array($params[ 'time' ])) {
|
||||
if (isset($params[ 'time' ][ $prefix . 'Hour' ])) {
|
||||
// $_REQUEST[$field_array] given
|
||||
foreach (array(
|
||||
'H' => 'Hour',
|
||||
'i' => 'Minute',
|
||||
's' => 'Second'
|
||||
) as $_elementKey => $_elementName) {
|
||||
$_variableName = '_' . strtolower($_elementName);
|
||||
$$_variableName =
|
||||
isset($params[ 'time' ][ $prefix . $_elementName ]) ? $params[ 'time' ][ $prefix . $_elementName ] :
|
||||
date($_elementKey);
|
||||
}
|
||||
$_meridian =
|
||||
isset($params[ 'time' ][ $prefix . 'Meridian' ]) ? (' ' . $params[ 'time' ][ $prefix . 'Meridian' ]) :
|
||||
'';
|
||||
$time = strtotime($_hour . ':' . $_minute . ':' . $_second . $_meridian);
|
||||
list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s', $time));
|
||||
} elseif (isset($params[ 'time' ][ $field_array ][ $prefix . 'Hour' ])) {
|
||||
// $_REQUEST given
|
||||
foreach (array(
|
||||
'H' => 'Hour',
|
||||
'i' => 'Minute',
|
||||
's' => 'Second'
|
||||
) as $_elementKey => $_elementName) {
|
||||
$_variableName = '_' . strtolower($_elementName);
|
||||
$$_variableName = isset($params[ 'time' ][ $field_array ][ $prefix . $_elementName ]) ?
|
||||
$params[ 'time' ][ $field_array ][ $prefix . $_elementName ] : date($_elementKey);
|
||||
}
|
||||
$_meridian = isset($params[ 'time' ][ $field_array ][ $prefix . 'Meridian' ]) ?
|
||||
(' ' . $params[ 'time' ][ $field_array ][ $prefix . 'Meridian' ]) : '';
|
||||
$time = strtotime($_hour . ':' . $_minute . ':' . $_second . $_meridian);
|
||||
list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s', $time));
|
||||
} else {
|
||||
// no date found, use NOW
|
||||
list($_year, $_month, $_day) = $time = explode('-', date('Y-m-d'));
|
||||
}
|
||||
} elseif ($time === null) {
|
||||
if (array_key_exists('time', $params)) {
|
||||
$_hour = $_minute = $_second = $time = null;
|
||||
} else {
|
||||
list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s'));
|
||||
}
|
||||
} else {
|
||||
list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s', $time));
|
||||
}
|
||||
// generate hour <select>
|
||||
if ($display_hours) {
|
||||
$_html_hours = '';
|
||||
$_extra = '';
|
||||
$_name = $field_array ? ($field_array . '[' . $prefix . 'Hour]') : ($prefix . 'Hour');
|
||||
if ($all_extra) {
|
||||
$_extra .= ' ' . $all_extra;
|
||||
}
|
||||
if ($hour_extra) {
|
||||
$_extra .= ' ' . $hour_extra;
|
||||
}
|
||||
$_html_hours = '<select name="' . $_name . '"';
|
||||
if ($hour_id !== null || $all_id !== null) {
|
||||
$_html_hours .= ' id="' .
|
||||
smarty_function_escape_special_chars(
|
||||
$hour_id !== null ? ($hour_id ? $hour_id : $_name) :
|
||||
($all_id ? ($all_id . $_name) : $_name)
|
||||
) . '"';
|
||||
}
|
||||
if ($hour_size) {
|
||||
$_html_hours .= ' size="' . $hour_size . '"';
|
||||
}
|
||||
$_html_hours .= $_extra . $extra_attrs . '>' . $option_separator;
|
||||
if (isset($hour_empty) || isset($all_empty)) {
|
||||
$_html_hours .= '<option value="">' . (isset($hour_empty) ? $hour_empty : $all_empty) . '</option>' .
|
||||
$option_separator;
|
||||
}
|
||||
$start = $use_24_hours ? 0 : 1;
|
||||
$end = $use_24_hours ? 23 : 12;
|
||||
for ($i = $start; $i <= $end; $i++) {
|
||||
$_val = sprintf('%02d', $i);
|
||||
$_text = $hour_format === '%02d' ? $_val : sprintf($hour_format, $i);
|
||||
$_value = $hour_value_format === '%02d' ? $_val : sprintf($hour_value_format, $i);
|
||||
if (!$use_24_hours) {
|
||||
$_hour12 = $_hour == 0 ? 12 : ($_hour <= 12 ? $_hour : $_hour - 12);
|
||||
}
|
||||
$selected = $_hour !== null ? ($use_24_hours ? $_hour == $_val : $_hour12 == $_val) : null;
|
||||
$_html_hours .= '<option value="' . $_value . '"' . ($selected ? ' selected="selected"' : '') . '>' .
|
||||
$_text . '</option>' . $option_separator;
|
||||
}
|
||||
$_html_hours .= '</select>';
|
||||
}
|
||||
// generate minute <select>
|
||||
if ($display_minutes) {
|
||||
$_html_minutes = '';
|
||||
$_extra = '';
|
||||
$_name = $field_array ? ($field_array . '[' . $prefix . 'Minute]') : ($prefix . 'Minute');
|
||||
if ($all_extra) {
|
||||
$_extra .= ' ' . $all_extra;
|
||||
}
|
||||
if ($minute_extra) {
|
||||
$_extra .= ' ' . $minute_extra;
|
||||
}
|
||||
$_html_minutes = '<select name="' . $_name . '"';
|
||||
if ($minute_id !== null || $all_id !== null) {
|
||||
$_html_minutes .= ' id="' . smarty_function_escape_special_chars(
|
||||
$minute_id !== null ?
|
||||
($minute_id ? $minute_id : $_name) :
|
||||
($all_id ? ($all_id . $_name) :
|
||||
$_name)
|
||||
) . '"';
|
||||
}
|
||||
if ($minute_size) {
|
||||
$_html_minutes .= ' size="' . $minute_size . '"';
|
||||
}
|
||||
$_html_minutes .= $_extra . $extra_attrs . '>' . $option_separator;
|
||||
if (isset($minute_empty) || isset($all_empty)) {
|
||||
$_html_minutes .= '<option value="">' . (isset($minute_empty) ? $minute_empty : $all_empty) . '</option>' .
|
||||
$option_separator;
|
||||
}
|
||||
$selected = $_minute !== null ? ($_minute - $_minute % $minute_interval) : null;
|
||||
for ($i = 0; $i <= 59; $i += $minute_interval) {
|
||||
$_val = sprintf('%02d', $i);
|
||||
$_text = $minute_format === '%02d' ? $_val : sprintf($minute_format, $i);
|
||||
$_value = $minute_value_format === '%02d' ? $_val : sprintf($minute_value_format, $i);
|
||||
$_html_minutes .= '<option value="' . $_value . '"' . ($selected === $i ? ' selected="selected"' : '') .
|
||||
'>' . $_text . '</option>' . $option_separator;
|
||||
}
|
||||
$_html_minutes .= '</select>';
|
||||
}
|
||||
// generate second <select>
|
||||
if ($display_seconds) {
|
||||
$_html_seconds = '';
|
||||
$_extra = '';
|
||||
$_name = $field_array ? ($field_array . '[' . $prefix . 'Second]') : ($prefix . 'Second');
|
||||
if ($all_extra) {
|
||||
$_extra .= ' ' . $all_extra;
|
||||
}
|
||||
if ($second_extra) {
|
||||
$_extra .= ' ' . $second_extra;
|
||||
}
|
||||
$_html_seconds = '<select name="' . $_name . '"';
|
||||
if ($second_id !== null || $all_id !== null) {
|
||||
$_html_seconds .= ' id="' . smarty_function_escape_special_chars(
|
||||
$second_id !== null ?
|
||||
($second_id ? $second_id : $_name) :
|
||||
($all_id ? ($all_id . $_name) :
|
||||
$_name)
|
||||
) . '"';
|
||||
}
|
||||
if ($second_size) {
|
||||
$_html_seconds .= ' size="' . $second_size . '"';
|
||||
}
|
||||
$_html_seconds .= $_extra . $extra_attrs . '>' . $option_separator;
|
||||
if (isset($second_empty) || isset($all_empty)) {
|
||||
$_html_seconds .= '<option value="">' . (isset($second_empty) ? $second_empty : $all_empty) . '</option>' .
|
||||
$option_separator;
|
||||
}
|
||||
$selected = $_second !== null ? ($_second - $_second % $second_interval) : null;
|
||||
for ($i = 0; $i <= 59; $i += $second_interval) {
|
||||
$_val = sprintf('%02d', $i);
|
||||
$_text = $second_format === '%02d' ? $_val : sprintf($second_format, $i);
|
||||
$_value = $second_value_format === '%02d' ? $_val : sprintf($second_value_format, $i);
|
||||
$_html_seconds .= '<option value="' . $_value . '"' . ($selected === $i ? ' selected="selected"' : '') .
|
||||
'>' . $_text . '</option>' . $option_separator;
|
||||
}
|
||||
$_html_seconds .= '</select>';
|
||||
}
|
||||
// generate meridian <select>
|
||||
if ($display_meridian && !$use_24_hours) {
|
||||
$_html_meridian = '';
|
||||
$_extra = '';
|
||||
$_name = $field_array ? ($field_array . '[' . $prefix . 'Meridian]') : ($prefix . 'Meridian');
|
||||
if ($all_extra) {
|
||||
$_extra .= ' ' . $all_extra;
|
||||
}
|
||||
if ($meridian_extra) {
|
||||
$_extra .= ' ' . $meridian_extra;
|
||||
}
|
||||
$_html_meridian = '<select name="' . $_name . '"';
|
||||
if ($meridian_id !== null || $all_id !== null) {
|
||||
$_html_meridian .= ' id="' . smarty_function_escape_special_chars(
|
||||
$meridian_id !== null ?
|
||||
($meridian_id ? $meridian_id :
|
||||
$_name) :
|
||||
($all_id ? ($all_id . $_name) :
|
||||
$_name)
|
||||
) . '"';
|
||||
}
|
||||
if ($meridian_size) {
|
||||
$_html_meridian .= ' size="' . $meridian_size . '"';
|
||||
}
|
||||
$_html_meridian .= $_extra . $extra_attrs . '>' . $option_separator;
|
||||
if (isset($meridian_empty) || isset($all_empty)) {
|
||||
$_html_meridian .= '<option value="">' . (isset($meridian_empty) ? $meridian_empty : $all_empty) .
|
||||
'</option>' . $option_separator;
|
||||
}
|
||||
$_html_meridian .= '<option value="am"' . ($_hour > 0 && $_hour < 12 ? ' selected="selected"' : '') .
|
||||
'>AM</option>' . $option_separator . '<option value="pm"' .
|
||||
($_hour < 12 ? '' : ' selected="selected"') . '>PM</option>' . $option_separator .
|
||||
'</select>';
|
||||
}
|
||||
$_html = '';
|
||||
foreach (array(
|
||||
'_html_hours',
|
||||
'_html_minutes',
|
||||
'_html_seconds',
|
||||
'_html_meridian'
|
||||
) as $k) {
|
||||
if (isset($$k)) {
|
||||
if ($_html) {
|
||||
$_html .= $field_separator;
|
||||
}
|
||||
$_html .= $$k;
|
||||
}
|
||||
}
|
||||
return $_html;
|
||||
}
|
|
@ -0,0 +1,164 @@
|
|||
<?php
|
||||
/**
|
||||
* Smarty plugin
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage PluginsFunction
|
||||
*/
|
||||
/**
|
||||
* Smarty {html_table} function plugin
|
||||
* Type: function
|
||||
* Name: html_table
|
||||
* Date: Feb 17, 2003
|
||||
* Purpose: make an html table from an array of data
|
||||
* Params:
|
||||
*
|
||||
* - loop - array to loop through
|
||||
* - cols - number of columns, comma separated list of column names
|
||||
* or array of column names
|
||||
* - rows - number of rows
|
||||
* - table_attr - table attributes
|
||||
* - th_attr - table heading attributes (arrays are cycled)
|
||||
* - tr_attr - table row attributes (arrays are cycled)
|
||||
* - td_attr - table cell attributes (arrays are cycled)
|
||||
* - trailpad - value to pad trailing cells with
|
||||
* - caption - text for caption element
|
||||
* - vdir - vertical direction (default: "down", means top-to-bottom)
|
||||
* - hdir - horizontal direction (default: "right", means left-to-right)
|
||||
* - inner - inner loop (default "cols": print $loop line by line,
|
||||
* $loop will be printed column by column otherwise)
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* {table loop=$data}
|
||||
* {table loop=$data cols=4 tr_attr='"bgcolor=red"'}
|
||||
* {table loop=$data cols="first,second,third" tr_attr=$colors}
|
||||
*
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
* @author credit to Messju Mohr <messju at lammfellpuschen dot de>
|
||||
* @author credit to boots <boots dot smarty at yahoo dot com>
|
||||
* @version 1.1
|
||||
* @link https://www.smarty.net/manual/en/language.function.html.table.php {html_table}
|
||||
* (Smarty online manual)
|
||||
*
|
||||
* @param array $params parameters
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function smarty_function_html_table($params)
|
||||
{
|
||||
$table_attr = 'border="1"';
|
||||
$tr_attr = '';
|
||||
$th_attr = '';
|
||||
$td_attr = '';
|
||||
$cols = $cols_count = 3;
|
||||
$rows = 3;
|
||||
$trailpad = ' ';
|
||||
$vdir = 'down';
|
||||
$hdir = 'right';
|
||||
$inner = 'cols';
|
||||
$caption = '';
|
||||
$loop = null;
|
||||
if (!isset($params[ 'loop' ])) {
|
||||
trigger_error("html_table: missing 'loop' parameter", E_USER_WARNING);
|
||||
return;
|
||||
}
|
||||
foreach ($params as $_key => $_value) {
|
||||
switch ($_key) {
|
||||
case 'loop':
|
||||
$$_key = (array)$_value;
|
||||
break;
|
||||
case 'cols':
|
||||
if (is_array($_value) && !empty($_value)) {
|
||||
$cols = $_value;
|
||||
$cols_count = count($_value);
|
||||
} elseif (!is_numeric($_value) && is_string($_value) && !empty($_value)) {
|
||||
$cols = explode(',', $_value);
|
||||
$cols_count = count($cols);
|
||||
} elseif (!empty($_value)) {
|
||||
$cols_count = (int)$_value;
|
||||
} else {
|
||||
$cols_count = $cols;
|
||||
}
|
||||
break;
|
||||
case 'rows':
|
||||
$$_key = (int)$_value;
|
||||
break;
|
||||
case 'table_attr':
|
||||
case 'trailpad':
|
||||
case 'hdir':
|
||||
case 'vdir':
|
||||
case 'inner':
|
||||
case 'caption':
|
||||
$$_key = (string)$_value;
|
||||
break;
|
||||
case 'tr_attr':
|
||||
case 'td_attr':
|
||||
case 'th_attr':
|
||||
$$_key = $_value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$loop_count = count($loop);
|
||||
if (empty($params[ 'rows' ])) {
|
||||
/* no rows specified */
|
||||
$rows = ceil($loop_count / $cols_count);
|
||||
} elseif (empty($params[ 'cols' ])) {
|
||||
if (!empty($params[ 'rows' ])) {
|
||||
/* no cols specified, but rows */
|
||||
$cols_count = ceil($loop_count / $rows);
|
||||
}
|
||||
}
|
||||
$output = "<table $table_attr>\n";
|
||||
if (!empty($caption)) {
|
||||
$output .= '<caption>' . $caption . "</caption>\n";
|
||||
}
|
||||
if (is_array($cols)) {
|
||||
$cols = ($hdir === 'right') ? $cols : array_reverse($cols);
|
||||
$output .= "<thead><tr>\n";
|
||||
for ($r = 0; $r < $cols_count; $r++) {
|
||||
$output .= '<th' . smarty_function_html_table_cycle('th', $th_attr, $r) . '>';
|
||||
$output .= $cols[ $r ];
|
||||
$output .= "</th>\n";
|
||||
}
|
||||
$output .= "</tr></thead>\n";
|
||||
}
|
||||
$output .= "<tbody>\n";
|
||||
for ($r = 0; $r < $rows; $r++) {
|
||||
$output .= "<tr" . smarty_function_html_table_cycle('tr', $tr_attr, $r) . ">\n";
|
||||
$rx = ($vdir === 'down') ? $r * $cols_count : ($rows - 1 - $r) * $cols_count;
|
||||
for ($c = 0; $c < $cols_count; $c++) {
|
||||
$x = ($hdir === 'right') ? $rx + $c : $rx + $cols_count - 1 - $c;
|
||||
if ($inner !== 'cols') {
|
||||
/* shuffle x to loop over rows*/
|
||||
$x = floor($x / $cols_count) + ($x % $cols_count) * $rows;
|
||||
}
|
||||
if ($x < $loop_count) {
|
||||
$output .= "<td" . smarty_function_html_table_cycle('td', $td_attr, $c) . ">" . $loop[ $x ] . "</td>\n";
|
||||
} else {
|
||||
$output .= "<td" . smarty_function_html_table_cycle('td', $td_attr, $c) . ">$trailpad</td>\n";
|
||||
}
|
||||
}
|
||||
$output .= "</tr>\n";
|
||||
}
|
||||
$output .= "</tbody>\n";
|
||||
$output .= "</table>\n";
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param $var
|
||||
* @param $no
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function smarty_function_html_table_cycle($name, $var, $no)
|
||||
{
|
||||
if (!is_array($var)) {
|
||||
$ret = $var;
|
||||
} else {
|
||||
$ret = $var[ $no % count($var) ];
|
||||
}
|
||||
return ($ret) ? ' ' . $ret : '';
|
||||
}
|
|
@ -0,0 +1,134 @@
|
|||
<?php
|
||||
/**
|
||||
* Smarty plugin
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage PluginsFunction
|
||||
*/
|
||||
/**
|
||||
* Smarty {mailto} function plugin
|
||||
* Type: function
|
||||
* Name: mailto
|
||||
* Date: May 21, 2002
|
||||
* Purpose: automate mailto address link creation, and optionally encode them.
|
||||
* Params:
|
||||
*
|
||||
* - address - (required) - e-mail address
|
||||
* - text - (optional) - text to display, default is address
|
||||
* - encode - (optional) - can be one of:
|
||||
* * none : no encoding (default)
|
||||
* * javascript : encode with javascript
|
||||
* * javascript_charcode : encode with javascript charcode
|
||||
* * hex : encode with hexadecimal (no javascript)
|
||||
* - cc - (optional) - address(es) to carbon copy
|
||||
* - bcc - (optional) - address(es) to blind carbon copy
|
||||
* - subject - (optional) - e-mail subject
|
||||
* - newsgroups - (optional) - newsgroup(s) to post to
|
||||
* - followupto - (optional) - address(es) to follow up to
|
||||
* - extra - (optional) - extra tags for the href link
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* {mailto address="me@domain.com"}
|
||||
* {mailto address="me@domain.com" encode="javascript"}
|
||||
* {mailto address="me@domain.com" encode="hex"}
|
||||
* {mailto address="me@domain.com" subject="Hello to you!"}
|
||||
* {mailto address="me@domain.com" cc="you@domain.com,they@domain.com"}
|
||||
* {mailto address="me@domain.com" extra='class="mailto"'}
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.function.mailto.php {mailto}
|
||||
* (Smarty online manual)
|
||||
* @version 1.2
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
* @author credits to Jason Sweat (added cc, bcc and subject functionality)
|
||||
*
|
||||
* @param array $params parameters
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function smarty_function_mailto($params)
|
||||
{
|
||||
static $_allowed_encoding =
|
||||
array('javascript' => true, 'javascript_charcode' => true, 'hex' => true, 'none' => true);
|
||||
$extra = '';
|
||||
if (empty($params[ 'address' ])) {
|
||||
trigger_error("mailto: missing 'address' parameter", E_USER_WARNING);
|
||||
return;
|
||||
} else {
|
||||
$address = $params[ 'address' ];
|
||||
}
|
||||
$text = $address;
|
||||
// netscape and mozilla do not decode %40 (@) in BCC field (bug?)
|
||||
// so, don't encode it.
|
||||
$search = array('%40', '%2C');
|
||||
$replace = array('@', ',');
|
||||
$mail_parms = array();
|
||||
foreach ($params as $var => $value) {
|
||||
switch ($var) {
|
||||
case 'cc':
|
||||
case 'bcc':
|
||||
case 'followupto':
|
||||
if (!empty($value)) {
|
||||
$mail_parms[] = $var . '=' . str_replace($search, $replace, rawurlencode($value));
|
||||
}
|
||||
break;
|
||||
case 'subject':
|
||||
case 'newsgroups':
|
||||
$mail_parms[] = $var . '=' . rawurlencode($value);
|
||||
break;
|
||||
case 'extra':
|
||||
case 'text':
|
||||
$$var = $value;
|
||||
// no break
|
||||
default:
|
||||
}
|
||||
}
|
||||
if ($mail_parms) {
|
||||
$address .= '?' . join('&', $mail_parms);
|
||||
}
|
||||
$encode = (empty($params[ 'encode' ])) ? 'none' : $params[ 'encode' ];
|
||||
if (!isset($_allowed_encoding[ $encode ])) {
|
||||
trigger_error(
|
||||
"mailto: 'encode' parameter must be none, javascript, javascript_charcode or hex",
|
||||
E_USER_WARNING
|
||||
);
|
||||
return;
|
||||
}
|
||||
if ($encode === 'javascript') {
|
||||
$string = '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
|
||||
$js_encode = '';
|
||||
for ($x = 0, $_length = strlen($string); $x < $_length; $x++) {
|
||||
$js_encode .= '%' . bin2hex($string[ $x ]);
|
||||
}
|
||||
return '<script type="text/javascript">document.write(unescape(\'' . $js_encode . '\'))</script>';
|
||||
} elseif ($encode === 'javascript_charcode') {
|
||||
$string = '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
|
||||
for ($x = 0, $_length = strlen($string); $x < $_length; $x++) {
|
||||
$ord[] = ord($string[ $x ]);
|
||||
}
|
||||
return '<script type="text/javascript">document.write(String.fromCharCode(' . implode(',', $ord) . '))</script>';
|
||||
} elseif ($encode === 'hex') {
|
||||
preg_match('!^(.*)(\?.*)$!', $address, $match);
|
||||
if (!empty($match[ 2 ])) {
|
||||
trigger_error("mailto: hex encoding does not work with extra attributes. Try javascript.", E_USER_WARNING);
|
||||
return;
|
||||
}
|
||||
$address_encode = '';
|
||||
for ($x = 0, $_length = strlen($address); $x < $_length; $x++) {
|
||||
if (preg_match('!\w!' . Smarty::$_UTF8_MODIFIER, $address[ $x ])) {
|
||||
$address_encode .= '%' . bin2hex($address[ $x ]);
|
||||
} else {
|
||||
$address_encode .= $address[ $x ];
|
||||
}
|
||||
}
|
||||
$text_encode = '';
|
||||
for ($x = 0, $_length = strlen($text); $x < $_length; $x++) {
|
||||
$text_encode .= '&#x' . bin2hex($text[ $x ]) . ';';
|
||||
}
|
||||
$mailto = "mailto:";
|
||||
return '<a href="' . $mailto . $address_encode . '" ' . $extra . '>' . $text_encode . '</a>';
|
||||
} else {
|
||||
// no encoding
|
||||
return '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
|
||||
}
|
||||
}
|
|
@ -0,0 +1,142 @@
|
|||
<?php
|
||||
/**
|
||||
* Smarty plugin
|
||||
* This plugin is only for Smarty2 BC
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage PluginsFunction
|
||||
*/
|
||||
/**
|
||||
* Smarty {math} function plugin
|
||||
* Type: function
|
||||
* Name: math
|
||||
* Purpose: handle math computations in template
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.function.math.php {math}
|
||||
* (Smarty online manual)
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
*
|
||||
* @param array $params parameters
|
||||
* @param Smarty_Internal_Template $template template object
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
function smarty_function_math($params, $template)
|
||||
{
|
||||
static $_allowed_funcs =
|
||||
array(
|
||||
'int' => true,
|
||||
'abs' => true,
|
||||
'ceil' => true,
|
||||
'acos' => true,
|
||||
'acosh' => true,
|
||||
'cos' => true,
|
||||
'cosh' => true,
|
||||
'deg2rad' => true,
|
||||
'rad2deg' => true,
|
||||
'exp' => true,
|
||||
'floor' => true,
|
||||
'log' => true,
|
||||
'log10' => true,
|
||||
'max' => true,
|
||||
'min' => true,
|
||||
'pi' => true,
|
||||
'pow' => true,
|
||||
'rand' => true,
|
||||
'round' => true,
|
||||
'asin' => true,
|
||||
'asinh' => true,
|
||||
'sin' => true,
|
||||
'sinh' => true,
|
||||
'sqrt' => true,
|
||||
'srand' => true,
|
||||
'atan' => true,
|
||||
'atanh' => true,
|
||||
'tan' => true,
|
||||
'tanh' => true
|
||||
);
|
||||
|
||||
// be sure equation parameter is present
|
||||
if (empty($params[ 'equation' ])) {
|
||||
trigger_error("math: missing equation parameter", E_USER_WARNING);
|
||||
return;
|
||||
}
|
||||
$equation = $params[ 'equation' ];
|
||||
|
||||
// Remove whitespaces
|
||||
$equation = preg_replace('/\s+/', '', $equation);
|
||||
|
||||
// Adapted from https://www.php.net/manual/en/function.eval.php#107377
|
||||
$number = '(?:\d+(?:[,.]\d+)?|pi|π)'; // What is a number
|
||||
$functionsOrVars = '((?:0x[a-fA-F0-9]+)|([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*))';
|
||||
$operators = '[,+\/*\^%-]'; // Allowed math operators
|
||||
$regexp = '/^(('.$number.'|'.$functionsOrVars.'|('.$functionsOrVars.'\s*\((?1)+\)|\((?1)+\)))(?:'.$operators.'(?1))?)+$/';
|
||||
|
||||
if (!preg_match($regexp, $equation)) {
|
||||
trigger_error("math: illegal characters", E_USER_WARNING);
|
||||
return;
|
||||
}
|
||||
|
||||
// make sure parenthesis are balanced
|
||||
if (substr_count($equation, '(') !== substr_count($equation, ')')) {
|
||||
trigger_error("math: unbalanced parenthesis", E_USER_WARNING);
|
||||
return;
|
||||
}
|
||||
|
||||
// disallow backticks
|
||||
if (strpos($equation, '`') !== false) {
|
||||
trigger_error("math: backtick character not allowed in equation", E_USER_WARNING);
|
||||
return;
|
||||
}
|
||||
|
||||
// also disallow dollar signs
|
||||
if (strpos($equation, '$') !== false) {
|
||||
trigger_error("math: dollar signs not allowed in equation", E_USER_WARNING);
|
||||
return;
|
||||
}
|
||||
foreach ($params as $key => $val) {
|
||||
if ($key !== 'equation' && $key !== 'format' && $key !== 'assign') {
|
||||
// make sure value is not empty
|
||||
if (strlen($val) === 0) {
|
||||
trigger_error("math: parameter '{$key}' is empty", E_USER_WARNING);
|
||||
return;
|
||||
}
|
||||
if (!is_numeric($val)) {
|
||||
trigger_error("math: parameter '{$key}' is not numeric", E_USER_WARNING);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// match all vars in equation, make sure all are passed
|
||||
preg_match_all('!(?:0x[a-fA-F0-9]+)|([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)!', $equation, $match);
|
||||
foreach ($match[ 1 ] as $curr_var) {
|
||||
if ($curr_var && !isset($params[ $curr_var ]) && !isset($_allowed_funcs[ $curr_var ])) {
|
||||
trigger_error(
|
||||
"math: function call '{$curr_var}' not allowed, or missing parameter '{$curr_var}'",
|
||||
E_USER_WARNING
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
foreach ($params as $key => $val) {
|
||||
if ($key !== 'equation' && $key !== 'format' && $key !== 'assign') {
|
||||
$equation = preg_replace("/\b$key\b/", " \$params['$key'] ", $equation);
|
||||
}
|
||||
}
|
||||
$smarty_math_result = null;
|
||||
eval("\$smarty_math_result = " . $equation . ";");
|
||||
|
||||
if (empty($params[ 'format' ])) {
|
||||
if (empty($params[ 'assign' ])) {
|
||||
return $smarty_math_result;
|
||||
} else {
|
||||
$template->assign($params[ 'assign' ], $smarty_math_result);
|
||||
}
|
||||
} else {
|
||||
if (empty($params[ 'assign' ])) {
|
||||
printf($params[ 'format' ], $smarty_math_result);
|
||||
} else {
|
||||
$template->assign($params[ 'assign' ], sprintf($params[ 'format' ], $smarty_math_result));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,145 @@
|
|||
<?php
|
||||
/**
|
||||
* Smarty plugin
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage PluginsModifier
|
||||
*/
|
||||
/**
|
||||
* Smarty capitalize modifier plugin
|
||||
* Type: modifier
|
||||
* Name: capitalize
|
||||
* Purpose: capitalize words in the string
|
||||
* {@internal {$string|capitalize:true:true} is the fastest option for MBString enabled systems }}
|
||||
*
|
||||
* @param string $string string to capitalize
|
||||
* @param boolean $uc_digits also capitalize "x123" to "X123"
|
||||
* @param boolean $lc_rest capitalize first letters, lowercase all following letters "aAa" to "Aaa"
|
||||
*
|
||||
* @return string capitalized string
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
* @author Rodney Rehm
|
||||
*/
|
||||
function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = false)
|
||||
{
|
||||
if (Smarty::$_MBSTRING) {
|
||||
if ($lc_rest) {
|
||||
// uppercase (including hyphenated words)
|
||||
$upper_string = mb_convert_case($string, MB_CASE_TITLE, Smarty::$_CHARSET);
|
||||
} else {
|
||||
// uppercase word breaks
|
||||
$upper_string = preg_replace_callback(
|
||||
"!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER,
|
||||
'smarty_mod_cap_mbconvert_cb',
|
||||
$string
|
||||
);
|
||||
}
|
||||
// check uc_digits case
|
||||
if (!$uc_digits) {
|
||||
if (preg_match_all(
|
||||
"!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!" . Smarty::$_UTF8_MODIFIER,
|
||||
$string,
|
||||
$matches,
|
||||
PREG_OFFSET_CAPTURE
|
||||
)
|
||||
) {
|
||||
foreach ($matches[ 1 ] as $match) {
|
||||
$upper_string =
|
||||
substr_replace(
|
||||
$upper_string,
|
||||
mb_strtolower($match[ 0 ], Smarty::$_CHARSET),
|
||||
$match[ 1 ],
|
||||
strlen($match[ 0 ])
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
$upper_string =
|
||||
preg_replace_callback(
|
||||
"!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER,
|
||||
'smarty_mod_cap_mbconvert2_cb',
|
||||
$upper_string
|
||||
);
|
||||
return $upper_string;
|
||||
}
|
||||
// lowercase first
|
||||
if ($lc_rest) {
|
||||
$string = strtolower($string);
|
||||
}
|
||||
// uppercase (including hyphenated words)
|
||||
$upper_string =
|
||||
preg_replace_callback(
|
||||
"!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER,
|
||||
'smarty_mod_cap_ucfirst_cb',
|
||||
$string
|
||||
);
|
||||
// check uc_digits case
|
||||
if (!$uc_digits) {
|
||||
if (preg_match_all(
|
||||
"!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!" . Smarty::$_UTF8_MODIFIER,
|
||||
$string,
|
||||
$matches,
|
||||
PREG_OFFSET_CAPTURE
|
||||
)
|
||||
) {
|
||||
foreach ($matches[ 1 ] as $match) {
|
||||
$upper_string =
|
||||
substr_replace($upper_string, strtolower($match[ 0 ]), $match[ 1 ], strlen($match[ 0 ]));
|
||||
}
|
||||
}
|
||||
}
|
||||
$upper_string = preg_replace_callback(
|
||||
"!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER,
|
||||
'smarty_mod_cap_ucfirst2_cb',
|
||||
$upper_string
|
||||
);
|
||||
return $upper_string;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Bug: create_function() use exhausts memory when used in long loops
|
||||
* Fix: use declared functions for callbacks instead of using create_function()
|
||||
* Note: This can be fixed using anonymous functions instead, but that requires PHP >= 5.3
|
||||
*
|
||||
* @author Kyle Renfrow
|
||||
*/
|
||||
/**
|
||||
* @param $matches
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function smarty_mod_cap_mbconvert_cb($matches)
|
||||
{
|
||||
return stripslashes($matches[ 1 ]) . mb_convert_case(stripslashes($matches[ 2 ]), MB_CASE_UPPER, Smarty::$_CHARSET);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $matches
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function smarty_mod_cap_mbconvert2_cb($matches)
|
||||
{
|
||||
return stripslashes($matches[ 1 ]) . mb_convert_case(stripslashes($matches[ 3 ]), MB_CASE_UPPER, Smarty::$_CHARSET);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $matches
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function smarty_mod_cap_ucfirst_cb($matches)
|
||||
{
|
||||
return stripslashes($matches[ 1 ]) . ucfirst(stripslashes($matches[ 2 ]));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $matches
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function smarty_mod_cap_ucfirst2_cb($matches)
|
||||
{
|
||||
return stripslashes($matches[ 1 ]) . ucfirst(stripslashes($matches[ 3 ]));
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
<?php
|
||||
/**
|
||||
* Smarty plugin
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage PluginsModifier
|
||||
*/
|
||||
/**
|
||||
* Smarty date_format modifier plugin
|
||||
* Type: modifier
|
||||
* Name: date_format
|
||||
* Purpose: format datestamps via strftime
|
||||
* Input:
|
||||
* - string: input date string
|
||||
* - format: strftime format for output
|
||||
* - default_date: default date if $string is empty
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.modifier.date.format.php date_format (Smarty online manual)
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
*
|
||||
* @param string $string input date string
|
||||
* @param string $format strftime format for output
|
||||
* @param string $default_date default date if $string is empty
|
||||
* @param string $formatter either 'strftime' or 'auto'
|
||||
*
|
||||
* @return string |void
|
||||
* @uses smarty_make_timestamp()
|
||||
*/
|
||||
function smarty_modifier_date_format($string, $format = null, $default_date = '', $formatter = 'auto')
|
||||
{
|
||||
if ($format === null) {
|
||||
$format = Smarty::$_DATE_FORMAT;
|
||||
}
|
||||
/**
|
||||
* require_once the {@link shared.make_timestamp.php} plugin
|
||||
*/
|
||||
static $is_loaded = false;
|
||||
if (!$is_loaded) {
|
||||
if (!is_callable('smarty_make_timestamp')) {
|
||||
include_once SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php';
|
||||
}
|
||||
$is_loaded = true;
|
||||
}
|
||||
if (!empty($string) && $string !== '0000-00-00' && $string !== '0000-00-00 00:00:00') {
|
||||
$timestamp = smarty_make_timestamp($string);
|
||||
} elseif (!empty($default_date)) {
|
||||
$timestamp = smarty_make_timestamp($default_date);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
if ($formatter === 'strftime' || ($formatter === 'auto' && strpos($format, '%') !== false)) {
|
||||
if (Smarty::$_IS_WINDOWS) {
|
||||
$_win_from = array(
|
||||
'%D',
|
||||
'%h',
|
||||
'%n',
|
||||
'%r',
|
||||
'%R',
|
||||
'%t',
|
||||
'%T'
|
||||
);
|
||||
$_win_to = array(
|
||||
'%m/%d/%y',
|
||||
'%b',
|
||||
"\n",
|
||||
'%I:%M:%S %p',
|
||||
'%H:%M',
|
||||
"\t",
|
||||
'%H:%M:%S'
|
||||
);
|
||||
if (strpos($format, '%e') !== false) {
|
||||
$_win_from[] = '%e';
|
||||
$_win_to[] = sprintf('%\' 2d', date('j', $timestamp));
|
||||
}
|
||||
if (strpos($format, '%l') !== false) {
|
||||
$_win_from[] = '%l';
|
||||
$_win_to[] = sprintf('%\' 2d', date('h', $timestamp));
|
||||
}
|
||||
$format = str_replace($_win_from, $_win_to, $format);
|
||||
}
|
||||
return strftime($format, $timestamp);
|
||||
} else {
|
||||
return date($format, $timestamp);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
<?php
|
||||
/**
|
||||
* Smarty plugin
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage Debug
|
||||
*/
|
||||
/**
|
||||
* Smarty debug_print_var modifier plugin
|
||||
* Type: modifier
|
||||
* Name: debug_print_var
|
||||
* Purpose: formats variable contents for display in the console
|
||||
*
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
*
|
||||
* @param array|object $var variable to be formatted
|
||||
* @param int $max maximum recursion depth if $var is an array or object
|
||||
* @param int $length maximum string length if $var is a string
|
||||
* @param int $depth actual recursion depth
|
||||
* @param array $objects processed objects in actual depth to prevent recursive object processing
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth = 0, $objects = array())
|
||||
{
|
||||
$_replace = array("\n" => '\n', "\r" => '\r', "\t" => '\t');
|
||||
switch (gettype($var)) {
|
||||
case 'array':
|
||||
$results = '<b>Array (' . count($var) . ')</b>';
|
||||
if ($depth === $max) {
|
||||
break;
|
||||
}
|
||||
foreach ($var as $curr_key => $curr_val) {
|
||||
$results .= '<br>' . str_repeat(' ', $depth * 2) . '<b>' . strtr($curr_key, $_replace) .
|
||||
'</b> => ' .
|
||||
smarty_modifier_debug_print_var($curr_val, $max, $length, ++$depth, $objects);
|
||||
$depth--;
|
||||
}
|
||||
break;
|
||||
case 'object':
|
||||
$object_vars = get_object_vars($var);
|
||||
$results = '<b>' . get_class($var) . ' Object (' . count($object_vars) . ')</b>';
|
||||
if (in_array($var, $objects)) {
|
||||
$results .= ' called recursive';
|
||||
break;
|
||||
}
|
||||
if ($depth === $max) {
|
||||
break;
|
||||
}
|
||||
$objects[] = $var;
|
||||
foreach ($object_vars as $curr_key => $curr_val) {
|
||||
$results .= '<br>' . str_repeat(' ', $depth * 2) . '<b> ->' . strtr($curr_key, $_replace) .
|
||||
'</b> = ' . smarty_modifier_debug_print_var($curr_val, $max, $length, ++$depth, $objects);
|
||||
$depth--;
|
||||
}
|
||||
break;
|
||||
case 'boolean':
|
||||
case 'NULL':
|
||||
case 'resource':
|
||||
if (true === $var) {
|
||||
$results = 'true';
|
||||
} elseif (false === $var) {
|
||||
$results = 'false';
|
||||
} elseif (null === $var) {
|
||||
$results = 'null';
|
||||
} else {
|
||||
$results = htmlspecialchars((string)$var);
|
||||
}
|
||||
$results = '<i>' . $results . '</i>';
|
||||
break;
|
||||
case 'integer':
|
||||
case 'float':
|
||||
$results = htmlspecialchars((string)$var);
|
||||
break;
|
||||
case 'string':
|
||||
$results = strtr($var, $_replace);
|
||||
if (Smarty::$_MBSTRING) {
|
||||
if (mb_strlen($var, Smarty::$_CHARSET) > $length) {
|
||||
$results = mb_substr($var, 0, $length - 3, Smarty::$_CHARSET) . '...';
|
||||
}
|
||||
} else {
|
||||
if (isset($var[ $length ])) {
|
||||
$results = substr($var, 0, $length - 3) . '...';
|
||||
}
|
||||
}
|
||||
$results = htmlspecialchars('"' . $results . '"', ENT_QUOTES, Smarty::$_CHARSET);
|
||||
break;
|
||||
case 'unknown type':
|
||||
default:
|
||||
$results = strtr((string)$var, $_replace);
|
||||
if (Smarty::$_MBSTRING) {
|
||||
if (mb_strlen($results, Smarty::$_CHARSET) > $length) {
|
||||
$results = mb_substr($results, 0, $length - 3, Smarty::$_CHARSET) . '...';
|
||||
}
|
||||
} else {
|
||||
if (strlen($results) > $length) {
|
||||
$results = substr($results, 0, $length - 3) . '...';
|
||||
}
|
||||
}
|
||||
$results = htmlspecialchars($results, ENT_QUOTES, Smarty::$_CHARSET);
|
||||
}
|
||||
return $results;
|
||||
}
|
|
@ -0,0 +1,260 @@
|
|||
<?php
|
||||
/**
|
||||
* Smarty plugin
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage PluginsModifier
|
||||
*/
|
||||
/**
|
||||
* Smarty escape modifier plugin
|
||||
* Type: modifier
|
||||
* Name: escape
|
||||
* Purpose: escape string for output
|
||||
*
|
||||
* @link https://www.smarty.net/docs/en/language.modifier.escape
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
*
|
||||
* @param string $string input string
|
||||
* @param string $esc_type escape type
|
||||
* @param string $char_set character set, used for htmlspecialchars() or htmlentities()
|
||||
* @param boolean $double_encode encode already encoded entitites again, used for htmlspecialchars() or htmlentities()
|
||||
*
|
||||
* @return string escaped input string
|
||||
*/
|
||||
function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $double_encode = true)
|
||||
{
|
||||
static $_double_encode = true;
|
||||
static $is_loaded_1 = false;
|
||||
static $is_loaded_2 = false;
|
||||
if (!$char_set) {
|
||||
$char_set = Smarty::$_CHARSET;
|
||||
}
|
||||
|
||||
$string = (string)$string;
|
||||
|
||||
switch ($esc_type) {
|
||||
case 'html':
|
||||
if ($_double_encode) {
|
||||
// php >=5.3.2 - go native
|
||||
return htmlspecialchars($string, ENT_QUOTES, $char_set, $double_encode);
|
||||
} else {
|
||||
if ($double_encode) {
|
||||
// php <5.2.3 - only handle double encoding
|
||||
return htmlspecialchars($string, ENT_QUOTES, $char_set);
|
||||
} else {
|
||||
// php <5.2.3 - prevent double encoding
|
||||
$string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string);
|
||||
$string = htmlspecialchars($string, ENT_QUOTES, $char_set);
|
||||
$string = str_replace(
|
||||
array(
|
||||
'%%%SMARTY_START%%%',
|
||||
'%%%SMARTY_END%%%'
|
||||
),
|
||||
array(
|
||||
'&',
|
||||
';'
|
||||
),
|
||||
$string
|
||||
);
|
||||
return $string;
|
||||
}
|
||||
}
|
||||
// no break
|
||||
case 'htmlall':
|
||||
if (Smarty::$_MBSTRING) {
|
||||
// mb_convert_encoding ignores htmlspecialchars()
|
||||
if ($_double_encode) {
|
||||
// php >=5.3.2 - go native
|
||||
$string = htmlspecialchars($string, ENT_QUOTES, $char_set, $double_encode);
|
||||
} else {
|
||||
if ($double_encode) {
|
||||
// php <5.2.3 - only handle double encoding
|
||||
$string = htmlspecialchars($string, ENT_QUOTES, $char_set);
|
||||
} else {
|
||||
// php <5.2.3 - prevent double encoding
|
||||
$string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string);
|
||||
$string = htmlspecialchars($string, ENT_QUOTES, $char_set);
|
||||
$string =
|
||||
str_replace(
|
||||
array(
|
||||
'%%%SMARTY_START%%%',
|
||||
'%%%SMARTY_END%%%'
|
||||
),
|
||||
array(
|
||||
'&',
|
||||
';'
|
||||
),
|
||||
$string
|
||||
);
|
||||
return $string;
|
||||
}
|
||||
}
|
||||
// htmlentities() won't convert everything, so use mb_convert_encoding
|
||||
return mb_convert_encoding($string, 'HTML-ENTITIES', $char_set);
|
||||
}
|
||||
// no MBString fallback
|
||||
if ($_double_encode) {
|
||||
return htmlentities($string, ENT_QUOTES, $char_set, $double_encode);
|
||||
} else {
|
||||
if ($double_encode) {
|
||||
return htmlentities($string, ENT_QUOTES, $char_set);
|
||||
} else {
|
||||
$string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string);
|
||||
$string = htmlentities($string, ENT_QUOTES, $char_set);
|
||||
$string = str_replace(
|
||||
array(
|
||||
'%%%SMARTY_START%%%',
|
||||
'%%%SMARTY_END%%%'
|
||||
),
|
||||
array(
|
||||
'&',
|
||||
';'
|
||||
),
|
||||
$string
|
||||
);
|
||||
return $string;
|
||||
}
|
||||
}
|
||||
// no break
|
||||
case 'url':
|
||||
return rawurlencode($string);
|
||||
case 'urlpathinfo':
|
||||
return str_replace('%2F', '/', rawurlencode($string));
|
||||
case 'quotes':
|
||||
// escape unescaped single quotes
|
||||
return preg_replace("%(?<!\\\\)'%", "\\'", $string);
|
||||
case 'hex':
|
||||
// escape every byte into hex
|
||||
// Note that the UTF-8 encoded character ä will be represented as %c3%a4
|
||||
$return = '';
|
||||
$_length = strlen($string);
|
||||
for ($x = 0; $x < $_length; $x++) {
|
||||
$return .= '%' . bin2hex($string[ $x ]);
|
||||
}
|
||||
return $return;
|
||||
case 'hexentity':
|
||||
$return = '';
|
||||
if (Smarty::$_MBSTRING) {
|
||||
if (!$is_loaded_1) {
|
||||
if (!is_callable('smarty_mb_to_unicode')) {
|
||||
include_once SMARTY_PLUGINS_DIR . 'shared.mb_unicode.php';
|
||||
}
|
||||
$is_loaded_1 = true;
|
||||
}
|
||||
$return = '';
|
||||
foreach (smarty_mb_to_unicode($string, Smarty::$_CHARSET) as $unicode) {
|
||||
$return .= '&#x' . strtoupper(dechex($unicode)) . ';';
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
// no MBString fallback
|
||||
$_length = strlen($string);
|
||||
for ($x = 0; $x < $_length; $x++) {
|
||||
$return .= '&#x' . bin2hex($string[ $x ]) . ';';
|
||||
}
|
||||
return $return;
|
||||
case 'decentity':
|
||||
$return = '';
|
||||
if (Smarty::$_MBSTRING) {
|
||||
if (!$is_loaded_1) {
|
||||
if (!is_callable('smarty_mb_to_unicode')) {
|
||||
include_once SMARTY_PLUGINS_DIR . 'shared.mb_unicode.php';
|
||||
}
|
||||
$is_loaded_1 = true;
|
||||
}
|
||||
$return = '';
|
||||
foreach (smarty_mb_to_unicode($string, Smarty::$_CHARSET) as $unicode) {
|
||||
$return .= '&#' . $unicode . ';';
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
// no MBString fallback
|
||||
$_length = strlen($string);
|
||||
for ($x = 0; $x < $_length; $x++) {
|
||||
$return .= '&#' . ord($string[ $x ]) . ';';
|
||||
}
|
||||
return $return;
|
||||
case 'javascript':
|
||||
// escape quotes and backslashes, newlines, etc.
|
||||
return strtr(
|
||||
$string,
|
||||
array(
|
||||
'\\' => '\\\\',
|
||||
"'" => "\\'",
|
||||
'"' => '\\"',
|
||||
"\r" => '\\r',
|
||||
"\n" => '\\n',
|
||||
'</' => '<\/',
|
||||
// see https://html.spec.whatwg.org/multipage/scripting.html#restrictions-for-contents-of-script-elements
|
||||
'<!--' => '<\!--',
|
||||
'<s' => '<\s',
|
||||
'<S' => '<\S'
|
||||
)
|
||||
);
|
||||
case 'mail':
|
||||
if (Smarty::$_MBSTRING) {
|
||||
if (!$is_loaded_2) {
|
||||
if (!is_callable('smarty_mb_str_replace')) {
|
||||
include_once SMARTY_PLUGINS_DIR . 'shared.mb_str_replace.php';
|
||||
}
|
||||
$is_loaded_2 = true;
|
||||
}
|
||||
return smarty_mb_str_replace(
|
||||
array(
|
||||
'@',
|
||||
'.'
|
||||
),
|
||||
array(
|
||||
' [AT] ',
|
||||
' [DOT] '
|
||||
),
|
||||
$string
|
||||
);
|
||||
}
|
||||
// no MBString fallback
|
||||
return str_replace(
|
||||
array(
|
||||
'@',
|
||||
'.'
|
||||
),
|
||||
array(
|
||||
' [AT] ',
|
||||
' [DOT] '
|
||||
),
|
||||
$string
|
||||
);
|
||||
case 'nonstd':
|
||||
// escape non-standard chars, such as ms document quotes
|
||||
$return = '';
|
||||
if (Smarty::$_MBSTRING) {
|
||||
if (!$is_loaded_1) {
|
||||
if (!is_callable('smarty_mb_to_unicode')) {
|
||||
include_once SMARTY_PLUGINS_DIR . 'shared.mb_unicode.php';
|
||||
}
|
||||
$is_loaded_1 = true;
|
||||
}
|
||||
foreach (smarty_mb_to_unicode($string, Smarty::$_CHARSET) as $unicode) {
|
||||
if ($unicode >= 126) {
|
||||
$return .= '&#' . $unicode . ';';
|
||||
} else {
|
||||
$return .= chr($unicode);
|
||||
}
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
$_length = strlen($string);
|
||||
for ($_i = 0; $_i < $_length; $_i++) {
|
||||
$_ord = ord(substr($string, $_i, 1));
|
||||
// non-standard char, escape it
|
||||
if ($_ord >= 126) {
|
||||
$return .= '&#' . $_ord . ';';
|
||||
} else {
|
||||
$return .= substr($string, $_i, 1);
|
||||
}
|
||||
}
|
||||
return $return;
|
||||
default:
|
||||
trigger_error("escape: unsupported type: $esc_type - returning unmodified string", E_USER_NOTICE);
|
||||
return $string;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
/**
|
||||
* Smarty plugin
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage PluginsModifier
|
||||
*/
|
||||
/**
|
||||
* Smarty wordwrap modifier plugin
|
||||
* Type: modifier
|
||||
* Name: mb_wordwrap
|
||||
* Purpose: Wrap a string to a given number of characters
|
||||
*
|
||||
* @link https://php.net/manual/en/function.wordwrap.php for similarity
|
||||
*
|
||||
* @param string $str the string to wrap
|
||||
* @param int $width the width of the output
|
||||
* @param string $break the character used to break the line
|
||||
* @param boolean $cut ignored parameter, just for the sake of
|
||||
*
|
||||
* @return string wrapped string
|
||||
* @author Rodney Rehm
|
||||
*/
|
||||
function smarty_modifier_mb_wordwrap($str, $width = 75, $break = "\n", $cut = false)
|
||||
{
|
||||
// break words into tokens using white space as a delimiter
|
||||
$tokens = preg_split('!(\s)!S' . Smarty::$_UTF8_MODIFIER, $str, -1, PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE);
|
||||
$length = 0;
|
||||
$t = '';
|
||||
$_previous = false;
|
||||
$_space = false;
|
||||
foreach ($tokens as $_token) {
|
||||
$token_length = mb_strlen($_token, Smarty::$_CHARSET);
|
||||
$_tokens = array($_token);
|
||||
if ($token_length > $width) {
|
||||
if ($cut) {
|
||||
$_tokens = preg_split(
|
||||
'!(.{' . $width . '})!S' . Smarty::$_UTF8_MODIFIER,
|
||||
$_token,
|
||||
-1,
|
||||
PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE
|
||||
);
|
||||
}
|
||||
}
|
||||
foreach ($_tokens as $token) {
|
||||
$_space = !!preg_match('!^\s$!S' . Smarty::$_UTF8_MODIFIER, $token);
|
||||
$token_length = mb_strlen($token, Smarty::$_CHARSET);
|
||||
$length += $token_length;
|
||||
if ($length > $width) {
|
||||
// remove space before inserted break
|
||||
if ($_previous) {
|
||||
$t = mb_substr($t, 0, -1, Smarty::$_CHARSET);
|
||||
}
|
||||
if (!$_space) {
|
||||
// add the break before the token
|
||||
if (!empty($t)) {
|
||||
$t .= $break;
|
||||
}
|
||||
$length = $token_length;
|
||||
}
|
||||
} elseif ($token === "\n") {
|
||||
// hard break must reset counters
|
||||
$length = 0;
|
||||
}
|
||||
$_previous = $_space;
|
||||
// add the token
|
||||
$t .= $token;
|
||||
}
|
||||
}
|
||||
return $t;
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
/**
|
||||
* Smarty plugin
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage PluginsModifier
|
||||
*/
|
||||
/**
|
||||
* Smarty regex_replace modifier plugin
|
||||
* Type: modifier
|
||||
* Name: regex_replace
|
||||
* Purpose: regular expression search/replace
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.modifier.regex.replace.php
|
||||
* regex_replace (Smarty online manual)
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
*
|
||||
* @param string $string input string
|
||||
* @param string|array $search regular expression(s) to search for
|
||||
* @param string|array $replace string(s) that should be replaced
|
||||
* @param int $limit the maximum number of replacements
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function smarty_modifier_regex_replace($string, $search, $replace, $limit = -1)
|
||||
{
|
||||
if (is_array($search)) {
|
||||
foreach ($search as $idx => $s) {
|
||||
$search[ $idx ] = _smarty_regex_replace_check($s);
|
||||
}
|
||||
} else {
|
||||
$search = _smarty_regex_replace_check($search);
|
||||
}
|
||||
return preg_replace($search, $replace, $string, $limit);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $search string(s) that should be replaced
|
||||
*
|
||||
* @return string
|
||||
* @ignore
|
||||
*/
|
||||
function _smarty_regex_replace_check($search)
|
||||
{
|
||||
// null-byte injection detection
|
||||
// anything behind the first null-byte is ignored
|
||||
if (($pos = strpos($search, "\0")) !== false) {
|
||||
$search = substr($search, 0, $pos);
|
||||
}
|
||||
// remove eval-modifier from $search
|
||||
if (preg_match('!([a-zA-Z\s]+)$!s', $search, $match) && (strpos($match[ 1 ], 'e') !== false)) {
|
||||
$search = substr($search, 0, -strlen($match[ 1 ])) . preg_replace('![e\s]+!', '', $match[ 1 ]);
|
||||
}
|
||||
return $search;
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
/**
|
||||
* Smarty plugin
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage PluginsModifier
|
||||
*/
|
||||
/**
|
||||
* Smarty replace modifier plugin
|
||||
* Type: modifier
|
||||
* Name: replace
|
||||
* Purpose: simple search/replace
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.modifier.replace.php replace (Smarty online manual)
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
* @author Uwe Tews
|
||||
*
|
||||
* @param string $string input string
|
||||
* @param string $search text to search for
|
||||
* @param string $replace replacement text
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function smarty_modifier_replace($string, $search, $replace)
|
||||
{
|
||||
static $is_loaded = false;
|
||||
if (Smarty::$_MBSTRING) {
|
||||
if (!$is_loaded) {
|
||||
if (!is_callable('smarty_mb_str_replace')) {
|
||||
include_once SMARTY_PLUGINS_DIR . 'shared.mb_str_replace.php';
|
||||
}
|
||||
$is_loaded = true;
|
||||
}
|
||||
return smarty_mb_str_replace($search, $replace, $string);
|
||||
}
|
||||
return str_replace($search, $replace, $string);
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
/**
|
||||
* Smarty plugin
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage PluginsModifier
|
||||
*/
|
||||
/**
|
||||
* Smarty spacify modifier plugin
|
||||
* Type: modifier
|
||||
* Name: spacify
|
||||
* Purpose: add spaces between characters in a string
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.modifier.spacify.php spacify (Smarty online manual)
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
*
|
||||
* @param string $string input string
|
||||
* @param string $spacify_char string to insert between characters.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function smarty_modifier_spacify($string, $spacify_char = ' ')
|
||||
{
|
||||
// well… what about charsets besides latin and UTF-8?
|
||||
return implode($spacify_char, preg_split('//' . Smarty::$_UTF8_MODIFIER, $string, -1, PREG_SPLIT_NO_EMPTY));
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
/**
|
||||
* Smarty plugin
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage PluginsModifier
|
||||
*/
|
||||
/**
|
||||
* Smarty truncate modifier plugin
|
||||
* Type: modifier
|
||||
* Name: truncate
|
||||
* Purpose: Truncate a string to a certain length if necessary,
|
||||
* optionally splitting in the middle of a word, and
|
||||
* appending the $etc string or inserting $etc into the middle.
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.modifier.truncate.php truncate (Smarty online manual)
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
*
|
||||
* @param string $string input string
|
||||
* @param integer $length length of truncated text
|
||||
* @param string $etc end string
|
||||
* @param boolean $break_words truncate at word boundary
|
||||
* @param boolean $middle truncate in the middle of text
|
||||
*
|
||||
* @return string truncated string
|
||||
*/
|
||||
function smarty_modifier_truncate($string, $length = 80, $etc = '...', $break_words = false, $middle = false)
|
||||
{
|
||||
if ($length === 0) {
|
||||
return '';
|
||||
}
|
||||
if (Smarty::$_MBSTRING) {
|
||||
if (mb_strlen($string, Smarty::$_CHARSET) > $length) {
|
||||
$length -= min($length, mb_strlen($etc, Smarty::$_CHARSET));
|
||||
if (!$break_words && !$middle) {
|
||||
$string = preg_replace(
|
||||
'/\s+?(\S+)?$/' . Smarty::$_UTF8_MODIFIER,
|
||||
'',
|
||||
mb_substr($string, 0, $length + 1, Smarty::$_CHARSET)
|
||||
);
|
||||
}
|
||||
if (!$middle) {
|
||||
return mb_substr($string, 0, $length, Smarty::$_CHARSET) . $etc;
|
||||
}
|
||||
return mb_substr($string, 0, intval($length / 2), Smarty::$_CHARSET) . $etc .
|
||||
mb_substr($string, -intval($length / 2), $length, Smarty::$_CHARSET);
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
// no MBString fallback
|
||||
if (isset($string[ $length ])) {
|
||||
$length -= min($length, strlen($etc));
|
||||
if (!$break_words && !$middle) {
|
||||
$string = preg_replace('/\s+?(\S+)?$/', '', substr($string, 0, $length + 1));
|
||||
}
|
||||
if (!$middle) {
|
||||
return substr($string, 0, $length) . $etc;
|
||||
}
|
||||
return substr($string, 0, intval($length / 2)) . $etc . substr($string, -intval($length / 2));
|
||||
}
|
||||
return $string;
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
/**
|
||||
* Smarty plugin
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage PluginsModifierCompiler
|
||||
*/
|
||||
/**
|
||||
* Smarty cat modifier plugin
|
||||
* Type: modifier
|
||||
* Name: cat
|
||||
* Date: Feb 24, 2003
|
||||
* Purpose: catenate a value to a variable
|
||||
* Input: string to catenate
|
||||
* Example: {$var|cat:"foo"}
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.modifier.cat.php cat
|
||||
* (Smarty online manual)
|
||||
* @author Uwe Tews
|
||||
*
|
||||
* @param array $params parameters
|
||||
*
|
||||
* @return string with compiled code
|
||||
*/
|
||||
function smarty_modifiercompiler_cat($params)
|
||||
{
|
||||
return '(' . implode(').(', $params) . ')';
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
/**
|
||||
* Smarty plugin
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage PluginsModifierCompiler
|
||||
*/
|
||||
/**
|
||||
* Smarty count_characters modifier plugin
|
||||
* Type: modifier
|
||||
* Name: count_characters
|
||||
* Purpose: count the number of characters in a text
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.modifier.count.characters.php count_characters (Smarty online
|
||||
* manual)
|
||||
* @author Uwe Tews
|
||||
*
|
||||
* @param array $params parameters
|
||||
*
|
||||
* @return string with compiled code
|
||||
*/
|
||||
function smarty_modifiercompiler_count_characters($params)
|
||||
{
|
||||
if (!isset($params[ 1 ]) || $params[ 1 ] !== 'true') {
|
||||
return 'preg_match_all(\'/[^\s]/' . Smarty::$_UTF8_MODIFIER . '\',' . $params[ 0 ] . ', $tmp)';
|
||||
}
|
||||
if (Smarty::$_MBSTRING) {
|
||||
return 'mb_strlen(' . $params[ 0 ] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')';
|
||||
}
|
||||
// no MBString fallback
|
||||
return 'strlen(' . $params[ 0 ] . ')';
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
/**
|
||||
* Smarty plugin
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage PluginsModifierCompiler
|
||||
*/
|
||||
/**
|
||||
* Smarty count_paragraphs modifier plugin
|
||||
* Type: modifier
|
||||
* Name: count_paragraphs
|
||||
* Purpose: count the number of paragraphs in a text
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.modifier.count.paragraphs.php
|
||||
* count_paragraphs (Smarty online manual)
|
||||
* @author Uwe Tews
|
||||
*
|
||||
* @param array $params parameters
|
||||
*
|
||||
* @return string with compiled code
|
||||
*/
|
||||
function smarty_modifiercompiler_count_paragraphs($params)
|
||||
{
|
||||
// count \r or \n characters
|
||||
return '(preg_match_all(\'#[\r\n]+#\', ' . $params[ 0 ] . ', $tmp)+1)';
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
/**
|
||||
* Smarty plugin
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage PluginsModifierCompiler
|
||||
*/
|
||||
/**
|
||||
* Smarty count_sentences modifier plugin
|
||||
* Type: modifier
|
||||
* Name: count_sentences
|
||||
* Purpose: count the number of sentences in a text
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.modifier.count.paragraphs.php
|
||||
* count_sentences (Smarty online manual)
|
||||
* @author Uwe Tews
|
||||
*
|
||||
* @param array $params parameters
|
||||
*
|
||||
* @return string with compiled code
|
||||
*/
|
||||
function smarty_modifiercompiler_count_sentences($params)
|
||||
{
|
||||
// find periods, question marks, exclamation marks with a word before but not after.
|
||||
return 'preg_match_all("#\w[\.\?\!](\W|$)#S' . Smarty::$_UTF8_MODIFIER . '", ' . $params[ 0 ] . ', $tmp)';
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
/**
|
||||
* Smarty plugin
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage PluginsModifierCompiler
|
||||
*/
|
||||
/**
|
||||
* Smarty count_words modifier plugin
|
||||
* Type: modifier
|
||||
* Name: count_words
|
||||
* Purpose: count the number of words in a text
|
||||
*
|
||||
* @link https://www.smarty.net/manual/en/language.modifier.count.words.php count_words (Smarty online manual)
|
||||
* @author Uwe Tews
|
||||
*
|
||||
* @param array $params parameters
|
||||
*
|
||||
* @return string with compiled code
|
||||
*/
|
||||
function smarty_modifiercompiler_count_words($params)
|
||||
{
|
||||
if (Smarty::$_MBSTRING) {
|
||||
// return 'preg_match_all(\'#[\w\pL]+#' . Smarty::$_UTF8_MODIFIER . '\', ' . $params[0] . ', $tmp)';
|
||||
// expression taken from http://de.php.net/manual/en/function.str-word-count.php#85592
|
||||
return 'preg_match_all(\'/\p{L}[\p{L}\p{Mn}\p{Pd}\\\'\x{2019}]*/' . Smarty::$_UTF8_MODIFIER . '\', ' .
|
||||
$params[ 0 ] . ', $tmp)';
|
||||
}
|
||||
// no MBString fallback
|
||||
return 'str_word_count(' . $params[ 0 ] . ')';
|
||||
}
|