Dev-827-0.0.8.1
28
CHANGES-DEV.MD
Executable file
@ -0,0 +1,28 @@
|
||||
ChangeLog :
|
||||
|
||||
0.8.2
|
||||
|
||||
Erreur dans la présentation d'un lien vide dans le menu
|
||||
|
||||
0.8.1
|
||||
|
||||
Modification cosmétique dans la présentation du thème l'option d'inactivation d'une page disparaît si masquée
|
||||
|
||||
0.8
|
||||
|
||||
suppression message lors du clic sur une page de redirection en mode connecté
|
||||
suppression droits modérateurs sur l'édition de la redirection (plugin PetterRabit)
|
||||
ajout d'une option dans le thème header permettant de rendre la bannière cliquable ou pas
|
||||
|
||||
0.7 la bannière devient cliquable et renvoie vers la page d'accueil
|
||||
|
||||
0.6 Cascade aux pages filles, désactivation et image
|
||||
|
||||
0.5 modification d'étiquette (Bulle au lieu de Titre)
|
||||
nouvelle option : activer ou désactiver une page
|
||||
0.4 correction module/page.php
|
||||
0.3 noyau 8.2.6 dev + désactivation mise à jour auto
|
||||
|
||||
0.2 Ajouter des options texte et image
|
||||
|
||||
0.1 Version initiale
|
674
LICENSE
Executable file
@ -0,0 +1,674 @@
|
||||
GNU 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.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is 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. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
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.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
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 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. Use with the GNU Affero General Public License.
|
||||
|
||||
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 Affero 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 special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU 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 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 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 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 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
{project} Copyright (C) {year} {fullname}
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
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 GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
55
README.md
Executable file
@ -0,0 +1,55 @@
|
||||
# Zwii 8
|
||||
|
||||
Zwii est un CMS sans base de données (Flat-File) qui permet à ses utilisateurs de créer et gérer facilement un site web sans aucune connaissance en programmation.
|
||||
|
||||
[Site](http://zwiicms.com/) - [Forum](http://forum.zwiicms.com/) - [GitHub](https://github.com/remijean/ZwiiCMS/)
|
||||
|
||||
## Configuration recommandée
|
||||
|
||||
* PHP 5.6 ou plus
|
||||
* Support du .htaccess
|
||||
|
||||
## Installation
|
||||
|
||||
Décompressez l'archive de Zwii sur votre serveur et c'est tout !
|
||||
|
||||
## Procédure de mise à jour de Zwii
|
||||
|
||||
### Mise à jour automatique
|
||||
|
||||
* Connectez vous à votre site,
|
||||
* Allez dans l'interface de configuration,
|
||||
* Cliquez sur le bouton "Mettre à jour".
|
||||
|
||||
### Mise à jour manuelle
|
||||
|
||||
**Note : La réécriture d'URL est automatiquement désactivée après une mise à jour manuelle. À vous de la réactiver depuis l'interface de configuration du site.**
|
||||
|
||||
* Sauvegardez le dossier "site" de votre serveur,
|
||||
* Décompressez la nouvelle version sur votre serveur,
|
||||
* Remplacez le dossier "site" de la nouvelle version par le votre.
|
||||
|
||||
## Arborescence générale
|
||||
|
||||
*Légende : [D] Dossier ; [F] Fichier*
|
||||
|
||||
```text
|
||||
[D] core Contient le coeur de Zwii
|
||||
[D] layout Contient les différentes structure de thème
|
||||
[D] module Contient les modules du coeur
|
||||
[D] vendor Contient les librairies
|
||||
[F] core.js.php Coeur JavaScript de Zwii
|
||||
[F] core.php Coeur PHP de Zwii
|
||||
[D] module Contient les modules de page
|
||||
[D] site Contient les données du site
|
||||
[D] backup Contient les 30 dernière sauvegardes automatiques du fichier data.json
|
||||
[D] data Contient les fichiers de données
|
||||
[F] data.json Fichier de données
|
||||
[F] custom.css Feuille de style de la personnalisation avancée
|
||||
[F] theme.css Thème stocké dans le fichier data.json compilé en CSS
|
||||
[D] file Contient les fichiers envoyés sur le serveur depuis le gestionnaire de fichiers
|
||||
[D] source Contient les fichiers
|
||||
[D] thumb Contient les miniatures des fichiers de type image
|
||||
[D] tmp Contient les fichiers temporaire
|
||||
[F] index.php Fichier d'initialisation de Zwii
|
||||
```
|
350
core/core.js.php
Executable file
@ -0,0 +1,350 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.com/
|
||||
*/
|
||||
|
||||
var core = {};
|
||||
|
||||
/**
|
||||
* Crée un message d'alerte
|
||||
*/
|
||||
core.alert = function(text) {
|
||||
var lightbox = lity(function($) {
|
||||
return $("<div>")
|
||||
.addClass("lightbox")
|
||||
.append(
|
||||
$("<span>").text(text),
|
||||
$("<div>")
|
||||
.addClass("lightboxButtons")
|
||||
.append(
|
||||
$("<a>")
|
||||
.addClass("button")
|
||||
.text("Ok")
|
||||
.on("click", function() {
|
||||
lightbox.close();
|
||||
})
|
||||
)
|
||||
)
|
||||
}(jQuery));
|
||||
// Validation de la lightbox avec le bouton entrée
|
||||
$(document).on("keyup", function(event) {
|
||||
if(event.keyCode === 13) {
|
||||
lightbox.close();
|
||||
}
|
||||
});
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Génère des variations d'une couleur
|
||||
*/
|
||||
core.colorVariants = function(rgba) {
|
||||
rgba = rgba.match(/\(+(.*)\)/);
|
||||
rgba = rgba[1].split(", ");
|
||||
return {
|
||||
"normal": "rgba(" + rgba[0] + "," + rgba[1] + "," + rgba[2] + "," + rgba[3] + ")",
|
||||
"darken": "rgba(" + Math.max(0, rgba[0] - 15) + "," + Math.max(0, rgba[1] - 15) + "," + Math.max(0, rgba[2] - 15) + "," + rgba[3] + ")",
|
||||
"veryDarken": "rgba(" + Math.max(0, rgba[0] - 20) + "," + Math.max(0, rgba[1] - 20) + "," + Math.max(0, rgba[2] - 20) + "," + rgba[3] + ")",
|
||||
"text": core.relativeLuminanceW3C(rgba) > .22 ? "inherit" : "white"
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Crée un message de confirmation
|
||||
*/
|
||||
core.confirm = function(text, yesCallback, noCallback) {
|
||||
var lightbox = lity(function($) {
|
||||
return $("<div>")
|
||||
.addClass("lightbox")
|
||||
.append(
|
||||
$("<span>").text(text),
|
||||
$("<div>")
|
||||
.addClass("lightboxButtons")
|
||||
.append(
|
||||
$("<a>")
|
||||
.addClass("button grey")
|
||||
.text("Non")
|
||||
.on("click", function() {
|
||||
lightbox.options('button', true);
|
||||
lightbox.close();
|
||||
if(typeof noCallback !== "undefined") {
|
||||
noCallback();
|
||||
}
|
||||
}),
|
||||
$("<a>")
|
||||
.addClass("button")
|
||||
.text("Oui")
|
||||
.on("click", function() {
|
||||
lightbox.options('button', true);
|
||||
lightbox.close();
|
||||
if(typeof yesCallback !== "undefined") {
|
||||
yesCallback();
|
||||
}
|
||||
})
|
||||
)
|
||||
)
|
||||
}(jQuery));
|
||||
// Callback lors d'un clic sur le fond et sur la croix de fermeture
|
||||
lightbox.options('button', false);
|
||||
$(document).on('lity:close', function(event, instance) {
|
||||
if(
|
||||
instance.options('button') === false
|
||||
&& typeof noCallback !== "undefined"
|
||||
) {
|
||||
noCallback();
|
||||
}
|
||||
});
|
||||
// Validation de la lightbox avec le bouton entrée
|
||||
$(document).on("keyup", function(event) {
|
||||
if(event.keyCode === 13) {
|
||||
lightbox.close();
|
||||
if(typeof yesCallback !== "undefined") {
|
||||
yesCallback();
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Scripts à exécuter en dernier
|
||||
*/
|
||||
core.end = function() {
|
||||
/**
|
||||
* Modifications non enregistrées du formulaire
|
||||
*/
|
||||
var formDOM = $("form");
|
||||
// Ignore :
|
||||
// - TinyMCE car il gère lui même le message
|
||||
// - Les champs avec data-no-dirty
|
||||
var inputsDOM = formDOM.find("input:not([data-no-dirty]), select:not([data-no-dirty]), textarea:not(.editorWysiwyg):not([data-no-dirty])");
|
||||
var inputSerialize = inputsDOM.serialize();
|
||||
$(window).on("beforeunload", function() {
|
||||
if(inputsDOM.serialize() !== inputSerialize) {
|
||||
return "Les modifications que vous avez apportées ne seront peut-être pas enregistrées.";
|
||||
}
|
||||
});
|
||||
formDOM.submit(function() {
|
||||
$(window).off("beforeunload");
|
||||
});
|
||||
};
|
||||
$(function() {
|
||||
core.end();
|
||||
});
|
||||
|
||||
/**
|
||||
* Ajoute une notice
|
||||
*/
|
||||
core.noticeAdd = function(id, notice) {
|
||||
$("#" + id + "Notice").text(notice).removeClass("displayNone");
|
||||
$("#" + id).addClass("notice");
|
||||
};
|
||||
|
||||
/**
|
||||
* Supprime une notice
|
||||
*/
|
||||
core.noticeRemove = function(id) {
|
||||
$("#" + id + "Notice").text("").addClass("displayNone");
|
||||
$("#" + id).removeClass("notice");
|
||||
};
|
||||
|
||||
/**
|
||||
* Scripts à exécuter en premier
|
||||
*/
|
||||
core.start = function() {
|
||||
/**
|
||||
* Remonter en haut au clic sur le bouton
|
||||
*/
|
||||
var backToTopDOM = $("#backToTop");
|
||||
backToTopDOM.on("click", function() {
|
||||
$("body, html").animate({scrollTop: 0}, "400");
|
||||
});
|
||||
/**
|
||||
* Affiche / Cache le bouton pour remonter en haut
|
||||
*/
|
||||
$(window).on("scroll", function() {
|
||||
if($(this).scrollTop() > 200) {
|
||||
backToTopDOM.fadeIn();
|
||||
}
|
||||
else {
|
||||
backToTopDOM.fadeOut();
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Cache les notifications
|
||||
*/
|
||||
var notificationTimer;
|
||||
$("#notification")
|
||||
.on("mouseenter", function() {
|
||||
clearTimeout(notificationTimer);
|
||||
$("#notificationProgress")
|
||||
.stop()
|
||||
.width("100%");
|
||||
})
|
||||
.on("mouseleave", function() {
|
||||
// Disparition de la notification
|
||||
notificationTimer = setTimeout(function() {
|
||||
$("#notification").fadeOut();
|
||||
}, 4000);
|
||||
// Barre de progression
|
||||
$("#notificationProgress").animate({
|
||||
"width": "0%"
|
||||
}, 4000, "linear");
|
||||
})
|
||||
.trigger("mouseleave");
|
||||
$("#notificationClose").on("click", function() {
|
||||
clearTimeout(notificationTimer);
|
||||
$("#notification").fadeOut();
|
||||
$("#notificationProgress").stop();
|
||||
});
|
||||
/**
|
||||
* Affiche / Cache le menu en mode responsive
|
||||
*/
|
||||
var menuDOM = $("#menu");
|
||||
$("#toggle").on("click", function() {
|
||||
menuDOM.slideToggle();
|
||||
});
|
||||
$(window).on("resize", function() {
|
||||
if($(window).width() > 768) {
|
||||
menuDOM.css("display", "");
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Message sur l'utilisation des cookies
|
||||
*/
|
||||
if(<?php echo json_encode($this->getData(['config', 'cookieConsent'])); ?>) {
|
||||
if(document.cookie.indexOf("ZWII_COOKIE_CONSENT") === -1) {
|
||||
$("body").append(
|
||||
$("<div>").attr("id", "cookieConsent").append(
|
||||
$("<span>").text("En poursuivant votre navigation sur ce site, vous acceptez l'utilisation de cookies."),
|
||||
$("<span>")
|
||||
.attr("id", "cookieConsentConfirm")
|
||||
.text("OK")
|
||||
.on("click", function() {
|
||||
// Créé le cookie d'acceptation
|
||||
var expires = new Date();
|
||||
expires.setFullYear(expires.getFullYear() + 1);
|
||||
expires = "expires=" + expires.toUTCString();
|
||||
document.cookie = "ZWII_COOKIE_CONSENT=true;" + expires;
|
||||
// Ferme le message
|
||||
$(this).parents("#cookieConsent").fadeOut();
|
||||
})
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Choix de page dans la barre de membre
|
||||
*/
|
||||
$("#barSelectPage").on("change", function() {
|
||||
var pageUrl = $(this).val();
|
||||
if(pageUrl) {
|
||||
$(location).attr("href", pageUrl);
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Champs d'upload de fichiers
|
||||
*/
|
||||
// Mise à jour de l'affichage des champs d'upload
|
||||
$(".inputFileHidden").on("change", function() {
|
||||
var inputFileHiddenDOM = $(this);
|
||||
var fileName = inputFileHiddenDOM.val();
|
||||
if(fileName === "") {
|
||||
fileName = "Choisissez un fichier";
|
||||
$(".inputFileDelete").addClass("disabled");
|
||||
}
|
||||
else {
|
||||
$(".inputFileDelete").removeClass("disabled");
|
||||
}
|
||||
inputFileHiddenDOM.parent().find(".inputFileLabel").text(fileName);
|
||||
}).trigger("change");
|
||||
// Suppression du fichier contenu dans le champ
|
||||
$(".inputFileDelete").on("click", function() {
|
||||
$(this).parents(".inputWrapper").find(".inputFileHidden").val("").trigger("change");
|
||||
});
|
||||
// Confirmation de mise à jour
|
||||
$("#barUpdate").on("click", function() {
|
||||
return core.confirm("Effectuer la mise à jour ?", function() {
|
||||
$(location).attr("href", $("#barUpdate").attr("href"));
|
||||
});
|
||||
});
|
||||
// Confirmation de déconnexion
|
||||
$("#barLogout").on("click", function() {
|
||||
return core.confirm("Se déconnecter ?", function() {
|
||||
$(location).attr("href", $("#barLogout").attr("href"));
|
||||
});
|
||||
});
|
||||
/**
|
||||
* Bloque la multi-soumission des boutons
|
||||
*/
|
||||
$("form").on("submit", function() {
|
||||
$(this).find(".uniqueSubmission")
|
||||
.addClass("disabled")
|
||||
.prop("disabled", true)
|
||||
.empty()
|
||||
.append(
|
||||
$("<span>").addClass("zwiico-spin animate-spin")
|
||||
)
|
||||
});
|
||||
/**
|
||||
* Check adresse email
|
||||
*/
|
||||
$("[type=email]").on("change", function() {
|
||||
var _this = $(this);
|
||||
var pattern = /^([a-z\d!#$%&'*+\-\/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+(\.[a-z\d!#$%&'*+\-\/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+)*|"((([ \t]*\r\n)?[ \t]+)?([\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*(([ \t]*\r\n)?[ \t]+)?")@(([a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF][a-z\d\-._~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]*[a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])\.)+([a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF][a-z\d\-._~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]*[a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])\.?$/i;
|
||||
if(pattern.test(_this.val())) {
|
||||
core.noticeRemove(_this.attr("id"));
|
||||
}
|
||||
else {
|
||||
core.noticeAdd(_this.attr("id"), "Format incorrect");
|
||||
}
|
||||
});
|
||||
/**
|
||||
* Iframes et vidéos responsives
|
||||
*/
|
||||
var elementDOM = $("iframe, video, embed");
|
||||
// Calcul du ratio et suppression de la hauteur / largeur des iframes
|
||||
elementDOM.each(function() {
|
||||
var _this = $(this);
|
||||
_this
|
||||
.data("ratio", _this.height() / _this.width())
|
||||
.removeAttr("width height");
|
||||
});
|
||||
// Prend la largeur du parent et détermine la hauteur à l'aide du ratio lors du resize de la fenêtre
|
||||
$(window).on("resize", function() {
|
||||
elementDOM.each(function() {
|
||||
var _this = $(this);
|
||||
var width = _this.parent().first().width();
|
||||
_this
|
||||
.width(width)
|
||||
.height(width * _this.data("ratio"));
|
||||
});
|
||||
}).trigger("resize");
|
||||
};
|
||||
core.start();
|
||||
|
||||
/**
|
||||
* Calcul de la luminance relative d'une couleur
|
||||
*/
|
||||
core.relativeLuminanceW3C = function(rgba) {
|
||||
// Conversion en sRGB
|
||||
var RsRGB = rgba[0] / 255;
|
||||
var GsRGB = rgba[1] / 255;
|
||||
var BsRGB = rgba[2] / 255;
|
||||
// Ajout de la transparence
|
||||
var RsRGBA = rgba[3] * RsRGB + (1 - rgba[3]);
|
||||
var GsRGBA = rgba[3] * GsRGB + (1 - rgba[3]);
|
||||
var BsRGBA = rgba[3] * BsRGB + (1 - rgba[3]);
|
||||
// Calcul de la luminance
|
||||
var R = (RsRGBA <= .03928) ? RsRGBA / 12.92 : Math.pow((RsRGBA + .055) / 1.055, 2.4);
|
||||
var G = (GsRGBA <= .03928) ? GsRGBA / 12.92 : Math.pow((GsRGBA + .055) / 1.055, 2.4);
|
||||
var B = (BsRGBA <= .03928) ? BsRGBA / 12.92 : Math.pow((BsRGBA + .055) / 1.055, 2.4);
|
||||
return .2126 * R + .7152 * G + .0722 * B;
|
||||
};
|
2864
core/core.php
Executable file
19
core/layout/blank.css
Executable file
@ -0,0 +1,19 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.com/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Éléments génériques
|
||||
*/
|
||||
|
||||
body {
|
||||
background : #FFF !important;
|
||||
}
|
20
core/layout/blank.php
Executable file
@ -0,0 +1,20 @@
|
||||
<?php $layout = new layout($this); ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<?php $layout->showMetaTitle(); ?>
|
||||
<?php $layout->showMetaDescription(); ?>
|
||||
<?php $layout->showFavicon(); ?>
|
||||
<?php $layout->showVendor(); ?>
|
||||
<link rel="stylesheet" href="<?php echo helper::baseUrl(false); ?>core/layout/common.css">
|
||||
<link rel="stylesheet" href="<?php echo helper::baseUrl(false); ?>core/layout/blank.css">
|
||||
<link rel="stylesheet" href="<?php echo helper::baseUrl(false); ?>site/data/theme.css?<?php echo md5_file('site/data/theme.css'); ?>">
|
||||
<link rel="stylesheet" href="<?php echo helper::baseUrl(false); ?>site/data/custom.css?<?php echo md5_file('site/data/custom.css'); ?>"></head>
|
||||
<body>
|
||||
<?php $layout->showStyle(); ?>
|
||||
<?php $layout->showContent(); ?>
|
||||
<?php $layout->showScript(); ?>
|
||||
</body>
|
||||
</html>
|
1019
core/layout/common.css
Executable file
20
core/layout/light.css
Executable file
@ -0,0 +1,20 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.com/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Éléments spécifiques
|
||||
*/
|
||||
|
||||
/* Site */
|
||||
#site {
|
||||
max-width: 600px !important;
|
||||
}
|
24
core/layout/light.php
Executable file
@ -0,0 +1,24 @@
|
||||
<?php $layout = new layout($this); ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<?php $layout->showMetaTitle(); ?>
|
||||
<?php $layout->showMetaDescription(); ?>
|
||||
<?php $layout->showFavicon(); ?>
|
||||
<?php $layout->showVendor(); ?>
|
||||
<link rel="stylesheet" href="<?php echo helper::baseUrl(false); ?>core/layout/common.css">
|
||||
<link rel="stylesheet" href="<?php echo helper::baseUrl(false); ?>core/layout/light.css">
|
||||
<link rel="stylesheet" href="<?php echo helper::baseUrl(false); ?>site/data/theme.css?<?php echo md5_file('site/data/theme.css'); ?>">
|
||||
<link rel="stylesheet" href="<?php echo helper::baseUrl(false); ?>site/data/custom.css?<?php echo md5_file('site/data/custom.css'); ?>">
|
||||
</head>
|
||||
<body>
|
||||
<?php $layout->showStyle(); ?>
|
||||
<?php $layout->showNotification(); ?>
|
||||
<div id="site" class="container">
|
||||
<section><?php $layout->showContent(); ?></section>
|
||||
</div>
|
||||
<?php $layout->showScript(); ?>
|
||||
</body>
|
||||
</html>
|
127
core/layout/mail.php
Executable file
@ -0,0 +1,127 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="x-apple-disable-message-reformatting">
|
||||
<title><?php echo $subject; ?></title>
|
||||
<!--[if mso]>
|
||||
<style>
|
||||
* {
|
||||
font-family: sans-serif !important;
|
||||
}
|
||||
</style>
|
||||
<![endif]-->
|
||||
<!--[if !mso]>
|
||||
<link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
|
||||
<![endif]-->
|
||||
<style>
|
||||
html,
|
||||
body {
|
||||
margin: 0 auto !important;
|
||||
padding: 0 !important;
|
||||
height: 100% !important;
|
||||
width: 100% !important;
|
||||
}
|
||||
* {
|
||||
-ms-text-size-adjust: 100%;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
}
|
||||
div[style*="margin: 16px 0"] {
|
||||
margin:0 !important;
|
||||
}
|
||||
table,
|
||||
td {
|
||||
mso-table-lspace: 0pt !important;
|
||||
mso-table-rspace: 0pt !important;
|
||||
}
|
||||
table {
|
||||
border-spacing: 0 !important;
|
||||
border-collapse: collapse !important;
|
||||
table-layout: fixed !important;
|
||||
margin: 0 auto !important;
|
||||
}
|
||||
table table table {
|
||||
table-layout: auto;
|
||||
}
|
||||
*[x-apple-data-detectors] {
|
||||
color: inherit !important;
|
||||
text-decoration: none !important;
|
||||
}
|
||||
.x-gmail-data-detectors,
|
||||
.x-gmail-data-detectors *,
|
||||
.aBn {
|
||||
border-bottom: 0 !important;
|
||||
cursor: default !important;
|
||||
}
|
||||
.a6S {
|
||||
display: none !important;
|
||||
opacity: 0.01 !important;
|
||||
}
|
||||
@media only screen and (min-device-width: 375px) and (max-device-width: 413px) {
|
||||
.email-container {
|
||||
min-width: 375px !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body width="100%" bgcolor="#EBEEF2" style="margin: 0; padding: 10px; mso-line-height-rule: exactly;">
|
||||
<center style="width: 100%; background: #EBEEF2; text-align: left;">
|
||||
<div style="display:none;font-size:1px;line-height:1px;max-height:0px;max-width:0px;opacity:0;overflow:hidden;mso-hide:all;font-family: sans-serif;">
|
||||
<?php echo $subject; ?>
|
||||
</div>
|
||||
<div style="max-width: 500px; margin: auto;" class="email-container">
|
||||
<!--[if mso]>
|
||||
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="500" align="center">
|
||||
<tr>
|
||||
<td>
|
||||
<![endif]-->
|
||||
<table role="presentation" cellspacing="0" cellpadding="0" border="0" align="center" width="100%" style="max-width: 500px;">
|
||||
<tr>
|
||||
<td bgcolor="#ffffff">
|
||||
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
|
||||
<tr>
|
||||
<td style="border-bottom: 1px solid #EBEEF2; padding: 20px; font-family: 'Open Sans', sans-serif; font-size: 19px; line-height: 24px; text-align: center; color: #212223;">
|
||||
<?php echo $this->getData(['config', 'title']); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table role="presentation" cellspacing="0" cellpadding="0" border="0" align="center" width="100%" style="max-width: 500px;">
|
||||
<tr>
|
||||
<td bgcolor="#ffffff">
|
||||
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
|
||||
<tr>
|
||||
<td style="padding: 30px; font-family: 'Open Sans', sans-serif; font-size: 14px; line-height: 19px; color: #212223;">
|
||||
<?php echo nl2br($content); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table role="presentation" cellspacing="0" cellpadding="0" border="0" align="center" width="100%" style="max-width: 500px;">
|
||||
<tr>
|
||||
<td bgcolor="#ffffff">
|
||||
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
|
||||
<tr>
|
||||
<td style="border-top: 1px solid #EBEEF2; padding: 20px; text-align: center; font-family: 'Open Sans', sans-serif; font-size: 12px; line-height: 17px; color: #212223;">
|
||||
<a href="<?php echo helper::baseUrl(false); ?>" target="_blank"><?php echo $this->getData(['config', 'title']); ?></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!--[if mso]>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<![endif]-->
|
||||
</div>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
155
core/layout/main.php
Executable file
@ -0,0 +1,155 @@
|
||||
<?php $layout = new layout($this); ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<?php $layout->showMetaTitle(); ?>
|
||||
<?php $layout->showMetaDescription(); ?>
|
||||
<?php $layout->showFavicon(); ?>
|
||||
<?php $layout->showVendor(); ?>
|
||||
<link rel="stylesheet" href="<?php echo helper::baseUrl(false); ?>core/layout/common.css">
|
||||
<link rel="stylesheet" href="<?php echo helper::baseUrl(false); ?>site/data/theme.css?<?php echo md5_file('site/data/theme.css'); ?>">
|
||||
<link rel="stylesheet" href="<?php echo helper::baseUrl(false); ?>site/data/custom.css?<?php echo md5_file('site/data/custom.css'); ?>">
|
||||
</head>
|
||||
<body>
|
||||
<?php $layout->showStyle(); ?>
|
||||
<?php $layout->showBar(); ?>
|
||||
<?php $layout->showNotification(); ?>
|
||||
<?php if($this->getData(['theme', 'menu', 'position']) === 'body-first'): ?>
|
||||
<!-- Menu dans le fond du site avant la bannière -->
|
||||
<nav>
|
||||
<div id="toggle"><?php echo template::ico('menu'); ?></div>
|
||||
<div id="menu" class="container">
|
||||
<?php $layout->showMenu(); ?>
|
||||
</div>
|
||||
</nav>
|
||||
<?php endif; ?>
|
||||
<?php if($this->getData(['theme', 'header', 'position']) === 'body'): ?>
|
||||
<!-- Bannière dans le fond du site -->
|
||||
<header>
|
||||
<?php if(
|
||||
$this->getData(['theme', 'header', 'textHide']) === false
|
||||
// Affiche toujours le titre de la bannière pour l'édition du thème
|
||||
OR ($this->getUrl(0) === 'theme' AND $this->getUrl(1) === 'header')
|
||||
): ?>
|
||||
<!-- menu image -->
|
||||
<?php
|
||||
if ($this->getData(['theme','header','linkHome'])){
|
||||
echo "<a href='" . helper::baseUrl(false) . "'>" ;} ?>
|
||||
<!-- menu image -->
|
||||
|
||||
<div class="container">
|
||||
<span><?php echo $this->getData(['config', 'title']); ?></span>
|
||||
</div>
|
||||
<!-- menu image -->
|
||||
<?php
|
||||
if ($this->getData(['theme','header','linkHome'])){echo "</a>";}
|
||||
?>
|
||||
<!-- menu image -->
|
||||
|
||||
<?php endif; ?>
|
||||
</header>
|
||||
<?php endif; ?>
|
||||
<?php if($this->getData(['theme', 'menu', 'position']) === 'body-second'): ?>
|
||||
<!-- Menu dans le fond du site après la bannière -->
|
||||
<nav>
|
||||
<div id="toggle"><?php echo template::ico('menu'); ?></div>
|
||||
<div id="menu" class="container">
|
||||
<?php $layout->showMenu(); ?>
|
||||
</div>
|
||||
</nav>
|
||||
<?php endif; ?>
|
||||
<!-- Site -->
|
||||
<div id="site" class="container">
|
||||
<?php if($this->getData(['theme', 'menu', 'position']) === 'site-first'): ?>
|
||||
<!-- Menu dans le site avant la bannière -->
|
||||
<nav>
|
||||
<div id="toggle"><?php echo template::ico('menu'); ?></div>
|
||||
<div id="menu" class="container">
|
||||
<?php $layout->showMenu(); ?>
|
||||
</div>
|
||||
</nav>
|
||||
<?php endif; ?>
|
||||
<?php if(
|
||||
$this->getData(['theme', 'header', 'position']) === 'site'
|
||||
// Affiche toujours la bannière pour l'édition du thème
|
||||
OR (
|
||||
$this->getData(['theme', 'header', 'position']) === 'hide'
|
||||
AND $this->getUrl(0) === 'theme'
|
||||
)
|
||||
): ?>
|
||||
<!-- Bannière dans le site -->
|
||||
<header <?php if($this->getData(['theme', 'header', 'position']) === 'hide'): ?>class="displayNone"<?php endif; ?>>
|
||||
<?php if(
|
||||
$this->getData(['theme', 'header', 'textHide']) === false
|
||||
// Affiche toujours le titre de la bannière pour l'édition du thème
|
||||
OR ($this->getUrl(0) === 'theme' AND $this->getUrl(1) === 'header')
|
||||
): ?>
|
||||
<!-- menu image -->
|
||||
<?php
|
||||
if ($this->getData(['theme','header','linkHome'])){
|
||||
echo "<a href='" . helper::baseUrl(false) . "'>" ;} ?>
|
||||
<div class="container">
|
||||
<span><?php echo $this->getData(['config', 'title']); ?></span>
|
||||
</div>
|
||||
<?php
|
||||
if ($this->getData(['theme','header','linkHome'])){echo "</a>";}
|
||||
?>
|
||||
<?php endif; ?>
|
||||
<!-- menu image -->
|
||||
|
||||
</header>
|
||||
<?php endif; ?>
|
||||
<?php if(
|
||||
$this->getData(['theme', 'menu', 'position']) === 'site-second'
|
||||
// Affiche toujours le menu pour l'édition du thème
|
||||
OR (
|
||||
$this->getData(['theme', 'menu', 'position']) === 'hide'
|
||||
AND $this->getUrl(0) === 'theme'
|
||||
)
|
||||
): ?>
|
||||
<!-- Menu dans le site après la bannière -->
|
||||
<nav <?php if($this->getData(['theme', 'menu', 'position']) === 'hide'): ?>class="displayNone"<?php endif; ?>>
|
||||
<div id="toggle"><?php echo template::ico('menu'); ?></div>
|
||||
<div id="menu" class="container">
|
||||
<?php $layout->showMenu(); ?>
|
||||
</div>
|
||||
</nav>
|
||||
<?php endif; ?>
|
||||
<!-- Corps -->
|
||||
<section><?php $layout->showContent(); ?></section>
|
||||
<?php if(
|
||||
$this->getData(['theme', 'footer', 'position']) === 'site'
|
||||
// Affiche toujours le pied de page pour l'édition du thème
|
||||
OR (
|
||||
$this->getData(['theme', 'footer', 'position']) === 'hide'
|
||||
AND $this->getUrl(0) === 'theme'
|
||||
)
|
||||
): ?>
|
||||
<!-- Pied de page dans le site -->
|
||||
<footer <?php if($this->getData(['theme', 'footer', 'position']) === 'hide'): ?>class="displayNone"<?php endif; ?>>
|
||||
<div class="container">
|
||||
<?php $layout->showSocials(); ?>
|
||||
<?php $layout->showFooterText(); ?>
|
||||
<?php $layout->showCopyright(); ?>
|
||||
</div>
|
||||
</footer>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if($this->getData(['theme', 'footer', 'position']) === 'body'): ?>
|
||||
<!-- Pied de page dans le fond du site -->
|
||||
<footer>
|
||||
<div class="container">
|
||||
<?php $layout->showSocials(); ?>
|
||||
<?php $layout->showFooterText(); ?>
|
||||
<?php $layout->showCopyright(); ?>
|
||||
</div>
|
||||
</footer>
|
||||
<?php endif; ?>
|
||||
<!-- Lien remonter en haut -->
|
||||
<div id="backToTop"><?php echo template::ico('up'); ?></div>
|
||||
<?php $layout->showAnalytics(); ?>
|
||||
<?php $layout->showScript(); ?>
|
||||
</body>
|
||||
</html>
|
265
core/module/config/config.php
Executable file
@ -0,0 +1,265 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.com/
|
||||
*/
|
||||
|
||||
class config extends common {
|
||||
|
||||
public static $actions = [
|
||||
'backup' => self::GROUP_ADMIN,
|
||||
'index' => self::GROUP_ADMIN
|
||||
];
|
||||
|
||||
public static $timezones = [
|
||||
'Pacific/Midway' => '(GMT-11:00) Midway Island',
|
||||
'US/Samoa' => '(GMT-11:00) Samoa',
|
||||
'US/Hawaii' => '(GMT-10:00) Hawaii',
|
||||
'US/Alaska' => '(GMT-09:00) Alaska',
|
||||
'US/Pacific' => '(GMT-08:00) Pacific Time (US & Canada)',
|
||||
'America/Tijuana' => '(GMT-08:00) Tijuana',
|
||||
'US/Arizona' => '(GMT-07:00) Arizona',
|
||||
'US/Mountain' => '(GMT-07:00) Mountain Time (US & Canada)',
|
||||
'America/Chihuahua' => '(GMT-07:00) Chihuahua',
|
||||
'America/Mazatlan' => '(GMT-07:00) Mazatlan',
|
||||
'America/Mexico_City' => '(GMT-06:00) Mexico City',
|
||||
'America/Monterrey' => '(GMT-06:00) Monterrey',
|
||||
'Canada/Saskatchewan' => '(GMT-06:00) Saskatchewan',
|
||||
'US/Central' => '(GMT-06:00) Central Time (US & Canada)',
|
||||
'US/Eastern' => '(GMT-05:00) Eastern Time (US & Canada)',
|
||||
'US/East-Indiana' => '(GMT-05:00) Indiana (East)',
|
||||
'America/Bogota' => '(GMT-05:00) Bogota',
|
||||
'America/Lima' => '(GMT-05:00) Lima',
|
||||
'America/Caracas' => '(GMT-04:30) Caracas',
|
||||
'Canada/Atlantic' => '(GMT-04:00) Atlantic Time (Canada)',
|
||||
'America/La_Paz' => '(GMT-04:00) La Paz',
|
||||
'America/Santiago' => '(GMT-04:00) Santiago',
|
||||
'Canada/Newfoundland' => '(GMT-03:30) Newfoundland',
|
||||
'America/Buenos_Aires' => '(GMT-03:00) Buenos Aires',
|
||||
'Greenland' => '(GMT-03:00) Greenland',
|
||||
'Atlantic/Stanley' => '(GMT-02:00) Stanley',
|
||||
'Atlantic/Azores' => '(GMT-01:00) Azores',
|
||||
'Atlantic/Cape_Verde' => '(GMT-01:00) Cape Verde Is.',
|
||||
'Africa/Casablanca' => '(GMT) Casablanca',
|
||||
'Europe/Dublin' => '(GMT) Dublin',
|
||||
'Europe/Lisbon' => '(GMT) Lisbon',
|
||||
'Europe/London' => '(GMT) London',
|
||||
'Africa/Monrovia' => '(GMT) Monrovia',
|
||||
'Europe/Amsterdam' => '(GMT+01:00) Amsterdam',
|
||||
'Europe/Belgrade' => '(GMT+01:00) Belgrade',
|
||||
'Europe/Berlin' => '(GMT+01:00) Berlin',
|
||||
'Europe/Bratislava' => '(GMT+01:00) Bratislava',
|
||||
'Europe/Brussels' => '(GMT+01:00) Brussels',
|
||||
'Europe/Budapest' => '(GMT+01:00) Budapest',
|
||||
'Europe/Copenhagen' => '(GMT+01:00) Copenhagen',
|
||||
'Europe/Ljubljana' => '(GMT+01:00) Ljubljana',
|
||||
'Europe/Madrid' => '(GMT+01:00) Madrid',
|
||||
'Europe/Paris' => '(GMT+01:00) Paris',
|
||||
'Europe/Prague' => '(GMT+01:00) Prague',
|
||||
'Europe/Rome' => '(GMT+01:00) Rome',
|
||||
'Europe/Sarajevo' => '(GMT+01:00) Sarajevo',
|
||||
'Europe/Skopje' => '(GMT+01:00) Skopje',
|
||||
'Europe/Stockholm' => '(GMT+01:00) Stockholm',
|
||||
'Europe/Vienna' => '(GMT+01:00) Vienna',
|
||||
'Europe/Warsaw' => '(GMT+01:00) Warsaw',
|
||||
'Europe/Zagreb' => '(GMT+01:00) Zagreb',
|
||||
'Europe/Athens' => '(GMT+02:00) Athens',
|
||||
'Europe/Bucharest' => '(GMT+02:00) Bucharest',
|
||||
'Africa/Cairo' => '(GMT+02:00) Cairo',
|
||||
'Africa/Harare' => '(GMT+02:00) Harare',
|
||||
'Europe/Helsinki' => '(GMT+02:00) Helsinki',
|
||||
'Europe/Istanbul' => '(GMT+02:00) Istanbul',
|
||||
'Asia/Jerusalem' => '(GMT+02:00) Jerusalem',
|
||||
'Europe/Kiev' => '(GMT+02:00) Kyiv',
|
||||
'Europe/Minsk' => '(GMT+02:00) Minsk',
|
||||
'Europe/Riga' => '(GMT+02:00) Riga',
|
||||
'Europe/Sofia' => '(GMT+02:00) Sofia',
|
||||
'Europe/Tallinn' => '(GMT+02:00) Tallinn',
|
||||
'Europe/Vilnius' => '(GMT+02:00) Vilnius',
|
||||
'Asia/Baghdad' => '(GMT+03:00) Baghdad',
|
||||
'Asia/Kuwait' => '(GMT+03:00) Kuwait',
|
||||
'Europe/Moscow' => '(GMT+03:00) Moscow',
|
||||
'Africa/Nairobi' => '(GMT+03:00) Nairobi',
|
||||
'Asia/Riyadh' => '(GMT+03:00) Riyadh',
|
||||
'Europe/Volgograd' => '(GMT+03:00) Volgograd',
|
||||
'Asia/Tehran' => '(GMT+03:30) Tehran',
|
||||
'Asia/Baku' => '(GMT+04:00) Baku',
|
||||
'Asia/Muscat' => '(GMT+04:00) Muscat',
|
||||
'Asia/Tbilisi' => '(GMT+04:00) Tbilisi',
|
||||
'Asia/Yerevan' => '(GMT+04:00) Yerevan',
|
||||
'Asia/Kabul' => '(GMT+04:30) Kabul',
|
||||
'Asia/Yekaterinburg' => '(GMT+05:00) Ekaterinburg',
|
||||
'Asia/Karachi' => '(GMT+05:00) Karachi',
|
||||
'Asia/Tashkent' => '(GMT+05:00) Tashkent',
|
||||
'Asia/Kolkata' => '(GMT+05:30) Kolkata',
|
||||
'Asia/Kathmandu' => '(GMT+05:45) Kathmandu',
|
||||
'Asia/Almaty' => '(GMT+06:00) Almaty',
|
||||
'Asia/Dhaka' => '(GMT+06:00) Dhaka',
|
||||
'Asia/Novosibirsk' => '(GMT+06:00) Novosibirsk',
|
||||
'Asia/Bangkok' => '(GMT+07:00) Bangkok',
|
||||
'Asia/Jakarta' => '(GMT+07:00) Jakarta',
|
||||
'Asia/Krasnoyarsk' => '(GMT+07:00) Krasnoyarsk',
|
||||
'Asia/Chongqing' => '(GMT+08:00) Chongqing',
|
||||
'Asia/Hong_Kong' => '(GMT+08:00) Hong Kong',
|
||||
'Asia/Irkutsk' => '(GMT+08:00) Irkutsk',
|
||||
'Asia/Kuala_Lumpur' => '(GMT+08:00) Kuala Lumpur',
|
||||
'Australia/Perth' => '(GMT+08:00) Perth',
|
||||
'Asia/Singapore' => '(GMT+08:00) Singapore',
|
||||
'Asia/Taipei' => '(GMT+08:00) Taipei',
|
||||
'Asia/Ulaanbaatar' => '(GMT+08:00) Ulaan Bataar',
|
||||
'Asia/Urumqi' => '(GMT+08:00) Urumqi',
|
||||
'Asia/Seoul' => '(GMT+09:00) Seoul',
|
||||
'Asia/Tokyo' => '(GMT+09:00) Tokyo',
|
||||
'Asia/Yakutsk' => '(GMT+09:00) Yakutsk',
|
||||
'Australia/Adelaide' => '(GMT+09:30) Adelaide',
|
||||
'Australia/Darwin' => '(GMT+09:30) Darwin',
|
||||
'Australia/Brisbane' => '(GMT+10:00) Brisbane',
|
||||
'Australia/Canberra' => '(GMT+10:00) Canberra',
|
||||
'Pacific/Guam' => '(GMT+10:00) Guam',
|
||||
'Australia/Hobart' => '(GMT+10:00) Hobart',
|
||||
'Australia/Melbourne' => '(GMT+10:00) Melbourne',
|
||||
'Pacific/Port_Moresby' => '(GMT+10:00) Port Moresby',
|
||||
'Australia/Sydney' => '(GMT+10:00) Sydney',
|
||||
'Asia/Vladivostok' => '(GMT+10:00) Vladivostok',
|
||||
'Asia/Magadan' => '(GMT+11:00) Magadan',
|
||||
'Pacific/Auckland' => '(GMT+12:00) Auckland',
|
||||
'Pacific/Fiji' => '(GMT+12:00) Fiji',
|
||||
'Asia/Kamchatka' => '(GMT+12:00) Kamchatka'
|
||||
];
|
||||
|
||||
/**
|
||||
* Sauvegarde des données
|
||||
*/
|
||||
public function backup() {
|
||||
// Creation du ZIP
|
||||
$fileName = date('Y-m-d-h-i-s', time()) . '.zip';
|
||||
$zip = new ZipArchive();
|
||||
if($zip->open('site/tmp/' . $fileName, ZipArchive::CREATE) === TRUE){
|
||||
foreach(configHelper::scanDir('site/') as $file) {
|
||||
$zip->addFile($file);
|
||||
}
|
||||
}
|
||||
$zip->close();
|
||||
// Téléchargement du ZIP
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
header('Content-Disposition: attachment; filename="' . $fileName . '"');
|
||||
header('Content-Length: ' . filesize('site/tmp/' . $fileName));
|
||||
readfile('site/tmp/' . $fileName);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'display' => self::DISPLAY_RAW
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configuration
|
||||
*/
|
||||
public function index() {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
$this->setData([
|
||||
'config',
|
||||
[
|
||||
'analyticsId' => $this->getInput('configAnalyticsId'),
|
||||
'autoBackup' => $this->getInput('configAutoBackup', helper::FILTER_BOOLEAN),
|
||||
'maintenance' => $this->getInput('configMaintenance', helper::FILTER_BOOLEAN),
|
||||
'cookieConsent' => $this->getInput('configCookieConsent', helper::FILTER_BOOLEAN),
|
||||
'favicon' => $this->getInput('configFavicon'),
|
||||
'homePageId' => $this->getInput('configHomePageId', helper::FILTER_ID, true),
|
||||
'metaDescription' => $this->getInput('configMetaDescription', helper::FILTER_STRING_LONG, true),
|
||||
'social' => [
|
||||
'facebookId' => $this->getInput('configSocialFacebookId'),
|
||||
'googleplusId' => $this->getInput('configSocialGoogleplusId'),
|
||||
'instagramId' => $this->getInput('configSocialInstagramId'),
|
||||
'pinterestId' => $this->getInput('configSocialPinterestId'),
|
||||
'twitterId' => $this->getInput('configSocialTwitterId'),
|
||||
'youtubeId' => $this->getInput('configSocialYoutubeId')
|
||||
],
|
||||
'timezone' => $this->getInput('configTimezone', helper::FILTER_STRING_SHORT, true),
|
||||
'title' => $this->getInput('configTitle', helper::FILTER_STRING_SHORT, true)
|
||||
]
|
||||
]);
|
||||
if(self::$inputNotices === []) {
|
||||
// Active la réécriture d'URL
|
||||
$rewrite = $this->getInput('rewrite', helper::FILTER_BOOLEAN);
|
||||
if(
|
||||
$rewrite
|
||||
AND helper::checkRewrite() === false
|
||||
) {
|
||||
// Ajout des lignes dans le .htaccess
|
||||
file_put_contents(
|
||||
'.htaccess',
|
||||
PHP_EOL .
|
||||
'<ifModule mod_rewrite.c>' . PHP_EOL .
|
||||
"\tRewriteEngine on" . PHP_EOL .
|
||||
"\tRewriteBase " . helper::baseUrl(false, false) . PHP_EOL .
|
||||
"\tRewriteCond %{REQUEST_FILENAME} !-f" . PHP_EOL .
|
||||
"\tRewriteCond %{REQUEST_FILENAME} !-d" . PHP_EOL .
|
||||
"\tRewriteRule ^(.*)$ index.php?$1 [L]" . PHP_EOL .
|
||||
'</ifModule>',
|
||||
FILE_APPEND
|
||||
);
|
||||
// Change le statut de la réécriture d'URL (pour le helper::baseUrl() de la redirection)
|
||||
helper::$rewriteStatus = true;
|
||||
}
|
||||
// Désactive la réécriture d'URL
|
||||
elseif(
|
||||
$rewrite === false
|
||||
AND helper::checkRewrite()
|
||||
) {
|
||||
// Suppression des lignes dans le .htaccess
|
||||
$htaccess = explode('# URL rewriting', file_get_contents('.htaccess'));
|
||||
file_put_contents('.htaccess', $htaccess[0] . '# URL rewriting');
|
||||
// Change le statut de la réécriture d'URL (pour le helper::baseUrl() de la redirection)
|
||||
helper::$rewriteStatus = false;
|
||||
}
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(),
|
||||
'notification' => 'Modifications enregistrées',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Configuration',
|
||||
'view' => 'index'
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class configHelper extends helper {
|
||||
|
||||
/**
|
||||
* Scan le contenu d'un dossier et de ses sous-dossiers
|
||||
* @param string $dir Dossier à scanner
|
||||
* @return array
|
||||
*/
|
||||
public static function scanDir($dir) {
|
||||
$dirContent = [];
|
||||
$iterator = new DirectoryIterator($dir);
|
||||
foreach($iterator as $fileInfos) {
|
||||
if(in_array($fileInfos->getFilename(), ['.', '..', 'backup'])) {
|
||||
continue;
|
||||
}
|
||||
elseif($fileInfos->isDir()) {
|
||||
$dirContent = array_merge($dirContent, self::scanDir($fileInfos->getPathname()));
|
||||
}
|
||||
else {
|
||||
$dirContent[] = $fileInfos->getPathname();
|
||||
}
|
||||
}
|
||||
return $dirContent;
|
||||
}
|
||||
|
||||
}
|
137
core/module/config/view/index/index.php
Executable file
@ -0,0 +1,137 @@
|
||||
<?php echo template::formOpen('configForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('configBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl(false),
|
||||
'ico' => 'home',
|
||||
'value' => 'Accueil'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::submit('configSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<div class="block">
|
||||
<h4>Informations générales</h4>
|
||||
<?php echo template::text('configTitle', [
|
||||
'label' => 'Titre du site',
|
||||
'value' => $this->getData(['config', 'title'])
|
||||
]); ?>
|
||||
<?php echo template::textarea('configMetaDescription', [
|
||||
'label' => 'Description du site',
|
||||
'value' => $this->getData(['config', 'metaDescription'])
|
||||
]); ?>
|
||||
<?php echo template::select('configHomePageId', helper::arrayCollumn($this->getData(['page']), 'title', 'SORT_ASC'), [
|
||||
'label' => 'Page d\'accueil',
|
||||
'selected' => $this->getData(['config', 'homePageId'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="block">
|
||||
<h4>Options avancées</h4>
|
||||
<?php echo template::file('configFavicon', [
|
||||
'extensions' => 'ico',
|
||||
'help' => 'Seule une image de format .ico est acceptée. Pensez à supprimer le cache de votre navigateur si la favicon ne change pas.',
|
||||
'label' => 'Favicon',
|
||||
'value' => $this->getData(['config', 'favicon'])
|
||||
]); ?>
|
||||
<?php echo template::text('configAnalyticsId', [
|
||||
'help' => 'Saisissez l\'ID de suivi de votre propriété Google Analytics.',
|
||||
'label' => 'Google Analytics',
|
||||
'placeholder' => 'UA-XXXXXXXX-X',
|
||||
'value' => $this->getData(['config', 'analyticsId'])
|
||||
]); ?>
|
||||
<?php echo template::checkbox('configCookieConsent', true, 'Message de consentement pour l\'utilisation des cookies', [
|
||||
'checked' => $this->getData(['config', 'cookieConsent'])
|
||||
]); ?>
|
||||
<?php echo template::checkbox('rewrite', true, 'Réécriture d\'URL', [
|
||||
'checked' => helper::checkRewrite(),
|
||||
'help' => 'Afin d\'éviter de bloquer votre site pensez à vérifier que le module de réécriture d\'URL est bien actif sur votre serveur avant d\'activer cette fonctionnalité.'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<div class="block">
|
||||
<h4>Réseaux sociaux</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::text('configSocialFacebookId', [
|
||||
'help' => 'Saisissez votre ID Facebook : https://www.facebook.com/[CETTE PARTIE].',
|
||||
'label' => 'Facebook',
|
||||
'value' => $this->getData(['config', 'social', 'facebookId'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::text('configSocialGoogleplusId', [
|
||||
'help' => 'Saisissez votre ID Google+ : https://plus.google.com/[CETTE PARTIE].',
|
||||
'label' => 'Google+',
|
||||
'value' => $this->getData(['config', 'social', 'googleplusId'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::text('configSocialInstagramId', [
|
||||
'help' => 'Saisissez votre ID Instagram : https://www.instagram.com/[CETTE PARTIE].',
|
||||
'label' => 'Instagram',
|
||||
'value' => $this->getData(['config', 'social', 'instagramId'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::text('configSocialPinterestId', [
|
||||
'help' => 'Saisissez votre ID Pinterest : https://pinterest.com/[CETTE PARTIE].',
|
||||
'label' => 'Pinterest',
|
||||
'value' => $this->getData(['config', 'social', 'pinterestId'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::text('configSocialTwitterId', [
|
||||
'help' => 'Saisissez votre ID Twitter : https://twitter.com/[CETTE PARTIE].',
|
||||
'label' => 'Twitter',
|
||||
'value' => $this->getData(['config', 'social', 'twitterId'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::text('configSocialYoutubeId', [
|
||||
'help' => 'Saisissez votre ID Youtube : https://www.youtube.com/channel/[CETTE PARTIE].',
|
||||
'label' => 'Youtube',
|
||||
'value' => $this->getData(['config', 'social', 'youtubeId'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="block">
|
||||
<h4>Système</h4>
|
||||
<?php echo template::text('configVersion', [
|
||||
'label' => 'Version de Zwii',
|
||||
'readonly' => true,
|
||||
'value' => self::ZWII_VERSION
|
||||
]); ?>
|
||||
<?php echo template::select('configTimezone', $module::$timezones, [
|
||||
'label' => 'Fuseau horaire',
|
||||
'selected' => $this->getData(['config', 'timezone'])
|
||||
]); ?>
|
||||
<?php echo template::checkbox('configMaintenance', true, 'Site en maintenance', [
|
||||
'checked' => $this->getData(['config', 'maintenance']),
|
||||
'help' => 'Le site devient inaccessible sauf pour les administrateurs.'
|
||||
]); ?>
|
||||
<?php echo template::checkbox('configAutoBackup', true, 'Sauvegarde automatique des données', [
|
||||
'checked' => $this->getData(['config', 'autoBackup']),
|
||||
'help' => 'Sauvegarde une fois par jour le fichier de données dans le dossier site/backup/. La sauvegarde est conservée 30 jours.'
|
||||
]); ?>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::button('configExport', [
|
||||
'href' => helper::baseUrl() . 'config/backup',
|
||||
'value' => 'Exporter les données'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
198
core/module/install/install.php
Executable file
@ -0,0 +1,198 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.com/
|
||||
*/
|
||||
|
||||
class install extends common {
|
||||
|
||||
public static $actions = [
|
||||
'index' => self::GROUP_VISITOR,
|
||||
'steps' => self::GROUP_ADMIN,
|
||||
'update' => self::GROUP_ADMIN
|
||||
];
|
||||
|
||||
public static $newVersion;
|
||||
|
||||
/**
|
||||
* Installation
|
||||
*/
|
||||
public function index() {
|
||||
// Accès refusé
|
||||
if($this->getData(['user']) !== []) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
]);
|
||||
}
|
||||
// Accès autorisé
|
||||
else {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
// Double vérification pour le mot de passe
|
||||
if($this->getInput('installPassword', helper::FILTER_STRING_SHORT, true) !== $this->getInput('installConfirmPassword', helper::FILTER_STRING_SHORT, true)) {
|
||||
self::$inputNotices['installConfirmPassword'] = 'Incorrect';
|
||||
}
|
||||
// Crée l'utilisateur
|
||||
$userFirstname = $this->getInput('installFirstname', helper::FILTER_STRING_SHORT, true);
|
||||
$userLastname = $this->getInput('installLastname', helper::FILTER_STRING_SHORT, true);
|
||||
$userMail = $this->getInput('installMail', helper::FILTER_MAIL, true);
|
||||
$userId = $this->getInput('installId', helper::FILTER_ID, true);
|
||||
$this->setData([
|
||||
'user',
|
||||
$userId,
|
||||
[
|
||||
'firstname' => $userFirstname,
|
||||
'forgot' => 0,
|
||||
'group' => self::GROUP_ADMIN,
|
||||
'lastname' => $userLastname,
|
||||
'mail' => $userMail,
|
||||
'password' => $this->getInput('installPassword', helper::FILTER_PASSWORD, true)
|
||||
]
|
||||
]);
|
||||
// Configure certaines données par défaut
|
||||
$this->setData(['module', 'blog', 'mon-premier-article', 'userId', $userId]);
|
||||
$this->setData(['module', 'blog', 'mon-deuxieme-article', 'userId', $userId]);
|
||||
$this->setData(['module', 'blog', 'mon-troisieme-article', 'userId', $userId]);
|
||||
// Envoi le mail
|
||||
$sent = $this->sendMail(
|
||||
$userMail,
|
||||
'Installation de votre site',
|
||||
'Bonjour' . ' <strong>' . $userFirstname . ' ' . $userLastname . '</strong>,<br><br>' .
|
||||
'Vous trouverez ci-dessous les détails de votre installation.<br><br>' .
|
||||
'<strong>URL du site :</strong> <a href="' . helper::baseUrl(false) . '" target="_blank">' . helper::baseUrl(false) . '</a><br>' .
|
||||
'<strong>Identifiant du compte :</strong> ' . $this->getInput('installId') . '<br>' .
|
||||
'<strong>Mot de passe du compte :</strong> ' . $this->getInput('installPassword')
|
||||
);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl(false),
|
||||
'notification' => ($sent === true ? 'Installation terminée' : $sent),
|
||||
'state' => ($sent === true ? true : null)
|
||||
]);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'display' => self::DISPLAY_LAYOUT_LIGHT,
|
||||
'title' => 'Installation',
|
||||
'view' => 'index'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Étapes de mise à jour
|
||||
*/
|
||||
public function steps() {
|
||||
switch($this->getInput('step', helper::FILTER_INT)) {
|
||||
// Préparation
|
||||
case 1:
|
||||
$success = true;
|
||||
// Copie du fichier de données
|
||||
copy('site/data/data.json', 'site/backup/' . date('Y-m-d', time()) . '-update.json');
|
||||
// Nettoyage des fichiers temporaires
|
||||
if(file_exists('site/tmp/update.tar.gz')) {
|
||||
$success = unlink('site/tmp/update.tar.gz');
|
||||
}
|
||||
if(file_exists('site/tmp/update.tar')) {
|
||||
$success = unlink('site/tmp/update.tar');
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'display' => self::DISPLAY_JSON,
|
||||
'content' => [
|
||||
'success' => $success,
|
||||
'data' => null
|
||||
]
|
||||
]);
|
||||
break;
|
||||
// Téléchargement
|
||||
case 2:
|
||||
// Téléchargement depuis le serveur de Zwii
|
||||
$success = (file_put_contents('site/tmp/update.tar.gz', file_get_contents('https://zwiicms.com/update.tar.gz')) !== false);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'display' => self::DISPLAY_JSON,
|
||||
'content' => [
|
||||
'success' => $success,
|
||||
'data' => null
|
||||
]
|
||||
]);
|
||||
break;
|
||||
// Installation
|
||||
case 3:
|
||||
$success = true;
|
||||
// Check la réécriture d'URL avant d'écraser les fichiers
|
||||
$rewrite = helper::checkRewrite();
|
||||
// Décompression et installation
|
||||
try {
|
||||
// Décompression dans le dossier de fichier temporaires
|
||||
$pharData = new PharData('site/tmp/update.tar.gz');
|
||||
$pharData->decompress();
|
||||
// Installation
|
||||
$pharData->extractTo(__DIR__ . '/../../../', null, true);
|
||||
} catch (Exception $e) {
|
||||
$success = $e->getMessage();
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'display' => self::DISPLAY_JSON,
|
||||
'content' => [
|
||||
'success' => $success,
|
||||
'data' => $rewrite
|
||||
]
|
||||
]);
|
||||
break;
|
||||
// Configuration
|
||||
case 4:
|
||||
$success = true;
|
||||
// Réécriture d'URL
|
||||
if($this->getInput('data', helper::FILTER_BOOLEAN)) {
|
||||
$success = (file_put_contents(
|
||||
'.htaccess',
|
||||
PHP_EOL .
|
||||
'<ifModule mod_rewrite.c>' . PHP_EOL .
|
||||
"\tRewriteEngine on" . PHP_EOL .
|
||||
"\tRewriteBase " . helper::baseUrl(false, false) . PHP_EOL .
|
||||
"\tRewriteCond %{REQUEST_FILENAME} !-f" . PHP_EOL .
|
||||
"\tRewriteCond %{REQUEST_FILENAME} !-d" . PHP_EOL .
|
||||
"\tRewriteRule ^(.*)$ index.php?$1 [L]" . PHP_EOL .
|
||||
'</ifModule>',
|
||||
FILE_APPEND
|
||||
) !== false);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'display' => self::DISPLAY_JSON,
|
||||
'content' => [
|
||||
'success' => $success,
|
||||
'data' => null
|
||||
]
|
||||
]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Mise à jour
|
||||
*/
|
||||
public function update() {
|
||||
// Nouvelle version
|
||||
self::$newVersion = file_get_contents('http://zwiicms.com/version');
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'display' => self::DISPLAY_LAYOUT_LIGHT,
|
||||
'title' => 'Mise à jour',
|
||||
'view' => 'update'
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
36
core/module/install/view/index/index.js.php
Executable file
@ -0,0 +1,36 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.com/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Affichage de l'id en simulant FILTER_ID
|
||||
*/
|
||||
$("#installId").on("change keydown keyup", function(event) {
|
||||
var userId = $(this).val();
|
||||
if(
|
||||
event.keyCode !== 8 // BACKSPACE
|
||||
&& event.keyCode !== 37 // LEFT
|
||||
&& event.keyCode !== 39 // RIGHT
|
||||
&& event.keyCode !== 46 // DELETE
|
||||
&& window.getSelection().toString() !== userId // Texte sélectionné
|
||||
) {
|
||||
var searchReplace = {
|
||||
"á": "a", "à": "a", "â": "a", "ä": "a", "ã": "a", "å": "a", "ç": "c", "é": "e", "è": "e", "ê": "e", "ë": "e", "í": "i", "ì": "i", "î": "i", "ï": "i", "ñ": "n", "ó": "o", "ò": "o", "ô": "o", "ö": "o", "õ": "o", "ú": "u", "ù": "u", "û": "u", "ü": "u", "ý": "y", "ÿ": "y",
|
||||
"Á": "A", "À": "A", "Â": "A", "Ä": "A", "Ã": "A", "Å": "A", "Ç": "C", "É": "E", "È": "E", "Ê": "E", "Ë": "E", "Í": "I", "Ì": "I", "Î": "I", "Ï": "I", "Ñ": "N", "Ó": "O", "Ò": "O", "Ô": "O", "Ö": "O", "Õ": "O", "Ú": "U", "Ù": "U", "Û": "U", "Ü": "U", "Ý": "Y", "Ÿ": "Y",
|
||||
"'": "-", "\"": "-", " ": "-"
|
||||
};
|
||||
userId = userId.replace(/[áàâäãåçéèêëíìîïñóòôöõúùûüýÿ'" ]/ig, function(match) {
|
||||
return searchReplace[match];
|
||||
});
|
||||
userId = userId.replace(/[^a-z0-9-]/ig, "");
|
||||
$(this).val(userId);
|
||||
}
|
||||
});
|
46
core/module/install/view/index/index.php
Executable file
@ -0,0 +1,46 @@
|
||||
<p>Veuillez saisir les champs ci-dessous afin de terminer l'installation.</p>
|
||||
<?php echo template::formOpen('installForm'); ?>
|
||||
<?php echo template::text('installId', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Identifiant'
|
||||
]); ?>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::password('installPassword', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Mot de passe'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::password('installConfirmPassword', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Confirmation'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::mail('installMail', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Adresse mail'
|
||||
]); ?>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::text('installFirstname', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Prénom'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::text('installLastname', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Nom'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col3 offset9">
|
||||
<?php echo template::submit('installSubmit', [
|
||||
'value' => 'Installer'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
63
core/module/install/view/update/update.js.php
Executable file
@ -0,0 +1,63 @@
|
||||
/**
|
||||
* Exécution des différentes étapes de mise à jour
|
||||
*/
|
||||
function step(i, data) {
|
||||
// Affiche le texte de progression
|
||||
$(".installUpdateProgressText").hide();
|
||||
$(".installUpdateProgressText[data-id=" + i + "]").show();
|
||||
// Requête ajax
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<?php echo helper::baseUrl(false); ?>?install/steps", // Ignore la réécriture d'URL
|
||||
data: {
|
||||
step: i,
|
||||
data: data
|
||||
},
|
||||
// Succès de la requête
|
||||
success: function(result) {
|
||||
setTimeout(function() {
|
||||
// Succès
|
||||
if(result.success === true) {
|
||||
// Fin de la mise à jour
|
||||
if(i === 4) {
|
||||
// Affiche le message de succès
|
||||
$("#installUpdateSuccess").show();
|
||||
// Déverrouille le bouton "Terminer"
|
||||
$("#installUpdateEnd").removeClass("disabled");
|
||||
// Cache le texte de progression
|
||||
$("#installUpdateProgress").hide();
|
||||
}
|
||||
// Prochaine étape
|
||||
else {
|
||||
step(i + 1, result.data);
|
||||
}
|
||||
}
|
||||
// Échec
|
||||
else {
|
||||
// Affiche le message d'erreur
|
||||
$("#installUpdateErrorStep").text(i);
|
||||
$("#installUpdateError").show();
|
||||
// Déverrouille le bouton "Terminer"
|
||||
$("#installUpdateEnd").removeClass("disabled");
|
||||
// Cache le texte de progression
|
||||
$("#installUpdateProgress").hide();
|
||||
// Affiche le résultat dans la console
|
||||
console.error(result);
|
||||
}
|
||||
}, 2000);
|
||||
},
|
||||
// Échec de la requête
|
||||
error: function(xhr) {
|
||||
// Affiche le message d'erreur
|
||||
$("#installUpdateErrorStep").text(0);
|
||||
$("#installUpdateError").show();
|
||||
// Déverrouille le bouton "Terminer"
|
||||
$("#installUpdateEnd").removeClass("disabled");
|
||||
// Cache le texte de progression
|
||||
$("#installUpdateProgress").hide();
|
||||
// Affiche l'erreur dans la console
|
||||
console.error(xhr);
|
||||
}
|
||||
});
|
||||
}
|
||||
$(window).on("load", step(1, null));
|
29
core/module/install/view/update/update.php
Executable file
@ -0,0 +1,29 @@
|
||||
<p><strong>Mise à jour de Zwii <?php echo self::ZWII_VERSION; ?> vers Zwii <?php echo $module::$newVersion; ?>.</strong></p>
|
||||
<p>Afin d'assurer le bon fonctionnement de Zwii, veuillez ne pas fermer cette page avant la fin de l'opération.</p>
|
||||
<div class="row">
|
||||
<div class="col9 verticalAlignMiddle">
|
||||
<div id="installUpdateProgress">
|
||||
<?php echo template::ico('spin', '', true); ?>
|
||||
<span class="installUpdateProgressText" data-id="1">1/4 : Préparation...</span>
|
||||
<span class="installUpdateProgressText displayNone" data-id="2">2/4 : Téléchargement...</span>
|
||||
<span class="installUpdateProgressText displayNone" data-id="3">3/4 : Installation...</span>
|
||||
<span class="installUpdateProgressText displayNone" data-id="4">4/4 : Configuration...</span>
|
||||
</div>
|
||||
<div id="installUpdateError" class="colorRed displayNone">
|
||||
<?php echo template::ico('cancel', ''); ?>
|
||||
Une erreur est survenue lors de l'étape <span id="installUpdateErrorStep"></span>.
|
||||
</div>
|
||||
<div id="installUpdateSuccess" class="colorGreen displayNone">
|
||||
<?php echo template::ico('check', ''); ?>
|
||||
Mise à jour terminée avec succès.
|
||||
</div>
|
||||
</div>
|
||||
<div class="col3 verticalAlignMiddle">
|
||||
<?php echo template::button('installUpdateEnd', [
|
||||
'value' => 'Terminer',
|
||||
'href' => helper::baseUrl() . 'config',
|
||||
'ico' => 'check',
|
||||
'class' => 'disabled'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
33
core/module/maintenance/maintenance.php
Executable file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.com/
|
||||
*/
|
||||
|
||||
class maintenance extends common {
|
||||
|
||||
public static $actions = [
|
||||
'index' => self::GROUP_VISITOR
|
||||
];
|
||||
|
||||
/**
|
||||
* Maintenance
|
||||
*/
|
||||
public function index() {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'display' => self::DISPLAY_LAYOUT_LIGHT,
|
||||
'title' => 'Maintenance en cours...',
|
||||
'view' => 'index'
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
10
core/module/maintenance/view/index/index.php
Executable file
@ -0,0 +1,10 @@
|
||||
<p>Notre site est actuellement en maintenance. Nous sommes désolés pour la gêne occasionnée et faisons notre possible pour être rapidement de retour.</p>
|
||||
<div class="row">
|
||||
<div class="col4 offset8 textAlignCenter">
|
||||
<?php echo template::button('maintenanceLogin', [
|
||||
'value' => 'Administration',
|
||||
'href' => helper::baseUrl() . 'user/login',
|
||||
'ico' => 'lock'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
239
core/module/page/page.php
Executable file
@ -0,0 +1,239 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.com/
|
||||
*/
|
||||
|
||||
class page extends common {
|
||||
|
||||
public static $actions = [
|
||||
'add' => self::GROUP_MODERATOR,
|
||||
'delete' => self::GROUP_MODERATOR,
|
||||
'edit' => self::GROUP_MODERATOR
|
||||
];
|
||||
public static $pagesNoParentId = [
|
||||
'' => 'Aucune'
|
||||
];
|
||||
public static $moduleIds = [];
|
||||
|
||||
// Menu image
|
||||
public static $typeMenu = [
|
||||
'text' => 'Texte',
|
||||
'icon' => 'Icône',
|
||||
'icontitle' => 'Icône et bulle',
|
||||
'icontext' => 'Icône et texte'
|
||||
];
|
||||
// menu image
|
||||
|
||||
/**
|
||||
* Création
|
||||
*/
|
||||
public function add() {
|
||||
$pageTitle = 'Nouvelle page';
|
||||
$pageId = helper::increment(helper::filter($pageTitle, helper::FILTER_ID), $this->getData(['page']));
|
||||
$this->setData([
|
||||
'page',
|
||||
$pageId,
|
||||
[
|
||||
// Menu icon
|
||||
'typeMenu' => 'text',
|
||||
'iconUrl' => '',
|
||||
'disable' => false,
|
||||
// Menu icon
|
||||
'content' => 'Contenu de votre nouvelle page.',
|
||||
'hideTitle' => false,
|
||||
'metaDescription' => '',
|
||||
'metaTitle' => '',
|
||||
'moduleId' => '',
|
||||
'parentPageId' => '',
|
||||
'position' => 0,
|
||||
'group' => self::GROUP_VISITOR,
|
||||
'targetBlank' => false,
|
||||
'title' => $pageTitle
|
||||
]
|
||||
]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $pageId,
|
||||
'notification' => 'Nouvelle page créée',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Suppression
|
||||
*/
|
||||
public function delete() {
|
||||
// La page n'existe pas
|
||||
if($this->getData(['page', $this->getUrl(2)]) === null) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
]);
|
||||
}
|
||||
// Impossible de supprimer la page d'accueil
|
||||
elseif($this->getUrl(2) === $this->getData(['config', 'homePageId'])) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'page/edit/' . $this->getUrl(2),
|
||||
'notification' => 'Impossible de supprimer la page d\'accueil'
|
||||
]);
|
||||
}
|
||||
// Impossible de supprimer une page contenant des enfants
|
||||
elseif($this->getHierarchy($this->getUrl(2))) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'page/edit/' . $this->getUrl(2),
|
||||
'notification' => 'Impossible de supprimer une page contenant des enfants'
|
||||
]);
|
||||
}
|
||||
// Suppression
|
||||
else {
|
||||
$this->deleteData(['page', $this->getUrl(2)]);
|
||||
$this->deleteData(['module', $this->getUrl(2)]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl(false),
|
||||
'notification' => 'Page supprimée',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Édition
|
||||
*/
|
||||
public function edit() {
|
||||
// La page n'existe pas
|
||||
if($this->getData(['page', $this->getUrl(2)]) === null) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
]);
|
||||
}
|
||||
// La page existe
|
||||
else {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
$pageId = $this->getInput('pageEditTitle', helper::FILTER_ID, true);
|
||||
// Si l'id a changée
|
||||
if($pageId !== $this->getUrl(2)) {
|
||||
// Incrémente le nouvel id de la page
|
||||
$pageId = helper::increment($pageId, $this->getData(['page']));
|
||||
$pageId = helper::increment($pageId, self::$coreModuleIds);
|
||||
$pageId = helper::increment($pageId, self::$moduleIds);
|
||||
// Met à jour les enfants
|
||||
foreach($this->getHierarchy($this->getUrl(2)) as $childrenPageId) {
|
||||
$this->setData(['page', $childrenPageId, 'parentPageId', $pageId]);
|
||||
}
|
||||
// Change l'id de page dans les données des modules
|
||||
$this->setData(['module', $pageId, $this->getData(['module', $this->getUrl(2)])]);
|
||||
$this->deleteData(['module', $this->getUrl(2)]);
|
||||
// Si la page correspond à la page d'accueil, change l'id dans la configuration du site
|
||||
if($this->getData(['config', 'homePageId']) === $this->getUrl(2)) {
|
||||
$this->setData(['config', 'homePageId', $pageId]);
|
||||
}
|
||||
}
|
||||
// Supprime les données du module en cas de changement de module
|
||||
if($this->getInput('pageEditModuleId') !== $this->getData(['page', $this->getUrl(2), 'moduleId'])) {
|
||||
$this->deleteData(['module', $pageId]);
|
||||
}
|
||||
// Supprime l'ancienne page si l'id a changée
|
||||
if($pageId !== $this->getUrl(2)) {
|
||||
$this->deleteData(['page', $this->getUrl(2)]);
|
||||
}
|
||||
// Si la page est une page enfant, actualise les positions des autres enfants du parent, sinon actualise les pages sans parents
|
||||
$lastPosition = 1;
|
||||
$hierarchy = $this->getInput('pageEditParentPageId') ? $this->getHierarchy($this->getInput('pageEditParentPageId')) : array_keys($this->getHierarchy());
|
||||
$position = $this->getInput('pageEditPosition', helper::FILTER_INT);
|
||||
foreach($hierarchy as $hierarchyPageId) {
|
||||
// Ignore la page en cours de modification
|
||||
if($hierarchyPageId === $this->getUrl(2)) {
|
||||
continue;
|
||||
}
|
||||
// Incrémente de +1 pour laisser la place à la position de la page en cours de modification
|
||||
if($lastPosition === $position) {
|
||||
$lastPosition++;
|
||||
}
|
||||
// Change la position
|
||||
$this->setData(['page', $hierarchyPageId, 'position', $lastPosition]);
|
||||
// Incrémente pour la prochaine position
|
||||
$lastPosition++;
|
||||
}
|
||||
// Modifie la page ou en crée une nouvelle si l'id à changée
|
||||
$this->setData([
|
||||
'page',
|
||||
$pageId,
|
||||
[
|
||||
// Menu image
|
||||
'typeMenu' => $this->getinput('pageTypeMenu'),
|
||||
'iconUrl' => $this->getinput('pageIconUrl'),
|
||||
'disable'=> $this->getinput('pageDisable', helper::FILTER_BOOLEAN),
|
||||
// Menu image
|
||||
'content' => $this->getInput('pageEditContent', null),
|
||||
'hideTitle' => $this->getInput('pageEditHideTitle', helper::FILTER_BOOLEAN),
|
||||
'metaDescription' => $this->getInput('pageEditMetaDescription', helper::FILTER_STRING_LONG),
|
||||
'metaTitle' => $this->getInput('pageEditMetaTitle'),
|
||||
'moduleId' => $this->getInput('pageEditModuleId'),
|
||||
'parentPageId' => $this->getInput('pageEditParentPageId'),
|
||||
'position' => $position,
|
||||
'group' => $this->getInput('pageEditGroup', helper::FILTER_INT),
|
||||
'targetBlank' => $this->getInput('pageEditTargetBlank', helper::FILTER_BOOLEAN),
|
||||
'title' => $this->getInput('pageEditTitle', helper::FILTER_STRING_SHORT, true)
|
||||
]
|
||||
]);
|
||||
// Redirection vers la configuration
|
||||
if($this->getInput('pageEditModuleRedirect', helper::FILTER_BOOLEAN)) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $pageId . '/config',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
// Redirection vers la page
|
||||
else {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $pageId,
|
||||
'notification' => 'Modifications enregistrées',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
}
|
||||
// Liste des modules
|
||||
$moduleIds = [
|
||||
'' => 'Aucun'
|
||||
];
|
||||
$iterator = new DirectoryIterator('module/');
|
||||
foreach($iterator as $fileInfos) {
|
||||
if(is_file($fileInfos->getPathname() . '/' . $fileInfos->getFilename() . '.php')) {
|
||||
$moduleIds[$fileInfos->getBasename()] = ucfirst($fileInfos->getBasename());
|
||||
}
|
||||
}
|
||||
self::$moduleIds = $moduleIds;
|
||||
// Pages sans parent
|
||||
foreach($this->getHierarchy() as $parentPageId => $childrenPageIds) {
|
||||
if($parentPageId !== $this->getUrl(2)) {
|
||||
self::$pagesNoParentId[$parentPageId] = $this->getData(['page', $parentPageId, 'title']);
|
||||
}
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => $this->getData(['page', $this->getUrl(2), 'title']),
|
||||
'vendor' => [
|
||||
'tinymce'
|
||||
],
|
||||
'view' => 'edit'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
102
core/module/page/view/edit/edit.js.php
Executable file
@ -0,0 +1,102 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.com/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Confirmation de suppression
|
||||
*/
|
||||
$("#pageEditDelete").on("click", function() {
|
||||
var _this = $(this);
|
||||
return core.confirm("Êtes-vous sûr de vouloir supprimer cette page ?", function() {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Bloque/Débloque le bouton de configuration au changement de module
|
||||
*/
|
||||
var pageEditModuleIdDOM = $("#pageEditModuleId");
|
||||
pageEditModuleIdDOM.on("change", function() {
|
||||
if($(this).val() === "") {
|
||||
$("#pageEditModuleConfig").addClass("disabled");
|
||||
$("#pageEditContentContainer").slideDown();
|
||||
}
|
||||
else {
|
||||
$("#pageEditModuleConfig").removeClass("disabled");
|
||||
$("#pageEditContentContainer").slideUp();
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Soumission du formulaire pour éditer le module
|
||||
*/
|
||||
$("#pageEditModuleConfig").on("click", function() {
|
||||
$("#pageEditModuleRedirect").val(1);
|
||||
$("#pageEditForm").trigger("submit");
|
||||
});
|
||||
|
||||
/**
|
||||
* Affiche les pages en fonction de la page parent dans le choix de la position
|
||||
*/
|
||||
var hierarchy = <?php echo json_encode($this->getHierarchy()); ?>;
|
||||
var pages = <?php echo json_encode($this->getData(['page'])); ?>;
|
||||
$("#pageEditParentPageId").on("change", function() {
|
||||
var positionDOM = $("#pageEditPosition");
|
||||
positionDOM.empty().append(
|
||||
$("<option>").val(0).text("Ne pas afficher"),
|
||||
$("<option>").val(1).text("Au début")
|
||||
);
|
||||
var parentSelected = $(this).val();
|
||||
var positionSelected = 0;
|
||||
var positionPrevious = 1;
|
||||
// Aucune page parent selectionnée
|
||||
if(parentSelected === "") {
|
||||
// Liste des pages sans parents
|
||||
for(var key in hierarchy) {
|
||||
if(hierarchy.hasOwnProperty(key)) {
|
||||
// Sélectionne la page avant si il s'agit de la page courante
|
||||
if(key === "<?php echo $this->getUrl(2); ?>") {
|
||||
positionSelected = positionPrevious;
|
||||
}
|
||||
// Sinon ajoute la page à la liste
|
||||
else {
|
||||
// Enregistre la position de cette page afin de la sélectionner si la prochaine page de la liste est la page courante
|
||||
positionPrevious++;
|
||||
// Ajout à la liste
|
||||
positionDOM.append(
|
||||
$("<option>").val(positionPrevious).text("Après \"" + pages[key].title + "\"")
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Un page parent est selectionnée
|
||||
else {
|
||||
// Liste des pages enfants de la page parent
|
||||
for(var i = 0; i < hierarchy[parentSelected].length; i++) {
|
||||
// Pour page courante sélectionne la page précédente (pas de - 1 à positionSelected à cause des options par défaut)
|
||||
if(hierarchy[parentSelected][i] === "<?php echo $this->getUrl(2); ?>") {
|
||||
positionSelected = positionPrevious;
|
||||
}
|
||||
// Sinon ajoute la page à la liste
|
||||
else {
|
||||
// Enregistre la position de cette page afin de la sélectionner si la prochaine page de la liste est la page courante
|
||||
positionPrevious++;
|
||||
// Ajout à la liste
|
||||
positionDOM.append(
|
||||
$("<option>").val(positionPrevious).text("Après \"" + pages[hierarchy[parentSelected][i]].title + "\"")
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Sélectionne la bonne position
|
||||
positionDOM.val(positionSelected);
|
||||
}).trigger("change");
|
137
core/module/page/view/edit/edit.php
Executable file
@ -0,0 +1,137 @@
|
||||
<?php echo template::formOpen('pageEditForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('pageEditBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . $this->getUrl(2),
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset6">
|
||||
<?php echo template::button('pageEditDelete', [
|
||||
'class' => 'buttonRed',
|
||||
'href' => helper::baseUrl() . 'page/delete/' . $this->getUrl(2),
|
||||
'value' => 'Supprimer',
|
||||
'ico' => 'cancel'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::submit('pageEditSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Informations générales</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::text('pageEditTitle', [
|
||||
'label' => 'Titre',
|
||||
'value' => $this->getData(['page', $this->getUrl(2), 'title'])
|
||||
]); ?>
|
||||
</div>
|
||||
|
||||
<div class="col6">
|
||||
<div class="row">
|
||||
<div class="col10">
|
||||
<?php echo template::hidden('pageEditModuleRedirect'); ?>
|
||||
<?php echo template::select('pageEditModuleId', $module::$moduleIds, [
|
||||
'help' => 'En cas de changement de module, les données du module précédent seront supprimées.',
|
||||
'label' => 'Module',
|
||||
'selected' => $this->getData(['page', $this->getUrl(2), 'moduleId'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 verticalAlignBottom">
|
||||
<?php echo template::button('pageEditModuleConfig', [
|
||||
'disabled' => (bool) $this->getData(['page', $this->getUrl(2), 'moduleId']) === false,
|
||||
'uniqueSubmission' => true,
|
||||
'value' => template::ico('gear')
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--
|
||||
Menu Image
|
||||
-->
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
|
||||
<?php echo template::select('pageTypeMenu', $module::$typeMenu,[
|
||||
'help' => 'Sélectionnez le type de menu.',
|
||||
'label' => 'Type de menu',
|
||||
'selected' => $this->getData(['page', $this->getUrl(2), 'typeMenu'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
|
||||
<?php echo template::file('pageIconUrl', [
|
||||
'label' => 'Icône',
|
||||
'value' => $this->getData(['page', $this->getUrl(2), 'iconUrl'])
|
||||
]); ?>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!--
|
||||
Menu Image
|
||||
-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::textarea('pageEditContent', [
|
||||
'class' => 'editorWysiwyg',
|
||||
'value' => $this->getData(['page', $this->getUrl(2), 'content'])
|
||||
]); ?>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<div class="block">
|
||||
<h4>Menu</h4>
|
||||
<?php if($this->getHierarchy($this->getUrl(2), false)): ?>
|
||||
<?php echo template::hidden('pageEditParentPageId', [
|
||||
'value' => $this->getData(['page', $this->getUrl(2), 'parentPageId'])
|
||||
]); ?>
|
||||
<?php else: ?>
|
||||
<?php echo template::select('pageEditParentPageId', $module::$pagesNoParentId, [
|
||||
'label' => 'Page parent',
|
||||
'selected' => $this->getData(['page', $this->getUrl(2), 'parentPageId'])
|
||||
]); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo template::select('pageEditPosition', [], [
|
||||
'label' => 'Position'
|
||||
]); ?>
|
||||
<?php echo template::checkbox('pageEditTargetBlank', true, 'Ouvrir dans un nouvel onglet', [
|
||||
'checked' => $this->getData(['page', $this->getUrl(2), 'targetBlank'])
|
||||
]); ?>
|
||||
<!-- menu image -->
|
||||
<?php echo template::checkbox('pageDisable', true, 'Page inactive', [
|
||||
'checked' => $this->getData(['page', $this->getUrl(2), 'disable'])
|
||||
]); ?>
|
||||
<!-- menu image -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<div class="block">
|
||||
<h4>Options avancées</h4>
|
||||
<?php echo template::select('pageEditGroup', self::$groupPublics, [
|
||||
'label' => 'Groupe requis pour accéder à la page',
|
||||
'selected' => $this->getData(['page', $this->getUrl(2), 'group'])
|
||||
]); ?>
|
||||
<?php echo template::text('pageEditMetaTitle', [
|
||||
'label' => 'Méta-titre',
|
||||
'value' => $this->getData(['page', $this->getUrl(2), 'metaTitle'])
|
||||
]); ?>
|
||||
<?php echo template::textarea('pageEditMetaDescription', [
|
||||
'label' => 'Méta-description',
|
||||
'maxlength' => '500',
|
||||
'value' => $this->getData(['page', $this->getUrl(2), 'metaDescription'])
|
||||
]); ?>
|
||||
<?php echo template::checkbox('pageEditHideTitle', true, 'Cacher le titre', [
|
||||
'checked' => $this->getData(['page', $this->getUrl(2), 'hideTitle'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
32
core/module/sitemap/sitemap.php
Executable file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.com/
|
||||
*/
|
||||
|
||||
class sitemap extends common {
|
||||
|
||||
public static $actions = [
|
||||
'index' => self::GROUP_VISITOR
|
||||
];
|
||||
|
||||
/**
|
||||
* Plan du site
|
||||
*/
|
||||
public function index() {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Plan du site',
|
||||
'view' => 'index'
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
14
core/module/sitemap/view/index/index.php
Executable file
@ -0,0 +1,14 @@
|
||||
<ul>
|
||||
<?php foreach($this->getHierarchy() as $parentId => $childIds): ?>
|
||||
<li>
|
||||
<a href="<?php echo helper::baseUrl() . $parentId; ?>"><?php echo $this->getData(['page', $parentId, 'title']); ?></a>
|
||||
<ul>
|
||||
<?php foreach($childIds as $childId): ?>
|
||||
<li>
|
||||
<a href="<?php echo helper::baseUrl() . $childId; ?>"><?php echo $this->getData(['page', $childId, 'title']); ?></a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
126
core/module/theme/resource/custom.css
Executable file
@ -0,0 +1,126 @@
|
||||
/**
|
||||
* Voici une feuille de style type, bien entendu vous pouvez ajouter
|
||||
* ou supprimer des propriétés CSS en fonction de vos besoins.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Éléments principaux
|
||||
*/
|
||||
|
||||
/* Fond du site */
|
||||
body {
|
||||
}
|
||||
|
||||
/* Site */
|
||||
#site {
|
||||
}
|
||||
|
||||
/* Bannière */
|
||||
header {
|
||||
}
|
||||
|
||||
/* Titre de la bannière */
|
||||
header span {
|
||||
}
|
||||
|
||||
/* Menu */
|
||||
nav {
|
||||
}
|
||||
|
||||
/* Items du menu */
|
||||
nav a {
|
||||
}
|
||||
|
||||
/* Items au survol du menu */
|
||||
nav a:hover {
|
||||
}
|
||||
|
||||
/* Item courant du menu */
|
||||
nav a.active {
|
||||
}
|
||||
|
||||
/* Bas de page */
|
||||
footer {
|
||||
}
|
||||
|
||||
/* Liens du bas de page */
|
||||
footer a {
|
||||
}
|
||||
|
||||
/* Réseaux sociaux dans le bas de page */
|
||||
#footerSocials {
|
||||
}
|
||||
|
||||
/* Texte libre dans le bas de page */
|
||||
#footerText {
|
||||
}
|
||||
|
||||
/* Copyright dans le bas de page */
|
||||
#footerCopyright {
|
||||
}
|
||||
|
||||
/**
|
||||
* Éléments de contenu
|
||||
*/
|
||||
|
||||
/* Titres */
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4 {
|
||||
}
|
||||
|
||||
/* Liens */
|
||||
a {
|
||||
}
|
||||
|
||||
/* Liens au survol */
|
||||
a:hover {
|
||||
}
|
||||
|
||||
/* Liens au clic */
|
||||
a:active {
|
||||
}
|
||||
|
||||
/* Boutons */
|
||||
.button,
|
||||
button[type='submit'],
|
||||
.pagination a {
|
||||
}
|
||||
|
||||
/* Boutons au survol */
|
||||
.button:hover,
|
||||
button[type='submit']:hover,
|
||||
.pagination a:hover {
|
||||
}
|
||||
|
||||
/* Boutons au clic */
|
||||
.button:active,
|
||||
button[type='submit']:active,
|
||||
.pagination a:active {
|
||||
}
|
||||
|
||||
/* Cases à cocher */
|
||||
input[type='checkbox']:checked + label:before {
|
||||
}
|
||||
|
||||
/* Cases à cocher au survol */
|
||||
input[type='checkbox']:not(:active):checked:hover + label:before,
|
||||
input[type='checkbox']:active + label:before {
|
||||
}
|
||||
|
||||
/* Champs de formulaire */
|
||||
input[type='text'],
|
||||
input[type='password'],
|
||||
.inputFile,
|
||||
select,
|
||||
textarea {
|
||||
}
|
||||
|
||||
/* Champs de formulaire au survol */
|
||||
input[type='text']:hover,
|
||||
input[type='password']:hover,
|
||||
.inputFile:hover,
|
||||
select:hover,
|
||||
textarea:hover {
|
||||
}
|
412
core/module/theme/theme.php
Executable file
@ -0,0 +1,412 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.com/
|
||||
*/
|
||||
|
||||
class theme extends common {
|
||||
|
||||
public static $actions = [
|
||||
'advanced' => self::GROUP_ADMIN,
|
||||
'body' => self::GROUP_ADMIN,
|
||||
'footer' => self::GROUP_ADMIN,
|
||||
'header' => self::GROUP_ADMIN,
|
||||
'index' => self::GROUP_ADMIN,
|
||||
'menu' => self::GROUP_ADMIN,
|
||||
'reset' => self::GROUP_ADMIN,
|
||||
'site' => self::GROUP_ADMIN
|
||||
];
|
||||
public static $aligns = [
|
||||
'left' => 'À gauche',
|
||||
'center' => 'Au centre',
|
||||
'right' => 'À droite'
|
||||
];
|
||||
public static $attachments = [
|
||||
'scroll' => 'Normale',
|
||||
'fixed' => 'Fixe'
|
||||
];
|
||||
public static $fonts = [
|
||||
'Abril+Fatface' => 'Abril Fatface',
|
||||
'Arimo' => 'Arimo',
|
||||
'Arvo' => 'Arvo',
|
||||
'Berkshire+Swash' => 'Berkshire Swash',
|
||||
'Cabin' => 'Cabin',
|
||||
'Dancing+Script' => 'Dancing Script',
|
||||
'Droid+Sans' => 'Droid Sans',
|
||||
'Droid+Serif' => 'Droid Serif',
|
||||
'Fira+Sans' => 'Fira Sans',
|
||||
'Inconsolata' => 'Inconsolata',
|
||||
'Indie+Flower' => 'Indie Flower',
|
||||
'Josefin+Slab' => 'Josefin Slab',
|
||||
'Lobster' => 'Lobster',
|
||||
'Lora' => 'Lora',
|
||||
'Lato' => 'Lato',
|
||||
'Marvel' => 'Marvel',
|
||||
'Old+Standard+TT' => 'Old Standard TT',
|
||||
'Open+Sans' => 'Open Sans',
|
||||
'Oswald' => 'Oswald',
|
||||
'PT+Mono' => 'PT Mono',
|
||||
'PT+Serif' => 'PT Serif',
|
||||
'Raleway' => 'Raleway',
|
||||
'Rancho' => 'Rancho',
|
||||
'Roboto' => 'Roboto',
|
||||
'Signika' => 'Signika',
|
||||
'Ubuntu' => 'Ubuntu',
|
||||
'Vollkorn' => 'Vollkorn'
|
||||
];
|
||||
public static $fontWeights = [
|
||||
'normal' => 'Normal',
|
||||
'bold' => 'Gras'
|
||||
];
|
||||
public static $footerHeights = [
|
||||
'5px' => 'Très petite',
|
||||
'10px' => 'Petite',
|
||||
'20px' => 'Moyenne',
|
||||
'30px' => 'Grande',
|
||||
'40px' => 'Très grande'
|
||||
];
|
||||
public static $footerPositions = [
|
||||
'hide' => 'Cachée',
|
||||
'site' => 'Dans le site',
|
||||
'body' => 'En dessous du site'
|
||||
];
|
||||
public static $headerFontSizes = [
|
||||
'1.6em' => 'Très petite',
|
||||
'1.8em' => 'Petite',
|
||||
'2em' => 'Moyenne',
|
||||
'2.2em' => 'Grande',
|
||||
'2.4em' => 'Très grande'
|
||||
];
|
||||
public static $headerHeights = [
|
||||
'100px' => 'Très petite (100 pixels)',
|
||||
'150px' => 'Petite (150 pixels)',
|
||||
'200px' => 'Moyenne (200 pixels)',
|
||||
'300px' => 'Grande (300 pixels)',
|
||||
'400px' => 'Très grande (400 pixels)'
|
||||
];
|
||||
public static $headerPositions = [
|
||||
'hide' => 'Cachée',
|
||||
'site' => 'Dans le site',
|
||||
'body' => 'Au dessus du site'
|
||||
];
|
||||
public static $imagePositions = [
|
||||
'top left' => 'En haut à gauche',
|
||||
'top center' => 'En haut au centre',
|
||||
'top right' => 'En haut à droite',
|
||||
'center left' => 'Au milieu à gauche',
|
||||
'center center' => 'Au milieu au centre',
|
||||
'center right' => 'Au milieu à droite',
|
||||
'bottom left' => 'En bas à gauche',
|
||||
'bottom center' => 'En bas au centre',
|
||||
'bottom right' => 'En bas à droite'
|
||||
];
|
||||
public static $menuFontSizes = [
|
||||
'.8em' => 'Très petite',
|
||||
'.9em' => 'Petite',
|
||||
'1em' => 'Normale',
|
||||
'1.1em' => 'Moyenne',
|
||||
'1.2em' => 'Grande',
|
||||
'1.3em' => 'Très grande'
|
||||
];
|
||||
public static $menuHeights = [
|
||||
'5px 10px' => 'Très petite',
|
||||
'10px' => 'Petite',
|
||||
'15px 10px' => 'Moyenne',
|
||||
'20px 15px' => 'Grande',
|
||||
'25px 15px' => 'Très grande'
|
||||
];
|
||||
public static $menuPositions = [
|
||||
'hide' => 'Caché',
|
||||
'site-first' => 'Dans le site avant la bannière',
|
||||
'site-second' => 'Dans le site après la bannière',
|
||||
'body-first' => 'Au dessus du site avant la bannière',
|
||||
'body-second' => 'Au dessus du site après la bannière'
|
||||
];
|
||||
public static $radius = [
|
||||
'0' => 'Aucun',
|
||||
'5px' => 'Très léger',
|
||||
'10px' => 'Léger',
|
||||
'15px' => 'Moyen',
|
||||
'25px' => 'Important',
|
||||
'50px' => 'Très important'
|
||||
];
|
||||
public static $repeats = [
|
||||
'no-repeat' => 'Ne pas répéter',
|
||||
'repeat-x' => 'Sur l\'axe horizontal',
|
||||
'repeat-y' => 'Sur l\'axe vertical',
|
||||
'repeat' => 'Sur les deux axes'
|
||||
];
|
||||
public static $shadows = [
|
||||
'0' => 'Aucune',
|
||||
'1px 1px 5px' => 'Très légère',
|
||||
'1px 1px 10px' => 'Légère',
|
||||
'1px 1px 15px' => 'Moyenne',
|
||||
'1px 1px 25px' => 'Importante',
|
||||
'1px 1px 50px' => 'Très importante'
|
||||
];
|
||||
public static $siteFontSizes = [
|
||||
'12px' => '12',
|
||||
'13px' => '13',
|
||||
'14px' => '14',
|
||||
'15px' => '15',
|
||||
'16px' => '16'
|
||||
];
|
||||
public static $sizes = [
|
||||
'auto' => 'Automatique',
|
||||
'cover' => 'Largeur adaptée au fond'
|
||||
];
|
||||
public static $textTransforms = [
|
||||
'none' => 'Normaux',
|
||||
'uppercase' => 'Majuscules'
|
||||
];
|
||||
public static $widths = [
|
||||
'750px' => 'Petite (750 pixels)',
|
||||
'960px' => 'Moyenne (960 pixels)',
|
||||
'1170px' => 'Grande (1170 pixels)',
|
||||
'100%' => 'Fluide (100%)'
|
||||
];
|
||||
|
||||
/**
|
||||
* Mode avancé
|
||||
*/
|
||||
public function advanced() {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
// Enregistre le CSS
|
||||
file_put_contents('site/data/custom.css', $this->getInput('themeAdvancedCss', null));
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'notification' => 'Modifications enregistrées',
|
||||
'redirect' => helper::baseUrl() . 'theme/advanced',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Personnalisation avancée',
|
||||
'vendor' => [
|
||||
'codemirror'
|
||||
],
|
||||
'view' => 'advanced'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Options de l'arrière plan
|
||||
*/
|
||||
public function body() {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
$this->setData(['theme', 'body', [
|
||||
'backgroundColor' => $this->getInput('themeBodyBackgroundColor'),
|
||||
'image' => $this->getInput('themeBodyImage'),
|
||||
'imageAttachment' => $this->getInput('themeBodyImageAttachment'),
|
||||
'imagePosition' => $this->getInput('themeBodyImagePosition'),
|
||||
'imageRepeat' => $this->getInput('themeBodyImageRepeat'),
|
||||
'imageSize' => $this->getInput('themeBodyImageSize')
|
||||
]]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'notification' => 'Modifications enregistrées',
|
||||
'redirect' => helper::baseUrl() . 'theme',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Personnalisation de l\'arrière plan',
|
||||
'vendor' => [
|
||||
'tinycolorpicker'
|
||||
],
|
||||
'view' => 'body'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Options du pied de page
|
||||
*/
|
||||
public function footer() {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
$this->setData(['theme', 'footer', [
|
||||
'backgroundColor' => $this->getInput('themeFooterBackgroundColor'),
|
||||
'copyrightAlign' => $this->getInput('themeFooterCopyrightAlign'),
|
||||
'height' => $this->getInput('themeFooterHeight'),
|
||||
'loginLink' => $this->getInput('themeFooterLoginLink'),
|
||||
'margin' => $this->getInput('themeFooterMargin', helper::FILTER_BOOLEAN),
|
||||
'position' => $this->getInput('themeFooterPosition'),
|
||||
'socialsAlign' => $this->getInput('themeFooterSocialsAlign'),
|
||||
'text' => $this->getInput('themeFooterText', null),
|
||||
'textAlign' => $this->getInput('themeFooterTextAlign'),
|
||||
'textColor' => $this->getInput('themeFooterTextColor')
|
||||
]]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'notification' => 'Modifications enregistrées',
|
||||
'redirect' => helper::baseUrl() . 'theme',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Personnalisation du pied de page',
|
||||
'vendor' => [
|
||||
'tinycolorpicker'
|
||||
],
|
||||
'view' => 'footer'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Options de la bannière
|
||||
*/
|
||||
public function header() {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
$this->setData(['theme', 'header', [
|
||||
'backgroundColor' => $this->getInput('themeHeaderBackgroundColor'),
|
||||
'font' => $this->getInput('themeHeaderFont'),
|
||||
'fontSize' => $this->getInput('themeHeaderFontSize'),
|
||||
'fontWeight' => $this->getInput('themeHeaderFontWeight'),
|
||||
'height' => $this->getInput('themeHeaderHeight'),
|
||||
'image' => $this->getInput('themeHeaderImage'),
|
||||
'imagePosition' => $this->getInput('themeHeaderImagePosition'),
|
||||
'imageRepeat' => $this->getInput('themeHeaderImageRepeat'),
|
||||
'margin' => $this->getInput('themeHeaderMargin', helper::FILTER_BOOLEAN),
|
||||
'position' => $this->getInput('themeHeaderPosition'),
|
||||
'textAlign' => $this->getInput('themeHeaderTextAlign'),
|
||||
'textColor' => $this->getInput('themeHeaderTextColor'),
|
||||
'textHide' => $this->getInput('themeHeaderTextHide', helper::FILTER_BOOLEAN),
|
||||
'textTransform' => $this->getInput('themeHeaderTextTransform'),
|
||||
// Menu Image
|
||||
'linkHome' => $this->getInput('themeHeaderlinkHome',helper::FILTER_BOOLEAN)
|
||||
// Menu Image
|
||||
]]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'notification' => 'Modifications enregistrées',
|
||||
'redirect' => helper::baseUrl() . 'theme',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Personnalisation de la bannière',
|
||||
'vendor' => [
|
||||
'tinycolorpicker'
|
||||
],
|
||||
'view' => 'header'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Accueil de la personnalisation
|
||||
*/
|
||||
public function index() {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Personnalisation du thème',
|
||||
'view' => 'index'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Options du menu
|
||||
*/
|
||||
public function menu() {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
$this->setData(['theme', 'menu', [
|
||||
'backgroundColor' => $this->getInput('themeMenuBackgroundColor'),
|
||||
'fontSize' => $this->getInput('themeMenuFontSize'),
|
||||
'fontWeight' => $this->getInput('themeMenuFontWeight'),
|
||||
'height' => $this->getInput('themeMenuHeight'),
|
||||
'loginLink' => $this->getInput('themeMenuLoginLink'),
|
||||
'margin' => $this->getInput('themeMenuMargin', helper::FILTER_BOOLEAN),
|
||||
'position' => $this->getInput('themeMenuPosition'),
|
||||
'textAlign' => $this->getInput('themeMenuTextAlign'),
|
||||
'textColor' => $this->getInput('themeMenuTextColor'),
|
||||
'textTransform' => $this->getInput('themeMenuTextTransform')
|
||||
]]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'notification' => 'Modifications enregistrées',
|
||||
'redirect' => helper::baseUrl() . 'theme',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Personnalisation du menu',
|
||||
'vendor' => [
|
||||
'tinycolorpicker'
|
||||
],
|
||||
'view' => 'menu'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Réinitialisation de la personnalisation avancée
|
||||
*/
|
||||
public function reset() {
|
||||
// Supprime le fichier de personnalisation avancée
|
||||
unlink('site/data/custom.css');
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'notification' => 'Personnalisation avancée réinitialisée',
|
||||
'redirect' => helper::baseUrl() . 'theme/advanced',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Options du site
|
||||
*/
|
||||
public function site() {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
$this->setData(['theme', 'title', [
|
||||
'font' => $this->getInput('themeTitleFont'),
|
||||
'textColor' => $this->getInput('themeTitleTextColor'),
|
||||
'fontWeight' => $this->getInput('themeTitleFontWeight'),
|
||||
'textTransform' => $this->getInput('themeTitleTextTransform')
|
||||
]]);
|
||||
$this->setData(['theme', 'button', 'backgroundColor', $this->getInput('themeButtonBackgroundColor')]);
|
||||
$this->setData(['theme', 'link', 'textColor', $this->getInput('themeLinkTextColor')]);
|
||||
$this->setData(['theme', 'text', [
|
||||
'font' => $this->getInput('themeTextFont'),
|
||||
'fontSize' => $this->getInput('themeTextFontSize'),
|
||||
'textColor' => $this->getInput('themeTextTextColor'),
|
||||
]]);
|
||||
$this->setData(['theme', 'site', [
|
||||
'backgroundColor' => $this->getInput('themeSiteBackgroundColor'),
|
||||
'radius' => $this->getInput('themeSiteRadius'),
|
||||
'shadow' => $this->getInput('themeSiteShadow'),
|
||||
'width' => $this->getInput('themeSiteWidth')
|
||||
]]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'notification' => 'Modifications enregistrées',
|
||||
'redirect' => helper::baseUrl() . 'theme',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Personnalisation du site',
|
||||
'vendor' => [
|
||||
'tinycolorpicker'
|
||||
],
|
||||
'view' => 'site'
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
34
core/module/theme/view/advanced/advanced.js.php
Executable file
@ -0,0 +1,34 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.com/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Aperçu en direct
|
||||
*/
|
||||
$("#themeAdvancedCss").on("change keydown keyup", function() {
|
||||
// Ajout du css au DOM
|
||||
$("#themePreview").remove();
|
||||
$("<style>")
|
||||
.attr("type", "text/css")
|
||||
.attr("id", "themePreview")
|
||||
.text($(this).val())
|
||||
.appendTo("head");
|
||||
});
|
||||
|
||||
/**
|
||||
* Confirmation de réinitialisation
|
||||
*/
|
||||
$("#themeAdvancedReset").on("click", function() {
|
||||
var _this = $(this);
|
||||
return core.confirm("Êtes-vous sûr de vouloir réinitialiser à son état d'origine la personnalisation avancée ?", function() {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
31
core/module/theme/view/advanced/advanced.php
Executable file
@ -0,0 +1,31 @@
|
||||
<?php echo template::formOpen('themeAdvancedForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('themeAdvancedBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'theme',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset6">
|
||||
<?php echo template::button('themeAdvancedReset', [
|
||||
'href' => helper::baseUrl() . 'theme/reset',
|
||||
'class' => 'buttonRed',
|
||||
'ico' => 'cancel',
|
||||
'value' => 'Réinitialiser'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::submit('themeAdvancedSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::textarea('themeAdvancedCss', [
|
||||
'value' => file_get_contents('site/data/custom.css'),
|
||||
'class' => 'editorCss'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
43
core/module/theme/view/body/body.js.php
Executable file
@ -0,0 +1,43 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.com/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Aperçu en direct
|
||||
*/
|
||||
$("input, select").on("change", function() {
|
||||
// Couleur du fond
|
||||
var css = "body{background-color:" + $("#themeBodyBackgroundColor").val() + "}";
|
||||
// Image du fond
|
||||
var themeBodyImage = $("#themeBodyImage").val();
|
||||
if(themeBodyImage) {
|
||||
css += "body{background-image:url('<?php echo helper::baseUrl(false); ?>site/file/source/" + themeBodyImage + "');background-repeat:" + $("#themeBodyImageRepeat").val() + ";background-position:" + $("#themeBodyImagePosition").val() + ";background-attachment:" + $("#themeBodyImageAttachment").val() + ";background-size:" + $("#themeBodyImageSize").val() + "]";
|
||||
}
|
||||
else {
|
||||
css += "body{background-image:none}";
|
||||
}
|
||||
// Ajout du css au DOM
|
||||
$("#themePreview").remove();
|
||||
$("<style>")
|
||||
.attr("type", "text/css")
|
||||
.attr("id", "themePreview")
|
||||
.text(css)
|
||||
.appendTo("head");
|
||||
});
|
||||
// Affiche / Cache les options de l'image du fond
|
||||
$("#themeBodyImage").on("change", function() {
|
||||
if($(this).val()) {
|
||||
$("#themeBodyImageOptions").slideDown();
|
||||
}
|
||||
else {
|
||||
$("#themeBodyImageOptions").slideUp();
|
||||
}
|
||||
}).trigger("change");
|
67
core/module/theme/view/body/body.php
Executable file
@ -0,0 +1,67 @@
|
||||
<?php echo template::formOpen('themeBodyForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('themeBodyBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'theme',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::submit('themeBodySubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<div class="block">
|
||||
<h4>Couleur</h4>
|
||||
<?php echo template::text('themeBodyBackgroundColor', [
|
||||
'class' => 'colorPicker',
|
||||
'label' => 'Fond',
|
||||
'value' => $this->getData(['theme', 'body', 'backgroundColor'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<div class="block">
|
||||
<h4>Image</h4>
|
||||
<?php echo template::file('themeBodyImage', [
|
||||
'label' => 'Fond',
|
||||
'type' => 1,
|
||||
'value' => $this->getData(['theme', 'body', 'image'])
|
||||
]); ?>
|
||||
<div id="themeBodyImageOptions" class="displayNone">
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::select('themeBodyImageRepeat', $module::$repeats, [
|
||||
'label' => 'Répétition',
|
||||
'selected' => $this->getData(['theme', 'body', 'imageRepeat'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::select('themeBodyImagePosition', $module::$imagePositions, [
|
||||
'label' => 'Position',
|
||||
'selected' => $this->getData(['theme', 'body', 'imagePosition'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::select('themeBodyImageAttachment', $module::$attachments, [
|
||||
'label' => 'Fixation',
|
||||
'selected' => $this->getData(['theme', 'body', 'imageAttachment'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::select('themeBodyImageSize', $module::$sizes, [
|
||||
'label' => 'Taille',
|
||||
'selected' => $this->getData(['theme', 'body', 'imageSize'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
78
core/module/theme/view/footer/footer.js.php
Executable file
@ -0,0 +1,78 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.com/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Aperçu en direct
|
||||
*/
|
||||
$("input, select").on("change", function() {
|
||||
// Couleurs du pied de page
|
||||
var colors = core.colorVariants($("#themeFooterBackgroundColor").val());
|
||||
var textColor = $("#themeFooterTextColor").val();
|
||||
var css = "footer{background-color:" + colors.normal + ";color:" + textColor + "}";
|
||||
css += "footer a{color:" + textColor + "}";
|
||||
// Hauteur du pied de page
|
||||
css += "footer .container > div{margin:" + $("#themeFooterHeight").val() + " 0}";
|
||||
// Alignement du contenu
|
||||
css += "#footerSocials{text-align:" + $("#themeFooterSocialsAlign").val() + "}";
|
||||
css += "#footerText{text-align:" + $("#themeFooterTextAlign").val() + "}";
|
||||
css += "#footerCopyright{text-align:" + $("#themeFooterCopyrightAlign").val() + "}";
|
||||
// Marge
|
||||
if($("#themeFooterMargin").is(":checked")) {
|
||||
css += 'footer{margin:0 20px 20px}';
|
||||
}
|
||||
else {
|
||||
css += 'footer{margin:0}';
|
||||
}
|
||||
// Ajout du css au DOM
|
||||
$("#themePreview").remove();
|
||||
$("<style>")
|
||||
.attr("type", "text/css")
|
||||
.attr("id", "themePreview")
|
||||
.text(css)
|
||||
.appendTo("head");
|
||||
// Position du pied de page
|
||||
switch($("#themeFooterPosition").val()) {
|
||||
case 'hide':
|
||||
$("footer").hide();
|
||||
break;
|
||||
case 'site':
|
||||
$("footer").show().appendTo("#site");
|
||||
break;
|
||||
case 'body':
|
||||
$("footer").show().appendTo("body");
|
||||
break;
|
||||
}
|
||||
});
|
||||
// Lien de connexion
|
||||
$("#themeFooterLoginLink").on("change", function() {
|
||||
if($(this).is(":checked")) {
|
||||
$("#footerLoginLink").show();
|
||||
}
|
||||
else {
|
||||
$("#footerLoginLink").hide();
|
||||
}
|
||||
}).trigger("change");
|
||||
// Aperçu du texte
|
||||
$("#themeFooterText").on("change keydown keyup", function() {
|
||||
$("#footerText").html($(this).val());
|
||||
});
|
||||
// Affiche / Cache les options de la position
|
||||
$("#themeFooterPosition").on("change", function() {
|
||||
if($(this).val() === 'site') {
|
||||
$("#themeFooterPositionOptions").slideDown();
|
||||
}
|
||||
else {
|
||||
$("#themeFooterPositionOptions").slideUp(function() {
|
||||
$("#themeFooterMargin").prop("checked", false).trigger("change");
|
||||
});
|
||||
}
|
||||
}).trigger("change");
|
104
core/module/theme/view/footer/footer.php
Executable file
@ -0,0 +1,104 @@
|
||||
<?php echo template::formOpen('themeFooterForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('themeFooterBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'theme',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::submit('themeFooterSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<div class="block">
|
||||
<h4>Couleur</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::text('themeFooterBackgroundColor', [
|
||||
'class' => 'colorPicker',
|
||||
'label' => 'Fond',
|
||||
'value' => $this->getData(['theme', 'footer', 'backgroundColor'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::text('themeFooterTextColor', [
|
||||
'class' => 'colorPicker',
|
||||
'label' => 'Texte',
|
||||
'value' => $this->getData(['theme', 'footer', 'textColor'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<div class="block">
|
||||
<h4>Configuration</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::select('themeFooterPosition', $module::$footerPositions, [
|
||||
'label' => 'Position',
|
||||
'selected' => $this->getData(['theme', 'footer', 'position'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::select('themeFooterHeight', $module::$footerHeights, [
|
||||
'label' => 'Hauteur',
|
||||
'selected' => $this->getData(['theme', 'footer', 'height'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div id="themeFooterPositionOptions" class="displayNone">
|
||||
<?php echo template::checkbox('themeFooterMargin', true, 'Aligner le bas de page avec le contenu', [
|
||||
'checked' => $this->getData(['theme', 'footer', 'margin'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Alignement du contenu</h4>
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::select('themeFooterSocialsAlign', $module::$aligns, [
|
||||
'label' => 'Réseaux sociaux',
|
||||
'selected' => $this->getData(['theme', 'footer', 'socialsAlign'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('themeFooterTextAlign', $module::$aligns, [
|
||||
'label' => 'Texte',
|
||||
'selected' => $this->getData(['theme', 'footer', 'textAlign'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('themeFooterCopyrightAlign', $module::$aligns, [
|
||||
'label' => 'Copyright',
|
||||
'selected' => $this->getData(['theme', 'footer', 'copyrightAlign'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<div class="block">
|
||||
<h4>Contenu</h4>
|
||||
<?php echo template::textarea('themeFooterText', [
|
||||
'label' => 'Texte du pied de page',
|
||||
'value' => $this->getData(['theme', 'footer', 'text'])
|
||||
]); ?>
|
||||
<?php echo template::checkbox('themeFooterLoginLink', true, 'Lien de connexion', [
|
||||
'checked' => $this->getData(['theme', 'footer', 'loginLink']),
|
||||
'help' => 'Visible seulement sur cette page et lorsque vous n\'êtes pas connecté.'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
119
core/module/theme/view/header/header.js.php
Executable file
@ -0,0 +1,119 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.com/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Aperçu en direct
|
||||
*/
|
||||
$("input, select").on("change", function() {
|
||||
// Import des polices de caractères
|
||||
var headerFont = $("#themeHeaderFont").val();
|
||||
var css = "@import url('https://fonts.googleapis.com/css?family=" + headerFont + "');";
|
||||
// Couleurs, image, alignement et hauteur de la bannière
|
||||
css += "header{background-color:" + $("#themeHeaderBackgroundColor").val() + ";text-align:" + $("#themeHeaderTextAlign").val() + ";height:" + $("#themeHeaderHeight").val() + ";line-height:" + $("#themeHeaderHeight").val() + "}";
|
||||
var themeHeaderImage = $("#themeHeaderImage").val();
|
||||
if(themeHeaderImage) {
|
||||
css += "header{background-image:url('<?php echo helper::baseUrl(false); ?>site/file/source/" + themeHeaderImage + "');background-repeat:" + $("#themeHeaderImageRepeat").val() + ";background-position:" + $("#themeHeaderImagePosition").val() + "}";
|
||||
}
|
||||
else {
|
||||
css += "header{background-image:none}";
|
||||
}
|
||||
// Taille, couleur, épaisseur et capitalisation du titre de la bannière
|
||||
css += "header span{color:" + $("#themeHeaderTextColor").val() + ";font-family:'" + headerFont.replace(/\+/g, " ") + "',sans-serif;font-weight:" + $("#themeHeaderFontWeight").val() + ";font-size:" + $("#themeHeaderFontSize").val() + ";text-transform:" + $("#themeHeaderTextTransform").val() + "}";
|
||||
// Cache le titre de la bannière
|
||||
if($("#themeHeaderTextHide").is(":checked")) {
|
||||
$("header .container").hide();
|
||||
}
|
||||
else {
|
||||
$("header .container").show();
|
||||
}
|
||||
// Marge
|
||||
if($("#themeHeaderMargin").is(":checked")) {
|
||||
if(<?php echo json_encode($this->getData(['theme', 'menu', 'position']) === 'site-first'); ?>) {
|
||||
css += 'header{margin:0 20px}';
|
||||
}
|
||||
else {
|
||||
css += 'header{margin:20px 20px 0 20px}';
|
||||
}
|
||||
}
|
||||
else {
|
||||
css += 'header{margin:0}';
|
||||
}
|
||||
// Position de la bannière
|
||||
switch($("#themeHeaderPosition").val()) {
|
||||
case 'hide':
|
||||
$("header").hide();
|
||||
break;
|
||||
case 'site':
|
||||
if(<?php echo json_encode($this->getData(['theme', 'menu', 'position']) === 'site-first'); ?>) {
|
||||
$("header").show().insertAfter("nav");
|
||||
}
|
||||
else {
|
||||
$("header").show().prependTo("#site");
|
||||
// Supprime le margin en trop du menu
|
||||
if(<?php echo json_encode($this->getData(['theme', 'menu', 'margin'])); ?>) {
|
||||
css += 'nav{margin:0 20px}';
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'body':
|
||||
if(<?php echo json_encode($this->getData(['theme', 'menu', 'position']) === 'body-first'); ?>) {
|
||||
$("header").show().insertAfter("nav");
|
||||
}
|
||||
else {
|
||||
$("header").show().insertAfter("#bar");
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Ajout du css au DOM
|
||||
$("#themePreview").remove();
|
||||
$("<style>")
|
||||
.attr("type", "text/css")
|
||||
.attr("id", "themePreview")
|
||||
.text(css)
|
||||
.appendTo("head");
|
||||
});
|
||||
// Affiche / Cache les options de l'image du fond
|
||||
$("#themeHeaderImage").on("change", function() {
|
||||
if($(this).val()) {
|
||||
$("#themeHeaderImageOptions").slideDown();
|
||||
}
|
||||
else {
|
||||
$("#themeHeaderImageOptions").slideUp(function() {
|
||||
$("#themeHeaderTextHide").prop("checked", false).trigger("change");
|
||||
});
|
||||
}
|
||||
}).trigger("change");
|
||||
// Affiche / Cache les options de la position
|
||||
$("#themeHeaderPosition").on("change", function() {
|
||||
if($(this).val() === 'site') {
|
||||
$("#themeHeaderPositionOptions").slideDown();
|
||||
}
|
||||
else {
|
||||
$("#themeHeaderPositionOptions").slideUp(function() {
|
||||
$("#themeHeaderMargin").prop("checked", false).trigger("change");
|
||||
});
|
||||
}
|
||||
}).trigger("change");
|
||||
|
||||
// Affiche / Cache les options de la bannière cliquable si pas masquée
|
||||
$("#themeHeaderPosition").on("change", function() {
|
||||
if($(this).val() === 'hide') {
|
||||
$("#themeHeaderShow").slideUp(function() {
|
||||
$("#themeHeaderlinkHome").prop("checked", false).trigger("change");
|
||||
});
|
||||
}
|
||||
else {
|
||||
$("#themeHeaderShow").slideDown();
|
||||
}
|
||||
}).trigger("change");
|
||||
|
||||
|
143
core/module/theme/view/header/header.php
Executable file
@ -0,0 +1,143 @@
|
||||
<?php echo template::formOpen('themeHeaderForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('themeHeaderBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'theme',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::submit('themeHeaderSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<div class="block">
|
||||
<h4>Couleurs</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::text('themeHeaderBackgroundColor', [
|
||||
'class' => 'colorPicker',
|
||||
'label' => 'Fond',
|
||||
'value' => $this->getData(['theme', 'header', 'backgroundColor'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::text('themeHeaderTextColor', [
|
||||
'class' => 'colorPicker',
|
||||
'label' => 'Texte',
|
||||
'value' => $this->getData(['theme', 'header', 'textColor'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<div class="block">
|
||||
<h4>Image</h4>
|
||||
<?php echo template::file('themeHeaderImage', [
|
||||
'label' => 'Fond',
|
||||
'type' => 1,
|
||||
'value' => $this->getData(['theme', 'header', 'image'])
|
||||
]); ?>
|
||||
<div id="themeHeaderImageOptions" class="displayNone">
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::select('themeHeaderImageRepeat', $module::$repeats, [
|
||||
'label' => 'Répétition',
|
||||
'selected' => $this->getData(['theme', 'header', 'imageRepeat'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::select('themeHeaderImagePosition', $module::$imagePositions, [
|
||||
'label' => 'Position',
|
||||
'selected' => $this->getData(['theme', 'header', 'imagePosition'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::checkbox('themeHeaderTextHide', true, 'Cacher le titre du site', [
|
||||
'checked' => $this->getData(['theme', 'header', 'textHide'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Mise en forme du texte</h4>
|
||||
<div class="row">
|
||||
<div class="col3">
|
||||
<?php echo template::select('themeHeaderTextTransform', $module::$textTransforms, [
|
||||
'label' => 'Caractères',
|
||||
'selected' => $this->getData(['theme', 'header', 'textTransform'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::select('themeHeaderFontWeight', $module::$fontWeights, [
|
||||
'label' => 'Style',
|
||||
'selected' => $this->getData(['theme', 'header', 'fontWeight'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::select('themeHeaderFontSize', $module::$headerFontSizes, [
|
||||
'label' => 'Taille',
|
||||
'selected' => $this->getData(['theme', 'header', 'fontSize'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::select('themeHeaderFont', $module::$fonts, [
|
||||
'label' => 'Police',
|
||||
'selected' => $this->getData(['theme', 'header', 'font'])
|
||||
]); ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Configuration</h4>
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::select('themeHeaderPosition', $module::$headerPositions, [
|
||||
'label' => 'Position',
|
||||
'selected' => $this->getData(['theme', 'header', 'position'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('themeHeaderHeight', $module::$headerHeights, [
|
||||
'label' => 'Hauteur',
|
||||
'selected' => $this->getData(['theme', 'header', 'height'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('themeHeaderTextAlign', $module::$aligns, [
|
||||
'label' => 'Alignement du contenu',
|
||||
'selected' => $this->getData(['theme', 'header', 'textAlign'])
|
||||
]); ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- menu image -->
|
||||
<div id="themeHeaderShow" class="displayNone">
|
||||
<?php echo template::checkbox('themeHeaderlinkHome', true, 'Bannière cliquable', [
|
||||
'checked' => $this->getData(['theme', 'header', 'linkHome'])
|
||||
]); ?>
|
||||
</div>
|
||||
<!-- menu image -->
|
||||
|
||||
<div id="themeHeaderPositionOptions" class="displayNone">
|
||||
<?php echo template::checkbox('themeHeaderMargin', true, 'Aligner la bannière avec le contenu', [
|
||||
'checked' => $this->getData(['theme', 'header', 'margin'])
|
||||
]); ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
48
core/module/theme/view/index/index.css
Executable file
@ -0,0 +1,48 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.com/
|
||||
*/
|
||||
|
||||
#bar,
|
||||
#site,
|
||||
header,
|
||||
nav,
|
||||
section,
|
||||
footer {
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
}
|
||||
#themeShowAll,
|
||||
#themeBack,
|
||||
#themeAdvanced {
|
||||
position: relative;
|
||||
z-index: 11;
|
||||
}
|
||||
.themeOverlay {
|
||||
-webkit-transition: all .3s;
|
||||
transition: all .3s;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: 5;
|
||||
cursor: pointer;
|
||||
content: " ";
|
||||
display: block;
|
||||
background: transparent;
|
||||
}
|
||||
.themeOverlay:not(.themeOverlayHideBackground):hover,
|
||||
.themeOverlayTriggerHover {
|
||||
background: rgba(39, 174, 96, .5);
|
||||
}
|
||||
#themeOverlayBody {
|
||||
position: fixed; /* Sinon l'overlay s'arrête à la hauteur de la fenêtre et non de la page*/
|
||||
}
|
75
core/module/theme/view/index/index.js.php
Executable file
@ -0,0 +1,75 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.com/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Ajout des overlays
|
||||
*/
|
||||
$("<a>")
|
||||
.addClass("themeOverlay")
|
||||
.attr({
|
||||
"id": "themeOverlayBody",
|
||||
"href": "<?php echo helper::baseUrl(); ?>theme/body"
|
||||
})
|
||||
.appendTo("body");
|
||||
$("<a>")
|
||||
.addClass("themeOverlay")
|
||||
.attr({
|
||||
"id": "themeOverlayHeader",
|
||||
"href": "<?php echo helper::baseUrl(); ?>theme/header"
|
||||
})
|
||||
.appendTo("header");
|
||||
$("<a>")
|
||||
.addClass("themeOverlay")
|
||||
.attr({
|
||||
"id": "themeOverlayMenu",
|
||||
"href": "<?php echo helper::baseUrl(); ?>theme/menu"
|
||||
})
|
||||
.appendTo("nav");
|
||||
$("<a>")
|
||||
.addClass("themeOverlay")
|
||||
.attr({
|
||||
"id": "themeOverlaySite",
|
||||
"href": "<?php echo helper::baseUrl(); ?>theme/site"
|
||||
})
|
||||
.appendTo("#site");
|
||||
$("<a>")
|
||||
.addClass("themeOverlay themeOverlayHideBackground")
|
||||
.attr({
|
||||
"id": "themeOverlaySection",
|
||||
"href": "<?php echo helper::baseUrl(); ?>theme/site"
|
||||
})
|
||||
.appendTo("section");
|
||||
$("<a>")
|
||||
.addClass("themeOverlay")
|
||||
.attr({
|
||||
"id": "themeOverlayFooter",
|
||||
"href": "<?php echo helper::baseUrl(); ?>theme/footer"
|
||||
})
|
||||
.appendTo("footer");
|
||||
|
||||
/**
|
||||
* Affiche les zones cachées
|
||||
*/
|
||||
$("#themeShowAll").on("click", function() {
|
||||
$("header.displayNone, nav.displayNone, footer.displayNone").slideToggle();
|
||||
});
|
||||
|
||||
/**
|
||||
* Simule un survole du site lors du survole de la section
|
||||
*/
|
||||
$("section")
|
||||
.on("mouseover", function() {
|
||||
$("#themeOverlaySite:not(.themeOverlayTriggerHover)").addClass("themeOverlayTriggerHover");
|
||||
})
|
||||
.on("mouseleave", function() {
|
||||
$("#themeOverlaySite.themeOverlayTriggerHover").removeClass("themeOverlayTriggerHover");
|
||||
});
|
49
core/module/theme/view/index/index.php
Executable file
@ -0,0 +1,49 @@
|
||||
<?php if(
|
||||
$this->getData(['theme', 'header', 'position']) === 'hide'
|
||||
OR $this->getData(['theme', 'menu', 'position']) === 'hide'
|
||||
OR $this->getData(['theme', 'footer', 'position']) === 'hide'
|
||||
): ?>
|
||||
<?php echo template::speech('Cliquez sur une zone afin d\'accéder à ses options de personnalisation. Vous pouvez également afficher les zones cachées à l\'aide du bouton ci-dessous.'); ?>
|
||||
<div class="row">
|
||||
<div class="col2 offset3">
|
||||
<?php echo template::button('themeBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl(false),
|
||||
'ico' => 'home',
|
||||
'value' => 'Accueil'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::button('themeAdvanced', [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/advanced',
|
||||
'value' => 'Mode avancé',
|
||||
'ico' => 'code'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::button('themeShowAll', [
|
||||
'ico' => 'eye',
|
||||
'value' => 'Zones cachées'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?php echo template::speech('Cliquez sur une zone afin d\'accéder à ses options de personnalisation.'); ?>
|
||||
<div class="row">
|
||||
<div class="col2 offset4">
|
||||
<?php echo template::button('themeBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl(false),
|
||||
'ico' => 'home',
|
||||
'value' => 'Accueil'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::button('themeAdvanced', [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/advanced',
|
||||
'value' => 'Mode avancé',
|
||||
'ico' => 'code'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
97
core/module/theme/view/menu/menu.js.php
Executable file
@ -0,0 +1,97 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.com/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Aperçu en direct
|
||||
*/
|
||||
$("input, select").on("change", function() {
|
||||
// Couleurs du menu
|
||||
var colors = core.colorVariants($("#themeMenuBackgroundColor").val());
|
||||
var css = "nav,nav a{background-color:" + colors.normal + "}";
|
||||
css += "nav a,#toggle span,nav a:hover{color:" + $("#themeMenuTextColor").val() + "}";
|
||||
css += "nav a:hover{background-color:" + colors.darken + "}";
|
||||
css += "nav a.active{background-color:" + colors.veryDarken + "}";
|
||||
// Taille, hauteur, épaisseur et capitalisation de caractères du menu
|
||||
css += "#toggle span,#menu a{padding:" + $("#themeMenuHeight").val() + ";font-weight:" + $("#themeMenuFontWeight").val() + ";font-size:" + $("#themeMenuFontSize").val() + ";text-transform:" + $("#themeMenuTextTransform").val() + "}";
|
||||
// Alignement du menu
|
||||
css += "#menu{text-align:" + $("#themeMenuTextAlign").val() + "}";
|
||||
// Marge
|
||||
if($("#themeMenuMargin").is(":checked")) {
|
||||
if(
|
||||
<?php echo json_encode($this->getData(['theme', 'menu', 'position']) === 'site-first'); ?>
|
||||
|| <?php echo json_encode($this->getData(['theme', 'header', 'position']) === 'body'); ?>
|
||||
) {
|
||||
css += 'nav{margin:20px 20px 0 20px}';
|
||||
}
|
||||
else {
|
||||
css += 'nav{margin:0 20px}';
|
||||
}
|
||||
}
|
||||
else {
|
||||
css += 'nav{margin:0}';
|
||||
}
|
||||
// Ajout du css au DOM
|
||||
$("#themePreview").remove();
|
||||
$("<style>")
|
||||
.attr("type", "text/css")
|
||||
.attr("id", "themePreview")
|
||||
.text(css)
|
||||
.appendTo("head");
|
||||
// Position du menu
|
||||
switch($("#themeMenuPosition").val()) {
|
||||
case 'hide':
|
||||
$("nav").hide();
|
||||
break;
|
||||
case 'site-first':
|
||||
$("nav").show().prependTo("#site");
|
||||
break;
|
||||
case 'site-second':
|
||||
if(<?php echo json_encode($this->getData(['theme', 'header', 'position']) === 'site'); ?>) {
|
||||
$("nav").show().insertAfter("header");
|
||||
}
|
||||
else {
|
||||
$("nav").show().prependTo("#site");
|
||||
}
|
||||
break;
|
||||
case 'body-first':
|
||||
$("nav").show().insertAfter("#bar");
|
||||
break;
|
||||
case 'body-second':
|
||||
if(<?php echo json_encode($this->getData(['theme', 'header', 'position']) === 'body'); ?>) {
|
||||
$("nav").show().insertAfter("header");
|
||||
}
|
||||
else {
|
||||
$("nav").show().insertAfter("#bar");
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
// Lien de connexion (addClass() et removeClass() au lieu de hide() et show() car ils ne conservent pas le display-inline: block; de #themeMenuLoginLink)
|
||||
$("#themeMenuLoginLink").on("change", function() {
|
||||
if($(this).is(":checked")) {
|
||||
$("#menuLoginLink").removeClass('displayNone');
|
||||
}
|
||||
else {
|
||||
$("#menuLoginLink").addClass('displayNone');
|
||||
}
|
||||
}).trigger("change");
|
||||
// Affiche / Cache les options de la position
|
||||
$("#themeMenuPosition").on("change", function() {
|
||||
if($(this).val() === 'site-first' || $(this).val() === 'site-second') {
|
||||
$("#themeMenuPositionOptions").slideDown();
|
||||
}
|
||||
else {
|
||||
$("#themeMenuPositionOptions").slideUp(function() {
|
||||
$("#themeMenuMargin").prop("checked", false).trigger("change");
|
||||
});
|
||||
}
|
||||
}).trigger("change");
|
106
core/module/theme/view/menu/menu.php
Executable file
@ -0,0 +1,106 @@
|
||||
<?php echo template::formOpen('themeMenuForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('themeMenuBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'theme',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::submit('themeMenuSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<div class="block">
|
||||
<h4>Couleur</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::text('themeMenuBackgroundColor', [
|
||||
'class' => 'colorPicker',
|
||||
'label' => 'Fond',
|
||||
'value' => $this->getData(['theme', 'menu', 'backgroundColor'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::text('themeMenuTextColor', [
|
||||
'class' => 'colorPicker',
|
||||
'label' => 'Texte',
|
||||
'value' => $this->getData(['theme', 'menu', 'textColor'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<div class="block">
|
||||
<h4>Mise en forme du texte</h4>
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::select('themeMenuTextTransform', $module::$textTransforms, [
|
||||
'label' => 'Caractères',
|
||||
'selected' => $this->getData(['theme', 'menu', 'textTransform'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('themeMenuFontWeight', $module::$fontWeights, [
|
||||
'label' => 'Style',
|
||||
'selected' => $this->getData(['theme', 'menu', 'fontWeight'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('themeMenuFontSize', $module::$menuFontSizes, [
|
||||
'label' => 'Taille',
|
||||
'selected' => $this->getData(['theme', 'menu', 'fontSize'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Configuration</h4>
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::select('themeMenuPosition', $module::$menuPositions, [
|
||||
'label' => 'Position',
|
||||
'selected' => $this->getData(['theme', 'menu', 'position'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('themeMenuHeight', $module::$menuHeights, [
|
||||
'label' => 'Hauteur',
|
||||
'selected' => $this->getData(['theme', 'menu', 'height'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('themeMenuTextAlign', $module::$aligns, [
|
||||
'label' => 'Alignement du contenu',
|
||||
'selected' => $this->getData(['theme', 'menu', 'textAlign'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div id="themeMenuPositionOptions" class="displayNone">
|
||||
<?php echo template::checkbox('themeMenuMargin', true, 'Aligner le menu avec le contenu', [
|
||||
'checked' => $this->getData(['theme', 'menu', 'margin'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<div class="block">
|
||||
<h4>Contenu</h4>
|
||||
<?php echo template::checkbox('themeMenuLoginLink', true, 'Lien de connexion', [
|
||||
'checked' => $this->getData(['theme', 'menu', 'loginLink']),
|
||||
'help' => 'Visible seulement sur cette page et lorsque vous n\'êtes pas connecté.'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
53
core/module/theme/view/site/site.js.php
Executable file
@ -0,0 +1,53 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.com/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Aperçu en direct
|
||||
*/
|
||||
$("input, select").on("change", function() {
|
||||
// Import des polices de caractères
|
||||
var titleFont = $("#themeTitleFont").val();
|
||||
var textFont = $("#themeTextFont").val();
|
||||
var css = "@import url('https://fonts.googleapis.com/css?family=" + titleFont + "|" + textFont + "');";
|
||||
// Couleurs des boutons
|
||||
var colors = core.colorVariants($("#themeButtonBackgroundColor").val());
|
||||
css += ".speechBubble,.button,.button:hover,button[type='submit'],.pagination a,.pagination a:hover,input[type='checkbox']:checked + label:before,.helpContent{background-color:" + colors.normal + ";color:" + colors.text + "}";
|
||||
css += ".helpButton span{color:" + colors.normal + "}";
|
||||
css += "input[type='text']:hover,input[type='password']:hover,.inputFile:hover,select:hover,textarea:hover{border-color:" + colors.normal + "}";
|
||||
css += ".speechBubble:before{border-color:" + colors.normal + " transparent transparent transparent}";
|
||||
css += ".button:hover,button[type='submit']:hover,.pagination a:hover,input[type='checkbox']:not(:active):checked:hover + label:before,input[type='checkbox']:active + label:before{background-color:" + colors.darken + "}";
|
||||
css += ".helpButton span:hover{color:" + colors.darken + "}";
|
||||
css += ".button:active,button[type='submit']:active,.pagination a:active{background-color:" + colors.veryDarken + "}";
|
||||
// Couleurs des liens
|
||||
colors = core.colorVariants($("#themeLinkTextColor").val());
|
||||
css += "a{color:" + colors.normal + "}";
|
||||
css += "a:hover{color:" + colors.darken + "}";
|
||||
// Couleur, polices, épaisseur et capitalisation de caractères des titres
|
||||
css += "h1,h2,h3,h4,h5,h6{color:" + $("#themeTitleTextColor").val() + ";font-family:'" + titleFont.replace(/\+/g, " ") + "',sans-serif;font-weight:" + $("#themeTitleFontWeight").val() + ";text-transform:" + $("#themeTitleTextTransform").val() + "}";
|
||||
// Police de caractères
|
||||
css += "body{font-family:'" + textFont.replace(/\+/g, " ") + "',sans-serif}";
|
||||
// Taille du texte
|
||||
css += "body,.row > div{font-size:" + $("#themeTextFontSize").val() + "}";
|
||||
// Couleur du texte
|
||||
css += "body,.block h4,input[type='email'],input[type='text'],input[type='password'],.inputFile,select,textarea,.inputFile,.button.buttonGrey,.button.buttonGrey:hover{color:" + $("#themeTextTextColor").val() + "}";
|
||||
// Largeur du site
|
||||
css += ".container{max-width:" + $("#themeSiteWidth").val() + "}";
|
||||
// Couleur du site, arrondi sur les coins du site et ombre sur les bords du site
|
||||
css += "#site{background-color:" + $("#themeSiteBackgroundColor").val() + ";border-radius:" + $("#themeSiteRadius").val() + ";box-shadow:" + $("#themeSiteShadow").val() + " #212223}";
|
||||
// Ajout du css au DOM
|
||||
$("#themePreview").remove();
|
||||
$("<style>")
|
||||
.attr("type", "text/css")
|
||||
.attr("id", "themePreview")
|
||||
.text(css)
|
||||
.appendTo("head");
|
||||
});
|
134
core/module/theme/view/site/site.php
Executable file
@ -0,0 +1,134 @@
|
||||
<?php echo template::formOpen('themeSiteForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('themeSiteBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'theme',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::submit('themeSiteSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Couleurs</h4>
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::text('themeSiteBackgroundColor', [
|
||||
'class' => 'colorPicker',
|
||||
'label' => 'Fond',
|
||||
'value' => $this->getData(['theme', 'site', 'backgroundColor'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::text('themeTextTextColor', [
|
||||
'class' => 'colorPicker',
|
||||
'label' => 'Texte',
|
||||
'value' => $this->getData(['theme', 'text', 'textColor'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::text('themeTitleTextColor', [
|
||||
'class' => 'colorPicker',
|
||||
'label' => 'Titres',
|
||||
'value' => $this->getData(['theme', 'title', 'textColor'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::text('themeButtonBackgroundColor', [
|
||||
'class' => 'colorPicker',
|
||||
'label' => 'Boutons',
|
||||
'value' => $this->getData(['theme', 'button', 'backgroundColor'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::text('themeLinkTextColor', [
|
||||
'class' => 'colorPicker',
|
||||
'label' => 'Liens',
|
||||
'value' => $this->getData(['theme', 'link', 'textColor'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Apparence</h4>
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::select('themeSiteWidth', $module::$widths, [
|
||||
'label' => 'Largeur du site',
|
||||
'selected' => $this->getData(['theme', 'site', 'width'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('themeSiteRadius', $module::$radius, [
|
||||
'label' => 'Arrondi des coins',
|
||||
'selected' => $this->getData(['theme', 'site', 'radius'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('themeSiteShadow', $module::$shadows, [
|
||||
'label' => 'Ombre sur les bords du site',
|
||||
'selected' => $this->getData(['theme', 'site', 'shadow'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<div class="block">
|
||||
<h4>Mise en forme du texte</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::select('themeTextFontSize', $module::$siteFontSizes, [
|
||||
'label' => 'Taille',
|
||||
'selected' => $this->getData(['theme', 'text', 'fontSize'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::select('themeTextFont', $module::$fonts, [
|
||||
'label' => 'Police',
|
||||
'selected' => $this->getData(['theme', 'text', 'font'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<div class="block">
|
||||
<h4>Mise en forme des titres</h4>
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::select('themeTitleTextTransform', $module::$textTransforms, [
|
||||
'label' => 'Caractères',
|
||||
'selected' => $this->getData(['theme', 'title', 'textTransform'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('themeTitleFontWeight', $module::$fontWeights, [
|
||||
'label' => 'Style',
|
||||
'selected' => $this->getData(['theme', 'title', 'fontWeight'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('themeTitleFont', $module::$fonts, [
|
||||
'label' => 'Police',
|
||||
'selected' => $this->getData(['theme', 'title', 'font'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
412
core/module/user/user.php
Executable file
@ -0,0 +1,412 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.com/
|
||||
*/
|
||||
|
||||
class user extends common {
|
||||
|
||||
public static $actions = [
|
||||
'add' => self::GROUP_ADMIN,
|
||||
'delete' => self::GROUP_ADMIN,
|
||||
'edit' => self::GROUP_MEMBER,
|
||||
'forgot' => self::GROUP_VISITOR,
|
||||
'index' => self::GROUP_ADMIN,
|
||||
'login' => self::GROUP_VISITOR,
|
||||
'logout' => self::GROUP_MEMBER,
|
||||
'reset' => self::GROUP_VISITOR
|
||||
];
|
||||
public static $users = [];
|
||||
|
||||
/**
|
||||
* Ajout
|
||||
*/
|
||||
public function add() {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
// L'identifiant d'utilisateur est indisponible
|
||||
$userId = $this->getInput('userAddId', helper::FILTER_ID, true);
|
||||
if($this->getData(['user', $userId])) {
|
||||
self::$inputNotices['userAddId'] = 'Identifiant déjà utilisé';
|
||||
}
|
||||
// Double vérification pour le mot de passe
|
||||
if($this->getInput('userAddPassword', helper::FILTER_STRING_SHORT, true) !== $this->getInput('userAddConfirmPassword', helper::FILTER_STRING_SHORT, true)) {
|
||||
self::$inputNotices['userAddConfirmPassword'] = 'Incorrect';
|
||||
}
|
||||
// Crée l'utilisateur
|
||||
$userFirstname = $this->getInput('userAddFirstname', helper::FILTER_STRING_SHORT, true);
|
||||
$userLastname = $this->getInput('userAddLastname', helper::FILTER_STRING_SHORT, true);
|
||||
$userMail = $this->getInput('userAddMail', helper::FILTER_MAIL, true);
|
||||
$this->setData([
|
||||
'user',
|
||||
$userId,
|
||||
[
|
||||
'firstname' => $userFirstname,
|
||||
'forgot' => 0,
|
||||
'group' => $this->getInput('userAddGroup', helper::FILTER_INT, true),
|
||||
'lastname' => $userLastname,
|
||||
'mail' => $userMail,
|
||||
'password' => $this->getInput('userAddPassword', helper::FILTER_PASSWORD, true)
|
||||
]
|
||||
]);
|
||||
// Envoi le mail
|
||||
$sent = true;
|
||||
if($this->getInput('userAddSendMail', helper::FILTER_BOOLEAN)) {
|
||||
$sent = $this->sendMail(
|
||||
$userMail,
|
||||
'Compte créé sur ' . $this->getData(['config', 'title']),
|
||||
'Bonjour <strong>' . $userFirstname . ' ' . $userLastname . '</strong>,<br><br>' .
|
||||
'Un administrateur vous a créé un compte sur le site ' . $this->getData(['config', 'title']) . '. Vous trouverez ci-dessous les détails de votre compte.<br><br>' .
|
||||
'<strong>Identifiant du compte :</strong> ' . $this->getInput('userAddId') . '<br>' .
|
||||
'<strong>Mot de passe du compte :</strong> ' . $this->getInput('userAddPassword') . '<br><br>' .
|
||||
'<small>Nous ne conservons pas les mots de passe, par conséquence nous vous conseillons de garder ce mail tant que vous ne vous êtes pas connecté. Vous pourrez modifier votre mot de passe après votre première connexion.</small>'
|
||||
);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'user',
|
||||
'notification' => ($sent === true ? 'Utilisateur créé' : $sent),
|
||||
'state' => ($sent === true ? true : null)
|
||||
]);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Nouvel utilisateur',
|
||||
'view' => 'add'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Suppression
|
||||
*/
|
||||
public function delete() {
|
||||
// Accès refusé
|
||||
if(
|
||||
// L'utilisateur n'existe pas
|
||||
$this->getData(['user', $this->getUrl(2)]) === null
|
||||
// Groupe insuffisant
|
||||
AND ($this->getUrl('group') < self::GROUP_MODERATOR)
|
||||
) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
]);
|
||||
}
|
||||
// Bloque la suppression de son propre compte
|
||||
elseif($this->getUser('id') === $this->getUrl(2)) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'user',
|
||||
'notification' => 'Impossible de supprimer votre propre compte'
|
||||
]);
|
||||
}
|
||||
// Suppression
|
||||
else {
|
||||
$this->deleteData(['user', $this->getUrl(2)]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'user',
|
||||
'notification' => 'Utilisateur supprimé',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Édition
|
||||
*/
|
||||
public function edit() {
|
||||
// Accès refusé
|
||||
if(
|
||||
// L'utilisateur n'existe pas
|
||||
$this->getData(['user', $this->getUrl(2)]) === null
|
||||
// Droit d'édition
|
||||
AND (
|
||||
// Impossible de s'auto-éditer
|
||||
(
|
||||
$this->getUser('id') === $this->getUrl(2)
|
||||
AND $this->getUrl('group') <= self::GROUP_VISITOR
|
||||
)
|
||||
// Impossible d'éditer un autre utilisateur
|
||||
OR ($this->getUrl('group') < self::GROUP_MODERATOR)
|
||||
)
|
||||
) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
]);
|
||||
}
|
||||
// Accès autorisé
|
||||
else {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
// Double vérification pour le mot de passe
|
||||
$newPassword = $this->getData(['user', $this->getUrl(2), 'password']);
|
||||
if($this->getInput('userEditNewPassword')) {
|
||||
// L'ancien mot de passe est correct
|
||||
if(password_verify($this->getInput('userEditOldPassword'), $this->getData(['user', $this->getUrl(2), 'password']))) {
|
||||
// La confirmation correspond au mot de passe
|
||||
if($this->getInput('userEditNewPassword') === $this->getInput('userEditConfirmPassword')) {
|
||||
$newPassword = $this->getInput('userEditNewPassword', helper::FILTER_PASSWORD, true);
|
||||
// Déconnexion de l'utilisateur si il change le mot de passe de son propre compte
|
||||
if($this->getUser('id') === $this->getUrl(2)) {
|
||||
helper::deleteCookie('ZWII_USER_ID');
|
||||
helper::deleteCookie('ZWII_USER_PASSWORD');
|
||||
}
|
||||
}
|
||||
else {
|
||||
self::$inputNotices['userEditConfirmPassword'] = 'Incorrect';
|
||||
}
|
||||
}
|
||||
else {
|
||||
self::$inputNotices['userEditOldPassword'] = 'Incorrect';
|
||||
}
|
||||
}
|
||||
// Modification du groupe
|
||||
if(
|
||||
$this->getUser('group') === self::GROUP_ADMIN
|
||||
AND $this->getUrl(2) !== $this->getUser('id')
|
||||
) {
|
||||
$newGroup = $this->getInput('userEditGroup', helper::FILTER_INT, true);
|
||||
}
|
||||
else {
|
||||
$newGroup = $this->getData(['user', $this->getUrl(2), 'group']);
|
||||
}
|
||||
// Modifie l'utilisateur
|
||||
$this->setData([
|
||||
'user',
|
||||
$this->getUrl(2),
|
||||
[
|
||||
'firstname' => $this->getInput('userEditFirstname', helper::FILTER_STRING_SHORT, true),
|
||||
'forgot' => 0,
|
||||
'group' => $newGroup,
|
||||
'lastname' => $this->getInput('userEditLastname', helper::FILTER_STRING_SHORT, true),
|
||||
'mail' => $this->getInput('userEditMail', helper::FILTER_MAIL, true),
|
||||
'password' => $newPassword
|
||||
]
|
||||
]);
|
||||
// Redirection spécifique si l'utilisateur change son mot de passe
|
||||
if($this->getUser('id') === $this->getUrl(2) AND $this->getInput('userEditNewPassword')) {
|
||||
$redirect = helper::baseUrl() . 'user/login/' . str_replace('/', '_', $this->getUrl());
|
||||
}
|
||||
// Redirection si retour en arrière possible
|
||||
elseif($this->getUrl(3)) {
|
||||
$redirect = helper::baseUrl() . 'user';
|
||||
}
|
||||
// Redirection normale
|
||||
else {
|
||||
$redirect = helper::baseUrl() . $this->getUrl();
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => $redirect,
|
||||
'notification' => 'Modifications enregistrées',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => $this->getData(['user', $this->getUrl(2), 'firstname']) . ' ' . $this->getData(['user', $this->getUrl(2), 'lastname']),
|
||||
'view' => 'edit'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Mot de passe perdu
|
||||
*/
|
||||
public function forgot() {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
$userId = $this->getInput('userForgotId', helper::FILTER_ID, true);
|
||||
if($this->getData(['user', $userId])) {
|
||||
// Enregistre la date de la demande dans le compte utilisateur
|
||||
$this->setData(['user', $userId, 'forgot', time()]);
|
||||
// Crée un id unique pour la réinitialisation
|
||||
$uniqId = md5(json_encode($this->getData(['user', $userId])));
|
||||
// Envoi le mail
|
||||
$sent = $this->sendMail(
|
||||
$this->getData(['user', $userId, 'mail']),
|
||||
'Réinitialisation de votre mot de passe',
|
||||
'Bonjour <strong>' . $this->getData(['user', $userId, 'firstname']) . ' ' . $this->getData(['user', $userId, 'lastname']) . '</strong>,<br><br>' .
|
||||
'Vous avez demandé à changer le mot de passe lié à votre compte. Vous trouverez ci-dessous un lien vous permettant de modifier celui-ci.<br><br>' .
|
||||
'<a href="' . helper::baseUrl() . 'user/reset/' . $userId . '/' . $uniqId . '" target="_blank">' . helper::baseUrl() . 'user/reset/' . $userId . '/' . $uniqId . '</a><br><br>' .
|
||||
'<small>Si nous n\'avez pas demandé à réinitialiser votre mot de passe, veuillez ignorer ce mail.</small>'
|
||||
);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'notification' => ($sent === true ? 'Un mail vous a été envoyé afin de continuer la réinitialisation' : $sent),
|
||||
'state' => ($sent === true ? true : null)
|
||||
]);
|
||||
}
|
||||
// L'utilisateur n'existe pas
|
||||
else {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'notification' => 'Cet utilisateur n\'existe pas'
|
||||
]);
|
||||
}
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'display' => self::DISPLAY_LAYOUT_LIGHT,
|
||||
'title' => 'Mot de passe oublié',
|
||||
'view' => 'forgot'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Liste des utilisateurs
|
||||
*/
|
||||
public function index() {
|
||||
$userIdsFirstnames = helper::arrayCollumn($this->getData(['user']), 'firstname');
|
||||
ksort($userIdsFirstnames);
|
||||
foreach($userIdsFirstnames as $userId => $userFirstname) {
|
||||
self::$users[] = [
|
||||
$userId,
|
||||
$userFirstname . ' ' . $this->getData(['user', $userId, 'lastname']),
|
||||
self::$groups[$this->getData(['user', $userId, 'group'])],
|
||||
template::button('userEdit' . $userId, [
|
||||
'href' => helper::baseUrl() . 'user/edit/' . $userId . '/back',
|
||||
'value' => template::ico('pencil')
|
||||
]),
|
||||
template::button('userDelete' . $userId, [
|
||||
'class' => 'userDelete buttonRed',
|
||||
'href' => helper::baseUrl() . 'user/delete/' . $userId,
|
||||
'value' => template::ico('cancel')
|
||||
])
|
||||
];
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Liste des utilisateurs',
|
||||
'view' => 'index'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Connexion
|
||||
*/
|
||||
public function login() {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
$userId = $this->getInput('userLoginId', helper::FILTER_ID, true);
|
||||
// Connexion si les informations sont correctes
|
||||
if(
|
||||
password_verify($this->getInput('userLoginPassword', helper::FILTER_STRING_SHORT, true), $this->getData(['user', $userId, 'password']))
|
||||
AND $this->getData(['user', $userId, 'group']) >= self::GROUP_MEMBER
|
||||
) {
|
||||
$expire = $this->getInput('userLoginLongTime') ? strtotime("+1 year") : 0;
|
||||
setcookie('ZWII_USER_ID', $userId, $expire, helper::baseUrl(false, false));
|
||||
setcookie('ZWII_USER_PASSWORD', $this->getData(['user', $userId, 'password']), $expire, helper::baseUrl(false, false));
|
||||
// Valeurs en sortie lorsque le site est en maintenance et que l'utilisateur n'est pas administrateur
|
||||
if(
|
||||
$this->getData(['config', 'maintenance'])
|
||||
AND $this->getData(['user', $userId, 'group']) < self::GROUP_ADMIN
|
||||
) {
|
||||
$this->addOutput([
|
||||
'notification' => 'Seul un administrateur peur se connecter lors d\'une maintenance',
|
||||
'redirect' => helper::baseUrl(),
|
||||
'state' => false
|
||||
]);
|
||||
}
|
||||
// Valeurs en sortie en cas de réussite
|
||||
else {
|
||||
$this->addOutput([
|
||||
'notification' => 'Connexion réussie',
|
||||
'redirect' => helper::baseUrl() . str_replace('_', '/', str_replace('__', '#', $this->getUrl(2))),
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
}
|
||||
// Sinon notification d'échec
|
||||
else {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'notification' => 'Identifiant ou mot de passe incorrect'
|
||||
]);
|
||||
}
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'display' => self::DISPLAY_LAYOUT_LIGHT,
|
||||
'title' => 'Connexion',
|
||||
'view' => 'login'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Déconnexion
|
||||
*/
|
||||
public function logout() {
|
||||
helper::deleteCookie('ZWII_USER_ID');
|
||||
helper::deleteCookie('ZWII_USER_PASSWORD');
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'notification' => 'Déconnexion réussie',
|
||||
'redirect' => helper::baseUrl(false),
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Réinitialisation du mot de passe
|
||||
*/
|
||||
public function reset() {
|
||||
// Accès refusé
|
||||
if(
|
||||
// L'utilisateur n'existe pas
|
||||
$this->getData(['user', $this->getUrl(2)]) === null
|
||||
// Lien de réinitialisation trop vieux
|
||||
OR $this->getData(['user', $this->getUrl(2), 'forgot']) + 86400 < time()
|
||||
// Id unique incorrecte
|
||||
OR $this->getUrl(3) !== md5(json_encode($this->getData(['user', $this->getUrl(2)])))
|
||||
) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
]);
|
||||
}
|
||||
// Accès autorisé
|
||||
else {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
// Double vérification pour le mot de passe
|
||||
if($this->getInput('userResetNewPassword')) {
|
||||
// La confirmation ne correspond pas au mot de passe
|
||||
if($this->getInput('userResetNewPassword', helper::FILTER_STRING_SHORT, true) !== $this->getInput('userResetConfirmPassword', helper::FILTER_STRING_SHORT, true)) {
|
||||
$newPassword = $this->getData(['user', $this->getUrl(2), 'password']);
|
||||
self::$inputNotices['userResetConfirmPassword'] = 'Incorrect';
|
||||
}
|
||||
else {
|
||||
$newPassword = $this->getInput('userResetNewPassword', helper::FILTER_PASSWORD, true);
|
||||
}
|
||||
// Modifie le mot de passe
|
||||
$this->setData(['user', $this->getUrl(2), 'password', $newPassword]);
|
||||
// Réinitialise la date de la demande
|
||||
$this->setData(['user', $this->getUrl(2), 'forgot', 0]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'notification' => 'Nouveau mot de passe enregistré',
|
||||
'redirect' => helper::baseUrl() . 'user/login/' . str_replace('/', '_', $this->getUrl()),
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Réinitialisation du mot de passe',
|
||||
'view' => 'reset'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
44
core/module/user/view/add/add.js.php
Executable file
@ -0,0 +1,44 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.com/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Affichage de l'id en simulant FILTER_ID
|
||||
*/
|
||||
$("#userAddId").on("change keydown keyup", function(event) {
|
||||
var userId = $(this).val();
|
||||
if(
|
||||
event.keyCode !== 8 // BACKSPACE
|
||||
&& event.keyCode !== 37 // LEFT
|
||||
&& event.keyCode !== 39 // RIGHT
|
||||
&& event.keyCode !== 46 // DELETE
|
||||
&& window.getSelection().toString() !== userId // Texte sélectionné
|
||||
) {
|
||||
var searchReplace = {
|
||||
"á": "a", "à": "a", "â": "a", "ä": "a", "ã": "a", "å": "a", "ç": "c", "é": "e", "è": "e", "ê": "e", "ë": "e", "í": "i", "ì": "i", "î": "i", "ï": "i", "ñ": "n", "ó": "o", "ò": "o", "ô": "o", "ö": "o", "õ": "o", "ú": "u", "ù": "u", "û": "u", "ü": "u", "ý": "y", "ÿ": "y",
|
||||
"Á": "A", "À": "A", "Â": "A", "Ä": "A", "Ã": "A", "Å": "A", "Ç": "C", "É": "E", "È": "E", "Ê": "E", "Ë": "E", "Í": "I", "Ì": "I", "Î": "I", "Ï": "I", "Ñ": "N", "Ó": "O", "Ò": "O", "Ô": "O", "Ö": "O", "Õ": "O", "Ú": "U", "Ù": "U", "Û": "U", "Ü": "U", "Ý": "Y", "Ÿ": "Y",
|
||||
"'": "-", "\"": "-", " ": "-"
|
||||
};
|
||||
userId = userId.replace(/[áàâäãåçéèêëíìîïñóòôöõúùûüýÿ'" ]/ig, function(match) {
|
||||
return searchReplace[match];
|
||||
});
|
||||
userId = userId.replace(/[^a-z0-9-]/ig, "");
|
||||
$(this).val(userId);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Droits des groupes
|
||||
*/
|
||||
$("#userAddGroup").on("change", function() {
|
||||
$(".userAddGroupDescription").hide();
|
||||
$("#userAddGroupDescription" + $(this).val()).show();
|
||||
}).trigger("change");
|
79
core/module/user/view/add/add.php
Executable file
@ -0,0 +1,79 @@
|
||||
<?php echo template::formOpen('userAddForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('userAddBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'user',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::submit('userAddSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<div class="block">
|
||||
<h4>Informations générales</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::text('userAddFirstname', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Prénom'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::text('userAddLastname', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Nom'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::mail('userAddMail', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Adresse mail'
|
||||
]); ?>
|
||||
<?php echo template::select('userAddGroup', self::$groupNews, [
|
||||
'label' => 'Groupe',
|
||||
'selected' => self::GROUP_MEMBER
|
||||
]); ?>
|
||||
Autorisations :
|
||||
<ul id="userAddGroupDescription<?php echo self::GROUP_MEMBER; ?>" class="userAddGroupDescription displayNone">
|
||||
<li>Accès aux pages privées membres</li>
|
||||
</ul>
|
||||
<ul id="userAddGroupDescription<?php echo self::GROUP_MODERATOR; ?>" class="userAddGroupDescription displayNone">
|
||||
<li>Accès aux pages privées membres et modérateurs</li>
|
||||
<li>Ajout / Édition / Suppression de pages</li>
|
||||
<li>Ajout / Édition / Suppression de fichiers</li>
|
||||
</ul>
|
||||
<ul id="userAddGroupDescription<?php echo self::GROUP_ADMIN; ?>" class="userAddGroupDescription displayNone">
|
||||
<li>Accès à toutes les pages privées</li>
|
||||
<li>Ajout / Édition / Suppression de pages</li>
|
||||
<li>Ajout / Édition / Suppression de fichiers</li>
|
||||
<li>Ajout / Édition / Suppression d'utilisateurs</li>
|
||||
<li>Configuration du site</li>
|
||||
<li>Personnalisation du thème</li>
|
||||
</ul>
|
||||
<?php echo template::checkbox('userAddSendMail', true, 'Prévenir l\'utilisateur par mail'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<div class="block">
|
||||
<h4>Authentification</h4>
|
||||
<?php echo template::text('userAddId', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Identifiant'
|
||||
]); ?>
|
||||
<?php echo template::password('userAddPassword', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Mot de passe'
|
||||
]); ?>
|
||||
<?php echo template::password('userAddConfirmPassword', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Confirmation'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
19
core/module/user/view/edit/edit.js.php
Executable file
@ -0,0 +1,19 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.com/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Droits des groupes
|
||||
*/
|
||||
$("#userEditGroup").on("change", function() {
|
||||
$(".userEditGroupDescription").hide();
|
||||
$("#userEditGroupDescription" + $(this).val()).show();
|
||||
}).trigger("change");
|
101
core/module/user/view/edit/edit.php
Executable file
@ -0,0 +1,101 @@
|
||||
<?php echo template::formOpen('userEditForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php if($this->getUrl(3)): ?>
|
||||
<?php echo template::button('userEditBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'user',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
<?php else: ?>
|
||||
<?php echo template::button('userEditBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl(false),
|
||||
'ico' => 'home',
|
||||
'value' => 'Accueil'
|
||||
]); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::submit('userEditSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<div class="block">
|
||||
<h4>Informations générales</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::text('userEditFirstname', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Prénom',
|
||||
'value' => $this->getData(['user', $this->getUrl(2), 'firstname'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::text('userEditLastname', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Nom',
|
||||
'value' => $this->getData(['user', $this->getUrl(2), 'lastname'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::mail('userEditMail', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Adresse mail',
|
||||
'value' => $this->getData(['user', $this->getUrl(2), 'mail'])
|
||||
]); ?>
|
||||
<?php if($this->getUser('group') === self::GROUP_ADMIN): ?>
|
||||
<?php echo template::select('userEditGroup', self::$groupEdits, [
|
||||
'disabled' => ($this->getUrl(2) === $this->getUser('id')),
|
||||
'help' => ($this->getUrl(2) === $this->getUser('id') ? 'Impossible de modifier votre propre groupe.' : ''),
|
||||
'label' => 'Groupe',
|
||||
'selected' => $this->getData(['user', $this->getUrl(2), 'group'])
|
||||
]); ?>
|
||||
Autorisations :
|
||||
<ul id="userEditGroupDescription<?php echo self::GROUP_MEMBER; ?>" class="userEditGroupDescription displayNone">
|
||||
<li>Accès aux pages privées membres</li>
|
||||
</ul>
|
||||
<ul id="userEditGroupDescription<?php echo self::GROUP_MODERATOR; ?>" class="userEditGroupDescription displayNone">
|
||||
<li>Accès aux pages privées membres et modérateurs</li>
|
||||
<li>Ajout / Édition / Suppression de pages</li>
|
||||
<li>Ajout / Édition / Suppression de fichiers</li>
|
||||
</ul>
|
||||
<ul id="userEditGroupDescription<?php echo self::GROUP_ADMIN; ?>" class="userEditGroupDescription displayNone">
|
||||
<li>Accès à toutes les pages privées</li>
|
||||
<li>Ajout / Édition / Suppression de pages</li>
|
||||
<li>Ajout / Édition / Suppression de fichiers</li>
|
||||
<li>Ajout / Édition / Suppression d'utilisateurs</li>
|
||||
<li>Configuration du site</li>
|
||||
<li>Personnalisation du thème</li>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<div class="block">
|
||||
<h4>Authentification</h4>
|
||||
<?php echo template::text('userEditId', [
|
||||
'autocomplete' => 'off',
|
||||
'help' => 'L\'identifiant est défini lors de la création du compte, il ne peut pas être modifié.',
|
||||
'label' => 'Identifiant',
|
||||
'readonly' => true,
|
||||
'value' => $this->getUrl(2)
|
||||
]); ?>
|
||||
<?php echo template::password('userEditOldPassword', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Ancien mot de passe'
|
||||
]); ?>
|
||||
<?php echo template::password('userEditNewPassword', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Nouveau mot de passe'
|
||||
]); ?>
|
||||
<?php echo template::password('userEditConfirmPassword', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Confirmation'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
20
core/module/user/view/forgot/forgot.php
Executable file
@ -0,0 +1,20 @@
|
||||
<?php echo template::formOpen('userForgotForm'); ?>
|
||||
<?php echo template::text('userForgotId', [
|
||||
'label' => 'Identifiant'
|
||||
]); ?>
|
||||
<div class="row">
|
||||
<div class="col3 offset6">
|
||||
<?php echo template::button('userForgotBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'user/login/' . $this->getUrl(2),
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::submit('userForgotSubmit', [
|
||||
'value' => 'Valider'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
21
core/module/user/view/index/index.js.php
Executable file
@ -0,0 +1,21 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.com/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Confirmation de suppression
|
||||
*/
|
||||
$(".userDelete").on("click", function() {
|
||||
var _this = $(this);
|
||||
return core.confirm("Êtes-vous sûr de vouloir supprimer cet utilisateur ?", function() {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
18
core/module/user/view/index/index.php
Executable file
@ -0,0 +1,18 @@
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('userAddBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl(false),
|
||||
'ico' => 'home',
|
||||
'value' => 'Accueil'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::button('userAdd', [
|
||||
'href' => helper::baseUrl() . 'user/add',
|
||||
'ico' => 'plus',
|
||||
'value' => 'Utilisateur'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::table([3, 4, 3, 1, 1], $module::$users, ['Identifiant', 'Nom', 'Groupe', '', '']); ?>
|
39
core/module/user/view/login/login.php
Executable file
@ -0,0 +1,39 @@
|
||||
<?php echo template::formOpen('userLoginForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::text('userLoginId', [
|
||||
'label' => 'Identifiant'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::password('userLoginPassword', [
|
||||
'label' => 'Mot de passe'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('userLoginLongTime', true, 'Se souvenir de moi'); ?>
|
||||
|
||||
</div>
|
||||
<div class="col6 textAlignRight">
|
||||
<a href="<?php echo helper::baseUrl(); ?>user/forgot/<?php echo $this->getUrl(2); ?>">Mot de passe perdu ?</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col3 offset6">
|
||||
<?php echo template::button('userLoginBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . str_replace('_', '/', str_replace('__', '#', $this->getUrl(2))),
|
||||
'ico' => 'left',
|
||||
'value' => 'Annuler'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::submit('userLoginSubmit', [
|
||||
'value' => 'Connexion',
|
||||
'ico' => 'lock'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
21
core/module/user/view/reset/reset.php
Executable file
@ -0,0 +1,21 @@
|
||||
<?php echo template::formOpen('userResetForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::password('userResetNewPassword', [
|
||||
'label' => 'Nouveau mot de passe'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::password('userResetConfirmPassword', [
|
||||
'label' => 'Confirmation'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col2 offset10">
|
||||
<?php echo template::submit('userResetSubmit', [
|
||||
'value' => 'Valider'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
1
core/vendor/codemirror/codemirror.min.css
vendored
Executable file
7
core/vendor/codemirror/codemirror.min.js
vendored
Executable file
7
core/vendor/codemirror/inc.json
vendored
Executable file
@ -0,0 +1,7 @@
|
||||
[
|
||||
"codemirror.min.css",
|
||||
"codemirror.min.js",
|
||||
"mode/css.min.js",
|
||||
"init.js",
|
||||
"init.css"
|
||||
]
|
4
core/vendor/codemirror/init.css
vendored
Executable file
@ -0,0 +1,4 @@
|
||||
.CodeMirror {
|
||||
height: 500px;
|
||||
border: 1px solid #D8DFE3;
|
||||
}
|
18
core/vendor/codemirror/init.js
vendored
Executable file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Initialisation de CodeMirror
|
||||
*/
|
||||
$(function() {
|
||||
$(".editorCss").each(function() {
|
||||
var _this = this;
|
||||
// Initialisation de CodeMirror
|
||||
var codeMirror = CodeMirror.fromTextArea(_this, {
|
||||
lineNumbers: true,
|
||||
});
|
||||
// Mise à jour de la textarea
|
||||
codeMirror.on("change", function() {
|
||||
$(_this)
|
||||
.val(codeMirror.getValue())
|
||||
.trigger("change");
|
||||
});
|
||||
});
|
||||
});
|
2
core/vendor/codemirror/mode/css.min.js
vendored
Executable file
1543
core/vendor/filemanager/UploadHandler.php
vendored
Executable file
703
core/vendor/filemanager/ajax_calls.php
vendored
Executable file
@ -0,0 +1,703 @@
|
||||
<?php
|
||||
|
||||
$config = include 'config/config.php';
|
||||
//TODO switch to array
|
||||
extract($config, EXTR_OVERWRITE);
|
||||
|
||||
require_once 'include/utils.php';
|
||||
|
||||
if ($_SESSION['RF']["verify"] != "RESPONSIVEfilemanager")
|
||||
{
|
||||
response(trans('forbiden').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
$languages = include 'lang/languages.php';
|
||||
|
||||
if (isset($_SESSION['RF']['language']) && file_exists('lang/' . basename($_SESSION['RF']['language']) . '.php'))
|
||||
{
|
||||
if(array_key_exists($_SESSION['RF']['language'],$languages)){
|
||||
include 'lang/' . basename($_SESSION['RF']['language']) . '.php';
|
||||
}else{
|
||||
response(trans('Lang_Not_Found').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
response(trans('Lang_Not_Found').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
$ftp = ftp_con($config);
|
||||
|
||||
if(isset($_GET['action']))
|
||||
{
|
||||
switch($_GET['action'])
|
||||
{
|
||||
case 'new_file_form':
|
||||
echo trans('Filename') . ': <input type="text" id="create_text_file_name" style="height:30px"> <select id="create_text_file_extension" style="margin:0;width:100px;">';
|
||||
foreach($config['editable_text_file_exts'] as $ext){
|
||||
echo '<option value=".'.$ext.'">.'.$ext.'</option>';
|
||||
}
|
||||
echo '</select><br><hr><textarea id="textfile_create_area" style="width:100%;height:150px;"></textarea>';
|
||||
break;
|
||||
case 'view':
|
||||
if(isset($_GET['type']))
|
||||
{
|
||||
$_SESSION['RF']["view_type"] = $_GET['type'];
|
||||
}
|
||||
else
|
||||
{
|
||||
response(trans('view type number missing').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
break;
|
||||
case 'filter':
|
||||
if (isset($_GET['type']))
|
||||
{
|
||||
if (isset($remember_text_filter) && $remember_text_filter)
|
||||
{
|
||||
$_SESSION['RF']["filter"] = $_GET['type'];
|
||||
}
|
||||
}
|
||||
else {
|
||||
response(trans('view type number missing').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
break;
|
||||
case 'sort':
|
||||
if (isset($_GET['sort_by']))
|
||||
{
|
||||
$_SESSION['RF']["sort_by"] = $_GET['sort_by'];
|
||||
}
|
||||
|
||||
if (isset($_GET['descending']))
|
||||
{
|
||||
$_SESSION['RF']["descending"] = $_GET['descending'];
|
||||
}
|
||||
break;
|
||||
case 'image_size': // not used
|
||||
$pos = strpos($_POST['path'], $upload_dir);
|
||||
if ($pos !== false)
|
||||
{
|
||||
$info = getimagesize(substr_replace($_POST['path'], $current_path, $pos, strlen($upload_dir)));
|
||||
response($info)->send();
|
||||
exit;
|
||||
}
|
||||
break;
|
||||
case 'save_img':
|
||||
$info = pathinfo($_POST['name']);
|
||||
|
||||
if (
|
||||
strpos($_POST['path'], '/') === 0
|
||||
|| strpos($_POST['path'], '../') !== false
|
||||
|| strpos($_POST['path'], '..\\') !== false
|
||||
|| strpos($_POST['path'], './') === 0
|
||||
|| (strpos($_POST['url'], 'http://s3.amazonaws.com/feather') !== 0 && strpos($_POST['url'], 'https://s3.amazonaws.com/feather') !== 0)
|
||||
|| $_POST['name'] != fix_filename($_POST['name'], $config)
|
||||
|| ! in_array(strtolower($info['extension']), array( 'jpg', 'jpeg', 'png' ))
|
||||
)
|
||||
{
|
||||
response(trans('wrong data').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
$image_data = get_file_by_url($_POST['url']);
|
||||
if ($image_data === false)
|
||||
{
|
||||
response(trans('Aviary_No_Save').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!checkresultingsize(strlen($image_data))) {
|
||||
response(sprintf(trans('max_size_reached'),$MaxSizeTotal).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
if($ftp){
|
||||
|
||||
$temp = tempnam('/tmp','RF');
|
||||
unlink($temp);
|
||||
$temp .=".".substr(strrchr($_POST['url'],'.'),1);
|
||||
file_put_contents($temp,$image_data);
|
||||
|
||||
$ftp->put($ftp_base_folder.$upload_dir . $_POST['path'] . $_POST['name'], $temp, FTP_BINARY);
|
||||
|
||||
create_img($temp,$temp,122,91);
|
||||
$ftp->put($ftp_base_folder.$ftp_thumbs_dir. $_POST['path'] . $_POST['name'], $temp, FTP_BINARY);
|
||||
|
||||
unlink($temp);
|
||||
}else{
|
||||
|
||||
file_put_contents($current_path . $_POST['path'] . $_POST['name'],$image_data);
|
||||
create_img($current_path . $_POST['path'] . $_POST['name'], $thumbs_base_path.$_POST['path'].$_POST['name'], 122, 91);
|
||||
// TODO something with this function cause its blowing my mind
|
||||
new_thumbnails_creation(
|
||||
$current_path.$_POST['path'],
|
||||
$current_path.$_POST['path'].$_POST['name'],
|
||||
$_POST['name'],
|
||||
$current_path,
|
||||
$config
|
||||
);
|
||||
}
|
||||
break;
|
||||
case 'extract':
|
||||
if ( strpos($_POST['path'], '/') === 0
|
||||
|| strpos($_POST['path'], '../') !== false
|
||||
|| strpos($_POST['path'], '..\\') !== false
|
||||
|| strpos($_POST['path'], './') === 0)
|
||||
{
|
||||
response(trans('wrong path'.AddErrorLocation()))->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
if($ftp){
|
||||
$path = $ftp_base_url.$upload_dir . $_POST['path'];
|
||||
$base_folder = $ftp_base_url.$upload_dir . fix_dirname($_POST['path']) . "/";
|
||||
}else{
|
||||
$path = $current_path . $_POST['path'];
|
||||
$base_folder = $current_path . fix_dirname($_POST['path']) . "/";
|
||||
}
|
||||
|
||||
$info = pathinfo($path);
|
||||
|
||||
if($ftp){
|
||||
$tempDir = tempdir();
|
||||
$temp = tempnam($tempDir,'RF');
|
||||
unlink($temp);
|
||||
$temp .=".".$info['extension'];
|
||||
$handle = fopen($temp, "w");
|
||||
fwrite($handle, file_get_contents($path));
|
||||
fclose($handle);
|
||||
$path = $temp;
|
||||
$base_folder = $tempDir."/";
|
||||
}
|
||||
|
||||
$info = pathinfo($path);
|
||||
|
||||
switch ($info['extension'])
|
||||
{
|
||||
case "zip":
|
||||
$zip = new ZipArchive;
|
||||
if ($zip->open($path) === true)
|
||||
{
|
||||
//get total size
|
||||
$sizeTotalFinal = 0;
|
||||
for ($i = 0; $i < $zip->numFiles; $i++)
|
||||
{
|
||||
$aStat = $zip->statIndex($i);
|
||||
$sizeTotalFinal += $aStat['size'];
|
||||
}
|
||||
if (!checkresultingsize($sizeTotalFinal)) {
|
||||
response(sprintf(trans('max_size_reached'),$MaxSizeTotal).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
//make all the folders
|
||||
for ($i = 0; $i < $zip->numFiles; $i++)
|
||||
{
|
||||
$OnlyFileName = $zip->getNameIndex($i);
|
||||
$FullFileName = $zip->statIndex($i);
|
||||
if (substr($FullFileName['name'], -1, 1) == "/")
|
||||
{
|
||||
create_folder($base_folder . $FullFileName['name']);
|
||||
}
|
||||
}
|
||||
//unzip into the folders
|
||||
for ($i = 0; $i < $zip->numFiles; $i++)
|
||||
{
|
||||
$OnlyFileName = $zip->getNameIndex($i);
|
||||
$FullFileName = $zip->statIndex($i);
|
||||
|
||||
if ( ! (substr($FullFileName['name'], -1, 1) == "/"))
|
||||
{
|
||||
$fileinfo = pathinfo($OnlyFileName);
|
||||
if (in_array(strtolower($fileinfo['extension']), $ext))
|
||||
{
|
||||
copy('zip://' . $path . '#' . $OnlyFileName, $base_folder . $FullFileName['name']);
|
||||
}
|
||||
}
|
||||
}
|
||||
$zip->close();
|
||||
} else {
|
||||
response(trans('Zip_No_Extract').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "gz":
|
||||
// No resulting size pre-control available
|
||||
$p = new PharData($path);
|
||||
$p->decompress(); // creates files.tar
|
||||
|
||||
break;
|
||||
|
||||
case "tar":
|
||||
// No resulting size pre-control available
|
||||
// unarchive from the tar
|
||||
$phar = new PharData($path);
|
||||
$phar->decompressFiles();
|
||||
$files = array();
|
||||
check_files_extensions_on_phar($phar, $files, '', $ext);
|
||||
$phar->extractTo($base_folder, $files, true);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
response(trans('Zip_Invalid').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
if($ftp){
|
||||
unlink($path);
|
||||
$ftp->putAll($base_folder, "/".$ftp_base_folder . $upload_dir . fix_dirname($_POST['path']), FTP_BINARY);
|
||||
deleteDir($base_folder);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case 'media_preview':
|
||||
if($ftp){
|
||||
$preview_file = $ftp_base_url.$upload_dir . $_GET['file'];
|
||||
}else{
|
||||
$preview_file = $current_path . $_GET["file"];
|
||||
}
|
||||
$info = pathinfo($preview_file);
|
||||
ob_start();
|
||||
?>
|
||||
<div id="jp_container_1" class="jp-video " style="margin:0 auto;">
|
||||
<div class="jp-type-single">
|
||||
<div id="jquery_jplayer_1" class="jp-jplayer"></div>
|
||||
<div class="jp-gui">
|
||||
<div class="jp-video-play">
|
||||
<a href="javascript:;" class="jp-video-play-icon" tabindex="1">play</a>
|
||||
</div>
|
||||
<div class="jp-interface">
|
||||
<div class="jp-progress">
|
||||
<div class="jp-seek-bar">
|
||||
<div class="jp-play-bar"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="jp-current-time"></div>
|
||||
<div class="jp-duration"></div>
|
||||
<div class="jp-controls-holder">
|
||||
<ul class="jp-controls">
|
||||
<li><a href="javascript:;" class="jp-play" tabindex="1">play</a></li>
|
||||
<li><a href="javascript:;" class="jp-pause" tabindex="1">pause</a></li>
|
||||
<li><a href="javascript:;" class="jp-stop" tabindex="1">stop</a></li>
|
||||
<li><a href="javascript:;" class="jp-mute" tabindex="1" title="mute">mute</a></li>
|
||||
<li><a href="javascript:;" class="jp-unmute" tabindex="1" title="unmute">unmute</a></li>
|
||||
<li><a href="javascript:;" class="jp-volume-max" tabindex="1" title="max volume">max volume</a></li>
|
||||
</ul>
|
||||
<div class="jp-volume-bar">
|
||||
<div class="jp-volume-bar-value"></div>
|
||||
</div>
|
||||
<ul class="jp-toggles">
|
||||
<li><a href="javascript:;" class="jp-full-screen" tabindex="1" title="full screen">full screen</a></li>
|
||||
<li><a href="javascript:;" class="jp-restore-screen" tabindex="1" title="restore screen">restore screen</a></li>
|
||||
<li><a href="javascript:;" class="jp-repeat" tabindex="1" title="repeat">repeat</a></li>
|
||||
<li><a href="javascript:;" class="jp-repeat-off" tabindex="1" title="repeat off">repeat off</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="jp-title" style="display:none;">
|
||||
<ul>
|
||||
<li></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="jp-no-solution">
|
||||
<span>Update Required</span>
|
||||
To play the media you will need to either update your browser to a recent version or update your <a href="https://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php if(in_array(strtolower($info['extension']), $ext_music)): ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
|
||||
$("#jquery_jplayer_1").jPlayer({
|
||||
ready: function () {
|
||||
$(this).jPlayer("setMedia", {
|
||||
title:"<?php $_GET['title']; ?>",
|
||||
mp3: "<?php echo $preview_file; ?>",
|
||||
m4a: "<?php echo $preview_file; ?>",
|
||||
oga: "<?php echo $preview_file; ?>",
|
||||
wav: "<?php echo $preview_file; ?>"
|
||||
});
|
||||
},
|
||||
swfPath: "js",
|
||||
solution:"html,flash",
|
||||
supplied: "mp3, m4a, midi, mid, oga,webma, ogg, wav",
|
||||
smoothPlayBar: true,
|
||||
keyEnabled: false
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php elseif(in_array(strtolower($info['extension']), $ext_video)): ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
|
||||
$("#jquery_jplayer_1").jPlayer({
|
||||
ready: function () {
|
||||
$(this).jPlayer("setMedia", {
|
||||
title:"<?php $_GET['title']; ?>",
|
||||
m4v: "<?php echo $preview_file; ?>",
|
||||
ogv: "<?php echo $preview_file; ?>",
|
||||
flv: "<?php echo $preview_file; ?>"
|
||||
});
|
||||
},
|
||||
swfPath: "js",
|
||||
solution:"html,flash",
|
||||
supplied: "mp4, m4v, ogv, flv, webmv, webm",
|
||||
smoothPlayBar: true,
|
||||
keyEnabled: false
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php endif;
|
||||
|
||||
$content = ob_get_clean();
|
||||
|
||||
response($content)->send();
|
||||
exit;
|
||||
|
||||
break;
|
||||
case 'copy_cut':
|
||||
if ($_POST['sub_action'] != 'copy' && $_POST['sub_action'] != 'cut')
|
||||
{
|
||||
response(trans('wrong sub-action').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
if (strpos($_POST['path'],'../') !== FALSE
|
||||
|| strpos($_POST['path'],'./') !== FALSE
|
||||
|| strpos($_POST['path'],'..\\') !== FALSE
|
||||
|| strpos($_POST['path'],'.\\') !== FALSE )
|
||||
{
|
||||
response(trans('wrong path'.AddErrorLocation()))->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
if (trim($_POST['path']) == '')
|
||||
{
|
||||
response(trans('no path').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
$msg_sub_action = ($_POST['sub_action'] == 'copy' ? trans('Copy') : trans('Cut'));
|
||||
$path = $current_path . $_POST['path'];
|
||||
|
||||
if (is_dir($path))
|
||||
{
|
||||
// can't copy/cut dirs
|
||||
if ($copy_cut_dirs === false)
|
||||
{
|
||||
response(sprintf(trans('Copy_Cut_Not_Allowed'), $msg_sub_action, trans('Folders')).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
list($sizeFolderToCopy,$fileNum,$foldersCount) = folder_info($path,false);
|
||||
// size over limit
|
||||
if ($copy_cut_max_size !== false && is_int($copy_cut_max_size)) {
|
||||
if (($copy_cut_max_size * 1024 * 1024) < $sizeFolderToCopy) {
|
||||
response(sprintf(trans('Copy_Cut_Size_Limit'), $msg_sub_action, $copy_cut_max_size).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// file count over limit
|
||||
if ($copy_cut_max_count !== false && is_int($copy_cut_max_count))
|
||||
{
|
||||
if ($copy_cut_max_count < $fileNum)
|
||||
{
|
||||
response(sprintf(trans('Copy_Cut_Count_Limit'), $msg_sub_action, $copy_cut_max_count).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (!checkresultingsize($sizeFolderToCopy)) {
|
||||
response(sprintf(trans('max_size_reached'),$MaxSizeTotal).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
// can't copy/cut files
|
||||
if ($copy_cut_files === false)
|
||||
{
|
||||
response(sprintf(trans('Copy_Cut_Not_Allowed'), $msg_sub_action, trans('Files')).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$_SESSION['RF']['clipboard']['path'] = $_POST['path'];
|
||||
$_SESSION['RF']['clipboard_action'] = $_POST['sub_action'];
|
||||
break;
|
||||
case 'clear_clipboard':
|
||||
$_SESSION['RF']['clipboard'] = null;
|
||||
$_SESSION['RF']['clipboard_action'] = null;
|
||||
break;
|
||||
case 'chmod':
|
||||
if($ftp){
|
||||
$path = $ftp_base_url . $upload_dir . $_POST['path'];
|
||||
if (
|
||||
($_POST['folder']==1 && $chmod_dirs === false)
|
||||
|| ($_POST['folder']==0 && $chmod_files === false)
|
||||
|| (is_function_callable("chmod") === false) )
|
||||
{
|
||||
response(sprintf(trans('File_Permission_Not_Allowed'), (is_dir($path) ? trans('Folders') : trans('Files')), 403).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
$info = $_POST['permissions'];
|
||||
}else{
|
||||
$path = $current_path . $_POST['path'];
|
||||
if (
|
||||
(is_dir($path) && $chmod_dirs === false)
|
||||
|| (is_file($path) && $chmod_files === false)
|
||||
|| (is_function_callable("chmod") === false) )
|
||||
{
|
||||
response(sprintf(trans('File_Permission_Not_Allowed'), (is_dir($path) ? trans('Folders') : trans('Files')), 403).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
$perms = fileperms($path) & 0777;
|
||||
|
||||
$info = '-';
|
||||
|
||||
// Owner
|
||||
$info .= (($perms & 0x0100) ? 'r' : '-');
|
||||
$info .= (($perms & 0x0080) ? 'w' : '-');
|
||||
$info .= (($perms & 0x0040) ?
|
||||
(($perms & 0x0800) ? 's' : 'x' ) :
|
||||
(($perms & 0x0800) ? 'S' : '-'));
|
||||
|
||||
// Group
|
||||
$info .= (($perms & 0x0020) ? 'r' : '-');
|
||||
$info .= (($perms & 0x0010) ? 'w' : '-');
|
||||
$info .= (($perms & 0x0008) ?
|
||||
(($perms & 0x0400) ? 's' : 'x' ) :
|
||||
(($perms & 0x0400) ? 'S' : '-'));
|
||||
|
||||
// World
|
||||
$info .= (($perms & 0x0004) ? 'r' : '-');
|
||||
$info .= (($perms & 0x0002) ? 'w' : '-');
|
||||
$info .= (($perms & 0x0001) ?
|
||||
(($perms & 0x0200) ? 't' : 'x' ) :
|
||||
(($perms & 0x0200) ? 'T' : '-'));
|
||||
|
||||
}
|
||||
|
||||
|
||||
$ret = '<div id="files_permission_start">
|
||||
<form id="chmod_form">
|
||||
<table class="table file-perms-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>r </td>
|
||||
<td>w </td>
|
||||
<td>x </td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>'.trans('User').'</td>
|
||||
<td><input id="u_4" type="checkbox" data-value="4" data-group="user" '.(substr($info, 1,1)=='r' ? " checked" : "").'></td>
|
||||
<td><input id="u_2" type="checkbox" data-value="2" data-group="user" '.(substr($info, 2,1)=='w' ? " checked" : "").'></td>
|
||||
<td><input id="u_1" type="checkbox" data-value="1" data-group="user" '.(substr($info, 3,1)=='x' ? " checked" : "").'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>'.trans('Group').'</td>
|
||||
<td><input id="g_4" type="checkbox" data-value="4" data-group="group" '.(substr($info, 4,1)=='r' ? " checked" : "").'></td>
|
||||
<td><input id="g_2" type="checkbox" data-value="2" data-group="group" '.(substr($info, 5,1)=='w' ? " checked" : "").'></td>
|
||||
<td><input id="g_1" type="checkbox" data-value="1" data-group="group" '.(substr($info, 6,1)=='x' ? " checked" : "").'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>'.trans('All').'</td>
|
||||
<td><input id="a_4" type="checkbox" data-value="4" data-group="all" '.(substr($info, 7,1)=='r' ? " checked" : "").'></td>
|
||||
<td><input id="a_2" type="checkbox" data-value="2" data-group="all" '.(substr($info, 8,1)=='w' ? " checked" : "").'></td>
|
||||
<td><input id="a_1" type="checkbox" data-value="1" data-group="all" '.(substr($info, 9,1)=='x' ? " checked" : "").'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td colspan="3"><input type="text" class="input-block-level" name="chmod_value" id="chmod_value" value="" data-def-value=""></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>';
|
||||
|
||||
if ((!$ftp && is_dir($path)) )
|
||||
{
|
||||
$ret .= '<div class="hero-unit" style="padding:10px;">'.trans('File_Permission_Recursive').'<br/><br/>
|
||||
<ul class="unstyled">
|
||||
<li><label class="radio"><input value="none" name="apply_recursive" type="radio" checked> '.trans('No').'</label></li>
|
||||
<li><label class="radio"><input value="files" name="apply_recursive" type="radio"> '.trans('Files').'</label></li>
|
||||
<li><label class="radio"><input value="folders" name="apply_recursive" type="radio"> '.trans('Folders').'</label></li>
|
||||
<li><label class="radio"><input value="both" name="apply_recursive" type="radio"> '.trans('Files').' & '.trans('Folders').'</label></li>
|
||||
</ul>
|
||||
</div>';
|
||||
}
|
||||
|
||||
$ret .= '</form></div>';
|
||||
|
||||
response($ret)->send();
|
||||
exit;
|
||||
|
||||
break;
|
||||
case 'get_lang':
|
||||
if ( ! file_exists('lang/languages.php'))
|
||||
{
|
||||
response(trans('Lang_Not_Found').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
$languages = include 'lang/languages.php';
|
||||
if ( ! isset($languages) || ! is_array($languages))
|
||||
{
|
||||
response(trans('Lang_Not_Found').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
$curr = $_SESSION['RF']['language'];
|
||||
|
||||
$ret = '<select id="new_lang_select">';
|
||||
foreach ($languages as $code => $name)
|
||||
{
|
||||
$ret .= '<option value="' . $code . '"' . ($code == $curr ? ' selected' : '') . '>' . $name . '</option>';
|
||||
}
|
||||
$ret .= '</select>';
|
||||
|
||||
response($ret)->send();
|
||||
exit;
|
||||
|
||||
break;
|
||||
case 'change_lang':
|
||||
$choosen_lang = (!empty($_POST['choosen_lang']))? $_POST['choosen_lang']:"en_EN";
|
||||
|
||||
if(array_key_exists($choosen_lang,$languages)){
|
||||
if ( ! file_exists('lang/' . $choosen_lang . '.php'))
|
||||
{
|
||||
response(trans('Lang_Not_Found').AddErrorLocation())->send();
|
||||
exit;
|
||||
}else{
|
||||
$_SESSION['RF']['language'] = $choosen_lang;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case 'cad_preview':
|
||||
if($ftp){
|
||||
$selected_file = $ftp_base_url.$upload_dir . $_GET['file'];
|
||||
}else{
|
||||
$selected_file = $current_path . $_GET['file'];
|
||||
|
||||
if ( ! file_exists($selected_file))
|
||||
{
|
||||
response(trans('File_Not_Found').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
if($ftp){
|
||||
$url_file = $selected_file;
|
||||
}else{
|
||||
$url_file = $base_url . $upload_dir . str_replace($current_path, '', $_GET["file"]);
|
||||
}
|
||||
|
||||
$cad_url = urlencode($url_file);
|
||||
$cad_html = "<iframe src=\"//sharecad.org/cadframe/load?url=" . $url_file . "\" class=\"google-iframe\" scrolling=\"no\"></iframe>";
|
||||
$ret = $cad_html;
|
||||
response($ret)->send();
|
||||
break;
|
||||
case 'get_file': // preview or edit
|
||||
$sub_action = $_GET['sub_action'];
|
||||
$preview_mode = $_GET["preview_mode"];
|
||||
|
||||
if ($sub_action != 'preview' && $sub_action != 'edit')
|
||||
{
|
||||
response(trans('wrong action').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
if($ftp){
|
||||
$selected_file = ($sub_action == 'preview' ? $ftp_base_url.$upload_dir . $_GET['file'] : $ftp_base_url.$upload_dir . $_POST['path']);
|
||||
}else{
|
||||
$selected_file = ($sub_action == 'preview' ? $current_path . $_GET['file'] : $current_path . $_POST['path']);
|
||||
|
||||
if ( ! file_exists($selected_file))
|
||||
{
|
||||
response(trans('File_Not_Found').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$info = pathinfo($selected_file);
|
||||
|
||||
if ($preview_mode == 'text')
|
||||
{
|
||||
$is_allowed = ($sub_action == 'preview' ? $preview_text_files : $edit_text_files);
|
||||
$allowed_file_exts = ($sub_action == 'preview' ? $previewable_text_file_exts : $editable_text_file_exts);
|
||||
}elseif($preview_mode == 'google') {
|
||||
$is_allowed = $googledoc_enabled;
|
||||
$allowed_file_exts = $googledoc_file_exts;
|
||||
}
|
||||
|
||||
if ( ! isset($allowed_file_exts) || ! is_array($allowed_file_exts))
|
||||
{
|
||||
$allowed_file_exts = array();
|
||||
}
|
||||
|
||||
if ( ! in_array($info['extension'], $allowed_file_exts)
|
||||
|| ! isset($is_allowed)
|
||||
|| $is_allowed === false
|
||||
|| (!$ftp && ! is_readable($selected_file))
|
||||
)
|
||||
{
|
||||
response(sprintf(trans('File_Open_Edit_Not_Allowed'), ($sub_action == 'preview' ? strtolower(trans('Open')) : strtolower(trans('Edit')))).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
if ($sub_action == 'preview')
|
||||
{
|
||||
if ($preview_mode == 'text')
|
||||
{
|
||||
// get and sanities
|
||||
$data = file_get_contents($selected_file);
|
||||
$data = htmlspecialchars(htmlspecialchars_decode($data));
|
||||
$ret = '';
|
||||
|
||||
if ( ! in_array($info['extension'],$previewable_text_file_exts_no_prettify))
|
||||
{
|
||||
$ret .= '<script src="https://rawgit.com/google/code-prettify/master/loader/run_prettify.js?autoload=true&skin=sunburst"></script>';
|
||||
$ret .= '<?prettify lang='.$info['extension'].' linenums=true?><pre class="prettyprint"><code class="language-'.$info['extension'].'">'.$data.'</code></pre>';
|
||||
} else {
|
||||
$ret .= '<pre class="no-prettify">'.$data.'</pre>';
|
||||
}
|
||||
|
||||
}
|
||||
elseif ($preview_mode == 'google') {
|
||||
if($ftp){
|
||||
$url_file = $selected_file;
|
||||
}else{
|
||||
$url_file = $base_url . $upload_dir . str_replace($current_path, '', $_GET["file"]);
|
||||
}
|
||||
|
||||
$googledoc_url = urlencode($url_file);
|
||||
$googledoc_html = "<iframe src=\"https://docs.google.com/viewer?url=" . $url_file . "&embedded=true\" class=\"google-iframe\"></iframe>";
|
||||
$ret = $googledoc_html;
|
||||
}
|
||||
} else {
|
||||
$data = stripslashes(htmlspecialchars(file_get_contents($selected_file)));
|
||||
$ret = '<textarea id="textfile_edit_area" style="width:100%;height:300px;">'.$data.'</textarea>';
|
||||
}
|
||||
|
||||
response($ret)->send();
|
||||
exit;
|
||||
|
||||
break;
|
||||
default:
|
||||
response(trans('no action passed').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
response(trans('no action passed').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
?>
|
7
core/vendor/filemanager/callback.js
vendored
Executable file
@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Callback de RFM
|
||||
*/
|
||||
function responsive_filemanager_callback(fieldId) {
|
||||
$("#" + fieldId).trigger("change");
|
||||
$(".lity-close").trigger("click");
|
||||
}
|
1
core/vendor/filemanager/config/.htaccess
vendored
Executable file
@ -0,0 +1 @@
|
||||
Deny from all
|
451
core/vendor/filemanager/config/config.php
vendored
Executable file
@ -0,0 +1,451 @@
|
||||
<?php
|
||||
$version = "9.12.2";
|
||||
if (session_id() == '') session_start();
|
||||
|
||||
mb_internal_encoding('UTF-8');
|
||||
mb_http_output('UTF-8');
|
||||
mb_http_input('UTF-8');
|
||||
mb_language('uni');
|
||||
mb_regex_encoding('UTF-8');
|
||||
ob_start('mb_output_handler');
|
||||
date_default_timezone_set('Europe/Rome');
|
||||
setlocale(LC_CTYPE, 'fr_FR'); //correct transliteration
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Optional security
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| if set to true only those will access RF whose url contains the access key(akey) like:
|
||||
| <input type="button" href="../filemanager/dialog.php?field_id=imgField&lang=en_EN&akey=myPrivateKey" value="Files">
|
||||
| in tinymce a new parameter added: filemanager_access_key:"myPrivateKey"
|
||||
| example tinymce config:
|
||||
|
|
||||
| tiny init ...
|
||||
| external_filemanager_path:"../filemanager/",
|
||||
| filemanager_title:"Filemanager" ,
|
||||
| filemanager_access_key:"myPrivateKey" ,
|
||||
| ...
|
||||
|
|
||||
*/
|
||||
|
||||
define('USE_ACCESS_KEYS', true); // TRUE or FALSE
|
||||
$privateKey = md5_file('../../../site/data/data.json');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| DON'T COPY THIS VARIABLES IN FOLDERS config.php FILES
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
define('DEBUG_ERROR_MESSAGE', false); // TRUE or FALSE
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Path configuration
|
||||
|--------------------------------------------------------------------------
|
||||
| In this configuration the folder tree is
|
||||
| root
|
||||
| |- source <- upload folder
|
||||
| |- thumbs <- thumbnail folder [must have write permission (755)]
|
||||
| |- filemanager
|
||||
| |- js
|
||||
| | |- tinymce
|
||||
| | | |- plugins
|
||||
| | | | |- responsivefilemanager
|
||||
| | | | | |- plugin.min.js
|
||||
*/
|
||||
|
||||
$config = array(
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| DON'T TOUCH (base url (only domain) of site).
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| without final / (DON'T TOUCH)
|
||||
|
|
||||
*/
|
||||
'base_url' => ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] && ! in_array(strtolower($_SERVER['HTTPS']), array( 'off', 'no' ))) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . rtrim(str_replace('/core/vendor/filemanager', '', pathinfo($_SERVER['PHP_SELF'])['dirname']), ' /'),
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| path from base_url to base of upload folder
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| with start and final /
|
||||
|
|
||||
*/
|
||||
'upload_dir' => '/site/file/source/',
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| relative path from filemanager folder to upload folder
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| with final /
|
||||
|
|
||||
*/
|
||||
'current_path' => '../../../site/file/source/',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| relative path from filemanager folder to thumbs folder
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| with final /
|
||||
| DO NOT put inside upload folder
|
||||
|
|
||||
*/
|
||||
'thumbs_base_path' => '../../../site/file/thumb/',
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| FTP configuration BETA VERSION
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If you want enable ftp use write these parametres otherwise leave empty
|
||||
| Remember to set base_url properly to point in the ftp server domain and
|
||||
| upload dir will be ftp_base_folder + upload_dir so without final /
|
||||
|
|
||||
*/
|
||||
'ftp_host' => false, //put the FTP host
|
||||
'ftp_user' => "user",
|
||||
'ftp_pass' => "pass",
|
||||
'ftp_base_folder' => "base_folder",
|
||||
'ftp_base_url' => "http://site to ftp root",
|
||||
// Directory where place files before to send to FTP with final /
|
||||
'ftp_temp_folder' => "../temp/",
|
||||
/*
|
||||
|---------------------------------------------------------------------------
|
||||
| path from ftp_base_folder to base of thumbs folder with start and final /
|
||||
|---------------------------------------------------------------------------
|
||||
*/
|
||||
'ftp_thumbs_dir' => '/thumbs/',
|
||||
'ftp_ssl' => false,
|
||||
'ftp_port' => 21,
|
||||
|
||||
/* EXAMPLE
|
||||
'ftp_host' => "host.com",
|
||||
'ftp_user' => "test@host.com",
|
||||
'ftp_pass' => "pass.1",
|
||||
'ftp_base_folder' => "",
|
||||
'ftp_base_url' => "http://host.com/testFTP",
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Access keys
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| add access keys eg: array('myPrivateKey', 'someoneElseKey');
|
||||
| keys should only containt (a-z A-Z 0-9 \ . _ -) characters
|
||||
| if you are integrating lets say to a cms for admins, i recommend making keys randomized something like this:
|
||||
| $username = 'Admin';
|
||||
| $salt = 'dsflFWR9u2xQa' (a hard coded string)
|
||||
| $akey = md5($username.$salt);
|
||||
| DO NOT use 'key' as access key!
|
||||
| Keys are CASE SENSITIVE!
|
||||
|
|
||||
*/
|
||||
|
||||
'access_keys' => array($privateKey),
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
// YOU CAN COPY AND CHANGE THESE VARIABLES INTO FOLDERS config.php FILES TO CUSTOMIZE EACH FOLDER OPTIONS
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Maximum size of all files in source folder
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| in Megabytes
|
||||
|
|
||||
*/
|
||||
'MaxSizeTotal' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Maximum upload size
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| in Megabytes
|
||||
|
|
||||
*/
|
||||
'MaxSizeUpload' => 20000,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| File and Folder permission
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
*/
|
||||
'filePermission' => 0755,
|
||||
'folderPermission' => 0777,
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| default language file name
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'default_language' => "fr_FR",
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Icon theme
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Default available: ico and ico_dark
|
||||
| Can be set to custom icon inside filemanager/img
|
||||
|
|
||||
*/
|
||||
'icon_theme' => "ico",
|
||||
|
||||
|
||||
//Show or not total size in filemanager (is possible to greatly increase the calculations)
|
||||
'show_total_size' => false,
|
||||
//Show or not show folder size in list view feature in filemanager (is possible, if there is a large folder, to greatly increase the calculations)
|
||||
'show_folder_size' => false,
|
||||
//Show or not show sorting feature in filemanager
|
||||
'show_sorting_bar' => true,
|
||||
//Show or not show filters button in filemanager
|
||||
'show_filter_buttons' => true,
|
||||
//Show or not language selection feature in filemanager
|
||||
'show_language_selection' => true,
|
||||
//active or deactive the transliteration (mean convert all strange characters in A..Za..z0..9 characters)
|
||||
'transliteration' => false,
|
||||
//convert all spaces on files name and folders name with $replace_with variable
|
||||
'convert_spaces' => false,
|
||||
//convert all spaces on files name and folders name this value
|
||||
'replace_with' => "_",
|
||||
//convert to lowercase the files and folders name
|
||||
'lower_case' => false,
|
||||
|
||||
//Add ?484899493349 (time value) to returned images to prevent cache
|
||||
'add_time_to_img' => false,
|
||||
|
||||
|
||||
//*******************************************
|
||||
//Images limit and resizing configuration
|
||||
//*******************************************
|
||||
|
||||
// set maximum pixel width and/or maximum pixel height for all images
|
||||
// If you set a maximum width or height, oversized images are converted to those limits. Images smaller than the limit(s) are unaffected
|
||||
// if you don't need a limit set both to 0
|
||||
'image_max_width' => 0,
|
||||
'image_max_height' => 0,
|
||||
'image_max_mode' => 'auto',
|
||||
/*
|
||||
# $option: 0 / exact = defined size;
|
||||
# 1 / portrait = keep aspect set height;
|
||||
# 2 / landscape = keep aspect set width;
|
||||
# 3 / auto = auto;
|
||||
# 4 / crop= resize and crop;
|
||||
*/
|
||||
|
||||
//Automatic resizing //
|
||||
// If you set $image_resizing to TRUE the script converts all uploaded images exactly to image_resizing_width x image_resizing_height dimension
|
||||
// If you set width or height to 0 the script automatically calculates the other dimension
|
||||
// Is possible that if you upload very big images the script not work to overcome this increase the php configuration of memory and time limit
|
||||
'image_resizing' => false,
|
||||
'image_resizing_width' => 0,
|
||||
'image_resizing_height' => 0,
|
||||
'image_resizing_mode' => 'auto', // same as $image_max_mode
|
||||
'image_resizing_override' => false,
|
||||
// If set to TRUE then you can specify bigger images than $image_max_width & height otherwise if image_resizing is
|
||||
// bigger than $image_max_width or height then it will be converted to those values
|
||||
|
||||
|
||||
//******************
|
||||
//
|
||||
// WATERMARK IMAGE
|
||||
//
|
||||
//Watermark url or false
|
||||
'image_watermark' => false,
|
||||
# Could be a pre-determined position such as:
|
||||
# tl = top left,
|
||||
# t = top (middle),
|
||||
# tr = top right,
|
||||
# l = left,
|
||||
# m = middle,
|
||||
# r = right,
|
||||
# bl = bottom left,
|
||||
# b = bottom (middle),
|
||||
# br = bottom right
|
||||
# Or, it could be a co-ordinate position such as: 50x100
|
||||
'image_watermark_position' => 'br',
|
||||
# padding: If using a pre-determined position you can
|
||||
# adjust the padding from the edges by passing an amount
|
||||
# in pixels. If using co-ordinates, this value is ignored.
|
||||
'image_watermark_padding' => 0,
|
||||
|
||||
//******************
|
||||
// Default layout setting
|
||||
//
|
||||
// 0 => boxes
|
||||
// 1 => detailed list (1 column)
|
||||
// 2 => columns list (multiple columns depending on the width of the page)
|
||||
// YOU CAN ALSO PASS THIS PARAMETERS USING SESSION VAR => $_SESSION['RF']["VIEW"]=
|
||||
//
|
||||
//******************
|
||||
'default_view' => 0,
|
||||
|
||||
//set if the filename is truncated when overflow first row
|
||||
'ellipsis_title_after_first_row' => true,
|
||||
|
||||
//*************************
|
||||
//Permissions configuration
|
||||
//******************
|
||||
'delete_files' => true,
|
||||
'create_folders' => true,
|
||||
'delete_folders' => true,
|
||||
'upload_files' => true,
|
||||
'rename_files' => true,
|
||||
'rename_folders' => true,
|
||||
'duplicate_files' => true,
|
||||
'copy_cut_files' => true, // for copy/cut files
|
||||
'copy_cut_dirs' => true, // for copy/cut directories
|
||||
'chmod_files' => true, // change file permissions
|
||||
'chmod_dirs' => true, // change folder permissions
|
||||
'preview_text_files' => true, // eg.: txt, log etc.
|
||||
'edit_text_files' => true, // eg.: txt, log etc.
|
||||
'create_text_files' => true, // only create files with exts. defined in $editable_text_file_exts
|
||||
|
||||
// you can preview these type of files if $preview_text_files is true
|
||||
'previewable_text_file_exts' => array( "bsh", "c","css", "cc", "cpp", "cs", "csh", "cyc", "cv", "htm", "html", "java", "js", "m", "mxml", "perl", "pl", "pm", "py", "rb", "sh", "xhtml", "xml","xsl" ),
|
||||
'previewable_text_file_exts_no_prettify' => array( 'txt', 'log' ),
|
||||
|
||||
// you can edit these type of files if $edit_text_files is true (only text based files)
|
||||
// you can create these type of files if $create_text_files is true (only text based files)
|
||||
// if you want you can add html,css etc.
|
||||
// but for security reasons it's NOT RECOMMENDED!
|
||||
'editable_text_file_exts' => array( 'txt', 'log', 'xml', 'html', 'css', 'htm', 'js' ),
|
||||
|
||||
// Preview with Google Documents
|
||||
'googledoc_enabled' => true,
|
||||
'googledoc_file_exts' => array( 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx' , 'pdf', 'odt', 'odp', 'ods'),
|
||||
|
||||
// defines size limit for paste in MB / operation
|
||||
// set 'FALSE' for no limit
|
||||
'copy_cut_max_size' => 100,
|
||||
// defines file count limit for paste / operation
|
||||
// set 'FALSE' for no limit
|
||||
'copy_cut_max_count' => 200,
|
||||
//IF any of these limits reached, operation won't start and generate warning
|
||||
|
||||
//**********************
|
||||
//Allowed extensions (lowercase insert)
|
||||
//**********************
|
||||
'ext_img' => array( 'jpg', 'jpeg', 'png', 'gif', 'bmp', 'tiff', 'svg' ), //Images
|
||||
'ext_file' => array( 'doc', 'docx', 'rtf', 'pdf', 'xls', 'xlsx', 'txt', 'csv', 'html', 'xhtml', 'psd', 'sql', 'log', 'fla', 'xml', 'ade', 'adp', 'mdb', 'accdb', 'ppt', 'pptx', 'odt', 'ots', 'ott', 'odb', 'odg', 'otp', 'otg', 'odf', 'ods', 'odp', 'css', 'ai', 'kmz','dwg', 'dxf', 'hpgl', 'plt', 'spl', 'step', 'stp', 'iges', 'igs', 'sat', 'cgm', 'ico'), //Files
|
||||
'ext_video' => array( 'mov', 'mpeg', 'm4v', 'mp4', 'avi', 'mpg', 'wma', "flv", "webm" ), //Video
|
||||
'ext_music' => array( 'mp3', 'mpga', 'm4a', 'ac3', 'aiff', 'mid', 'ogg', 'wav' ), //Audio
|
||||
'ext_misc' => array( 'zip', 'rar', 'gz', 'tar', 'iso', 'dmg' ), //Archives
|
||||
|
||||
/******************
|
||||
* AVIARY config
|
||||
*******************/
|
||||
'aviary_active' => true,
|
||||
'aviary_apiKey' => "2444282ef4344e3dacdedc7a78f8877d",
|
||||
'aviary_language' => "fr",
|
||||
'aviary_theme' => "light",
|
||||
'aviary_tools' => "all",
|
||||
'aviary_maxSize' => "1400",
|
||||
// Add or modify the Aviary options below as needed - they will be json encoded when added to the configuration so arrays can be utilized as needed
|
||||
|
||||
//The filter and sorter are managed through both javascript and php scripts because if you have a lot of
|
||||
//file in a folder the javascript script can't sort all or filter all, so the filemanager switch to php script.
|
||||
//The plugin automatic swich javascript to php when the current folder exceeds the below limit of files number
|
||||
'file_number_limit_js' => 500,
|
||||
|
||||
//**********************
|
||||
// Hidden files and folders
|
||||
//**********************
|
||||
// set the names of any folders you want hidden (eg "hidden_folder1", "hidden_folder2" ) Remember all folders with these names will be hidden (you can set any exceptions in config.php files on folders)
|
||||
'hidden_folders' => array(),
|
||||
// set the names of any files you want hidden. Remember these names will be hidden in all folders (eg "this_document.pdf", "that_image.jpg" )
|
||||
'hidden_files' => array( 'config.php' ),
|
||||
|
||||
/*******************
|
||||
* URL upload
|
||||
*******************/
|
||||
'url_upload' => true,
|
||||
|
||||
|
||||
//************************************
|
||||
//Thumbnail for external use creation
|
||||
//************************************
|
||||
|
||||
|
||||
// New image resized creation with fixed path from filemanager folder after uploading (thumbnails in fixed mode)
|
||||
// If you want create images resized out of upload folder for use with external script you can choose this method,
|
||||
// You can create also more than one image at a time just simply add a value in the array
|
||||
// Remember than the image creation respect the folder hierarchy so if you are inside source/test/test1/ the new image will create at
|
||||
// path_from_filemanager/test/test1/
|
||||
// PS if there isn't write permission in your destination folder you must set it
|
||||
//
|
||||
'fixed_image_creation' => false, //activate or not the creation of one or more image resized with fixed path from filemanager folder
|
||||
'fixed_path_from_filemanager' => array( '../test/', '../test1/' ), //fixed path of the image folder from the current position on upload folder
|
||||
'fixed_image_creation_name_to_prepend' => array( '', 'test_' ), //name to prepend on filename
|
||||
'fixed_image_creation_to_append' => array( '_test', '' ), //name to appendon filename
|
||||
'fixed_image_creation_width' => array( 300, 400 ), //width of image (you can leave empty if you set height)
|
||||
'fixed_image_creation_height' => array( 200, '' ), //height of image (you can leave empty if you set width)
|
||||
/*
|
||||
# $option: 0 / exact = defined size;
|
||||
# 1 / portrait = keep aspect set height;
|
||||
# 2 / landscape = keep aspect set width;
|
||||
# 3 / auto = auto;
|
||||
# 4 / crop= resize and crop;
|
||||
*/
|
||||
'fixed_image_creation_option' => array( 'crop', 'auto' ), //set the type of the crop
|
||||
|
||||
|
||||
// New image resized creation with relative path inside to upload folder after uploading (thumbnails in relative mode)
|
||||
// With Responsive filemanager you can create automatically resized image inside the upload folder, also more than one at a time
|
||||
// just simply add a value in the array
|
||||
// The image creation path is always relative so if i'm inside source/test/test1 and I upload an image, the path start from here
|
||||
//
|
||||
'relative_image_creation' => false, //activate or not the creation of one or more image resized with relative path from upload folder
|
||||
'relative_path_from_current_pos' => array( './', './' ), //relative path of the image folder from the current position on upload folder
|
||||
'relative_image_creation_name_to_prepend' => array( '', '' ), //name to prepend on filename
|
||||
'relative_image_creation_name_to_append' => array( '_thumb', '_thumb1' ), //name to append on filename
|
||||
'relative_image_creation_width' => array( 300, 400 ), //width of image (you can leave empty if you set height)
|
||||
'relative_image_creation_height' => array( 200, '' ), //height of image (you can leave empty if you set width)
|
||||
/*
|
||||
# $option: 0 / exact = defined size;
|
||||
# 1 / portrait = keep aspect set height;
|
||||
# 2 / landscape = keep aspect set width;
|
||||
# 3 / auto = auto;
|
||||
# 4 / crop= resize and crop;
|
||||
*/
|
||||
'relative_image_creation_option' => array( 'crop', 'crop' ), //set the type of the crop
|
||||
|
||||
|
||||
// Remember text filter after close filemanager for future session
|
||||
'remember_text_filter' => false,
|
||||
|
||||
);
|
||||
|
||||
return array_merge(
|
||||
$config,
|
||||
array(
|
||||
'ext'=> array_merge(
|
||||
$config['ext_img'],
|
||||
$config['ext_file'],
|
||||
$config['ext_misc'],
|
||||
$config['ext_video'],
|
||||
$config['ext_music']
|
||||
),
|
||||
// For a list of options see: https://developers.aviary.com/docs/web/setup-guide#constructor-config
|
||||
'aviary_defaults_config' => array(
|
||||
'apiKey' => $config['aviary_apiKey'],
|
||||
'language' => $config['aviary_language'],
|
||||
'theme' => $config['aviary_theme'],
|
||||
'tools' => $config['aviary_tools'],
|
||||
'maxSize' => $config['aviary_maxSize']
|
||||
),
|
||||
)
|
||||
);
|
||||
?>
|
22
core/vendor/filemanager/css/jquery.fileupload-noscript.css
vendored
Executable file
@ -0,0 +1,22 @@
|
||||
@charset "UTF-8";
|
||||
/*
|
||||
* jQuery File Upload Plugin NoScript CSS
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
.fileinput-button input {
|
||||
position: static;
|
||||
opacity: 1;
|
||||
filter: none;
|
||||
font-size: inherit !important;
|
||||
direction: inherit;
|
||||
}
|
||||
.fileinput-button span {
|
||||
display: none;
|
||||
}
|
17
core/vendor/filemanager/css/jquery.fileupload-ui-noscript.css
vendored
Executable file
@ -0,0 +1,17 @@
|
||||
@charset "UTF-8";
|
||||
/*
|
||||
* jQuery File Upload UI Plugin NoScript CSS
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2012, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
.fileinput-button i,
|
||||
.fileupload-buttonbar .delete,
|
||||
.fileupload-buttonbar .toggle {
|
||||
display: none;
|
||||
}
|
53
core/vendor/filemanager/css/jquery.fileupload-ui.css
vendored
Executable file
@ -0,0 +1,53 @@
|
||||
@charset "UTF-8";
|
||||
/*
|
||||
* jQuery File Upload UI Plugin CSS
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2010, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
.fileupload-buttonbar .btn,
|
||||
.fileupload-buttonbar .toggle {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.fileupload-process {
|
||||
float: right;
|
||||
display: none;
|
||||
}
|
||||
.fileupload-processing .fileupload-process,
|
||||
.files .processing .preview {
|
||||
display: block;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
background: url("../img/loading.gif") center no-repeat;
|
||||
background-size: contain;
|
||||
}
|
||||
.files audio,
|
||||
.files video {
|
||||
max-width: 300px;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.fileupload-buttonbar .toggle,
|
||||
.files .toggle,
|
||||
.files .btn span {
|
||||
display: none;
|
||||
}
|
||||
.files .name {
|
||||
width: 80px;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
.files audio,
|
||||
.files video {
|
||||
max-width: 80px;
|
||||
}
|
||||
.files img,
|
||||
.files canvas {
|
||||
max-width: 100%;
|
||||
}
|
||||
}
|
37
core/vendor/filemanager/css/jquery.fileupload.css
vendored
Executable file
@ -0,0 +1,37 @@
|
||||
@charset "UTF-8";
|
||||
/*
|
||||
* jQuery File Upload Plugin CSS
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2013, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
.fileinput-button {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
display: inline-block;
|
||||
}
|
||||
.fileinput-button input {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
margin: 0;
|
||||
opacity: 0;
|
||||
-ms-filter: 'alpha(opacity=0)';
|
||||
font-size: 200px !important;
|
||||
direction: ltr;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* Fixes for IE < 8 */
|
||||
@media screen\9 {
|
||||
.fileinput-button input {
|
||||
filter: alpha(opacity=0);
|
||||
font-size: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
BIN
core/vendor/filemanager/css/rtl-style.css
vendored
Executable file
40
core/vendor/filemanager/css/style.css
vendored
Executable file
1224
core/vendor/filemanager/dialog.php
vendored
Executable file
528
core/vendor/filemanager/execute.php
vendored
Executable file
@ -0,0 +1,528 @@
|
||||
<?php
|
||||
$config = include 'config/config.php';
|
||||
//TODO switch to array
|
||||
extract($config, EXTR_OVERWRITE);
|
||||
|
||||
include 'include/utils.php';
|
||||
|
||||
if ($_SESSION['RF']["verify"] != "RESPONSIVEfilemanager")
|
||||
{
|
||||
response(trans('forbiden').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
if (strpos($_POST['path'],'/')===0
|
||||
|| strpos($_POST['path'],'../')!==FALSE
|
||||
|| strpos($_POST['path'],'./')===0
|
||||
|| strpos($_POST['path'],'..\\')!==FALSE
|
||||
|| strpos($_POST['path'],'.\\')===0)
|
||||
{
|
||||
response(trans('wrong path'.AddErrorLocation()))->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_SESSION['RF']['language']) && file_exists('lang/' . basename($_SESSION['RF']['language']) . '.php'))
|
||||
{
|
||||
$languages = include 'lang/languages.php';
|
||||
if(array_key_exists($_SESSION['RF']['language'],$languages)){
|
||||
include 'lang/' . basename($_SESSION['RF']['language']) . '.php';
|
||||
}else{
|
||||
response(trans('Lang_Not_Found').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
response(trans('Lang_Not_Found').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
$ftp = ftp_con($config);
|
||||
|
||||
$base = $current_path;
|
||||
$path = $base.$_POST['path'];
|
||||
$cycle = TRUE;
|
||||
$max_cycles = 50;
|
||||
$i = 0;
|
||||
while($cycle && $i<$max_cycles)
|
||||
{
|
||||
$i++;
|
||||
if ($path == $base) $cycle=FALSE;
|
||||
|
||||
if (file_exists($path."config.php"))
|
||||
{
|
||||
require_once $path."config.php";
|
||||
$cycle = FALSE;
|
||||
}
|
||||
$path = fix_dirname($path)."/";
|
||||
}
|
||||
|
||||
$path = $current_path.$_POST['path'];
|
||||
$path_thumb = $thumbs_base_path.$_POST['path'];
|
||||
|
||||
if($ftp){
|
||||
$path = $ftp_base_folder.$upload_dir.$_POST['path'];
|
||||
$path_thumb = $ftp_base_folder.$ftp_thumbs_dir.$_POST['path'];
|
||||
}
|
||||
|
||||
if (isset($_POST['name']))
|
||||
{
|
||||
$name = fix_filename($_POST['name'],$config);
|
||||
if (strpos($name,'../') !== FALSE || strpos($name,'..\\') !== FALSE)
|
||||
{
|
||||
response(trans('wrong name').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$info = pathinfo($path);
|
||||
if (isset($info['extension']) && !(isset($_GET['action']) && $_GET['action']=='delete_folder') && !in_array(strtolower($info['extension']), $ext) && $_GET['action'] != 'create_file')
|
||||
{
|
||||
response(trans('wrong extension').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_GET['action']))
|
||||
{
|
||||
switch($_GET['action'])
|
||||
{
|
||||
case 'delete_file':
|
||||
if ($delete_files){
|
||||
if($ftp){
|
||||
try{
|
||||
$ftp->delete("/".$path);
|
||||
@$ftp->delete("/".$path_thumb);
|
||||
}catch(FtpClient\FtpException $e){
|
||||
return;
|
||||
}
|
||||
}else{
|
||||
|
||||
unlink($path);
|
||||
if (file_exists($path_thumb)){
|
||||
unlink($path_thumb);
|
||||
}
|
||||
}
|
||||
|
||||
$info=pathinfo($path);
|
||||
if (!$ftp && $relative_image_creation){
|
||||
foreach($relative_path_from_current_pos as $k=>$path)
|
||||
{
|
||||
if ($path!="" && $path[strlen($path)-1]!="/") $path.="/";
|
||||
|
||||
if (file_exists($info['dirname']."/".$path.$relative_image_creation_name_to_prepend[$k].$info['filename'].$relative_image_creation_name_to_append[$k].".".$info['extension']))
|
||||
{
|
||||
unlink($info['dirname']."/".$path.$relative_image_creation_name_to_prepend[$k].$info['filename'].$relative_image_creation_name_to_append[$k].".".$info['extension']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$ftp && $fixed_image_creation)
|
||||
{
|
||||
foreach($fixed_path_from_filemanager as $k=>$path)
|
||||
{
|
||||
if ($path!="" && $path[strlen($path)-1] != "/") $path.="/";
|
||||
|
||||
$base_dir=$path.substr_replace($info['dirname']."/", '', 0, strlen($current_path));
|
||||
if (file_exists($base_dir.$fixed_image_creation_name_to_prepend[$k].$info['filename'].$fixed_image_creation_to_append[$k].".".$info['extension']))
|
||||
{
|
||||
unlink($base_dir.$fixed_image_creation_name_to_prepend[$k].$info['filename'].$fixed_image_creation_to_append[$k].".".$info['extension']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'delete_folder':
|
||||
if ($delete_folders){
|
||||
|
||||
if($ftp){
|
||||
deleteDir($path,$ftp,$config);
|
||||
deleteDir($path_thumb,$ftp,$config);
|
||||
}else{
|
||||
if (is_dir($path_thumb))
|
||||
{
|
||||
deleteDir($path_thumb);
|
||||
}
|
||||
|
||||
if (is_dir($path))
|
||||
{
|
||||
deleteDir($path);
|
||||
if ($fixed_image_creation)
|
||||
{
|
||||
foreach($fixed_path_from_filemanager as $k=>$paths){
|
||||
if ($paths!="" && $paths[strlen($paths)-1] != "/") $paths.="/";
|
||||
|
||||
$base_dir=$paths.substr_replace($path, '', 0, strlen($current_path));
|
||||
if (is_dir($base_dir)) deleteDir($base_dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'create_folder':
|
||||
if ($create_folders)
|
||||
{
|
||||
|
||||
$name = fix_filename($_POST['name'],$config);
|
||||
$path .= $name;
|
||||
$path_thumb .= $name;
|
||||
create_folder(fix_path($path,$config),fix_path($path_thumb,$config),$ftp,$config);
|
||||
}
|
||||
break;
|
||||
case 'rename_folder':
|
||||
if ($rename_folders){
|
||||
if(!is_dir($path)) {
|
||||
response(trans('wrong path'))->send();
|
||||
exit;
|
||||
}
|
||||
$name=fix_filename($name,$config);
|
||||
$name=str_replace('.','',$name);
|
||||
|
||||
if (!empty($name)){
|
||||
if (!rename_folder($path,$name,$ftp,$config))
|
||||
{
|
||||
response(trans('Rename_existing_folder').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
rename_folder($path_thumb,$name,$ftp,$config);
|
||||
if (!$ftp && $fixed_image_creation){
|
||||
foreach($fixed_path_from_filemanager as $k=>$paths){
|
||||
if ($paths!="" && $paths[strlen($paths)-1] != "/") $paths.="/";
|
||||
|
||||
$base_dir=$paths.substr_replace($path, '', 0, strlen($current_path));
|
||||
rename_folder($base_dir,$name,$ftp,$config);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
response(trans('Empty_name').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'create_file':
|
||||
if ($create_text_files === FALSE) {
|
||||
response(sprintf(trans('File_Open_Edit_Not_Allowed'), strtolower(trans('Edit'))).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!isset($editable_text_file_exts) || !is_array($editable_text_file_exts)){
|
||||
$editable_text_file_exts = array();
|
||||
}
|
||||
|
||||
// check if user supplied extension
|
||||
if (strpos($name, '.') === FALSE){
|
||||
response(trans('No_Extension').' '.sprintf(trans('Valid_Extensions'), implode(', ', $editable_text_file_exts)).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
// correct name
|
||||
$old_name = $name;
|
||||
$name=fix_filename($name,$config);
|
||||
if (empty($name))
|
||||
{
|
||||
response(trans('Empty_name').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
// check extension
|
||||
$parts = explode('.', $name);
|
||||
if (!in_array(end($parts), $editable_text_file_exts)) {
|
||||
response(trans('Error_extension').' '.sprintf(trans('Valid_Extensions'), implode(', ', $editable_text_file_exts)), 400)->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
$content = $_POST['new_content'];
|
||||
|
||||
if($ftp){
|
||||
$temp = tempnam('/tmp','RF');
|
||||
file_put_contents($temp, $content);
|
||||
$ftp->put("/".$path.$name, $temp, FTP_BINARY);
|
||||
unlink($temp);
|
||||
response(trans('File_Save_OK'))->send();
|
||||
}else{
|
||||
if (!checkresultingsize(strlen($content))) {
|
||||
response(sprintf(trans('max_size_reached'),$MaxSizeTotal).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
// file already exists
|
||||
if (file_exists($path.$name)) {
|
||||
response(trans('Rename_existing_file').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
if (@file_put_contents($path.$name, $content) === FALSE) {
|
||||
response(trans('File_Save_Error').AddErrorLocation())->send();
|
||||
exit;
|
||||
} else {
|
||||
if (is_function_callable('chmod') !== FALSE){
|
||||
chmod($path.$name, 0644);
|
||||
}
|
||||
response(trans('File_Save_OK'))->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case 'rename_file':
|
||||
if ($rename_files){
|
||||
$name=fix_filename($name,$config);
|
||||
if (!empty($name))
|
||||
{
|
||||
if (!rename_file($path,$name,$ftp,$config))
|
||||
{
|
||||
response(trans('Rename_existing_file').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
rename_file($path_thumb,$name,$ftp,$config);
|
||||
|
||||
if ($fixed_image_creation)
|
||||
{
|
||||
$info=pathinfo($path);
|
||||
|
||||
foreach($fixed_path_from_filemanager as $k=>$paths)
|
||||
{
|
||||
if ($paths!="" && $paths[strlen($paths)-1] != "/") $paths.="/";
|
||||
|
||||
$base_dir = $paths.substr_replace($info['dirname']."/", '', 0, strlen($current_path));
|
||||
if (file_exists($base_dir.$fixed_image_creation_name_to_prepend[$k].$info['filename'].$fixed_image_creation_to_append[$k].".".$info['extension']))
|
||||
{
|
||||
rename_file($base_dir.$fixed_image_creation_name_to_prepend[$k].$info['filename'].$fixed_image_creation_to_append[$k].".".$info['extension'],$fixed_image_creation_name_to_prepend[$k].$name.$fixed_image_creation_to_append[$k],$ftp,$config);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
response(trans('Empty_name').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'duplicate_file':
|
||||
if ($duplicate_files)
|
||||
{
|
||||
$name=fix_filename($name,$config);
|
||||
if (!empty($name))
|
||||
{
|
||||
if (!$ftp && !checkresultingsize(filesize($path))) {
|
||||
response(sprintf(trans('max_size_reached'),$MaxSizeTotal).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
if (!duplicate_file($path,$name,$ftp,$config))
|
||||
{
|
||||
response(trans('Rename_existing_file').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
duplicate_file($path_thumb,$name,$ftp,$config);
|
||||
|
||||
if (!$ftp && $fixed_image_creation)
|
||||
{
|
||||
$info=pathinfo($path);
|
||||
foreach($fixed_path_from_filemanager as $k=>$paths)
|
||||
{
|
||||
if ($paths!="" && $paths[strlen($paths)-1] != "/") $paths.= "/";
|
||||
|
||||
$base_dir=$paths.substr_replace($info['dirname']."/", '', 0, strlen($current_path));
|
||||
|
||||
if (file_exists($base_dir.$fixed_image_creation_name_to_prepend[$k].$info['filename'].$fixed_image_creation_to_append[$k].".".$info['extension']))
|
||||
{
|
||||
duplicate_file($base_dir.$fixed_image_creation_name_to_prepend[$k].$info['filename'].$fixed_image_creation_to_append[$k].".".$info['extension'],$fixed_image_creation_name_to_prepend[$k].$name.$fixed_image_creation_to_append[$k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
response(trans('Empty_name').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'paste_clipboard':
|
||||
if ( ! isset($_SESSION['RF']['clipboard_action'], $_SESSION['RF']['clipboard']['path'])
|
||||
|| $_SESSION['RF']['clipboard_action'] == ''
|
||||
|| $_SESSION['RF']['clipboard']['path'] == '')
|
||||
{
|
||||
response()->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
$action = $_SESSION['RF']['clipboard_action'];
|
||||
$data = $_SESSION['RF']['clipboard'];
|
||||
|
||||
|
||||
if($ftp){
|
||||
if($_POST['path']!=""){
|
||||
$path.=DIRECTORY_SEPARATOR;
|
||||
$path_thumb.=DIRECTORY_SEPARATOR;
|
||||
}
|
||||
$path_thumb .= basename($data['path']);
|
||||
$path .= basename($data['path']) ;
|
||||
$data['path_thumb'] = DIRECTORY_SEPARATOR.$config['ftp_base_folder'].$config['ftp_thumbs_dir'].$data['path'];
|
||||
$data['path'] = DIRECTORY_SEPARATOR.$config['ftp_base_folder'].$config['upload_dir'].$data['path'];
|
||||
}else{
|
||||
$data['path_thumb'] = $thumbs_base_path.$data['path'];
|
||||
$data['path'] = $current_path.$data['path'];
|
||||
}
|
||||
|
||||
$pinfo = pathinfo($data['path']);
|
||||
|
||||
// user wants to paste to the same dir. nothing to do here...
|
||||
if ($pinfo['dirname'] == rtrim($path, DIRECTORY_SEPARATOR)) {
|
||||
response()->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
// user wants to paste folder to it's own sub folder.. baaaah.
|
||||
if (is_dir($data['path']) && strpos($path, $data['path']) !== FALSE){
|
||||
response()->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
// something terribly gone wrong
|
||||
if ($action != 'copy' && $action != 'cut'){
|
||||
response(trans('wrong action').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
if($ftp){
|
||||
if ($action == 'copy')
|
||||
{
|
||||
$tmp = time().basename($data['path']);
|
||||
$ftp->get($tmp, $data['path'], FTP_BINARY);
|
||||
$ftp->put(DIRECTORY_SEPARATOR.$path, $tmp, FTP_BINARY);
|
||||
unlink($tmp);
|
||||
|
||||
if(url_exists($data['path_thumb'])){
|
||||
$tmp = time().basename($data['path_thumb']);
|
||||
@$ftp->get($tmp, $data['path_thumb'], FTP_BINARY);
|
||||
@$ftp->put(DIRECTORY_SEPARATOR.$path_thumb, $tmp, FTP_BINARY);
|
||||
unlink($tmp);
|
||||
}
|
||||
|
||||
} elseif ($action == 'cut') {
|
||||
$ftp->rename($data['path'], DIRECTORY_SEPARATOR.$path);
|
||||
if(url_exists($data['path_thumb'])){
|
||||
@$ftp->rename($data['path_thumb'], DIRECTORY_SEPARATOR.$path_thumb);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
// check for writability
|
||||
if (is_really_writable($path) === FALSE || is_really_writable($path_thumb) === FALSE){
|
||||
response(trans('Dir_No_Write').'<br/>'.str_replace('../','',$path).'<br/>'.str_replace('../','',$path_thumb).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
// check if server disables copy or rename
|
||||
if (is_function_callable(($action == 'copy' ? 'copy' : 'rename')) === FALSE){
|
||||
response(sprintf(trans('Function_Disabled'), ($action == 'copy' ? (trans('Copy')) : (trans('Cut')))).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
if ($action == 'copy')
|
||||
{
|
||||
list($sizeFolderToCopy,$fileNum,$foldersCount) = folder_info($path,false);
|
||||
if (!checkresultingsize($sizeFolderToCopy)) {
|
||||
response(sprintf(trans('max_size_reached'),$MaxSizeTotal).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
rcopy($data['path'], $path);
|
||||
rcopy($data['path_thumb'], $path_thumb);
|
||||
} elseif ($action == 'cut') {
|
||||
rrename($data['path'], $path);
|
||||
rrename($data['path_thumb'], $path_thumb);
|
||||
|
||||
// cleanup
|
||||
if (is_dir($data['path']) === TRUE){
|
||||
rrename_after_cleaner($data['path']);
|
||||
rrename_after_cleaner($data['path_thumb']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// cleanup
|
||||
$_SESSION['RF']['clipboard']['path'] = NULL;
|
||||
$_SESSION['RF']['clipboard_action'] = NULL;
|
||||
|
||||
break;
|
||||
case 'chmod':
|
||||
$mode = $_POST['new_mode'];
|
||||
$rec_option = $_POST['is_recursive'];
|
||||
$valid_options = array('none', 'files', 'folders', 'both');
|
||||
$chmod_perm = ($_POST['folder'] ? $chmod_dirs : $chmod_files);
|
||||
|
||||
// check perm
|
||||
if ($chmod_perm === FALSE) {
|
||||
response(sprintf(trans('File_Permission_Not_Allowed'), (is_dir($path) ? (trans('Folders')) : (trans('Files')) )).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
// check mode
|
||||
if (!preg_match("/^[0-7]{3}$/", $mode)){
|
||||
response(trans('File_Permission_Wrong_Mode').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
// check recursive option
|
||||
if (!in_array($rec_option, $valid_options)){
|
||||
response(trans("wrong option").AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
// check if server disabled chmod
|
||||
if (!$ftp && is_function_callable('chmod') === FALSE){
|
||||
response(sprintf(trans('Function_Disabled'), 'chmod').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
$mode = "0".$mode;
|
||||
$mode = octdec($mode);
|
||||
if($ftp){
|
||||
$ftp->chmod($mode, "/".$path);
|
||||
}else{
|
||||
rchmod($path, $mode, $rec_option);
|
||||
}
|
||||
|
||||
break;
|
||||
case 'save_text_file':
|
||||
$content = $_POST['new_content'];
|
||||
// $content = htmlspecialchars($content); not needed
|
||||
// $content = stripslashes($content);
|
||||
|
||||
if($ftp){
|
||||
$tmp = time();
|
||||
file_put_contents($tmp, $content);
|
||||
try{
|
||||
$ftp->put("/".$path, $tmp, FTP_BINARY);
|
||||
}catch(FtpClient\FtpException $e){
|
||||
echo $e->getMessage();
|
||||
}
|
||||
unlink($tmp);
|
||||
response(trans('File_Save_OK'))->send();
|
||||
}else{
|
||||
// no file
|
||||
if (!file_exists($path)) {
|
||||
response(trans('File_Not_Found').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
// not writable or edit not allowed
|
||||
if (!is_writable($path) || $edit_text_files === FALSE) {
|
||||
response(sprintf(trans('File_Open_Edit_Not_Allowed'), strtolower(trans('Edit'))).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!checkresultingsize(strlen($content))) {
|
||||
response(sprintf(trans('max_size_reached'),$MaxSizeTotal).AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
if (@file_put_contents($path, $content) === FALSE) {
|
||||
response(trans('File_Save_Error').AddErrorLocation())->send();
|
||||
exit;
|
||||
} else {
|
||||
response(trans('File_Save_OK'))->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
response(trans('wrong action').AddErrorLocation())->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
?>
|
151
core/vendor/filemanager/force_download.php
vendored
Executable file
@ -0,0 +1,151 @@
|
||||
<?php
|
||||
|
||||
$config = include 'config/config.php';
|
||||
|
||||
|
||||
//TODO switch to array
|
||||
extract($config, EXTR_OVERWRITE);
|
||||
|
||||
include 'include/utils.php';
|
||||
|
||||
$ftp = ftp_con($config);
|
||||
|
||||
if ($_SESSION['RF']["verify"] != "RESPONSIVEfilemanager")
|
||||
{
|
||||
response(trans('forbiden').AddErrorLocation(), 403)->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
include 'include/mime_type_lib.php';
|
||||
|
||||
|
||||
if (
|
||||
strpos($_POST['path'], '/') === 0
|
||||
|| strpos($_POST['path'], '../') !== false
|
||||
|| strpos($_POST['path'], './') === 0
|
||||
|| strpos($_POST['path'], '..\\') !== false
|
||||
|| strpos($_POST['path'], '.\\') === 0
|
||||
)
|
||||
{
|
||||
response(trans('wrong path'.AddErrorLocation()), 400)->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
if (strpos($_POST['name'], '/') !== false)
|
||||
{
|
||||
response(trans('wrong path'.AddErrorLocation()), 400)->send();
|
||||
exit;
|
||||
}
|
||||
if($ftp){
|
||||
$path = $ftp_base_url . $upload_dir . $_POST['path'];
|
||||
}else{
|
||||
$path = $current_path . $_POST['path'];
|
||||
}
|
||||
|
||||
$name = $_POST['name'];
|
||||
|
||||
$info = pathinfo($name);
|
||||
|
||||
if ( ! in_array(fix_strtolower($info['extension']), $ext))
|
||||
{
|
||||
response(trans('wrong extension'.AddErrorLocation()), 400)->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$file_name = $info['basename'];
|
||||
$file_ext = $info['extension'];
|
||||
$file_path = $path . $name;
|
||||
|
||||
// make sure the file exists
|
||||
if($ftp){
|
||||
$file_url = 'http://www.myremoteserver.com/file.exe';
|
||||
header('Content-Type: application/octet-stream');
|
||||
header("Content-Transfer-Encoding: Binary");
|
||||
header("Content-disposition: attachment; filename=\"" . $file_name . "\"");
|
||||
readfile($file_path);
|
||||
}elseif (is_file($file_path) && is_readable($file_path))
|
||||
{
|
||||
if ( ! file_exists($path . $name))
|
||||
{
|
||||
response(trans('File_Not_Found'.AddErrorLocation()), 404)->send();
|
||||
exit;
|
||||
}
|
||||
|
||||
$size = filesize($file_path);
|
||||
$file_name = rawurldecode($file_name);
|
||||
if (function_exists('mime_content_type')){
|
||||
$mime_type = mime_content_type($file_path);
|
||||
}elseif(function_exists('finfo_open')){
|
||||
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
||||
$mime_type = finfo_file($finfo, $file_path);
|
||||
}else{
|
||||
include 'include/mime_type_lib.php';
|
||||
$mime_type = get_file_mime_type($file_path);
|
||||
}
|
||||
|
||||
@ob_end_clean();
|
||||
if(ini_get('zlib.output_compression')){
|
||||
ini_set('zlib.output_compression', 'Off');
|
||||
}
|
||||
header('Content-Type: ' . $mime_type);
|
||||
header('Content-Disposition: attachment; filename="'.$file_name.'"');
|
||||
header("Content-Transfer-Encoding: binary");
|
||||
header('Accept-Ranges: bytes');
|
||||
|
||||
if(isset($_SERVER['HTTP_RANGE']))
|
||||
{
|
||||
list($a, $range) = explode("=",$_SERVER['HTTP_RANGE'],2);
|
||||
list($range) = explode(",",$range,2);
|
||||
list($range, $range_end) = explode("-", $range);
|
||||
$range=intval($range);
|
||||
if(!$range_end) {
|
||||
$range_end=$size-1;
|
||||
} else {
|
||||
$range_end=intval($range_end);
|
||||
}
|
||||
|
||||
$new_length = $range_end-$range+1;
|
||||
header("HTTP/1.1 206 Partial Content");
|
||||
header("Content-Length: $new_length");
|
||||
header("Content-Range: bytes $range-$range_end/$size");
|
||||
} else {
|
||||
$new_length=$size;
|
||||
header("Content-Length: ".$size);
|
||||
}
|
||||
|
||||
$chunksize = 1*(1024*1024);
|
||||
$bytes_send = 0;
|
||||
if ($file = fopen($file_path, 'r'))
|
||||
{
|
||||
if(isset($_SERVER['HTTP_RANGE']))
|
||||
fseek($file, $range);
|
||||
|
||||
while(!feof($file) &&
|
||||
(!connection_aborted()) &&
|
||||
($bytes_send<$new_length)
|
||||
)
|
||||
{
|
||||
$buffer = fread($file, $chunksize);
|
||||
echo($buffer);
|
||||
flush();
|
||||
$bytes_send += strlen($buffer);
|
||||
}
|
||||
fclose($file);
|
||||
} else {
|
||||
die('Error - can not open file.');
|
||||
}
|
||||
|
||||
die();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// file does not exist
|
||||
header("HTTP/1.0 404 Not Found");
|
||||
exit;
|
||||
}
|
||||
|
||||
exit;
|
BIN
core/vendor/filemanager/img/clipboard_apply.png
vendored
Executable file
After Width: | Height: | Size: 189 B |
BIN
core/vendor/filemanager/img/clipboard_clear.png
vendored
Executable file
After Width: | Height: | Size: 195 B |
BIN
core/vendor/filemanager/img/copy.png
vendored
Executable file
After Width: | Height: | Size: 238 B |
BIN
core/vendor/filemanager/img/cut.png
vendored
Executable file
After Width: | Height: | Size: 173 B |
BIN
core/vendor/filemanager/img/date.png
vendored
Executable file
After Width: | Height: | Size: 611 B |
BIN
core/vendor/filemanager/img/dimension.png
vendored
Executable file
After Width: | Height: | Size: 489 B |
BIN
core/vendor/filemanager/img/down.png
vendored
Executable file
After Width: | Height: | Size: 163 B |
BIN
core/vendor/filemanager/img/download.png
vendored
Executable file
After Width: | Height: | Size: 674 B |
BIN
core/vendor/filemanager/img/duplicate.png
vendored
Executable file
After Width: | Height: | Size: 245 B |
BIN
core/vendor/filemanager/img/edit_img.png
vendored
Executable file
After Width: | Height: | Size: 673 B |
BIN
core/vendor/filemanager/img/file_edit.png
vendored
Executable file
After Width: | Height: | Size: 764 B |
BIN
core/vendor/filemanager/img/glyphicons-halflings-white.png
vendored
Executable file
After Width: | Height: | Size: 8.4 KiB |
BIN
core/vendor/filemanager/img/glyphicons-halflings.png
vendored
Executable file
After Width: | Height: | Size: 15 KiB |
BIN
core/vendor/filemanager/img/ico/ac3.jpg
vendored
Executable file
After Width: | Height: | Size: 1.7 KiB |
BIN
core/vendor/filemanager/img/ico/accdb.jpg
vendored
Executable file
After Width: | Height: | Size: 2.6 KiB |
BIN
core/vendor/filemanager/img/ico/ade.jpg
vendored
Executable file
After Width: | Height: | Size: 2.2 KiB |
BIN
core/vendor/filemanager/img/ico/adp.jpg
vendored
Executable file
After Width: | Height: | Size: 2.2 KiB |
BIN
core/vendor/filemanager/img/ico/ai.jpg
vendored
Executable file
After Width: | Height: | Size: 1.7 KiB |
BIN
core/vendor/filemanager/img/ico/aiff.jpg
vendored
Executable file
After Width: | Height: | Size: 1.7 KiB |
BIN
core/vendor/filemanager/img/ico/avi.jpg
vendored
Executable file
After Width: | Height: | Size: 1.5 KiB |
BIN
core/vendor/filemanager/img/ico/bmp.jpg
vendored
Executable file
After Width: | Height: | Size: 1.9 KiB |
BIN
core/vendor/filemanager/img/ico/c4d.jpg
vendored
Executable file
After Width: | Height: | Size: 6.1 KiB |
BIN
core/vendor/filemanager/img/ico/css.jpg
vendored
Executable file
After Width: | Height: | Size: 1.7 KiB |
BIN
core/vendor/filemanager/img/ico/csv.jpg
vendored
Executable file
After Width: | Height: | Size: 2.5 KiB |
BIN
core/vendor/filemanager/img/ico/default.jpg
vendored
Executable file
After Width: | Height: | Size: 1.7 KiB |
BIN
core/vendor/filemanager/img/ico/dmg.jpg
vendored
Executable file
After Width: | Height: | Size: 1.5 KiB |
BIN
core/vendor/filemanager/img/ico/doc.jpg
vendored
Executable file
After Width: | Height: | Size: 2.5 KiB |