Compare commits

..

No commits in common. "master" and "develop" have entirely different histories.

471 changed files with 317536 additions and 92704 deletions

6
.gitignore vendored
View File

@ -1,5 +1,5 @@
conf/user.inc.php
conf/user_defined.php
userdata
www/cache/
www/themes/new/css/custom.css
userdata/cronjobkey.txt
userdata/tmp/
www/cache/

View File

@ -1,3 +0,0 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: OpenXE
Source: https://openxe.org

View File

@ -1,5 +1,654 @@
# THE CONTENT OF THIS FILE HAS BEEN MOVED TO THE [LICENSES](LICENSES) SUBFOLDER
# SEE [README](README.md) AND [LICENSES](LICENSES) FOLDER FOR MORE INFORMATION
GNU Affero General Public License
=================================
_Version 3, 19 November 2007_
_Copyright © 2007 Free Software Foundation, Inc. &lt;<http://fsf.org/>&gt;_
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
## Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: **(1)** assert copyright on the software, and **(2)** offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
## TERMS AND CONDITIONS
### 0. Definitions
“This License” refers to version 3 of the GNU Affero General Public License.
“Copyright” also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
“The Program” refers to any copyrightable work licensed under this
License. Each licensee is addressed as “you”. “Licensees” and
“recipients” may be individuals or organizations.
To “modify” a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a “modified version” of the
earlier work or a work “based on” the earlier work.
A “covered work” means either the unmodified Program or a work based
on the Program.
To “propagate” a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To “convey” a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays “Appropriate Legal Notices”
to the extent that it includes a convenient and prominently visible
feature that **(1)** displays an appropriate copyright notice, and **(2)**
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
### 1. Source Code
The “source code” for a work means the preferred form of the work
for making modifications to it. “Object code” means any non-source
form of a work.
A “Standard Interface” means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The “System Libraries” of an executable work include anything, other
than the work as a whole, that **(a)** is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and **(b)** serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
“Major Component”, in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The “Corresponding Source” for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
### 2. Basic Permissions
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
### 3. Protecting Users' Legal Rights From Anti-Circumvention Law
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
### 4. Conveying Verbatim Copies
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
### 5. Conveying Modified Source Versions
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
* **a)** The work must carry prominent notices stating that you modified
it, and giving a relevant date.
* **b)** The work must carry prominent notices stating that it is
released under this License and any conditions added under section 7.
This requirement modifies the requirement in section 4 to
“keep intact all notices”.
* **c)** You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
* **d)** If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
“aggregate” if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
### 6. Conveying Non-Source Forms
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
* **a)** Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
* **b)** Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either **(1)** a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or **(2)** access to copy the
Corresponding Source from a network server at no charge.
* **c)** Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
* **d)** Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
* **e)** Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A “User Product” is either **(1)** a “consumer product”, which means any
tangible personal property which is normally used for personal, family,
or household purposes, or **(2)** anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, “normally used” refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
“Installation Information” for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
### 7. Additional Terms
“Additional permissions” are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
* **a)** Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
* **b)** Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
* **c)** Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
* **d)** Limiting the use for publicity purposes of names of licensors or
authors of the material; or
* **e)** Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
* **f)** Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered “further
restrictions” within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
### 8. Termination
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated **(a)**
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and **(b)** permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
### 9. Acceptance Not Required for Having Copies
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
### 10. Automatic Licensing of Downstream Recipients
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An “entity transaction” is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
### 11. Patents
A “contributor” is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's “contributor version”.
A contributor's “essential patent claims” are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, “control” includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a “patent license” is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To “grant” such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either **(1)** cause the Corresponding Source to be so
available, or **(2)** arrange to deprive yourself of the benefit of the
patent license for this particular work, or **(3)** arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. “Knowingly relying” means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is “discriminatory” if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license **(a)** in connection with copies of the covered work
conveyed by you (or copies made from those copies), or **(b)** primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
### 12. No Surrender of Others' Freedom
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
### 13. Remote Network Interaction; Use with the GNU General Public License
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
### 14. Revised Versions of this License
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License “or any later version” applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
### 15. Disclaimer of Warranty
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
### 16. Limitation of Liability
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
### 17. Interpretation of Sections 15 and 16
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
_END OF TERMS AND CONDITIONS_
## How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the “copyright” line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a “Source” link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a “copyright disclaimer” for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
&lt;<http://www.gnu.org/licenses/>&gt;.
## Plugins/Bibliotheken
@ -57,4 +706,4 @@
moxiecode.com
Flot
http://code.google.com/p/flot/
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,

View File

@ -1,660 +0,0 @@
### GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc.
<https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
### Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains
free software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing
under this license.
The precise terms and conditions for copying, distribution and
modification follow.
### TERMS AND CONDITIONS
#### 0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public
License.
"Copyright" also means copyright-like laws that apply to other kinds
of works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of
an exact copy. The resulting work is called a "modified version" of
the earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user
through a computer network, with no transfer of a copy, is not
conveying.
An interactive user interface displays "Appropriate Legal Notices" to
the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
#### 1. Source Code.
The "source code" for a work means the preferred form of the work for
making modifications to it. "Object code" means any non-source form of
a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users can
regenerate automatically from other parts of the Corresponding Source.
The Corresponding Source for a work in source code form is that same
work.
#### 2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not convey,
without conditions so long as your license otherwise remains in force.
You may convey covered works to others for the sole purpose of having
them make modifications exclusively for you, or provide you with
facilities for running those works, provided that you comply with the
terms of this License in conveying all material for which you do not
control copyright. Those thus making or running the covered works for
you must do so exclusively on your behalf, under your direction and
control, on terms that prohibit them from making any copies of your
copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under the
conditions stated below. Sublicensing is not allowed; section 10 makes
it unnecessary.
#### 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such
circumvention is effected by exercising rights under this License with
respect to the covered work, and you disclaim any intention to limit
operation or modification of the work as a means of enforcing, against
the work's users, your or third parties' legal rights to forbid
circumvention of technological measures.
#### 4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
#### 5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these
conditions:
- a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
- b) The work must carry prominent notices stating that it is
released under this License and any conditions added under
section 7. This requirement modifies the requirement in section 4
to "keep intact all notices".
- c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
- d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
#### 6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms of
sections 4 and 5, provided that you also convey the machine-readable
Corresponding Source under the terms of this License, in one of these
ways:
- a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
- b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the Corresponding
Source from a network server at no charge.
- c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
- d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
- e) Convey the object code using peer-to-peer transmission,
provided you inform other peers where the object code and
Corresponding Source of the work are being offered to the general
public at no charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal,
family, or household purposes, or (2) anything designed or sold for
incorporation into a dwelling. In determining whether a product is a
consumer product, doubtful cases shall be resolved in favor of
coverage. For a particular product received by a particular user,
"normally used" refers to a typical or common use of that class of
product, regardless of the status of the particular user or of the way
in which the particular user actually uses, or expects or is expected
to use, the product. A product is a consumer product regardless of
whether the product has substantial commercial, industrial or
non-consumer uses, unless such uses represent the only significant
mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to
install and execute modified versions of a covered work in that User
Product from a modified version of its Corresponding Source. The
information must suffice to ensure that the continued functioning of
the modified object code is in no case prevented or interfered with
solely because modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or
updates for a work that has been modified or installed by the
recipient, or for the User Product in which it has been modified or
installed. Access to a network may be denied when the modification
itself materially and adversely affects the operation of the network
or violates the rules and protocols for communication across the
network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
#### 7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders
of that material) supplement the terms of this License with terms:
- a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
- b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
- c) Prohibiting misrepresentation of the origin of that material,
or requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
- d) Limiting the use for publicity purposes of names of licensors
or authors of the material; or
- e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
- f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions
of it) with contractual assumptions of liability to the recipient,
for any liability that these contractual assumptions directly
impose on those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions; the
above requirements apply either way.
#### 8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your license
from a particular copyright holder is reinstated (a) provisionally,
unless and until the copyright holder explicitly and finally
terminates your license, and (b) permanently, if the copyright holder
fails to notify you of the violation by some reasonable means prior to
60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
#### 9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or run
a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
#### 10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
#### 11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims owned
or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within the
scope of its coverage, prohibits the exercise of, or is conditioned on
the non-exercise of one or more of the rights that are specifically
granted under this License. You may not convey a covered work if you
are a party to an arrangement with a third party that is in the
business of distributing software, under which you make payment to the
third party based on the extent of your activity of conveying the
work, and under which the third party grants, to any of the parties
who would receive the covered work from you, a discriminatory patent
license (a) in connection with copies of the covered work conveyed by
you (or copies made from those copies), or (b) primarily for and in
connection with specific products or compilations that contain the
covered work, unless you entered into that arrangement, or that patent
license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
#### 12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under
this License and any other pertinent obligations, then as a
consequence you may not convey it at all. For example, if you agree to
terms that obligate you to collect a royalty for further conveying
from those to whom you convey the Program, the only way you could
satisfy both those terms and this License would be to refrain entirely
from conveying the Program.
#### 13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your
version supports such interaction) an opportunity to receive the
Corresponding Source of your version by providing access to the
Corresponding Source from a network server at no charge, through some
standard or customary means of facilitating copying of software. This
Corresponding Source shall include the Corresponding Source for any
work covered by version 3 of the GNU General Public License that is
incorporated pursuant to the following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
#### 14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Affero General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever
published by the Free Software Foundation.
If the Program specifies that a proxy can decide which future versions
of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
#### 15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
CORRECTION.
#### 16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR
CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT
NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR
LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM
TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
#### 17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
### How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these
terms.
To do so, attach the following notices to the program. It is safest to
attach them to the start of each source file to most effectively state
the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper
mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for
the specific requirements.
You should also get your employer (if you work as a programmer) or
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. For more information on this, and how to apply and follow
the GNU AGPL, see <https://www.gnu.org/licenses/>.

View File

@ -1,69 +0,0 @@
# EMBEDDED PROJECTS GENERAL PUBLIC LICENSE Version 3.1
EGPLv3.1
Copyright (C) 2015 embedded projects GmbH, Augsburg, Germany
## Preamble
The EGPLv3.1 incorporates the terms of the GNU AFFERO GENERAL PUBLIC LICENSE Version 3, dated 19 November 2007 (AGPLv3) as shown under EXHIBIT A *and* the following terms, WHEREAS the following terms
- extend, amend and/or clarify the AGPLv3 and
- prevail in case of any contradictions with the AGPLv3.
The following terms of the EGPLv3.1 may not be separated from the terms of the AGPLv3 in EXHIBIT A together they form the EGPLv3.1.
It is purpose of the EGPLv3.1 to make any user and/or recipient of this file or its content aware of the identity of the copyright holder/licensor and its business.
## DEVELOPER & DISTRIBUTOR NOTES:
- For purpose of clarification, the following terms have priority over the terms of the AGPLv3, especially No. 7 of the AGPLv3. This however, may render the EGPLv3.1 incompatible with any other AGPLv3s or any other GPL.
- Inasmuch as embedded projects GmbH is the licensor, embedded projects reserves the right to publish guidelines for the interpretation of the EGPLv3.1 on http://www.wawision.de which are incorporated into this license by reference in case they are published prior to your obtainment of the EGPLv3.1. You bear the burden of proof that you obtained this license prior to the publishment of a certain guideline.
## 0. Definition of the program
The Program hereinafeter (and pursuant to No. 0 AGPLv3) includes but is not limited to any file or portion of it that
- a) references to the EGPLv3.1 including but not limited to such references from source code header files
OR
- b) is referenced to the EGPLv3.1 by
- (i) any documentation provided with the file OR
- (ii) a notice file that is contained in the same directory in which the file is stored. In the absence of such notice file in the same directory, said notice file can be found in the upper directory that is next to the file which would be the root directory as a last resort.
The use of this file and its content (including but not limited to all modules, databases, pictorial images and documentation and all forms of computer program codes and parts thereof) are subject to the EGPLv3.1.
## 1. Adevertising Clauses
- a) All advertising materials for (i) any work that contains this file, its content and/or any portion of it or (ii) mentioning features and/or use of this file, its content and/or any portion of it must mention at least ONE of the following statements:
> “Diese Software ist eine Ableitung und Veränderung von WaWision ERP. WaWision ERP wurde von embedded projects GmbH entwickelt und steht unter der EGPLv3.1-Lizenz als Open Source Software. Informationen zu WaWision und der Open-Source Version findet man unter http://www.wawision.de.”
AND/OR
> “This Software is a derivative and modification of WaWision ERP. WaWision ERP was developed by embedded projects GmbH und is licensed under the EGPLv3.1 license as Open Source Software. Information on WaWision and its open source distribution can be obtained from http://www.wawision.”
- b) The statement under clause 1 a) has to be displayed in black latin font (“Arial” or “Times New Roman”) on white background with font size of at least 12pt.
- c) The “advertising materials” under clause 1 a) comprises all non-verbal forms of advertising and business in theprogram, including but not limited to digital or printed offers or displays (e.g. on convention displays, brochures, websites or webshops) or terms and conditions for the distribution or cloud/SaaS use of the program.
- d) You are required to provide customers and/or any recipients of your advertising materials with the text of the complete EGPLv3.1 text upon request. You may not charge any fee for the provision of the EGPLv3.1 text, when you are requested to provide the EGPLv3.1 by means of electronic communication (e.g. e-mail).
## 2. Integrity of Copyright and License Notices
You are not allowed to remove or modify any copyright and license notices from the program unless you only add your own copyright notice exclusively for your own contributions.
## 3. Network Interaction
- a) A user interaction with the program pursuant to No. 13 AGPLv3 includes but is not limited to situations in which the user receives parts of the program on a client machine during interaction with a server. For the purpose of clarification,
- i) said user interaction does not necessarily mean access to all functions of the program in order to interact with it. Said interaction comprises but is not limited to any code of the program that is purposefully cached on the users machine for preparing code execution and any login dialog of the program no matter whether the user has the suitable login information.
- ii) the term user means anyone but the licensee, i.e. comprising but not limited to employees of the licensee.
- b) Instead of providing the user that interacts with the program pursuant to No. 13 AGPLv3 with the source code of the original program, you are obliged to offer the complete corresponding code of the licensees covered work for internet download to the PUBLIC under the EGPLv3.1, including but not limited to No. 5 AGPLv3. The aforementioned offer has to be prominently positioned
## 4. Defintion of a Work Based on the Program
A work based on the program includes but is not limited to
- a) any new arrangement of the program with other new files, e.g. libraries without regard to the form of linking (dynamic or static) AND
- b) any other new module that contains portions of the program, e.g. any code fragment of the program. In case, the aforementioned incorporation of a code fragment into a new module does not require the permission by the licensor, said module must be licensed under the EGPLv3.1 when the module is conveyed together with the program.
## 5. No Trademark or Name Rights
Notwithstanding No. 1 and 5 EGPLv3.1, nothing in the EGPLv3.1 grants you the to right to use the trademark WaWision or the name of the embedded projects GmbH.
## 6. Integrity of the EGPLv3.1
The EGPLv3.1 may not be changed, including but not limited for the distribution of the program or any work based on the program; No. 14 AGPLv3 does not apply.
## 7. Choice of Law, Jurisdiction
The EGPLv3.1 is governed by the laws of Germany whereas the application of the International Convention of the Sale of Goods (CISG) is excluded. Inasmuch as you are a merchant pursuant to Sec. 13 German Civil Code (BGB), all courts in Germany shall have jurisdiction for any dispute arising from the EGPLv3.1.
# EXHIBIT A
## GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
-> See [AGPL-3.0-only.md](AGPL-3.0-only.md)

View File

@ -36,6 +36,4 @@ Neuimplementierung des Xentral 20 Enterprise Ticketsystems mit vielen Verbesseru
[Hier gehts zur OpenXE Installation](INSTALL.md)
OpenXE ist freie Software, lizensiert unter der EGPL 3.1.
Diese Software ist eine Ableitung und Veränderung von WaWision ERP. WaWision ERP wurde von embedded projects GmbH entwickelt und steht unter der EGPLv3.1-Lizenz als Open Source Software. Informationen zu WaWision und der Open-Source Version findet man unter http://www.wawision.de
OpenXE ist freie Software, lizensiert unter AGPL 3 und basiert auf der Open Source Version von Xentral https://xentral.com/

View File

@ -54,11 +54,14 @@ memory_limit = 256M
## Install additional zip
`sudo apt-get install zip`
## Install mysql client
`sudo apt-get install mysql-client`
## Install database server
`sudo apt-get install mariadb-server`
## Configure database server
`sudo mariadb-secure-installation`
`sudo mysql_secure_installation`
```
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

View File

@ -1,20 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\Dhl\Data;
class Bank
{
public string $accountOwner;
public string $bankName;
public string $iban;
public string $note1;
public string $note2;
public ?string $bic;
public ?string $accountreference;
}

View File

@ -1,16 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\Dhl\Data;
class Communication
{
public ?string $phone;
public ?string $email;
public ?string $contactPerson;
}

View File

@ -1,16 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\Dhl\Data;
class Contact
{
public ?Communication $Communication;
public ?NativeAddress $Address;
public ?Name $Name;
}

View File

@ -1,24 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\Dhl\Data;
class Country
{
public ?string $country;
public string $countryISOCode;
public ?string $state;
public static function Create(string $isoCode, ?string $state = null):Country {
$obj = new Country();
$obj->countryISOCode = $isoCode;
$obj->state = $state;
return $obj;
}
}

View File

@ -1,20 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\Dhl\Data;
class CreateShipmentOrderRequest
{
public Version $Version;
public ShipmentOrder $ShipmentOrder;
public ?string $labelResponseType;
public ?string $groupProfileName;
public ?string $labelFormat;
public ?string $labelFormatRetoure;
public ?string $combinedPrinting;
}

View File

@ -1,16 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\Dhl\Data;
class CreateShipmentOrderResponse
{
public Version $Version;
public Statusinformation $Status;
public ?CreationState $CreationState;
}

View File

@ -1,17 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\Dhl\Data;
class CreationState
{
public string $sequenceNumber;
public ?string $shipmentNumber;
public ?string $returnShipmentNumber;
public LabelData $LabelData;
}

View File

@ -1,20 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\Dhl\Data;
class Customer
{
public Name $Name;
public ?string $vatID;
public string $EKP;
public NativeAddress $Address;
public Contact $Contact;
public ?Bank $Bank;
public ?string $note;
}

View File

@ -1,15 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\Dhl\Data;
class DeleteShipmentOrderRequest
{
public Version $Version;
public string $shipmentNumber;
}

View File

@ -1,16 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\Dhl\Data;
class DeleteShipmentOrderResponse
{
public Version $Version;
public Statusinformation $Status;
public ?DeletionState $DeletionState;
}

View File

@ -1,15 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\Dhl\Data;
class DeletionState
{
public string $shipmentNumber;
public Statusinformation $Status;
}

View File

@ -1,18 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\Dhl\Data;
class DeliveryAddress
{
public ?NativeAddress $NativeAddress;
public ?Postfiliale $PostOffice;
public ?PackStation $PackStation;
public ?string $streetNameCode;
public ?string $streetNumberCode;
}

View File

@ -1,17 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\Dhl\Data;
class Dimension
{
public int $length;
public int $width;
public int $height;
public ?string $unit;
}

View File

@ -1,19 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\Dhl\Data;
class ExportDocPosition
{
public string $description;
public string $countryCodeOrigin;
public string $customsTariffNumber;
public int $amount;
public float $netWeightInKG;
public float $customsValue;
}

View File

@ -1,40 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\Dhl\Data;
class ExportDocument
{
const TYPE_PRESENT = 'PRESENT';
const TYPE_DOCUMENT = 'DOCUMENT';
const TYPE_COMMERCIAL_GOODS = 'COMMERCIAL_GOODS';
const TYPE_COMMERCIAL_SAMPLE = 'COMMERCIAL_SAMPLE';
const TYPE_RETURN_OF_GOODS= 'RETURN_OF_GOODS';
const TYPE_OTHER = 'OTHER';
const TERMS_DDP = 'DDP';
const TERMS_DXV = 'DXV';
const TERMS_DAP = 'DAP';
const TERMS_DDX = 'DDX';
const TERMS_CPT = 'CPT';
public ?string $invoiceNumber;
public string $exportType;
public ?string $exportTypeDescription;
public ?string $termsOfTrade;
public string $placeOfCommital;
public ?float $additionalFee;
public ?string $customsCurrency;
public ?string $permitNumber;
public ?string $attestationNumber;
public ?string $addresseesCustomsReference;
public ?string $sendersCustomsReference;
public ?bool $WithElectronicExportNtfctn;
/** @var ExportDocPosition[] $ExportDocPosition */
public array $ExportDocPosition;
}

View File

@ -1,23 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\Dhl\Data;
class LabelData
{
public Statusinformation $Status;
public ?string $shipmentNumber;
public ?string $labelUrl;
public ?string $labelData;
public ?string $returnLabelUrl;
public ?string $returnLabelData;
public ?string $exportLabelUrl;
public ?string $exportLabelData;
public ?string $codLabelUrl;
public ?string $codLabelData;
}

View File

@ -1,16 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\Dhl\Data;
class Name
{
public string $name1;
public ?string $name2;
public ?string $name3;
}

View File

@ -1,25 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\Dhl\Data;
class NativeAddress
{
public string $streetName;
public ?string $streetNumber;
/**
* @var string[]
*/
public array $addressAddition;
public ?string $dispatchingInformation;
public string $zip;
public string $city;
public ?string $province;
public ?Country $Origin;
}

View File

@ -1,18 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\Dhl\Data;
class NativeAddressNew
{
public string $streetName;
public ?string $streetNumber;
public string $zip;
public string $city;
public ?Country $Origin;
}

View File

@ -1,19 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\Dhl\Data;
class PackStation
{
public string $postNumber;
public string $packstationNumber;
public string $zip;
public string $city;
public ?string $province;
public ?Country $Origin;
}

View File

@ -1,18 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\Dhl\Data;
class Postfiliale
{
public string $postfilialeNumber;
public string $postNumber;
public string $zip;
public string $city;
public ?Country $Origin;
}

View File

@ -1,18 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\Dhl\Data;
class Receiver
{
public string $name1;
public ?ReceiverNativeAddress $Address;
public ?PackStation $Packstation;
public ?Postfiliale $Postfiliale;
public ?Communication $Communication;
}

View File

@ -1,23 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\Dhl\Data;
class ReceiverNativeAddress
{
public ?string $name2;
public ?string $name3;
public string $streetName;
public ?string $streetNumber;
public array|string|null $addressAddition;
public ?string $dispatchingInformation;
public string $zip;
public string $city;
public ?string $province;
public ?Country $Origin;
}

View File

@ -1,28 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\Dhl\Data;
class Shipment
{
public ShipmentDetails $ShipmentDetails;
public Shipper $Shipper;
public string $ShipperReference;
public Receiver $Receiver;
public ?Shipper $ReturnReceiver;
public ?ExportDocument $ExportDocument;
public ?string $feederSystem;
public function __construct()
{
$this->ShipmentDetails = new ShipmentDetails();
$this->Shipper = new Shipper();
$this->ShipperReference = '';
$this->Receiver = new Receiver();
}
}

View File

@ -1,34 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\Dhl\Data;
use DateTimeImmutable;
class ShipmentDetails
{
public string $product;
public string $accountNumber;
public string $customerReference;
private string $shipmentDate;
public string $costCentre;
public string $returnShipmentAccountNumber;
public string $returnShipmentReference;
public ShipmentItem $ShipmentItem;
public ShipmentService $Service;
public ShipmentNotification $Notification;
public Bank $BankData;
public function SetShipmentDate(DateTimeImmutable $date): void {
$this->shipmentDate = $date->format('Y-m-d');
}
public function GetShipmentDate(): DateTimeImmutable {
return DateTimeImmutable::createFromFormat('Y-m-d', $this->shipmentDate);
}
}

View File

@ -1,17 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\Dhl\Data;
class ShipmentItem
{
public float $weightInKG;
public ?int $lengthInCM;
public ?int $widthInCM;
public ?int $heightInCM;
}

View File

@ -1,15 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\Dhl\Data;
class ShipmentNotification
{
public string $recipientEmailAddress;
public ?string $templateId;
}

View File

@ -1,16 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\Dhl\Data;
class ShipmentOrder
{
public string $sequenceNumber;
public Shipment $Shipment;
public ?Serviceconfiguration $PrintOnlyIfCodeable;
}

View File

@ -1,13 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\Dhl\Data;
class ShipmentService
{
}

View File

@ -1,22 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\Dhl\Data;
class Shipper
{
public Name $Name;
public NativeAddressNew $Address;
public ?Communication $Communication;
public function __construct()
{
$this->Name = new Name();
$this->Address = new NativeAddressNew();
}
}

View File

@ -1,15 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\Dhl\Data;
class Status
{
public string $statuscode;
public string $statusDescription;
}

View File

@ -1,15 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\Dhl\Data;
class StatusElement
{
public string $statusElement;
public string $statusMessage;
}

View File

@ -1,19 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\Dhl\Data;
class Statusinformation
{
public int $statusCode;
public string $statusText;
public array|string $statusMessage;
public string $statusType;
public StatusElement $errorMessage;
public StatusElement $warningMessage;
}

View File

@ -1,16 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\Dhl\Data;
class Version
{
public string $majorRelease;
public string $minorRelease;
public ?string $build;
}

View File

@ -1,76 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\Dhl;
use SoapClient;
use SoapHeader;
use Xentral\Carrier\Dhl\Data\CreateShipmentOrderRequest;
use Xentral\Carrier\Dhl\Data\CreateShipmentOrderResponse;
use Xentral\Carrier\Dhl\Data\CreationState;
use Xentral\Carrier\Dhl\Data\LabelData;
use Xentral\Carrier\Dhl\Data\Shipment;
use Xentral\Carrier\Dhl\Data\ShipmentOrder;
use Xentral\Carrier\Dhl\Data\Statusinformation;
use Xentral\Carrier\Dhl\Data\Version;
class DhlApi
{
private SoapClient $soapClient;
private const SANDBOX_URL = 'https://cig.dhl.de/services/sandbox/soap';
private const PRODUCTION_URL = 'https://cig.dhl.de/services/production/soap';
private const NAMESPACE_CIS = 'http://dhl.de/webservice/cisbase';
public function __construct(string $user, string $signature)
{
$this->soapClient = new SoapClient(__DIR__ . '/Wsdl/geschaeftskundenversand-api-3.4.0.wsdl', [
'login' => 'OpenXE_1',
'password' => 'cjzNEpGXxbbnRwcYLISX3ZTTcQrQrz',
'location' => self::PRODUCTION_URL,
'trace' => 1,
'connection_timeout' => 30,
'classmap' => [
'CreateShipmentOrderResponse' => CreateShipmentOrderResponse::class,
'CreationState' => CreationState::class,
'LabelData' => LabelData::class,
'Statusinformation' => Statusinformation::class,
'Version' => Version::class,
]
]);
$authHeader = new SoapHeader(self::NAMESPACE_CIS, 'Authentification', [
'user' => $user,
'signature' => $signature
]);
$this->soapClient->__setSoapHeaders($authHeader);
}
public function CreateShipment(Shipment $shipment): CreateShipmentOrderResponse|string
{
$request = new CreateShipmentOrderRequest();
$request->Version = $this->getVersion();
$request->ShipmentOrder = new ShipmentOrder();
$request->ShipmentOrder->Shipment = $shipment;
$request->ShipmentOrder->sequenceNumber = '1';
$request->labelResponseType = "B64";
try {
$response = $this->soapClient->createShipmentOrder($request);
return $response;
} catch (\SoapFault $e) {
return $e->getMessage();
}
}
private function getVersion() {
$version = new Version();
$version->majorRelease = '3';
$version->minorRelease = '4';
return $version;
}
}

View File

@ -1,340 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Version: 3.4.0
Date: 2022-08-01T22:00:51Z
--><wsdl:definitions xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:cis="http://dhl.de/webservice/cisbase"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:bcs="http://dhl.de/webservices/businesscustomershipping/3.0"
targetNamespace="http://dhl.de/webservices/businesscustomershipping/3.0">
<wsdl:types>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified">
<xs:import namespace="http://dhl.de/webservice/cisbase"
schemaLocation="geschaeftskundenversand-api-3.4.0-schema-cis_base.xsd"/>
<xs:import namespace="http://dhl.de/webservices/businesscustomershipping/3.0"
schemaLocation="geschaeftskundenversand-api-3.4.0-schema-bcs_base.xsd"/>
</xs:schema>
</wsdl:types>
<wsdl:message name="AuthentificationHeaderMessage">
<wsdl:documentation>The authentication data.</wsdl:documentation>
<wsdl:part name="header" element="cis:Authentification"/>
</wsdl:message>
<wsdl:message name="createShipmentOrderMessage">
<wsdl:documentation>The shipmentdata for creating a shipment.</wsdl:documentation>
<wsdl:part name="part1" element="bcs:CreateShipmentOrderRequest"> </wsdl:part>
</wsdl:message>
<wsdl:message name="createShipmentOrderResponseMessage">
<wsdl:documentation>The status of the createShipment operation and the identifier for the
shipment.</wsdl:documentation>
<wsdl:part name="part1" element="bcs:CreateShipmentOrderResponse"> </wsdl:part>
</wsdl:message>
<wsdl:message name="validateShipmentMessage">
<wsdl:documentation>The shipmentdata for validating a shipment.</wsdl:documentation>
<wsdl:part name="part1" element="bcs:ValidateShipmentOrderRequest"> </wsdl:part>
</wsdl:message>
<wsdl:message name="validateShipmentResponseMessage">
<wsdl:documentation>The status of the validateShipment operation and the identifier for the
shipment.</wsdl:documentation>
<wsdl:part name="part1" element="bcs:ValidateShipmentResponse"> </wsdl:part>
</wsdl:message>
<wsdl:message name="deleteShipmentOrderMessage">
<wsdl:documentation>The identifier for the shipment which should be
deleted.</wsdl:documentation>
<wsdl:part name="part1" element="bcs:DeleteShipmentOrderRequest"> </wsdl:part>
</wsdl:message>
<wsdl:message name="deleteShipmentOrderResponseMessage">
<wsdl:documentation>The status of the deletion operation.</wsdl:documentation>
<wsdl:part name="part1" element="bcs:DeleteShipmentOrderResponse"> </wsdl:part>
</wsdl:message>
<wsdl:message name="doManifestMessage">
<wsdl:documentation>The identifier for the shipment which should be
manifested.</wsdl:documentation>
<wsdl:part name="part1" element="bcs:DoManifestRequest"> </wsdl:part>
</wsdl:message>
<wsdl:message name="doManifestResponseMessage">
<wsdl:documentation>The status of the manifest operation.</wsdl:documentation>
<wsdl:part name="part1" element="bcs:DoManifestResponse"> </wsdl:part>
</wsdl:message>
<wsdl:message name="getLabelMessage">
<wsdl:documentation>The identifier for the DD shipment for which the label url is
requested.</wsdl:documentation>
<wsdl:part name="part1" element="bcs:GetLabelRequest"> </wsdl:part>
</wsdl:message>
<wsdl:message name="getLabelResponseMessage">
<wsdl:documentation>The status of the operation and the label url (if
available).</wsdl:documentation>
<wsdl:part name="part1" element="bcs:GetLabelResponse"> </wsdl:part>
</wsdl:message>
<wsdl:message name="getVersionRequestMessage">
<wsdl:documentation>The version of webservice implementation.</wsdl:documentation>
<wsdl:part name="part1" element="bcs:Version"> </wsdl:part>
</wsdl:message>
<wsdl:message name="getVersionResponseMessage">
<wsdl:documentation>The version of webservice implementation.</wsdl:documentation>
<wsdl:part name="part1" element="bcs:GetVersionResponse"> </wsdl:part>
</wsdl:message>
<wsdl:message name="getExportDocMessage">
<wsdl:documentation>The identifier for the DD shipment for which the label url is
requested.</wsdl:documentation>
<wsdl:part name="part1" element="bcs:GetExportDocRequest"> </wsdl:part>
</wsdl:message>
<wsdl:message name="getExportDocResponseMessage">
<wsdl:documentation>The status of the operation and the label url (if
available).</wsdl:documentation>
<wsdl:part name="part1" element="bcs:GetExportDocResponse"> </wsdl:part>
</wsdl:message>
<wsdl:message name="getManifestRequestMessage">
<wsdl:documentation>Request a manifest of the given date / date range.</wsdl:documentation>
<wsdl:part name="part1" element="bcs:GetManifestRequest"> </wsdl:part>
</wsdl:message>
<wsdl:message name="getManifestResponseMessage">
<wsdl:documentation>The status of the operation and the manifest url (if
available).</wsdl:documentation>
<wsdl:part name="part1" element="bcs:GetManifestResponse"> </wsdl:part>
</wsdl:message>
<wsdl:message name="updateShipmentOrderRequestMessage">
<wsdl:documentation>Request a manifest of the given date / date range.</wsdl:documentation>
<wsdl:part name="part1" element="bcs:UpdateShipmentOrderRequest"> </wsdl:part>
</wsdl:message>
<wsdl:message name="updateShipmentOrderResponseMessage">
<wsdl:documentation>The status of the operation and the manifest url (if
available).</wsdl:documentation>
<wsdl:part name="part1" element="bcs:UpdateShipmentOrderResponse"> </wsdl:part>
</wsdl:message>
<wsdl:message name="readShipmentOrderResponseMessage">
<wsdl:documentation>The status of the operation and the manifest url (if
available).</wsdl:documentation>
<wsdl:part name="part1" element="bcs:ReadShipmentOrderResponse"> </wsdl:part>
</wsdl:message>
<wsdl:portType name="GKV3XAPIServicePortType">
<wsdl:operation name="createShipmentOrder">
<wsdl:documentation>Creates shipments.</wsdl:documentation>
<wsdl:input message="bcs:createShipmentOrderMessage">
<wsdl:documentation>The shipment data.</wsdl:documentation>
</wsdl:input>
<wsdl:output message="bcs:createShipmentOrderResponseMessage">
<wsdl:documentation>The status of the createShipment operation and the identifier for the
shipment.</wsdl:documentation>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="validateShipment">
<wsdl:documentation>Creates shipments.</wsdl:documentation>
<wsdl:input message="bcs:validateShipmentMessage">
<wsdl:documentation>The shipment data.</wsdl:documentation>
</wsdl:input>
<wsdl:output message="bcs:validateShipmentResponseMessage">
<wsdl:documentation>The status of the validateShipment operation and the identifier for the
shipment.</wsdl:documentation>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="deleteShipmentOrder">
<wsdl:documentation>Deletes the requested shipments.</wsdl:documentation>
<wsdl:input message="bcs:deleteShipmentOrderMessage">
<wsdl:documentation>The identifier for the shipment which should be
deleted.</wsdl:documentation>
</wsdl:input>
<wsdl:output message="bcs:deleteShipmentOrderResponseMessage">
<wsdl:documentation>The status of the deletion operation.</wsdl:documentation>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="doManifest">
<wsdl:documentation>Manifest the requested DD shipments.</wsdl:documentation>
<wsdl:input message="bcs:doManifestMessage">
<wsdl:documentation>The identifier for the shipment which should be
manifested.</wsdl:documentation>
</wsdl:input>
<wsdl:output message="bcs:doManifestResponseMessage">
<wsdl:documentation>The status of the manifest operation.</wsdl:documentation>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getLabel">
<wsdl:documentation>Returns the request-url for getting a label.</wsdl:documentation>
<wsdl:input message="bcs:getLabelMessage">
<wsdl:documentation>The identifier for the shipment for which the label url is
requested.</wsdl:documentation>
</wsdl:input>
<wsdl:output message="bcs:getLabelResponseMessage">
<wsdl:documentation>The status of the operation and the label url (if
available).</wsdl:documentation>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getVersion">
<wsdl:documentation>Returns the actual version of the implementation of the whole ISService
webservice.</wsdl:documentation>
<wsdl:input message="bcs:getVersionRequestMessage"/>
<wsdl:output message="bcs:getVersionResponseMessage">
<wsdl:documentation>The version of webservice implementation.</wsdl:documentation>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getExportDoc">
<wsdl:documentation>Returns the request-url for getting a export
document.</wsdl:documentation>
<wsdl:input message="bcs:getExportDocMessage">
<wsdl:documentation>The identifier for the shipment for which the export document url is
requested.</wsdl:documentation>
</wsdl:input>
<wsdl:output message="bcs:getExportDocResponseMessage">
<wsdl:documentation>The status of the operation and the export document url (if
available).</wsdl:documentation>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getManifest">
<wsdl:documentation>Request the manifest.</wsdl:documentation>
<wsdl:input message="bcs:getManifestRequestMessage">
<wsdl:documentation>The request data.</wsdl:documentation>
</wsdl:input>
<wsdl:output message="bcs:getManifestResponseMessage">
<wsdl:documentation>The status of the getManifest operation and the manifest
url.</wsdl:documentation>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="updateShipmentOrder">
<wsdl:documentation>Updates a shipment order.</wsdl:documentation>
<wsdl:input message="bcs:updateShipmentOrderRequestMessage">
<wsdl:documentation>The shipment data.</wsdl:documentation>
</wsdl:input>
<wsdl:output message="bcs:updateShipmentOrderResponseMessage">
<wsdl:documentation>The status of the updateShipment operation and the identifier for the
shipment.</wsdl:documentation>
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="GKV3XAPISOAP11Binding" type="bcs:GKV3XAPIServicePortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="createShipmentOrder">
<wsdl:documentation>Creates shipments.</wsdl:documentation>
<soap:operation soapAction="urn:createShipmentOrder" style="document"/>
<wsdl:input>
<wsdl:documentation>The authentication data and the shipment data.</wsdl:documentation>
<soap:header message="bcs:AuthentificationHeaderMessage" part="header" use="literal"/>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<wsdl:documentation>The status of the operation and the shipment
identifier.</wsdl:documentation>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="validateShipment">
<wsdl:documentation>Validates shipments.</wsdl:documentation>
<soap:operation soapAction="urn:validateShipment" style="document"/>
<wsdl:input>
<wsdl:documentation>The authentication data and the shipment data.</wsdl:documentation>
<soap:header message="bcs:AuthentificationHeaderMessage" part="header" use="literal"/>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<wsdl:documentation>The status of the operation and the shipment
identifier.</wsdl:documentation>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="deleteShipmentOrder">
<wsdl:documentation>Deletes the requested shipments.</wsdl:documentation>
<soap:operation soapAction="urn:deleteShipmentOrder" style="document"/>
<wsdl:input>
<wsdl:documentation>The authentication data and the shipment
identifier.</wsdl:documentation>
<soap:header message="bcs:AuthentificationHeaderMessage" part="header" use="literal"/>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<wsdl:documentation>The status of the operation.</wsdl:documentation>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="doManifest">
<wsdl:documentation>Manifest the requested shipments.</wsdl:documentation>
<soap:operation soapAction="urn:doManifest" style="document"/>
<wsdl:input>
<wsdl:documentation>The authentication data and the shipment
identifier.</wsdl:documentation>
<soap:header message="bcs:AuthentificationHeaderMessage" part="header" use="literal"/>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<wsdl:documentation>The status of the operation.</wsdl:documentation>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getLabel">
<wsdl:documentation>Returns the request-url for getting a label.</wsdl:documentation>
<soap:operation soapAction="urn:getLabel" style="document"/>
<wsdl:input>
<wsdl:documentation>The authentication data and the shipment
identifier.</wsdl:documentation>
<soap:header message="bcs:AuthentificationHeaderMessage" part="header" use="literal"/>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<wsdl:documentation>The status of the operation and the url for requesting the
label.</wsdl:documentation>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getVersion">
<wsdl:documentation>Returns the actual version of the implementation of the whole ISService
webservice.</wsdl:documentation>
<soap:operation soapAction="urn:getVersion" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<wsdl:documentation>The version of the implementation.</wsdl:documentation>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getExportDoc">
<wsdl:documentation>Returns the request-url for getting a export
document.</wsdl:documentation>
<soap:operation soapAction="urn:getExportDoc" style="document"/>
<wsdl:input>
<wsdl:documentation>The authentication data and the shipment
identifier.</wsdl:documentation>
<soap:header message="bcs:AuthentificationHeaderMessage" part="header" use="literal"/>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<wsdl:documentation>The status of the operation and the url for requesting the export
document.</wsdl:documentation>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getManifest">
<wsdl:documentation>Requests the manifest.</wsdl:documentation>
<soap:operation soapAction="urn:getManifest" style="document"/>
<wsdl:input>
<wsdl:documentation>The authentication data and the shipment data.</wsdl:documentation>
<soap:header message="bcs:AuthentificationHeaderMessage" part="header" use="literal"/>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<wsdl:documentation>The status of the operation and the manifest url.</wsdl:documentation>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="updateShipmentOrder">
<wsdl:documentation>Updates a shipment order.</wsdl:documentation>
<soap:operation soapAction="urn:updateShipmentOrder" style="document"/>
<wsdl:input>
<wsdl:documentation>The authentication data and the shipment data.</wsdl:documentation>
<soap:header message="bcs:AuthentificationHeaderMessage" part="header" use="literal"/>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<wsdl:documentation>The status of the operation</wsdl:documentation>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="GVAPI_2_0_de">
<wsdl:port name="GKVAPISOAP11port0" binding="bcs:GKV3XAPISOAP11Binding">
<soap:address location="https://cig.dhl.de/services/production/soap"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

View File

@ -1,31 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\SendCloud\Data;
class Document
{
public const TYPE_LABEL = 'label';
public const TYPE_CP71 = 'cp71';
public const TYPE_CN23 = 'cn23';
public const TYPE_CN23_DEFAULT = 'cn23-default';
public const TYPE_COMMERCIAL_INVOICE = 'commercial-invoice';
public string $Type;
public string $Size;
public string $Link;
public static function fromApiResponse(object $data): Document
{
$obj = new Document();
$obj->Type = $data->type;
$obj->Size = $data->size;
$obj->Link = $data->link;
return $obj;
}
}

View File

@ -1,42 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\SendCloud\Data;
abstract class ParcelBase
{
public ?string $Name = null;
public ?string $CompanyName = null;
public ?string $Address = null;
public ?string $Address2 = null;
public ?string $HouseNumber = null;
public ?string $City = null;
public ?string $PostalCode = null;
public ?string $Telephone = null;
public bool $RequestLabel = true;
public ?string $EMail = null;
public ?string $Country = null;
public ?int $ShippingMethodId = null;
/**
* @var ?int weight in grams
*/
public ?int $Weight = null;
public ?string $OrderNumber = null;
public ?string $TotalOrderValueCurrency = null;
public ?float $TotalOrderValue = null;
public ?string $CountryState = null;
public ?string $CustomsInvoiceNr = null;
public ?int $CustomsShipmentType = null;
public ?string $ExternalReference = null;
public ?int $TotalInsuredValue = null;
public ?array $ParcelItems = array();
public bool $IsReturn = false;
public ?string $Length = null;
public ?string $Width = null;
public ?string $Height = null;
}

View File

@ -1,51 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\SendCloud\Data;
class ParcelCreation extends ParcelBase
{
public ?int $SenderAddressId = null;
public function toApiRequest(): array
{
$data = [
'name' => $this->Name,
'company_name' => $this->CompanyName,
'address' => $this->Address,
'address_2' => $this->Address2,
'house_number' => $this->HouseNumber,
'city' => $this->City,
'postal_code' => $this->PostalCode,
'telephone' => $this->Telephone,
'request_label' => $this->RequestLabel,
'email' => $this->EMail,
'country' => $this->Country,
'shipment' => ['id' => $this->ShippingMethodId],
'weight' => number_format($this->Weight / 1000, 3, '.', null),
'order_number' => $this->OrderNumber,
'total_order_value_currency' => $this->TotalOrderValueCurrency,
'total_order_value' => number_format($this->TotalOrderValue, 2, '.', null),
'country_state' => $this->CountryState,
'sender_address' => $this->SenderAddressId,
'external_reference' => $this->ExternalReference,
'total_insured_value' => $this->TotalInsuredValue ?? 0,
'parcel_items' => array_map(fn(ParcelItem $item) => $item->toApiRequest(), $this->ParcelItems),
'is_return' => $this->IsReturn,
'length' => $this->Length,
'width' => $this->Width,
'height' => $this->Height,
];
if ($this->CustomsInvoiceNr !== null)
$data['customs_invoice_nr'] = $this->CustomsInvoiceNr;
if ($this->CustomsShipmentType !== null)
$data['customs_shipment_type'] = $this->CustomsShipmentType;
return $data;
}
}

View File

@ -1,16 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\SendCloud\Data;
class ParcelCreationError
{
public int $Code;
public string $Message;
public string $Request;
}

View File

@ -1,52 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\SendCloud\Data;
class ParcelItem
{
public string $HsCode;
/**
* @var int weight in grams
*/
public int $Weight;
public int $Quantity;
public string $Description;
public string $OriginCountry;
public float $Price;
public ?string $Sku = null;
public ?string $ProductId = null;
public function toApiRequest(): array {
return [
'hs_code' => $this->HsCode,
'weight' => number_format($this->Weight / 1000, 3, '.', null),
'quantity' => $this->Quantity,
'description' => $this->Description,
'value' => $this->Price,
'origin_country' => $this->OriginCountry,
'sku' => $this->Sku ?? '',
'product_id' => $this->ProductId ?? '',
];
}
public static function fromApiResponse(object $data): ParcelItem
{
$obj = new ParcelItem();
$obj->HsCode = $data->hs_code;
$obj->Weight = intval(floatval($data->weight)*1000);
$obj->Quantity = $data->quantity;
$obj->Description = $data->description;
$obj->Price = $data->value;
$obj->OriginCountry = $data->origin_country;
$obj->Sku = $data->sku;
$obj->ProductId = $data->product_id;
return $obj;
}
}

View File

@ -1,82 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\SendCloud\Data;
use DateTimeImmutable;
use Exception;
class ParcelResponse extends ParcelBase
{
public int $Id;
public string $CarrierCode;
public DateTimeImmutable $DateCreated;
public DateTimeImmutable $DateUpdated;
public DateTimeImmutable $DateAnnounced;
public string $ShipmentMethodName;
public int $StatusId;
public string $StatusMessage;
public array $Documents;
public ?string $TrackingNumber = null;
public ?string $TrackingUrl = null;
public ?array $Errors;
public function GetDocumentByType(string $type): ?Document
{
/** @var Document $item */
foreach ($this->Documents as $item)
if ($item->Type == $type)
return $item;
return null;
}
/**
* @throws Exception
*/
public static function fromApiResponse(object $data): ParcelResponse
{
$obj = new ParcelResponse();
$obj->Address = $data->address_divided->street;
$obj->Address2 = $data->address_2;
$obj->HouseNumber = $data->address_divided->house_number;
$obj->CarrierCode = $data->carrier->code;
$obj->City = $data->city;
$obj->CompanyName = $data->company_name;
$obj->Country = $data->country->iso_2;
$obj->CustomsInvoiceNr = $data->customs_invoice_nr;
$obj->CustomsShipmentType = $data->customs_shipment_type;
$obj->DateCreated = new DateTimeImmutable($data->date_created);
$obj->DateUpdated = new DateTimeImmutable($data->date_updated);
$obj->DateAnnounced = new DateTimeImmutable($data->date_announced);
$obj->EMail = $data->email;
$obj->Id = $data->id;
$obj->Name = $data->name;
$obj->OrderNumber = $data->order_number;
$obj->ParcelItems = array_map(fn($item)=>ParcelItem::fromApiResponse($item), $data->parcel_items);
$obj->PostalCode = $data->postal_code;
$obj->ExternalReference = $data->external_reference;
$obj->ShippingMethodId = $data->shipment->id;
$obj->ShipmentMethodName = $data->shipment->name;
$obj->StatusId = $data->status->id;
$obj->StatusMessage = $data->status->message;
$obj->Documents = array_map(fn($item)=>Document::fromApiResponse($item), $data->documents);
$obj->Telephone = $data->telephone;
$obj->TotalInsuredValue = $data->total_insured_value;
$obj->TotalOrderValue = $data->total_order_value;
$obj->TotalOrderValueCurrency = $data->total_order_value_currency;
$obj->TrackingNumber = $data->tracking_number;
$obj->TrackingUrl = $data->tracking_url;
$obj->Weight = $data->weight;
$obj->Length = $data->length;
$obj->Height = $data->height;
$obj->Width = $data->width;
$obj->IsReturn = $data->is_return;
$obj->Errors = $data->errors->non_field_errors;
return $obj;
}
}

View File

@ -1,59 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\SendCloud\Data;
class SenderAddress {
public ?string $City;
public ?string $CompanyName;
public ?string $ContactName;
public string $Country;
public ?string $CountryState;
public ?string $Email;
public ?string $HouseNumber;
public int $Id;
public ?string $PostalBox;
public ?string $PostalCode;
public ?string $Street;
public ?string $Telephone;
public ?string $VatNumber;
public ?string $EoriNumber;
public int $BrandId;
public ?string $Label;
public ?string $SignatureFullName;
public ?string $SignatureInitials;
public function __toString(): string
{
return "$this->CompanyName; $this->ContactName; $this->Street $this->HouseNumber; $this->PostalCode; $this->City";
}
public static function fromApiResponse(object $data): SenderAddress {
$obj = new SenderAddress();
$obj->City = $data->city;
$obj->CompanyName = $data->company_name;
$obj->ContactName = $data->contact_name;
$obj->Country = $data->country;
$obj->CountryState = $data->country_state;
$obj->Email = $data->email;
$obj->HouseNumber = $data->house_number;
$obj->Id = $data->id;
$obj->PostalBox = $data->postal_box;
$obj->PostalCode = $data->postal_code;
$obj->Street = $data->street;
$obj->Telephone = $data->telephone;
$obj->VatNumber = $data->vat_number;
$obj->EoriNumber = $data->eori_number;
$obj->BrandId = $data->brand_id;
$obj->Label = $data->label;
$obj->SignatureFullName = $data->signature_full_name;
$obj->SignatureInitials = $data->signature_initials;
return $obj;
}
}

View File

@ -1,35 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\SendCloud\Data;
class ShippingMethod {
public int $Id;
public string $Name;
public ?string $Carrier;
public int $MinWeight;
public int $MaxWeight;
public int $MaxLength;
public int $MaxWidth;
public int $MaxHeight;
public string $Unit;
public static function fromApiResponse(object $data):ShippingMethod {
$obj = new ShippingMethod();
$obj->Id = $data->id;
$obj->Name = $data->name;
$obj->Carrier = $data->carrier ?? null;
$obj->MinWeight = $data->properties->min_weight;
$obj->MaxWeight = $data->properties->max_weight;
$obj->MaxLength = $data->properties->max_dimensions->length;
$obj->MaxWidth = $data->properties->max_dimensions->width;
$obj->MaxHeight = $data->properties->max_dimensions->height;
$obj->Unit = $data->properties->max_dimensions->unit;
return $obj;
}
}

View File

@ -1,35 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\SendCloud\Data;
class ShippingProduct {
public string $Name;
public string $Carrier;
public string $ServicePointsCarrier;
public string $Code;
public int $MinWeight;
public int $MaxWeight;
public array $ShippingMethods;
public static function fromApiResponse(object $data): ShippingProduct {
$obj = new ShippingProduct();
$obj->Name = $data->name;
$obj->Carrier = $data->carrier;
$obj->ServicePointsCarrier = $data->service_points_carrier;
$obj->Code = $data->code;
$obj->MinWeight = $data->weight_range->min_weight;
$obj->MaxWeight = $data->weight_range->max_weight;
foreach ($data->methods as $method) {
$child = ShippingMethod::fromApiResponse($method);
$child->Carrier = $obj->Carrier;
$obj->ShippingMethods[] = $child;
}
return $obj;
}
}

View File

@ -1,163 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\SendCloud;
use Exception;
use Xentral\Carrier\SendCloud\Data\Document;
use Xentral\Carrier\SendCloud\Data\ParcelCreation;
use Xentral\Carrier\SendCloud\Data\ParcelResponse;
use Xentral\Carrier\SendCloud\Data\SenderAddress;
use Xentral\Carrier\SendCloud\Data\ShippingProduct;
class SendCloudApi
{
/**
* @var ?string $public_key
*/
protected ?string $public_key;
/**
* @var ?string $private_key
*/
protected ?string $private_key;
const PROD_BASE_URI = 'https://panel.sendcloud.sc/api/v2';
public function __construct($public_key, $private_key)
{
$this->public_key = $public_key;
$this->private_key = $private_key;
}
/**
* @throws SendcloudApiException
*/
public function GetSenderAddresses(): array
{
$uri = self::PROD_BASE_URI . '/user/addresses/sender';
$response = $this->sendRequest($uri);
foreach ($response['body']->sender_addresses as $item)
$res[] = SenderAddress::fromApiResponse($item);
return $res ?? [];
}
/**
* @throws SendcloudApiException
*/
public function GetShippingProducts(string $sourceCountry, ?string $targetCountry = null, ?int $weight = null,
?int $height = null, ?int $length = null, ?int $width = null): array
{
$uri = self::PROD_BASE_URI . '/shipping-products';
$params = ['from_country' => $sourceCountry];
if ($targetCountry !== null)
$params['to_country'] = $targetCountry;
if ($weight !== null && $weight > 0)
$params['weight'] = $weight;
if ($height !== null && $height > 0) {
$params['height'] = $height;
$params['height_unit'] = 'centimeter';
}
if ($length !== null && $length > 0) {
$params['length'] = $length;
$params['length_unit'] = 'centimeter';
}
if ($width !== null && $width > 0) {
$params['width'] = $width;
$params['width_unit'] = 'centimeter';
}
$response = $this->sendRequest($uri, $params);
return array_map(fn($x) => ShippingProduct::fromApiResponse($x), $response['body'] ?? []);
}
/**
* @throws SendcloudApiException
*/
public function CreateParcel(ParcelCreation $parcel): ParcelResponse|string|null
{
$uri = self::PROD_BASE_URI . '/parcels';
$response = $this->sendRequest($uri, null, true, ['parcel' => $parcel->toApiRequest()], [200,400]);
switch ($response['code']) {
case 200:
if (isset($response['body']->parcel))
try {
return ParcelResponse::fromApiResponse($response['body']->parcel);
} catch (Exception $e) {
throw new SendcloudApiException(previous: $e);
}
break;
case 400:
if (isset($response->error))
return $response->error->message;
break;
}
throw SendcloudApiException::fromResponse($response);
}
/**
* @throws SendcloudApiException
*/
public function DownloadDocument(Document $document): string
{
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $document->Link,
CURLOPT_HTTPHEADER => [
"Authorization: Basic " . base64_encode($this->public_key . ':' . $this->private_key)
],
]);
$output = curl_exec($curl);
$code = curl_getinfo($curl, CURLINFO_RESPONSE_CODE);
if ($code != 200)
throw SendcloudApiException::fromResponse(['code' => $code, 'body' => $output]);
return $output;
}
/**
* @throws SendcloudApiException
*/
function sendRequest(string $uri, array $query_params = null, bool $post = false, array $postFields = null,
array $allowedResponseCodes = [200]): ?array
{
if (empty($this->public_key) || empty($this->private_key))
return null;
$curl = curl_init();
if (is_array($query_params)) {
$uri .= '?' . http_build_query($query_params);
}
curl_setopt_array($curl, [
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $uri,
CURLOPT_HTTPHEADER => [
"Authorization: Basic " . base64_encode($this->public_key . ':' . $this->private_key),
'Content-Type: application/json'
],
]);
if ($post === true) {
curl_setopt_array($curl, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($postFields)
]);
}
$output = json_decode(curl_exec($curl));
$code = curl_getinfo($curl, CURLINFO_RESPONSE_CODE);
curl_close($curl);
$ret = [
'code' => $code,
'body' => $output,
];
if (!in_array($code, $allowedResponseCodes))
throw SendcloudApiException::fromResponse($ret);
return $ret;
}
}

View File

@ -1,24 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Xentral\Carrier\SendCloud;
use Exception;
class SendcloudApiException extends Exception
{
public static function fromResponse(array $response) : SendcloudApiException {
if (!isset($response['body']) || !is_object($response['body']))
return new SendcloudApiException(print_r($response,true));
return new SendcloudApiException(
print_r($response['body'],true),
$response['code']
);
}
}

View File

@ -66,7 +66,7 @@ final class DatabaseLogHandler extends AbstractLogHandler
$sql = 'INSERT INTO `log`
(`log_time`, `level`, `message`, `class`, `method`, `line`, `origin_type`, `origin_detail`, `dump`)
VALUES
(NOW(3), :level, :message, :class, :method, :line, :origin_type, :origin_detail, :dump)';
(NOW(), :level, :message, :class, :method, :line, :origin_type, :origin_detail, :dump)';
$this->db->perform($sql, $values);
}
}

View File

@ -128,7 +128,7 @@ final class ImapMailClient implements MailClientInterface
$message = $this->imap->getMessage($msgNumber);
} catch (Exception $e) {
throw new MessageNotFoundException(
sprintf("Message number %s could not be fetched.\n\r%s", $msgNumber,print_r($e,true))
sprintf('Message number %s not found.', $msgNumber)
);
}

View File

@ -51,99 +51,44 @@ class MailAttachmentData implements MailAttachmentInterface
$this->cid = $cid;
}
/*
Check the type of Attachment
Possible results: application/octet-stream, attachment, inline
*/
public static function getAttachmentPartType(MailMessagePartInterface $part): ?string {
if (!$part->isMultipart()) {
$header = $part->getHeader('content-disposition');
if ($header !== null) {
$split = explode(';', $header->getValue());
if ($split[0] === 'attachment') {
return ('attachment');
} else if ($split[0] === 'inline') {
return ('inline');
}
} else { // Check for application/octet-stream
$content_type = $part->getContentType();
if ($content_type == 'application/octet-stream') {
return('application/octet-stream');
}
}
}
return(null);
}
/**
* @param MailMessagePartInterface $part
*
* @throws InvalidArgumentException
*
* @return MailAttachmentData
*/
public static function fromMailMessagePart(MailMessagePartInterface $part): MailAttachmentData
{
$attachmenttype = MailAttachmentData::getAttachmentPartType($part);
if ($attachmenttype == null) {
throw new InvalidArgumentException('object is no attachment');
}
$disposition = $part->getHeaderValue('content-disposition');
if ($disposition == null) {
$disposition = '';
}
$disposition = str_replace(["\n\r", "\n", "\r"], '', $disposition);
// file_put_contents('debug.txt',date("HH:mm:ss")."\nDispo: ".$disposition); // FILE_APPEND
// Determine filename
/*
Content-Disposition: inline
Content-Disposition: attachment
Content-Disposition: attachment; filename="filename.jpg"
This is not correctly implemented -> only the first string is evaluated
Content-Disposition: attachment; filename*0="filename_that_is_"
Content-Disposition: attachment; filename*1="very_long.jpg"
*/
$filename = 'OpenXE_file.unknown';
if (preg_match('/(.+);\s*filename(?:\*[0-9]){0,1}="*([^"]+)"*.*$/m', $disposition, $matches)) { // Filename in disposition
$filename = $matches[2];
} else {
$contenttype = $part->getHeaderValue('content-type');
$contenttype = str_replace(["\n\r", "\n", "\r"], '', $contenttype);
// file_put_contents('debug.txt',date("HH:mm:ss")."\nConttype: ".$contenttype,FILE_APPEND); // FILE_APPEND
if (preg_match('/(.+);\s*name(?:\*[0-9]){0,1}="*([^"]+)"*.*$/m', $contenttype, $matches)) { // Name in content-type
$filename = $matches[2];
} else if ($contenttype == 'message/rfc822') { // RFC822 message
$filename = 'ForwardedMessage.eml';
}
}
$encodingHeader = $part->getHeader('content-transfer-encoding');
if ($encodingHeader === null) {
$content_transfer_encoding = '';
} else {
$content_transfer_encoding = $encodingHeader->getValue();
throw new InvalidArgumentException('missing header: "Content-Transfer-Encoding"');
}
$encoding = $encodingHeader->getValue();
$dispositionHeader = $part->getHeader('content-disposition');
if ($dispositionHeader === null) {
throw new InvalidArgumentException('missing header: "Content-Disposition"');
}
$disposition = $dispositionHeader->getValue();
if (!preg_match('/(.+);\s*filename="([^"]+)".*$/m', $disposition, $matches)) {
throw new InvalidArgumentException(
sprintf('unexpected header value "Content-Disposition" = %s', $disposition)
);
}
$isInline = strtolower($matches[1]) === 'inline';
$filename = $matches[2];
// Thunderbird UTF URL-Format
$UTF_pos = strpos($filename,'UTF-8\'\'');
if ($UTF_pos !== false) {
if ($UTF_pos !== false) {
$wasUTF = "JA";
$filename = substr($filename,$UTF_pos);
$filename = rawurldecode($filename);
}
$cid = null;
$contentIdHeader = $part->getHeader('content-id');
if ($contentIdHeader !== null) {
@ -152,24 +97,13 @@ class MailAttachmentData implements MailAttachmentInterface
$cid = $cidMatches[1];
}
}
if ($attachmenttype == 'inline' && $cid != null) {
$filename = "cid:".$cid;
}
$content = $part->getContent();
if ($content === null) { // This should not be
// file_put_contents('debug.txt',date("HH:mm:ss")."\n".print_r($part,true)); // FILE_APPEND
throw new InvalidArgumentException(
sprintf('content is null "%s"', substr(print_r($part,true),0,1000))
);
}
return new self(
$filename,
$content,
$part->getContent(),
$part->getContentType(),
$content_transfer_encoding,
$attachmenttype == 'inline',
$encoding,
$isInline,
$cid
);
}

View File

@ -5,7 +5,6 @@ declare(strict_types=1);
namespace Xentral\Components\MailClient\Data;
use DateTime;
use DateTimeImmutable;
use DateTimeInterface;
use JsonSerializable;
use Throwable;
@ -148,7 +147,6 @@ final class MailMessageData implements MailMessageInterface, JsonSerializable
$parts = [];
$this->findAttachmentParts($this->contentPart, $parts);
$attachments = [];
foreach ($parts as $part) {
$attachments[] = MailAttachmentData::fromMailMessagePart($part);
}
@ -163,17 +161,19 @@ final class MailMessageData implements MailMessageInterface, JsonSerializable
* @return void
*/
private function findAttachmentParts(MailMessagePartInterface $part, array &$resultArray): void
{
{
try {
$header = $part->getHeader('content-disposition');
$split = explode(';', $header->getValue());
if ($split[0] === 'attachment' || $split[0] === 'inline') {
$resultArray[] = $part;
if ($part->isMultipart()) {
// Recurse subparts
return;
}
} catch (Throwable $e) {
for ($i = 0; $i < $part->countParts(); $i++) {
$this->findAttachmentParts($part->getPart($i), $resultArray);
}
} else {
if (MailAttachmentData::getAttachmentPartType($part) != null) {
$resultArray[] = $part;
}
}
}
@ -308,13 +308,13 @@ final class MailMessageData implements MailMessageInterface, JsonSerializable
if ($date === null) {
return null;
}
/* $dateTime = date_create($date->getValue());
$dateTime = DateTime::createFromFormat(DateTimeInterface::RFC2822, $date->getValue());
if ($dateTime === false) {
$dateTime = DateTime::createFromFormat(DateTimeInterface::RFC822, $date->getValue());
}
if ($dateTime === false) {
throw new InvalidArgumentException('Invalid date: '.$date->getValue());
return null;
}*/
$dateTime = new DateTimeImmutable($date->getValue());
}
return $dateTime;
}

View File

@ -83,18 +83,6 @@ final class MailMessagePartData implements MailMessagePartInterface, JsonSeriali
return $this->headers[strtolower($name)];
}
/**
* @inheritDoc
*/
public function getHeaderValue(string $name): ?string
{
$header = $this->getHeader($name);
if ($header == null) {
return (null);
}
return($header->getValue());
}
/**
* @inheritDoc
*/
@ -109,33 +97,6 @@ final class MailMessagePartData implements MailMessagePartInterface, JsonSeriali
return $split[0];
}
/**
* @inheritDoc
*/
public function getCharset(): ?string
{
$header = $this->getHeader('content-type');
if ($header === null) {
return '';
}
$pattern = "/([a-zA-Z]*[\/]*[a-zA-Z]*);[a-zA-Z\n\t\r0-9 ]*charset=\"([a-zA-Z-0-9]+)\"/i";
$matches = array();
if (preg_match(
$pattern,
$header->getValue(),
$matches
)) {
if (count($matches) >= 3) {
return($matches[2]);
} else {
return(null);
}
}
else {
return(null);
}
}
/**
* @inheritDoc
*/
@ -155,30 +116,17 @@ final class MailMessagePartData implements MailMessagePartInterface, JsonSeriali
/**
* @return string|null
*/
public function getDecodedContent(string $to_charset = 'UTF-8'): ?string
public function getDecodedContent(): ?string
{
$result = '';
if ($this->content === null) {
return null;
}
$encodingHeader = $this->getHeader('content-transfer-encoding');
if ($encodingHeader === null ) {
$result = $this->content;
}
else {
$result = $this->decode($this->content, $encodingHeader->getValue());
return $this->content;
}
$charset = $this->getCharset();
// throw new InvalidArgumentException('Charset is '.$charset." Text is: ".$result);
$converted = mb_convert_encoding(
$result,
$to_charset,
$charset
);
return($converted);
return $this->decode($this->content, $encodingHeader->getValue());
}
/**

View File

@ -20,7 +20,7 @@ final class ErrorPageData implements JsonSerializable
public function __construct($exception, $title = null)
{
$this->exception = $exception;
$this->title = !empty($title) ? (string)$title : 'DBXE: Es ist ein unerwarteter Fehler aufgetreten!';
$this->title = !empty($title) ? (string)$title : 'OpenXE: Es ist ein unerwarteter Fehler aufgetreten!';
}

View File

@ -35,7 +35,7 @@ final class Psr4ClassNameResolver
{
// Normalize inputs
$prefix = trim($prefix, '\\') . '\\';
$baseDir = rtrim($baseDir, '/\\') . DIRECTORY_SEPARATOR;
$baseDir = rtrim($baseDir, '/') . '/';
$this->prefixes[$prefix] = $baseDir;
}

View File

@ -492,8 +492,6 @@ final class ReportService
$testResult['messagetype'] = 'error';
$testResult['message'] = sprintf("QUERY FAILED:\n%s", $e->getMessage());
$testResult['message'] .= "\n\r".$compiled;
return $testResult;
}
@ -502,9 +500,6 @@ final class ReportService
if(count($rows) < 101){
$message = sprintf('Query successful: %s datasets found', count($rows));
}
$message .= "\n\r".print_r($rows[0],true);
$testResult = [
'messagetype' => 'success',
'message' => $message,

View File

@ -1,19 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: LicenseRef-EGPL-3.1
*/
namespace Xentral\Modules\ShippingMethod\Model;
class CreateShipmentResult
{
public bool $Success = false;
public array $Errors = [];
public ?string $Label;
public ?string $ExportDocuments;
public ?string $TrackingNumber;
public ?string $TrackingUrl;
}

View File

@ -1,19 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: LicenseRef-EGPL-3.1
*/
namespace Xentral\Modules\ShippingMethod\Model;
class CustomsInfo
{
const CUSTOMS_TYPE_GIFT = 0;
const CUSTOMS_TYPE_DOCUMENTS = 1;
const CUSTOMS_TYPE_GOODS = 2;
const CUSTOMS_TYPE_SAMPLE = 3;
const CUSTOMS_TYPE_RETURN = 4;
}

View File

@ -1,63 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
*
* SPDX-License-Identifier: LicenseRef-EGPL-3.1
*/
namespace Xentral\Modules\ShippingMethod\Model;
class Product
{
const SERVICE_COD = 'cod';
const SERVICE_PREMIUM = 'premium';
public string $Id;
public string $Name;
public float $LengthMin = 0;
public float $LengthMax = 500;
public float $WidthMin = 0;
public float $WidthMax = 500;
public float $HeightMin = 0;
public float $HeightMax = 500;
public float $WeightMin = 0;
public float $WeightMax = 100;
public array $AvailableServices = [];
public static function Create(string $id, string $name):Product {
$obj = new Product();
$obj->Id = $id;
$obj->Name = $name;
return $obj;
}
public function WithLength(float $min, float $max): Product {
$this->LengthMin = $min;
$this->LengthMax = $max;
return $this;
}
public function WithWidth(float $min, float $max): Product {
$this->WidthMin = $min;
$this->WidthMax = $max;
return $this;
}
public function WithHeight(float $min, float $max): Product {
$this->HeightMin = $min;
$this->HeightMax = $max;
return $this;
}
public function WithWeight(float $min, float $max): Product {
$this->WeightMin = $min;
$this->WeightMax = $max;
return $this;
}
public function WithServices(array $services): Product {
$this->AvailableServices = $services;
return $this;
}
}

View File

@ -1,10 +1,3 @@
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
* SPDX-FileCopyrightText: 2019 Xentral (c) Xentral ERP Software GmbH, Fuggerstrasse 11, D-86150 Augsburg, Germany
*
* SPDX-License-Identifier: LicenseRef-EGPL-3.1
*/
var ShippingMethodCreate = function ($) {
'use strict';
@ -18,14 +11,35 @@ var ShippingMethodCreate = function ($) {
vueElementId: '#shipment-create',
},
search: function (el) {
let val = $(el).val().toLowerCase();
$('.createbutton').each(function() {
let desc = $(this).find('.tilegrid-tile-title').text();
if (desc.toLowerCase().indexOf(val)>=0)
$(this).show();
else
$(this).hide();
$.ajax({
url: 'index.php?module=versandarten&action=create&cmd=suche',
type: 'POST',
dataType: 'json',
data: {
val: $(el).val()
}
})
.done(function (data) {
if (typeof data != 'undefined' && data != null) {
if (typeof data.ausblenden != 'undefined' && data.ausblenden != null) {
me.storage.hideElements = data.ausblenden.split(';');
$.each(me.storage.hideElements, function (k, v) {
if (v != '') {
$('#' + v).hide();
}
});
}
if (typeof data.anzeigen != 'undefined' && data.anzeigen != null) {
me.storage.showElements = data.anzeigen.split(';');
$.each(me.storage.showElements, function (k, v) {
if (v != '') {
$('#' + v).show();
}
});
}
}
});
},
init: function () {
if ($(me.selector.vueElementId).length === 0) {

View File

@ -73,7 +73,7 @@ final class Shopware6Client
$request = new ClientRequest(
$method,
$this->url . $endpoint,
$this->url . 'v2/' . $endpoint,
$headerInformation,
empty($body) ? null : json_encode($body)
);

View File

@ -1,17 +1,10 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
* SPDX-FileCopyrightText: 2019 Xentral ERP Sorftware GmbH, Fuggerstrasse 11, D-86150 Augsburg
* SPDX-License-Identifier: LicenseRef-EGPL-3.1
*/
declare(strict_types=1);
namespace Xentral\Modules\SubscriptionCycle;
use Aboabrechnung;
use Sabre\CalDAV\Subscriptions\Subscription;
use Xentral\Components\SchemaCreator\Collection\SchemaCollection;
use Xentral\Components\SchemaCreator\Schema\TableSchema;
use Xentral\Components\SchemaCreator\Type;
@ -42,7 +35,6 @@ final class Bootstrap
'SubscriptionCycleJobService' => 'onInitSubscriptionCycleJobService',
'SubscriptionCycleFullTask' => 'onInitSubscriptionCycleFullTask',
'TaskMutexService' => 'onInitTaskMutexService',
'SubscriptionModule' => 'onInitSubscriptionModule'
];
}
@ -68,12 +60,20 @@ final class Bootstrap
*/
public static function onInitSubscriptionCycleManualJobTask(ContainerInterface $container
): SubscriptionCycleManualJobTask {
$legacyApp = $container->get('LegacyApplication');
$subscriptionCycleModule = $legacyApp->loadModule('rechnungslauf');
$subscriptionModule = new Aboabrechnung($legacyApp);
$subscriptionModule->cronjob = true;
return new SubscriptionCycleManualJobTask(
$container->get('LegacyApplication'),
$legacyApp,
$container->get('Database'),
$container->get('TaskMutexService'),
$container->get('SubscriptionCycleJobService'),
$container->get('SubscriptionModule')
$subscriptionCycleModule,
$subscriptionModule,
!empty($legacyApp->erp->GetKonfiguration('rechnungslauf_gruppen'))
);
}
@ -210,10 +210,22 @@ final class Bootstrap
);
}
public static function onInitSubscriptionModule(ContainerInterface $container): SubscriptionModule {
return new SubscriptionModule(
$container->get('LegacyApplication'),
$container->get('Database')
);
/**
* @param SchemaCollection $collection
*
* @return void
*/
public static function registerTableSchemas(SchemaCollection $collection): void
{
$subscriptionCycleJob = new TableSchema('subscription_cycle_job');
$subscriptionCycleJob->addColumn(Type\Integer::asAutoIncrement('id'));
$subscriptionCycleJob->addColumn(new Type\Integer('address_id'));
$subscriptionCycleJob->addColumn(new Type\Varchar('document_type', 32));
$subscriptionCycleJob->addColumn(new Type\Varchar('job_type', 32));
$subscriptionCycleJob->addColumn(new Type\Integer('printer_id'));
$subscriptionCycleJob->addColumn(new Type\Timestamp('created_at', 'CURRENT_TIMESTAMP'));
$subscriptionCycleJob->addIndex(new Index\Primary(['id']));
$subscriptionCycleJob->addIndex(new Index\Index(['address_id']));
$collection->add($subscriptionCycleJob);
}
}

View File

@ -1,9 +1,4 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
* SPDX-FileCopyrightText: 2019 Xentral ERP Sorftware GmbH, Fuggerstrasse 11, D-86150 Augsburg
* SPDX-License-Identifier: LicenseRef-EGPL-3.1
*/
declare(strict_types=1);
@ -21,33 +16,52 @@ use Xentral\Modules\SubscriptionCycle\SubscriptionModuleInterface;
final class SubscriptionCycleManualJobTask
{
private ApplicationCore $app;
private Database $db;
private SubscriptionCycleJobService $cycleJobService;
private TaskMutexServiceInterface $taskMutexService;
private SubscriptionModuleInterface $subscriptionModule;
/** @var ApplicationCore $app */
private $app;
/**
* SubscriptionCycleManualJobTask constructor.
*
* @param ApplicationCore $app
* @param Database $db
* @param TaskMutexServiceInterface $taskMutexService
* @param SubscriptionCycleJobService $cycleJobService
* @param SubscriptionModuleInterface $subscriptionModule
*/
/** @var Database $db */
private $db;
/** @var SubscriptionCycleJobService $cycleJobService */
private $cycleJobService;
/** @var TaskMutexServiceInterface $taskMutexService */
private $taskMutexService;
/** @var SubscriptionCycleModuleInterface $subscriptionCycleModule */
private $subscriptionCycleModule;
/** @var SubscriptionModuleInterface $subscriptionModule */
private $subscriptionModule;
/** @var bool $useGroups */
private $useGroups;
/**
* SubscriptionCycleManualJobTask constructor.
*
* @param ApplicationCore $app
* @param Database $db
* @param SubscriptionCycleJobService $cycleJobService
* @param SubscriptionCycleModuleInterface $subscriptionCycleModule
* @param bool $useGroups
*/
public function __construct(
ApplicationCore $app,
Database $db,
TaskMutexServiceInterface $taskMutexService,
SubscriptionCycleJobService $cycleJobService,
SubscriptionModuleInterface $subscriptionModule
SubscriptionCycleModuleInterface $subscriptionCycleModule,
SubscriptionModuleInterface $subscriptionModule,
bool $useGroups
) {
$this->app = $app;
$this->db = $db;
$this->taskMutexService = $taskMutexService;
$this->cycleJobService = $cycleJobService;
$this->subscriptionCycleModule = $subscriptionCycleModule;
$this->subscriptionModule = $subscriptionModule;
$this->useGroups = $useGroups;
}
public function execute(): void
@ -57,16 +71,77 @@ final class SubscriptionCycleManualJobTask
}
$this->taskMutexService->setMutex('rechnungslauf_manual');
$jobs = $this->cycleJobService->listAll(100);
foreach ($jobs as $job) {
switch ($job['document_type']) {
case 'rechnung':
$this->subscriptionModule->CreateInvoice((int)$job['address_id']);
break;
case 'auftrag':
$this->subscriptionModule->CreateOrder((int)$job['address_id']);
break;
}
$this->cycleJobService->delete((int)$job['id']);
$simulatedDays = $this->getSimulatedDates($jobs);
if (empty($jobs)) {
return;
}
foreach (['auftrag', 'rechnung'] as $doctype) {
foreach ($simulatedDays as $simulatedDay) {
if ($simulatedDay === '') {
$simulatedDay = null;
} else {
try {
$simulatedDay = new DateTimeImmutable($simulatedDay);
} catch (Exception $exception) {
$simulatedDay = null;
}
}
$addresses = $this->getAddressesByTypeFromJobs($jobs, $doctype, $simulatedDay);
foreach ($jobs as $job) {
$job = $this->cycleJobService->getJob((int)$job['id']);
if (empty($job)) {
continue;
}
if ($job['document_type'] !== $doctype) {
continue;
}
if ($job['simulated_day'] === null && $simulatedDay !== null) {
continue;
}
if (
$job['simulated_day'] !== null
&& ($simulatedDay === null || $simulatedDay->format('Y-m-d') !== $job['simulated_day'])
) {
continue;
}
if (!in_array($job['address_id'], $addresses, false)) {
$this->cycleJobService->delete((int)$job['id']);
continue;
}
$simulatedDay = null;
if ($job['simulated_day'] !== null) {
try {
$simulatedDay = new DateTimeImmutable($job['simulated_day']);
} catch (Exception $exception) {
$simulatedDay = null;
}
}
if ($this->useGroups) {
$this->subscriptionCycleModule->generateAndSendSubscriptionCycleGroups(
$this->subscriptionModule,
[$job['address_id']],
$doctype,
$job['job_type'],
$job['printer_id'],
$simulatedDay
);
} else {
$this->subscriptionCycleModule->generateAndSendSubscriptionCycle(
$this->subscriptionModule,
[$job['address_id']],
$doctype,
$job['printer_id'],
$job['job_type'],
$simulatedDay
);
}
$this->cycleJobService->delete((int)$job['id']);
if ($this->taskMutexService->isTaskInstanceRunning('rechnungslauf')) {
return;
}
$this->taskMutexService->setMutex('rechnungslauf_manual');
}
}
}
}
@ -74,4 +149,52 @@ final class SubscriptionCycleManualJobTask
{
$this->taskMutexService->setMutex('rechnungslauf_manual', false);
}
/**
* @param array $jobs
* @param string $documentType
* @param DateTimeInterface|null $simulatedDay
*
* @return array
*/
private function getAddressesByTypeFromJobs(
array $jobs,
string $documentType,
?DateTimeInterface $simulatedDay = null
): array {
$addresses = [];
foreach ($jobs as $job) {
if ($job['document_type'] === $documentType) {
$addresses[] = (int)$job['address_id'];
}
}
if (empty($addresses)) {
return [];
}
$addressesWithSubscriptions = array_keys(
(array)$this->subscriptionModule->GetRechnungsArray($documentType, true)
);
return array_intersect($addresses, $addressesWithSubscriptions);
}
/**
* get all Dates from Setting "Vergangenes Datum für Abrechnungserstellung" to calc old Subscription cycles
*
* @param array $jobs
*
* @return array
*/
private function getSimulatedDates(array $jobs): array
{
$simulatedDates = [];
foreach ($jobs as $job) {
$simulatedDates[] = (string)$job['simulated_day'];
}
return array_unique($simulatedDates);
}
}

View File

@ -1,9 +1,4 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
* SPDX-FileCopyrightText: 2019 Xentral ERP Sorftware GmbH, Fuggerstrasse 11, D-86150 Augsburg
* SPDX-License-Identifier: LicenseRef-EGPL-3.1
*/
declare(strict_types=1);
@ -16,7 +11,7 @@ use Xentral\Modules\SubscriptionCycle\Exception\InvalidArgumentException;
final class SubscriptionCycleJobService
{
private Database $db;
private $db;
/**
* SubscriptionCycleJobService constructor.
@ -62,27 +57,29 @@ final class SubscriptionCycleJobService
* @param string $documentType
* @param string|null $jobType
* @param int|null $printerId
* @param DateTimeInterface|null $simulatedDay
*
* @throws InvalidArgumentException
*
* @return int
*/
public function create(int $addressId, string $documentType, ?string $jobType = null, ?int $printerId = null): int
public function create(int $addressId, string $documentType, ?string $jobType, ?int $printerId, ?DateTimeInterface $simulatedDay = null): int
{
$this->ensureDocumentType($documentType);
$this->db->perform(
'INSERT INTO `subscription_cycle_job`
(`address_id`, `document_type`, `job_type`, `printer_id`, `created_at`)
VALUES (:address_id, :document_type, :job_type, :printer_id, NOW())',
(`address_id`, `document_type`, `job_type`, `printer_id`, `created_at`, `simulated_day`)
VALUES (:address_id, :document_type, :job_type, :printer_id, NOW(), :simulated_day)',
[
'address_id' => $addressId,
'document_type' => $documentType,
'job_type' => $jobType,
'printer_id' => $printerId,
'simulated_day' => $simulatedDay === null ? null : $simulatedDay->format('Y-m-d'),
]
);
return $this->db->lastInsertId();
return (int)$this->db->lastInsertId();
}
/**

View File

@ -1,115 +0,0 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
* SPDX-License-Identifier: LicenseRef-EGPL-3.1
*/
namespace Xentral\Modules\SubscriptionCycle;
use ApplicationCore;
use DateTimeImmutable;
use DateTimeInterface;
use Xentral\Components\Database\Database;
class SubscriptionModule implements SubscriptionModuleInterface
{
private ApplicationCore $app;
private Database $db;
public function __construct(ApplicationCore $app, Database $db)
{
$this->app = $app;
$this->db = $db;
}
public function GetPositions(int $address, string $documentType, DateTimeInterface $calculationDate = null): array
{
if ($calculationDate === null)
$calculationDate = new DateTimeImmutable('today');
$sql = "SELECT
aa.id,
@start := GREATEST(aa.startdatum, aa.abgerechnetbis) as start,
@end := IF(aa.enddatum = '0000-00-00' OR aa.enddatum > :calcdate, :calcdate, aa.enddatum) as end,
@cycles := GREATEST(aa.zahlzyklus, CASE
WHEN aa.preisart = 'monat' THEN
TIMESTAMPDIFF(MONTH, @start, @end)
WHEN aa.preisart = 'jahr' THEN
TIMESTAMPDIFF(YEAR, @start, @end)
WHEN aa.preisart = '30tage' THEN
FLOOR(TIMESTAMPDIFF(DAY, @start, @end) / 30)
END+1) as cycles,
CASE
WHEN aa.preisart = 'monat' THEN
DATE_ADD(@start, INTERVAL @cycles MONTH)
WHEN aa.preisart = 'jahr' THEN
DATE_ADD(@start, INTERVAL @cycles YEAR)
WHEN aa.preisart = '30tage' THEN
DATE_ADD(@start, INTERVAL @cycles*30 DAY )
END as newend,
aa.preisart,
aa.adresse,
aa.preis,
aa.rabatt,
aa.bezeichnung,
aa.beschreibung,
aa.artikel,
aa.menge,
aa.waehrung
FROM abrechnungsartikel aa
JOIN artikel a on aa.artikel = a.id
WHERE aa.dokument = :doctype
AND greatest(aa.startdatum, aa.abgerechnetbis) <= :calcdate
AND (aa.enddatum = '0000-00-00' OR aa.abgerechnetbis < aa.enddatum)
AND aa.adresse = :address";
return $this->db->fetchAll($sql, [
'doctype' => $documentType,
'calcdate' => $calculationDate->format('Y-m-d'),
'address' => $address]);
}
public function CreateInvoice(int $address, DateTimeInterface $calculationDate = null) {
$positions = $this->GetPositions($address, 'rechnung', $calculationDate);
if(empty($positions))
return;
$invoice = $this->app->erp->CreateRechnung($address);
$this->app->erp->LoadRechnungStandardwerte($invoice, $address);
foreach ($positions as $pos) {
$beschreibung = $pos['beschreibung'];
$starts = DateTimeImmutable::createFromFormat('Y-m-d', $pos['start'])->format('d.m.Y');
$newends = DateTimeImmutable::createFromFormat('Y-m-d', $pos['newend'])->format('d.m.Y');
$beschreibung .= "<br>Zeitraum: $starts - $newends";
$this->app->erp->AddRechnungPositionManuell($invoice, $pos['artikel'], $pos['preis'],
$pos['menge']*$pos['cycles'], $pos['bezeichnung'], $beschreibung, $pos['waehrung'], $pos['rabatt']);
$this->db->exec("UPDATE abrechnungsartikel SET abgerechnetbis='{$pos['newend']}' WHERE id={$pos['id']}");
}
$this->app->erp->RechnungNeuberechnen($invoice);
//$this->app->erp->BelegFreigabe('rechnung', $invoice);
}
public function CreateOrder(int $address, DateTimeInterface $calculationDate = null) {
$positions = $this->GetPositions($address, 'auftrag', $calculationDate);
if(empty($positions))
return;
$orderid = $this->app->erp->CreateAuftrag($address);
$this->app->erp->LoadAuftragStandardwerte($orderid, $address);
foreach ($positions as $pos) {
$beschreibung = $pos['beschreibung'];
$starts = DateTimeImmutable::createFromFormat('Y-m-d', $pos['start'])->format('d.m.Y');
$newends = DateTimeImmutable::createFromFormat('Y-m-d', $pos['newend'])->format('d.m.Y');
$beschreibung .= "<br>Zeitraum: $starts - $newends";
$this->app->erp->AddAuftragPositionManuell($orderid, $pos['artikel'], $pos['preis'],
$pos['menge']*$pos['cycles'], $pos['bezeichnung'], $beschreibung, $pos['waehrung'], $pos['rabatt']);
$this->db->exec("UPDATE abrechnungsartikel SET abgerechnetbis='{$pos['newend']}' WHERE id={$pos['id']}");
}
$this->app->erp->AuftragNeuberechnen($orderid);
//$this->app->erp->BelegFreigabe('auftrag', $orderid);
}
}

View File

@ -1,8 +1,6 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
* SPDX-License-Identifier: LicenseRef-EGPL-3.1
*/
declare(strict_types=1);
namespace Xentral\Modules\SubscriptionCycle;
@ -10,7 +8,36 @@ use DateTimeInterface;
interface SubscriptionModuleInterface
{
public function CreateInvoice(int $address, DateTimeInterface $calculationDate = null);
public function CreateOrder(int $address, DateTimeInterface $calculationDate = null);
public function GetPositions(int $address, string $documentType, DateTimeInterface $calculationDate = null): array;
/**
* @param int $customer
* @param string $documentType
*
* @return mixed
*/
public function RechnungKunde($customer, $documentType);
/**
* @param $customer
* @param $invoiceGroupKey
* @param $key
*
* @return mixed
*/
public function AuftragImportAbo($customer, $invoiceGroupKey, $key);
/**
* @param $customer
* @param $invoiceGroupKey
* @param $key
*
* @return mixed
*/
public function RechnungImportAbo($customer, $invoiceGroupKey, $key);
/**
* @param string $documentType
*
* @return array|null
*/
public function GetRechnungsArray($documentType);
}

View File

@ -22,22 +22,12 @@ class TicketFormatter
*/
public function encodeToUtf8(string $string): string
{
$encoding = mb_detect_encoding($string, 'UTF-8, ISO-8859-1, ISO-8859-15', true);
$converted = mb_convert_encoding(
return mb_convert_encoding(
$string,
'UTF-8',
'auto'
$encoding
);
// Fallback
if ($converted === false) {
$converted = mb_convert_encoding(
$string,
'UTF-8',
'iso-8859-1'
);
}
return ($converted);
}
}

View File

@ -209,7 +209,7 @@ class TicketImportHelper
return($candidate);
}
if ($loopCounter > 9999) {
if ($loopCounter > 99) {
throw new NumberGeneratorException('ticket number generation failed');
}
$loopCounter++;
@ -285,15 +285,14 @@ class TicketImportHelper
tr.dsgvo AS `is_gdpr_relevant`,
tr.prio AS `priority`,
tr.persoenlich AS `is_private`,
tr.adresse,
tr.warteschlange AS `queue_id`
FROM `ticket_regeln` AS `tr`
WHERE
tr.aktiv = 1
AND ('".$this->db->real_escape_string($recipientMail)."' LIKE tr.empfaenger_email OR tr.empfaenger_email = '')
AND ('".$this->db->real_escape_string($senderMail)."' LIKE tr.sender_email OR tr.sender_email = '')
AND ('".$this->db->real_escape_string($senderMail)."' LIKE tr.name OR tr.name = '')
AND ('".$this->db->real_escape_string($subject)."' LIKE tr.betreff OR tr.betreff = '')";
AND ('".$recipientMail."' LIKE tr.empfaenger_email OR tr.empfaenger_email = '')
AND ('".$senderMail."' LIKE tr.sender_email OR tr.sender_email = '')
AND ('".$senderMail."' LIKE tr.name OR tr.name = '')
AND ('".$subject."' LIKE tr.betreff OR tr.betreff = '')";
$this->logger->debug('ticket rule',['sql' => $sql]);
@ -336,9 +335,9 @@ class TicketImportHelper
$queue_id = $this->mailAccount->getTicketQueueId();
if (!empty($queue_id)) {
$queue_label = $this->db->Select("SELECT label FROM warteschlangen WHERE label = '".$queue_id."' LIMIT 1");
$queue_label = $this->db->Select("SELECT label FROM warteschlangen WHERE id = ".$queue_id." LIMIT 1");
}
$insertTicket = "INSERT INTO `ticket` (
`schluessel`, `zeit`, `projekt`, `quelle`, `status`, `kunde`,
`mailadresse`, `prio`, `betreff`,`warteschlange`,`adresse`
@ -348,10 +347,10 @@ class TicketImportHelper
'".$projectId."',
'".$this->mailAccount->getEmailAddress()."',
'".$status."',
'".$this->db->real_escape_string($senderName)."',
'".$this->db->real_escape_string($senderAddress)."',
'".$senderName."',
'".$senderAddress."',
'".'3'."',
'".$this->db->real_escape_string($subject)."',
'".$subject."',
'".$queue_label."',
'".$AddressId."');";
@ -384,14 +383,14 @@ class TicketImportHelper
) VALUES (
'".$ticketNumber."',
'".date('Y-m-d H:i:s', $timestamp)."',
'".$this->db->real_escape_string($message)."',
'".$this->db->real_escape_string($subject)."',
'".$message."',
'".$subject."',
'".'email'."',
'".$this->db->real_escape_string($senderName)."',
'".$this->db->real_escape_string($senderAddress)."',
'".$senderName."',
'".$senderAddress."',
'".$status."',
'".$this->db->real_escape_string($replyToName)."',
'".$this->db->real_escape_string($replyToAddress)."');";
'".$replyToName."',
'".$replyToAddress."');";
$this->logger->debug('database insert',['query' => $sql]);
$this->db->Insert($sql);
@ -409,6 +408,9 @@ class TicketImportHelper
$this->logger->error('Failed to insert ticket message into db', ['exception' => $e]);
}
$this->applyTicketRules($messageId);
return($result);
}
@ -438,7 +440,7 @@ class TicketImportHelper
foreach ($ruleArray as $rule) {
$this->logger->debug('ticket rule applies',['rule_id' => $rule['id'],'rule' => print_r($rule,true)]);
$this->logger->debug('ticket rule applies',['rule_id' => $rule['id']]);
/*
$update = $this->db->update();
@ -459,16 +461,12 @@ class TicketImportHelper
$this->db->perform($sql, ['ticket_id' => $ticketId]);
*/
if ($rule['is_spam'] == 1) {
$status = 'spam';
} else {
$status = 'neu';
if ($rule['is_spam'] === 1) {
$sql = "UPDATE `ticket_nachricht` SET `status` = \'spam\' WHERE `id` = '".$ticketMessageId."'";
$this->db->Update($sql);
}
$sql = "UPDATE `ticket` SET `dsgvo` = '".$rule['is_gdpr_relevant']."', `privat` = '".$rule['is_private']."', `prio` = '".$rule['priority']."',`adresse` = '".$rule['adresse']."', `warteschlange` = '".$rule['queue_id']."', `status` = '".$status."' WHERE `id` = '".$ticketId."'";
$this->logger->debug('ticket rule sql',['sql' => $sql]);
$sql = "UPDATE `ticket` SET `dsgvo` = '".$rule['is_gdpr_relevant']."', `privat` = '".$rule['is_private']."', `prio` = '".$rule['priority']."', `warteschlange` = '".$rule['queue_id']."' WHERE `id` = '".$ticketId."'";
$this->db->Update($sql);
}
}
@ -485,9 +483,6 @@ class TicketImportHelper
{
$insertedMailsCount = 0;
foreach ($inboxMessageIds as $messageNumber) {
$this->logger->debug("Fetch $messageNumber", ['']);
try {
$message = $this->mailClient->fetchMessage((int)$messageNumber);
} catch (Throwable $e) {
@ -496,27 +491,17 @@ class TicketImportHelper
}
try {
// $this->logger->debug('Start import', ['message' => substr(print_r($message,true),1000)]);
$this->logger->debug('Start import '.$messageNumber, []);
$this->logger->debug('Start import', ['message' => $message->getSubject()]);
$result = $this->importMessage($message);
if ($result === true) {
$insertedMailsCount++;
if ($this->mailAccount->isDeleteAfterImportEnabled()) {
$this->mailClient->deleteMessage((int)$messageNumber);
} else {
$this->mailClient->setFlags((int)$messageNumber, ['\\Seen']);
}
$this->importMessage($message);
$insertedMailsCount++;
if ($this->mailAccount->isDeleteAfterImportEnabled()) {
$this->mailClient->deleteMessage((int)$messageNumber);
} else {
$this->logger->error('Error during email import '.$messageNumber, ['message' => substr(print_r($message,true),0,1000)]);
continue;
$this->mailClient->setFlags((int)$messageNumber, ['\\Seen']);
}
} catch (Throwable $e) {
$exception_message = $e->getMessage();
$this->logger->error('Error during email import '.$messageNumber, ['exc-message' => $exception_message ,'message2' => substr(print_r($message,true),0,1000)]);
$this->logger->error('Error during email import', ['exception' => $e]);
continue;
}
}
@ -532,10 +517,12 @@ class TicketImportHelper
/**
* @param MailMessageInterface $message
*
* @return true on success
* @return void
*/
public function importMessage(MailMessageInterface $message): bool
public function importMessage(MailMessageInterface $message): void
{
$DEBUG = 0;
// extract email data
$subject = $this->formatter->encodeToUtf8($message->getSubject());
$from = $this->formatter->encodeToUtf8($message->getSender()->getEmail());
@ -555,68 +542,42 @@ class TicketImportHelper
$htmlBody = $message->getHtmlBody();
if ($htmlBody === null) {
$htmlBody = '';
}
if ($plainTextBody == '' && $htmlBody == '') {
$simple_content = $message->getContent();
if (empty($simple_content)) {
$this->logger->debug('Empty mail',[]);
} else {
$plainTextBody = $simple_content;
$htmlBody = nl2br(htmlentities($simple_content));
}
}
$this->logger->debug('Text',['plain' => $plainTextBody, 'html' => $htmlBody, 'simple_content' => $simple_content]);
$action = $this->formatter->encodeToUtf8($plainTextBody);
$action_html = $this->formatter->encodeToUtf8($htmlBody);
if (strlen($action_html) < strlen($action)) {
$action_html = nl2br($action);
}
$this->logger->debug('Text (converted)',['plain' => $action, 'html' => $action_html]);
// Import database emailbackup
try {
$date = $message->getDate();
//check if email exists in database
$date = $message->getDate();
if (is_null($date)) { // This should not be happening -> Todo check getDate function
$this->logger->debug('Null date',['subject' => $message->getSubject()]);
$frommd5 = md5($from . $subject);
} else {
$timestamp = $date->getTimestamp();
$frommd5 = md5($from . $subject . $timestamp);
}
catch (exception $e) {
$this->logger->debug('Invalid date',['exc-message' => $e->getMessage(),'subject' => $message->getSubject(), $message->getHeader('date')->getValue()]);
return(false);
}
$timestamp = $date->getTimestamp();
$frommd5 = md5($from . $subject . $timestamp);
$empfang = $date->format('Y-m-d H:i:s');
$sql = "SELECT COUNT(id)
FROM `emailbackup_mails`
WHERE `checksum`='$frommd5'
AND `empfang`='$empfang'
AND `ticketnachricht` != 0
AND `webmail`='" . $this->mailAccount->getId() . "'";
$this->logger->debug('Importing message '.$from.' '.$fromname);
$result = $this->db->Select($sql);
$emailbackup_mails_id = null;
if ($this->db->Select($sql) == 0) {
if ($result == 0) {
// $this->logger->debug('Importing message',['message' => substr(print_r($message,true),1000)]);
$this->logger->debug('Importing message attachments',[]);
try {
$attachments = $message->getAttachments();
}
catch (Throwable $e) {
$this->logger->error('Error while getting attachments',['exception' => $e]);
return(false);
}
$this->logger->debug('Importing message',['']);
$attachments = $message->getAttachments();
$anhang = count($attachments) > 0 ? 1 : 0;
$mailacc = $this->mailAccount->getEmailAddress();
if (empty($mailacc) && count($message->getRecipients()) > 0) {
$mailacc = array_values($message->getRecipients())[0]->getEmail();
}
$mailaccid = $this->mailAccount->getId();
if (!$this->erpApi->isMailAdr($from)) {
@ -643,24 +604,23 @@ class TicketImportHelper
'$empfang','$anhang','$frommd5'
)";
$this->db->InsertWithoutLog($sql);
$emailbackup_mails_id = $this->db->GetInsertID();
} else {
$this->logger->debug('Message already imported.',['']);
return(true);
}
$id = null;
if ($DEBUG) {
echo $sql;
} else {
$this->db->InsertWithoutLog($sql);
$id = $this->db->GetInsertID();
}
}
if ($DEBUG) {
echo "ticket suchen oder anlegen\n";
}
$this->logger->debug('Message emailbackup_mails imported.',['id' => $emailbackup_mails_id]);
// END database import emailbackup
// Find ticket and add or create new ticket
$ticketNumber = null;
$ticketexists = null;
if (preg_match("/Ticket #[0-9]{12}/i", $subject, $matches)) {
$ticketNumber = str_replace('Ticket #', '', $matches[0]);
$this->logger->debug('Check for number',['ticketnummer' => $ticketNumber]);
$ticketexists = $this->db->Select(
"SELECT schluessel
FROM ticket
@ -688,7 +648,7 @@ class TicketImportHelper
$this->logger->debug('Add message to existing ticket',['ticketnummer' => $ticketNumber]);
}
// Database import ticket: Add message to new or existing ticket
// Add message to new or existing ticket
$ticketnachricht = $this->addTicketMessage(
(string) $ticketNumber,
$timestamp,
@ -701,17 +661,11 @@ class TicketImportHelper
$from
);
// Only for new tickets: apply filter rules
if (!$ticketexists) {
$this->applyTicketRules($ticketnachricht);
}
if ($ticketnachricht > 0 && $emailbackup_mails_id > 0) {
if ($ticketnachricht > 0 && $id > 0) {
$this->db->Update(
"UPDATE `emailbackup_mails`
SET ticketnachricht='$ticketnachricht'
WHERE id='$emailbackup_mails_id' LIMIT 1"
WHERE id='$id' LIMIT 1"
);
@ -757,58 +711,56 @@ class TicketImportHelper
}
}
}
} else {
$this->logger->error("Message not imported!", ['Time' => $timestamp, 'Subject' => $subject, 'From' => $from]);
$this->db->Delete("DELETE FROM emailbackup_mails WHERE id = ".$emailbackup_mails_id);
return(false);
}
// END database import ticket
// File management folder with raw text
$ordner = $this->config->WFuserdata . '/emailbackup/' . $this->config->WFdbname . "/$emailbackup_mails_id";
if (!is_dir($ordner) && $emailbackup_mails_id > 0) {
// Prüfen ob Ordner vorhanden ansonsten anlegen
$ordner = $this->config->WFuserdata . '/emailbackup/' . $this->config->WFdbname . "/$id";
if (!is_dir($ordner) && $id > 0) {
if (!mkdir($ordner, 0777, true) && !is_dir($ordner)) {
$this->logger->error("Folder \"{folder}\" was not created", ['folder' => $ordner]);
$this->db->Delete("DELETE FROM emailbackup_mails WHERE id = ".$emailbackup_mails_id);
return(false);
}
$raw_full_email = $message->getRawContent();
file_put_contents($ordner . '/mail.txt', $raw_full_email);
}
// File management attachments
if ($anhang == 1 && $emailbackup_mails_id > 0) {
//speichere anhang als datei
if ($anhang == 1 && $id > 0) {
$ordner = $this->config->WFuserdata . '/emailbackup/' . $this->config->WFdbname;
if (!is_dir($ordner)) {
if (!mkdir($ordner, 0777, true) && !is_dir($ordner)) {
$this->logger->error("Folder \"{folder}\" was not created", ['folder' => $ordner]);
$this->db->Delete("DELETE FROM emailbackup_mails WHERE id = ".$emailbackup_mails_id);
return(false);
}
}
// Prüfen ob Ordner vorhanden ansonsten anlegen
$ordner = $this->config->WFuserdata . '/emailbackup/' . $this->config->WFdbname . "/$emailbackup_mails_id";
$ordner = $this->config->WFuserdata . '/emailbackup/' . $this->config->WFdbname . "/$id";
if (!is_dir($ordner)) {
if (!mkdir($ordner, 0777, true) && !is_dir($ordner)) {
$this->logger->error("Folder \"{folder}\" was not created", ['folder' => $ordner]);
$this->db->Delete("DELETE FROM emailbackup_mails WHERE id = ".$emailbackup_mails_id);
return(false);
if ($DEBUG) {
echo "mkdir $ordner\n";
} else {
if (!mkdir($ordner, 0777, true) && !is_dir($ordner)) {
$this->logger->error("Folder \"{folder}\" was not created", ['folder' => $ordner]);
}
}
}
$this->logger->debug('Add '.count($attachments).' attachments',['']);
$this->logger->debug('Add attachments',['ticketnummer' => $ticketNumber, 'nachricht' => $ticketnachricht, 'count' => count($attachments)]);
foreach ($attachments as $attachment) {
if ($attachment->getFileName() !== '') {
$handle = fopen($ordner . '/' . $attachment->getFileName(), 'wb');
if ($handle) {
fwrite($handle, $attachment->getContent());
fclose($handle);
if ($DEBUG) {
} else {
$handle = fopen($ordner . '/' . $attachment->getFileName(), 'wb');
if ($handle) {
fwrite($handle, $attachment->getContent());
fclose($handle);
}
}
//Schreibe Anhänge in Datei-Tabelle
$datei = $ordner . '/' . $attachment->getFileName();
$dateiname = $attachment->getFileName();
$this->logger->debug("Attachment", ['filename' => $dateiname]);
if (stripos(strtoupper($dateiname), '=?UTF-8') !== false) {
$dateiname = $this->formatter->encodeToUtf8($dateiname);
$dateiname = htmlspecialchars_decode($dateiname);
@ -822,37 +774,48 @@ class TicketImportHelper
$dateiname = htmlspecialchars_decode($dateiname);
}
$tmpid = $this->erpApi->CreateDatei(
$dateiname,
$dateiname,
'',
'',
$datei,
'Support Mail',
true,
$this->config->WFuserdata . '/dms/' . $this->config->WFdbname
);
$this->logger->debug("Attachment cleaned", ['filename' => $dateiname]);
$this->logger->debug('Add attachment',['filename' => $dateiname, 'ticketnummer' => $ticketNumber,'id' => $tmpid, 'nachricht' => $ticketnachricht]);
if ($DEBUG) {
echo "CreateDatei($dateiname,{$dateiname},\"\",\"\",\"datei\",\"Support Mail\",true,"
. $this->config->WFuserdata . "/dms/" . $this->config->WFdbname . ")\n";
} else {
$tmpid = $this->erpApi->CreateDatei(
$dateiname,
$dateiname,
'',
'',
$datei,
'Support Mail',
true,
$this->config->WFuserdata . '/dms/' . $this->config->WFdbname
);
}
$this->erpApi->AddDateiStichwort(
$tmpid,
'Anhang',
'Ticket',
$ticketnachricht,
true
);
if ($DEBUG) {
echo "AddDateiStichwort $tmpid,'Anhang','Ticket',$ticketnachricht,true)\n";
} else {
$this->logger->debug('Add attachment',['ticketnummer' => $ticketNumber,'id' => $tmpid, 'nachricht' => $ticketnachricht]);
$this->erpApi->AddDateiStichwort(
$tmpid,
'Anhang',
'Ticket',
$ticketnachricht,
true
);
}
}
}
} // END File management
}
// Autoresponder
if (
$this->mailAccount->isAutoresponseEnabled()
&& $this->mailAccount->getAutoresponseText() !== ''
&& (
// $this->erpApi->AutoresponderBlacklist($from) !== 1 ||
$this->mailAccount->isAutoresponseLimitEnabled() === false
$this->erpApi->AutoresponderBlacklist($from) !== 1
|| $this->mailAccount->isAutoresponseLimitEnabled() === false
)
) {
@ -880,7 +843,5 @@ class TicketImportHelper
$text
);
}
return(true);
}
}

View File

@ -30,10 +30,10 @@ $factoryServiceMap = @include $serviceCacheFile;
if (!is_file($serviceCacheFile)) {
// Installer ausführen, wenn ServiceMap nicht vorhanden ist
// Installer ausführen wenn ServiceMap nicht vorhanden ist
$resolver = new Psr4ClassNameResolver();
$resolver->addNamespace('Xentral\\', __DIR__);
$resolver->excludeFile(__DIR__ . DIRECTORY_SEPARATOR . 'bootstrap.php');
$resolver->excludeFile(__DIR__ . '/bootstrap.php');
$generator = new ClassMapGenerator($resolver, __DIR__);
$installer = new Installer($generator, $resolver);

View File

@ -223,7 +223,7 @@ if ($task) {
} catch (Exception $e) {
$app->erp->LogFile(
$app->DB->real_escape_string(
'Prozessstarter Fehler bei Aufruf des Moduls ' . $task[$task_index]['parameter'] . ': ' . $e->getMessage()." Trace: ".$e->GetTraceAsString()
'Prozessstarter Fehler bei Aufruf des Moduls ' . $task[$task_index]['parameter'] . ': ' . $e->getMessage()
)
);
}

View File

@ -34,7 +34,7 @@ if(empty($app->remote)) {
$app->remote = new Remote($app);
}
}
$app->erp->LogFile("Lagerzahlen-Synchronisation Start");
$app->erp->LogFile("Starte Synchronisation");
//$app->DB->Update("UPDATE artikel SET cache_lagerplatzinhaltmenge='999'");
@ -53,9 +53,6 @@ $firmendatenid = $app->DB->Select("SELECT MAX(id) FROM firmendaten LIMIT 1");
$shops = $app->DB->SelectArr('SELECT * FROM `shopexport` WHERE `aktiv` = 1');
if(empty($shops)) {
$app->erp->LogFile("Lagerzahlen-Synchronisation Ende: Keine aktiven Shops");
return;
}
$shopByIds = [];
@ -100,9 +97,6 @@ $firmendatenid = $app->DB->Select("SELECT MAX(id) FROM firmendaten LIMIT 1");
);
if(empty($lagerartikel)) {
$app->erp->LogFile("Lagerzahlen-Synchronisation Ende: Keine fälligen Artikel");
return;
}
@ -116,7 +110,7 @@ $firmendatenid = $app->DB->Select("SELECT MAX(id) FROM firmendaten LIMIT 1");
}
$clagerartikel = $lagerartikel?count($lagerartikel):0;
$app->erp->LogFile('Lagerzahlen-Synchronisation, Artikel gesamt: '.$clagerartikel);
$app->erp->LogFile('Artikel Gesamt fuer Synchronisation: '.$clagerartikel);
foreach($lagerartikel as $ij => $articleId) {
$app->DB->Update(
"UPDATE `prozessstarter`
@ -125,9 +119,9 @@ $firmendatenid = $app->DB->Select("SELECT MAX(id) FROM firmendaten LIMIT 1");
);
try {
if($anzargs > 2){
$message .= $app->erp->LagerSync($articleId, false, $shopByIds); // 2nd parameter is print_echo -> prints via echo to logfile (big print_r)
$message .= $app->erp->LagerSync($articleId, true, $shopByIds);
}else{
$message .= $app->erp->LagerSync($articleId, false);
$message .= $app->erp->LagerSync($articleId, true);
}
}
catch (Exception $exception) {
@ -178,10 +172,9 @@ $firmendatenid = $app->DB->Select("SELECT MAX(id) FROM firmendaten LIMIT 1");
}
}
catch (Exception $exception) {
$app->erp->LogFile("Lagerzahlen-Synchronisation Exception:".$app->DB->real_escape_string($exception->getMessage()));
$app->erp->LogFile($app->DB->real_escape_string($exception->getMessage()));
}
}
$app->erp->LogFile("Lagerzahlen-Synchronisation Ende");
$app->erp->LogFile('Ende Synchronisation');

View File

@ -16728,11 +16728,7 @@ INSERT INTO `firmendaten_werte` (`id`, `name`, `typ`, `typ1`, `typ2`, `wert`, `d
(385, 'cleaner_shopimport', 'tinyint', '1', '', '1', '1', 0, 0),
(386, 'cleaner_shopimport_tage', 'int', '11', '', '90', '90', 0, 0),
(387, 'cleaner_adapterbox', 'tinyint', '1', '', '1', '1', 0, 0),
(388, 'cleaner_adapterbox_tage', 'int', '11', '', '90', '90', 0, 0),
(389, 'bcc3', 'varchar', '128', '', '', '', 0, 0),
(390, 'rechnungersatz_standard', 'int', '1', '', '0', '0', 0, 0)
;
(388, 'cleaner_adapterbox_tage', 'int', '11', '', '90', '90', 0, 0);
INSERT INTO `geschaeftsbrief_vorlagen` (`id`, `sprache`, `betreff`, `text`, `subjekt`, `projekt`, `firma`) VALUES
(1, 'deutsch', 'Bestellung {BELEGNR} von {FIRMA}', '{ANSCHREIBEN},<br><br>anbei übersenden wir Ihnen unsere Bestellung zu. Bitte senden Sie uns als Bestätigung für den Empfang eine Auftragsbestätigung zu.', 'Bestellung', 1, 1),
@ -16751,44 +16747,6 @@ INSERT INTO `geschaeftsbrief_vorlagen` (`id`, `sprache`, `betreff`, `text`, `sub
(16, 'deutsch', 'Zusammenstellung Ihrer Bestellung', '{ANSCHREIBEN},<br><br>soeben wurde Ihr Bestellung zusammengestellt. Sie können Ihre Ware jetzt abholen. Sind Sie bereits bei uns gewesen, so sehen Sie diese E-Mail bitte als gegenstandslos an.<br><br>{VERSAND}<br><br>Ihr {FIRMA} Team<br>', 'Selbstabholer', 0, 1),
(17, 'deutsch', 'Ihre Gutschrift {BELEGNR} von {FIRMA}', '{ANSCHREIBEN},<br><br>anbei finden Sie Ihre Gutschrift. Gerne stehen wir Ihnen weiterhin zur Verfügung.<br><br>Ihre Gutschrift ist im PDF-Format erstellt worden. Um sich die Gutschrift ansehen zu können, klicken Sie auf den Anhang und es öffnet sich automatisch der Acrobat Reader. Sollten Sie keinen Acrobat Reader besitzen, haben wir für Sie den Link zum kostenlosen Download von Adobe Acrobat Reader mit angegeben. Er führt Sie automatisch auf die Downloadseite von Adobe. So können Sie sich Ihre Gutschrift auch für Ihre Unterlagen ausdrucken.<br><br>http://www.adobe.com/products/acrobat/readstep2.html<br><br>{IF}{INTERNET}{THEN}Internet-Bestellnr.: {INTERNET}{ELSE}{ENDIF}', 'Gutschrift', 1, 1);
/* DBXE 2024-01-24 für datatablelabel */
INSERT INTO `hook` (`name`, `aktiv`, `parametercount`, `alias`, `description`) VALUES
('eproosystem_ende', 1, 0, '', ''),
('parseuservars', 1, 0, '', ''),
('dokumentsend_ende', 1, 0, '', ''),
('auftrag_versand_ende', 1, 0, '', ''),
('transfer_document_incoming', 1, 0, '', '')
;
INSERT INTO `hook_register` (`hook_action`, `function`, `aktiv`, `position`, `hook`, `module`, `module_parameter`) VALUES
(0, 'DataTableLabelsInclude', 1, 3, (SELECT id FROM hook WHERE name = 'eproosystem_ende'), 'Datatablelabels', 0),
(0, 'DatatablelabelsParseUserVars', 1, 2, (SELECT id FROM hook WHERE name = 'parseuservars'), 'Datatablelabels', 0),
(0, 'DataTableLabelsDokumentSendHook', 1, 1, (SELECT id FROM hook WHERE name = 'dokumentsend_ende'), 'Datatablelabels', 0),
(0, 'DatatablelabelsOrderSent', 1, 1, (SELECT id FROM hook WHERE name = 'auftrag_versand_ende'), 'Datatablelabels', 0),
(0, 'DatatablelabelsTransferDocumentIncomming', 1, 1, (SELECT id FROM hook WHERE name = 'transfer_document_incoming'), 'Datatablelabels', 0);
/* DBXE 2024-01-24 für datatablelabel */
/* OpenXE 2024-02-03 für belegvorlagen */
INSERT INTO `hook` (`name`, `aktiv`, `parametercount`, `alias`, `description`) VALUES
('BelegPositionenButtons', 1, 3, '', ''),
('AARLGPositionen_cmds_end', 1, 1, '', ''),
('ajax_filter_hook1', 1, 1, '', '');
INSERT INTO `hook_register` (`hook_action`, `function`, `aktiv`, `position`, `hook`, `module`, `module_parameter`) VALUES
(0, 'BelegevorlagenAARLGPositionen_cmds_end', 1, 2, (SELECT id FROM hook WHERE name = 'AARLGPositionen_cmds_end' LIMIT 1), 'belegevorlagen', 0),
(0, 'Belegevorlagenajax_filter_hook1', 1, 2, (SELECT id FROM hook WHERE name = 'ajax_filter_hook1' LIMIT 1), 'belegevorlagen', 0),
(0, 'BelegevorlagenBelegPositionenButtons', 1, 2, (SELECT id FROM hook WHERE name = 'BelegPositionenButtons' LIMIT 1), 'belegevorlagen', 0)
;
/* DBXE 2024-02-03 für belegvorlagen */
/*
BelegPositionenButtons
Id,Hook_action,Function,Aktiv,Position,Hook,Module,Module_parameter
20,0,BelegevorlagenBelegPositionenButtons,1,2,16,belegevorlagen,0
*/
INSERT INTO `hook_menu` (`id`, `module`, `aktiv`) VALUES
(1, 'artikel', 1),
(2, 'provisionenartikel', 1),
@ -16840,8 +16798,7 @@ INSERT INTO `prozessstarter` (`id`, `bezeichnung`, `bedingung`, `art`, `startzei
(6, 'Überzahlte Rechnungen', '', 'uhrzeit', '2015-10-25 23:00:00', '0000-00-00 00:00:00', '', 'cronjob', 'ueberzahlterechnungen', 0, 0, 0, 1, ''),
(7, 'Umsatzstatistik', '', 'uhrzeit', '2015-10-25 23:30:00', '0000-00-00 00:00:00', '', 'cronjob', 'umsatzstatistik', 0, 0, 0, 1, ''),
(8, 'Paketmarken Tracking Download', '', 'uhrzeit', '2015-10-25 14:00:00', '0000-00-00 00:00:00', '', 'cronjob', 'wgettracking', 0, 0, 0, 1, ''),
(9, 'Lagerhistorie', '', 'uhrzeit', '2015-10-25 00:00:00', '0000-00-00 00:00:00', '', 'cronjob', 'lagerwert', 0, 0, 0, 1, ''),
(10, 'Chat-Benachrichtigung', '', 'periodisch', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '60', 'cronjob', 'chat', 0, 0, 0, 1, '');
(9, 'Chat-Benachrichtigung', '', 'periodisch', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '60', 'cronjob', 'chat', 0, 0, 0, 1, '');
INSERT INTO `user` (`id`, `username`, `password`, `repassword`, `description`, `settings`, `parentuser`, `activ`, `type`, `adresse`, `fehllogins`, `standarddrucker`, `firma`, `logdatei`, `startseite`, `hwtoken`, `hwkey`, `hwcounter`, `motppin`, `motpsecret`, `passwordmd5`, `externlogin`, `projekt_bevorzugen`, `email_bevorzugen`, `projekt`, `rfidtag`, `vorlage`, `kalender_passwort`, `kalender_ausblenden`, `kalender_aktiv`, `gpsstechuhr`, `standardetikett`, `standardfax`, `internebezeichnung`, `hwdatablock`, `standardversanddrucker`, `passwordsha512`, `salt`) VALUES
(1, 'admin', 'qnvEQ1sFWNdIg', 0, 'Administrator', 'firstinstall', 0, 1, 'admin', 1, 0, 0, 1, '2016-08-05 08:34:59', NULL, NULL, NULL, NULL, NULL, NULL, '21232f297a57a5a743894a0e4a801fc3', 1, 0, 1, 0, '', NULL, NULL, 0, NULL, NULL, 0, 0, NULL, NULL, 0, '', '');
@ -18210,7 +18167,7 @@ INSERT INTO `wiedervorlage_stages` (`id`, `kurzbezeichnung`, `name`, `hexcolor`,
(12, 'Stay', 'Stay (Erhalt)', '#A2D624', 0, 1, 4, 4, NULL),
(13, 'Okay', 'Okay (Befürwortung)', '#A2D624', 0, 1, 5, 4, NULL);
INSERT INTO `wiki` (`id`, `name`, `content`, `lastcontent`) VALUES
(1, 'StartseiteWiki', '\n<p>Herzlich Willkommen in Ihrem DBXE, dem freien ERP.<br><br>Wir freuen uns Sie als Benutzer begrüßen zu dürfen. Mit DBXE organisieren Sie Ihre Firma schnell und einfach. Sie haben alle wichtigen Zahlen und Vorgänge im Überblick.<br><br>Für Einsteiger sind die folgenden Themen wichtig:<br><br></p>\n<ul>\n<li> <a href="index.php?module=firmendaten&amp;action=edit" target="_blank"> Firmendaten</a> (dort richten Sie Ihr Briefpapier ein)</li>\n<li> <a href="index.php?module=adresse&amp;action=list" target="_blank"> Stammdaten / Adressen</a> (Kunden und Lieferanten anlegen)</li>\n<li> <a href="index.php?module=artikel&amp;action=list" target="_blank"> Artikel anlegen</a> (Ihr Artikelstamm)</li>\n<li> <a href="index.php?module=angebot&amp;action=list" target="_blank"> Angebot</a> / <a href="index.php?module=auftrag&amp;action=list" target="_blank"> Auftrag</a> (Alle Dokumente für Ihr Geschäft)</li>\n<li> <a href="index.php?module=rechnung&amp;action=list" target="_blank"> Rechnung</a> / <a href="index.php?module=gutschrift&amp;action=list" target="_blank"> Gutschrift</a></li>\n<li> <a href="index.php?module=lieferschein&amp;action=list" target="_blank"> Lieferschein</a></li>\n</ul>\n<p><br><br>Kennen Sie unsere Zusatzmodule die Struktur und Organisation in das tägliche Geschäft bringen?<br><br></p>\n<ul>\n<li> <a href="index.php?module=kalender&amp;action=list" target="_blank"> Kalender</a></li>\n<li> <a href="index.php?module=wiki&amp;action=list" target="_blank"> Wiki</a></li>\n</ul>', NULL);
(1, 'StartseiteWiki', '\n<p>Herzlich Willkommen in Ihrem OpenXE, dem freien ERP.<br><br>Wir freuen uns Sie als Benutzer begrüßen zu dürfen. Mit OpenXE organisieren Sie Ihre Firma schnell und einfach. Sie haben alle wichtigen Zahlen und Vorgänge im Überblick.<br><br>Für Einsteiger sind die folgenden Themen wichtig:<br><br></p>\n<ul>\n<li> <a href="index.php?module=firmendaten&amp;action=edit" target="_blank"> Firmendaten</a> (dort richten Sie Ihr Briefpapier ein)</li>\n<li> <a href="index.php?module=adresse&amp;action=list" target="_blank"> Stammdaten / Adressen</a> (Kunden und Lieferanten anlegen)</li>\n<li> <a href="index.php?module=artikel&amp;action=list" target="_blank"> Artikel anlegen</a> (Ihr Artikelstamm)</li>\n<li> <a href="index.php?module=angebot&amp;action=list" target="_blank"> Angebot</a> / <a href="index.php?module=auftrag&amp;action=list" target="_blank"> Auftrag</a> (Alle Dokumente für Ihr Geschäft)</li>\n<li> <a href="index.php?module=rechnung&amp;action=list" target="_blank"> Rechnung</a> / <a href="index.php?module=gutschrift&amp;action=list" target="_blank"> Gutschrift</a></li>\n<li> <a href="index.php?module=lieferschein&amp;action=list" target="_blank"> Lieferschein</a></li>\n</ul>\n<p><br><br>Kennen Sie unsere Zusatzmodule die Struktur und Organisation in das tägliche Geschäft bringen?<br><br></p>\n<ul>\n<li> <a href="index.php?module=kalender&amp;action=list" target="_blank"> Kalender</a></li>\n<li> <a href="index.php?module=wiki&amp;action=list" target="_blank"> Wiki</a></li>\n</ul>', NULL);
INSERT INTO `konten` (`id`, `bezeichnung`, `kurzbezeichnung`, `type`, `erstezeile`, `datevkonto`, `blz`, `konto`, `swift`, `iban`, `lastschrift`, `hbci`, `hbcikennung`, `inhaber`, `aktiv`, `keineemail`, `firma`, `schreibbar`, `importletztenzeilenignorieren`, `liveimport`, `liveimport_passwort`, `liveimport_online`, `importtrennzeichen`, `codierung`, `importerstezeilenummer`, `importdatenmaskierung`, `importnullbytes`, `glaeubiger`, `geloescht`, `projekt`, `saldo_summieren`, `saldo_betrag`, `saldo_datum`, `importfelddatum`, `importfelddatumformat`, `importfelddatumformatausgabe`, `importfeldbetrag`, `importfeldbetragformat`, `importfeldbuchungstext`, `importfeldbuchungstextformat`, `importfeldwaehrung`, `importfeldwaehrungformat`, `importfeldhabensollkennung`, `importfeldkennunghaben`, `importfeldkennungsoll`, `importextrahabensoll`, `importfeldhaben`, `importfeldsoll`, `cronjobaktiv`, `cronjobverbuchen`) VALUES

View File

@ -765,7 +765,6 @@ $tooltip['firmendaten']['edit']['bezeichnungangebotersatz']="Im Angebot gibt es
$tooltip['firmendaten']['edit']['angebotersatz_standard']="Mit dieser Option setzen Sie die alternative Bezeichnung im Angebot (Option drüber) als Standard. Dadurch ist der Haken beim Erstellen eines neuen Angebots immer gesetzt.";
$tooltip['firmendaten']['edit']['bezeichnungauftragersatz']="Im Auftrag gibt es einen Haken um den Betreff des Augtrag-Belegs umzubenennen.<br>Mit der Option hier legen Sie den Namen des alternativen Betreffs fest.";
$tooltip['firmendaten']['edit']['bezeichnungrechnungersatz']="In der Rechnung gibt es einen Haken um den Betreff des Rechnung-Belegs umzubenennen.<br>Mit der Option hier legen Sie den Namen des alternativen Betreffs fest.";
$tooltip['firmendaten']['edit']['rechnungersatz_standard']="Mit dieser Option setzen Sie die alternative Bezeichnung in der Rechnung (Option drüber) als Standard. Dadurch ist der Haken beim Erstellen einer neuen Rechnung immer gesetzt.";
$tooltip['firmendaten']['edit']['bezeichnunglieferscheinersatz']="Im Lieferschein gibt es einen Haken um den Betreff des Lieferschein-Belegs umzubenennen.<br>Mit der Option hier legen Sie den Namen des alternativen Betreffs fest.";
$tooltip['firmendaten']['edit']['bezeichnungbestellungersatz']="In der Bestellung gibt es einen Haken um den Betreff des Bestell-Belegs umzubenennen.<br>Mit der Option hier legen Sie den Namen des alternativen Betreffs fest.";
$tooltip['firmendaten']['edit']['bezeichnungproformarechnungersatz']="In der Proformarechnung gibt es einen Haken um den Betreff der Proformarechnung-Belegs umzubenennen.<br>Mit der Option hier legen Sie den Namen des alternativen Betreffs fest.";
@ -1084,9 +1083,9 @@ $tooltip['produktionszentrum']['abschluss']['#auftragmengenanpassen']="Die Menge
$tooltip['produktion']['abschluss']['#mengeerfolgreich'] = 'Höhere Mengen als die geplante Menge können nur mit der deaktivierten (kein Haken setzen) Systemeinstellung "Produktionskorrektur nicht verwenden" verbucht werden. ';
$tooltip['produktion']['edit']['#mengeerfolgreich'] = $tooltip['produktion']['abschluss']['#mengeerfolgreich'];
$tooltip['produktion']['create']['#standardlager'] = "Lager, aus dem die Artikel für die Produktion ausgelagert werden sollen. Hier können alle Lager ausgewählt werden, in denen sich mindestens ein Lagerplatz befindet, aus dem Produktionen ausgelagert werden dürfen (Einstellung auf Regalebene unter Lager => Lagerverwaltung).";
$tooltip['produktion']['create']['#standardlager'] = "Lager, aus dem die Artikel für die Produktion ausgelagert werden sollen.Hier können alle Lager ausgewählt werden, in denen sich mindestens ein Lagerplatz befindet, aus dem Produktionen ausgelagert werden dürfen (Einstellung auf Regalebene unter Lager => Lagerverwaltung).";
$tooltip['produktion']['edit']['#standardlager'] = $tooltip['produktion']['create']['#standardlager'];
$tooltip['produktion']['edit']['#ziellager'] = "Wenn kein Ziellager angegenen ist, wird in das Standard-Lager des Artikels gebucht, wenn es das nicht gibt, in das Materiallager der Produktion.";
/* PROJEKT */
@ -1461,4 +1460,4 @@ $tooltip['coppersurcharge']['list']['surcharge-invoice'] = '(Pflichtfeld) Welche
$tooltip['coppersurcharge']['list']['surcharge-delivery-costs'] = '(Pflichtfeld) Bezugskosten sind eine Grundlage der Berechnungsformel (in %): Kupferzuschlag EUR/km = (Kupfergewicht (kg/km) * (DEL + Bezugskosten)) - Kupferbasis / 100. Der Standard sind derzeit 1%';
$tooltip['coppersurcharge']['list']['surcharge-copper-base-standard'] = '(Pflichtfeld) Die Kupferbasis ist eine Grundlage der Berechnungsformel: Kupferzuschlag EUR/km = (Kupfergewicht (kg/km) * (DEL + Bezugskosten)) - Kupferbasis / 100. Der Standard sind derzeit 150 EUR pro 100kg';
$tooltip['coppersurcharge']['list']['surcharge-copper-base'] = 'Falls ein Artikel eine abweichende Kupferbasis haben soll kann diese in einem Freifeld gepflegt werden. Dieses kann hier ausgewählt werden.';
$tooltip['coppersurcharge']['list']['surcharge-copper-number'] = '(Pflichtfeld) In diesem Freifeld kann die artikelspezifische Kupferzahl (km/kg) gepflegt werden. Sie ist Grundlage der Berechnung: Kupferzuschlag EUR/km = (Kupfergewicht (kg/km) * (DEL + Bezugskosten)) - Kupferbasis / 100.';
$tooltip['coppersurcharge']['list']['surcharge-copper-number'] = '(Pflichtfeld) In diesem Freifeld kann die artikelspezifische Kupferzahl (km/kg) gepflegt werden. Sie ist Grundlage der Berechnung: Kupferzuschlag EUR/km = (Kupfergewicht (kg/km) * (DEL + Bezugskosten)) - Kupferbasis / 100.';

View File

@ -1,361 +1,361 @@
<?php
/*
**** COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
*
* Xentral (c) Xentral ERP Sorftware GmbH, Fuggerstrasse 11, D-86150 Augsburg, * Germany 2019
*
* This file is licensed under the Embedded Projects General Public License *Version 3.1.
*
* You should have received a copy of this license from your vendor and/or *along with this file; If not, please visit www.wawision.de/Lizenzhinweis
* to obtain the text of the corresponding license version.
*
**** END OF COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
/*
**** COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
*
* Xentral (c) Xentral ERP Sorftware GmbH, Fuggerstrasse 11, D-86150 Augsburg, * Germany 2019
*
* This file is licensed under the Embedded Projects General Public License *Version 3.1.
*
* You should have received a copy of this license from your vendor and/or *along with this file; If not, please visit www.wawision.de/Lizenzhinweis
* to obtain the text of the corresponding license version.
*
**** END OF COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
*/
?>
<?php
/// represent a HTML Form structure
class HTMLForm
{
var $action;
var $method;
var $name;
var $id;
var $FieldList;
function __construct($action="",$method="post",$name="",$id="")
{
$this->action=$action;
$this->name=$name;
$this->method=$method;
$this->id=$id;
}
function Set($value)
{
}
function Get()
{
}
function GetClose()
{
}
}
class HTMLTextarea
{
var $name;
var $rows;
var $value;
var $cols;
var $id="";
var $readonly="";
var $disabled="";
var $class;
function __construct($name,$rows,$cols,$defvalue="",$id="",$readonly="",$disabled="",$class="")
{
$this->name = $name;
$this->rows = $rows;
$this->cols = $cols;
$this->class = $class;
$this->value = $defvalue;
$this->id = $id;
if($id=="")
$this->id = $name;
$this->readonly = $readonly;
$this->disabled = $disabled;
}
function Get()
{
// TEMP ACHTUNG HIER IST MIST!!!
$value = $this->value;
/*
if(!defined('WFHTMLTextareabr') || !WFHTMLTextareabr)$value = preg_replace('/<br\\s*?\/??>/i', "\n", $value);
*/
// $value = str_replace("\\r\\n","\n",$value);
$html = "<textarea rows=\"{$this->rows}\" id=\"{$this->id}\" class=\"{$this->class}\"
name=\"{$this->name}\" cols=\"{$this->cols}\"
{$this->readonly} {$this->disabled} [COMMONREADONLYINPUT]>$value</textarea>";
return $html;
}
function GetClose()
{
}
}
/// fuer Datenfelder die mit in die Datenbank o.ae. kommen sollen, aber nicht durch den
/// user in irgendeiner art und weise gesehen und manipuliert werden koennen
class BlindField
{
var $name;
var $value;
function __construct($name,$value)
{
$this->name = $name;
$this->value = $value;
}
function Get(){}
function GetClose(){}
}
class HTMLInput
{
var $name;
var $type;
var $value;
var $dbvalue;
var $checkvalue;
var $onchange;
var $onclick;
var $defvalue;
var $size;
var $maxlength;
var $tabindex;
var $id="";
var $readonly="";
var $disabled="";
var $placeholder="";
var $class;
var $checked;
function __construct($name,$type,$value,$size="",$maxlength="",$id="",$defvalue="",$checked="",$readonly="",$disabled="",$class="",$onclick="",$tabindex="",$placeholder="")
{
$this->name = $name;
$this->type = $type;
$this->value = $value;
$this->size = $size;
$this->maxlength = $maxlength;
$this->id = $id;
$this->readonly = $readonly;
$this->disabled = $disabled;
$this->class=$class;
$this->checked=$checked;
$this->tabindex=$tabindex;
$this->placeholder=$placeholder;
$this->defvalue=$defvalue; // if value is empty use this
$this->onclick=$onclick;
}
function Get()
{
if($this->id=="") $this->id = $this->name;
switch($this->type)
{
case "text":
$html = "<input type=\"{$this->type}\" id=\"{$this->id}\" class=\"{$this->class}\" tabindex=\"{$this->tabindex}\"
name=\"{$this->name}\" value=\"".preg_replace("/\"/","&quot;",$this->value)."\" size=\"{$this->size}\" placeholder=\"{$this->placeholder}\"
maxlength=\"{$this->maxlength}\" {$this->readonly} {$this->disabled} [COMMONREADONLYINPUT]>";
break;
case "password":
$html = "<input type=\"{$this->type}\" id=\"{$this->id}\" class=\"{$this->class}\" tabindex=\"{$this->tabindex}\"
name=\"{$this->name}\" value=\"{$this->value}\" size=\"{$this->size}\"
maxlength=\"{$this->maxlength}\" {$this->readonly} {$this->disabled} [COMMONREADONLYINPUT]>";
break;
case "checkbox":
$html = "<input type=\"{$this->type}\" id=\"{$this->id}\" class=\"{$this->class}\" tabindex=\"{$this->tabindex}\"
name=\"{$this->name}\" value=\"{$this->value}\" {$this->checked} onchange=\"{$this->onchange}\" onclick=\"{$this->onclick}\"
{$this->readonly} {$this->disabled} [COMMONREADONLYINPUT]>";
break;
case "radio":
if($this->value==$this->defvalue) $this->checked="checked";
$tmpname = str_replace('_'.$this->defvalue,'',$this->name);
$html = "<input type=\"{$this->type}\" id=\"{$this->id}\" class=\"{$this->class}\" tabindex=\"{$this->tabindex}\"
name=\"{$tmpname}\" value=\"{$this->defvalue}\" {$this->checked} onchange=\"{$this->onchange}\"
{$this->readonly} {$this->disabled} [COMMONREADONLYINPUT]>";
break;
case "submit":
$html = "<input type=\"{$this->type}\" id=\"{$this->id}\" class=\"{$this->class}\"
name=\"{$this->name}\" value=\"{$this->value}\"
{$this->readonly} {$this->disabled}>";
break;
case "hidden":
$html = "<input type=\"{$this->type}\" id=\"{$this->id}\" class=\"{$this->class}\"
name=\"{$this->name}\" value=\"{$this->value}\" size=\"{$this->size}\"
maxlength=\"{$this->maxlength}\" {$this->readonly} {$this->disabled}>";
break;
}
return $html;
}
function GetClose()
{
}
}
class HTMLCheckbox extends HTMLInput
{
function __construct($name,$value,$defvalue,$checkvalue="",$onclick="",$tabindex="")
{
if($checkvalue!="")
$this->checkvalue=$checkvalue;
else
$this->checkvalue=$value;
$this->name = $name;
$this->type = "checkbox";
$this->checkradiovalue = isset($okvalue)?$okvalue:null;
$this->defvalue = $defvalue;
$this->value = $value;
$this->onclick= $onclick;
$this->tabindex= $tabindex;
$this->orgvalue = $value;
}
function Get()
{
if(($this->value=="" && $this->defvalue==$this->checkvalue)) {
}
if($this->checkvalue==$this->value) {
$this->checked="checked";
}
if($this->value=="" && $this->defvalue!=$this->checkvalue)
$this->checked="";
$this->value = $this->checkvalue;
//$this->value=1;
return parent::Get();
}
function GetClose()
{
}
};
class HTMLSelect
{
var $name;
var $size;
var $id;
var $readonly;
var $disabled;
var $options;
var $onchange;
var $selected;
var $tabindex;
var $class;
function __construct($name,$size,$id="",$readonly=false,$disabled=false,$tabindex="")
{
$this->name=$name;
$this->size=$size;
$this->id=$id;
$this->readonly=$readonly;
$this->disabled=$disabled;
$this->tabindex=$tabindex;
$this->class="";
if($id=="")
$this->id = $name;
}
function AddOption($option,$value)
{
$this->options[] = array($option,$value);
}
function AddOptionsDimensionalArray($values)
{
foreach($values as $key=>$value)
{
$this->options[] = array($value[wert],$value[schluessel]);
}
}
function AddOptionsAsocSimpleArray($values)
{
foreach($values as $key=>$value)
$this->options[] = array($value,$key);
}
function AddOptionsSimpleArray($values)
{
if(is_array($values))
{
foreach($values as $key=>$value)
{
if(!is_numeric($key))
$this->options[] = array($value,$key);
else
$this->options[] = array($value,$value);
}
}
}
function AddOptions($values)
{
$number=0;
if(count($values)>0)
{
foreach($values as $key=>$row)
foreach($row as $value)
{
if($number==0){
$option=$value;
$number=1;
}
else {
$this->options[] = array($option,$value);
$number=0;
$option="";
}
}
}
}
function Get()
{
$html = "<select name=\"{$this->name}\" size=\"{$this->size}\" tabindex=\"{$this->tabindex}\"
id=\"{$this->id}\" class=\"{$this->class}\" onchange=\"{$this->onchange}\" [COMMONREADONLYSELECT]>";
if($this->options && count($this->options)>0)
{
foreach($this->options as $key=>$value)
{
if($this->value==$value[1])
$html .="<option value=\"{$value[1]}\" selected>{$value[0]}</option>";
else
$html .="<option value=\"{$value[1]}\">{$value[0]}</option>";
}
}
$html .="</select>";
return $html;
}
function GetClose()
{
}
}
<?php
/// represent a HTML Form structure
class HTMLForm
{
var $action;
var $method;
var $name;
var $id;
var $FieldList;
function __construct($action="",$method="post",$name="",$id="")
{
$this->action=$action;
$this->name=$name;
$this->method=$method;
$this->id=$id;
}
function Set($value)
{
}
function Get()
{
}
function GetClose()
{
}
}
class HTMLTextarea
{
var $name;
var $rows;
var $value;
var $cols;
var $id="";
var $readonly="";
var $disabled="";
var $class;
function __construct($name,$rows,$cols,$defvalue="",$id="",$readonly="",$disabled="",$class="")
{
$this->name = $name;
$this->rows = $rows;
$this->cols = $cols;
$this->class = $class;
$this->value = $defvalue;
$this->id = $id;
if($id=="")
$this->id = $name;
$this->readonly = $readonly;
$this->disabled = $disabled;
}
function Get()
{
// TEMP ACHTUNG HIER IST MIST!!!
$value = $this->value;
/*
if(!defined('WFHTMLTextareabr') || !WFHTMLTextareabr)$value = preg_replace('/<br\\s*?\/??>/i', "\n", $value);
*/
// $value = str_replace("\\r\\n","\n",$value);
$html = "<textarea rows=\"{$this->rows}\" id=\"{$this->id}\" class=\"{$this->class}\"
name=\"{$this->name}\" cols=\"{$this->cols}\"
{$this->readonly} {$this->disabled} [COMMONREADONLYINPUT]>$value</textarea>";
return $html;
}
function GetClose()
{
}
}
/// fuer Datenfelder die mit in die Datenbank o.ae. kommen sollen, aber nicht durch den
/// user in irgendeiner art und weise gesehen und manipuliert werden koennen
class BlindField
{
var $name;
var $value;
function __construct($name,$value)
{
$this->name = $name;
$this->value = $value;
}
function Get(){}
function GetClose(){}
}
class HTMLInput
{
var $name;
var $type;
var $value;
var $dbvalue;
var $checkvalue;
var $onchange;
var $onclick;
var $defvalue;
var $size;
var $maxlength;
var $tabindex;
var $id="";
var $readonly="";
var $disabled="";
var $placeholder="";
var $class;
var $checked;
function __construct($name,$type,$value,$size="",$maxlength="",$id="",$defvalue="",$checked="",$readonly="",$disabled="",$class="",$onclick="",$tabindex="",$placeholder="")
{
$this->name = $name;
$this->type = $type;
$this->value = $value;
$this->size = $size;
$this->maxlength = $maxlength;
$this->id = $id;
$this->readonly = $readonly;
$this->disabled = $disabled;
$this->class=$class;
$this->checked=$checked;
$this->tabindex=$tabindex;
$this->placeholder=$placeholder;
$this->defvalue=$defvalue; // if value is empty use this
$this->onclick=$onclick;
}
function Get()
{
if($this->id=="") $this->id = $this->name;
switch($this->type)
{
case "text":
$html = "<input type=\"{$this->type}\" id=\"{$this->id}\" class=\"{$this->class}\" tabindex=\"{$this->tabindex}\"
name=\"{$this->name}\" value=\"".preg_replace("/\"/","&quot;",$this->value)."\" size=\"{$this->size}\" placeholder=\"{$this->placeholder}\"
maxlength=\"{$this->maxlength}\" {$this->readonly} {$this->disabled} [COMMONREADONLYINPUT]>";
break;
case "password":
$html = "<input type=\"{$this->type}\" id=\"{$this->id}\" class=\"{$this->class}\" tabindex=\"{$this->tabindex}\"
name=\"{$this->name}\" value=\"{$this->value}\" size=\"{$this->size}\"
maxlength=\"{$this->maxlength}\" {$this->readonly} {$this->disabled} [COMMONREADONLYINPUT]>";
break;
case "checkbox":
$html = "<input type=\"{$this->type}\" id=\"{$this->id}\" class=\"{$this->class}\" tabindex=\"{$this->tabindex}\"
name=\"{$this->name}\" value=\"{$this->value}\" {$this->checked} onchange=\"{$this->onchange}\" onclick=\"{$this->onclick}\"
{$this->readonly} {$this->disabled} [COMMONREADONLYINPUT]>";
break;
case "radio":
if($this->value==$this->defvalue) $this->checked="checked";
$tmpname = str_replace('_'.$this->defvalue,'',$this->name);
$html = "<input type=\"{$this->type}\" id=\"{$this->id}\" class=\"{$this->class}\" tabindex=\"{$this->tabindex}\"
name=\"{$tmpname}\" value=\"{$this->defvalue}\" {$this->checked} onchange=\"{$this->onchange}\"
{$this->readonly} {$this->disabled} [COMMONREADONLYINPUT]>";
break;
case "submit":
$html = "<input type=\"{$this->type}\" id=\"{$this->id}\" class=\"{$this->class}\"
name=\"{$this->name}\" value=\"{$this->value}\"
{$this->readonly} {$this->disabled}>";
break;
case "hidden":
$html = "<input type=\"{$this->type}\" id=\"{$this->id}\" class=\"{$this->class}\"
name=\"{$this->name}\" value=\"{$this->value}\" size=\"{$this->size}\"
maxlength=\"{$this->maxlength}\" {$this->readonly} {$this->disabled}>";
break;
}
return $html;
}
function GetClose()
{
}
}
class HTMLCheckbox extends HTMLInput
{
function __construct($name,$value,$defvalue,$checkvalue="",$onclick="",$tabindex="")
{
if($checkvalue!="")
$this->checkvalue=$checkvalue;
else
$this->checkvalue=$value;
$this->name = $name;
$this->type = "checkbox";
$this->checkradiovalue = isset($okvalue)?$okvalue:null;
$this->defvalue = $defvalue;
$this->value = $value;
$this->onclick= $onclick;
$this->tabindex= $tabindex;
$this->orgvalue = $value;
}
function Get()
{
if(($this->value=="" && $this->defvalue==$this->checkvalue)) {
}
if($this->checkvalue==$this->value) {
$this->checked="checked";
}
if($this->value=="" && $this->defvalue!=$this->checkvalue)
$this->checked="";
$this->value = $this->checkvalue;
//$this->value=1;
return parent::Get();
}
function GetClose()
{
}
};
class HTMLSelect
{
var $name;
var $size;
var $id;
var $readonly;
var $disabled;
var $options;
var $onchange;
var $selected;
var $tabindex;
var $class;
function __construct($name,$size,$id="",$readonly=false,$disabled=false,$tabindex="")
{
$this->name=$name;
$this->size=$size;
$this->id=$id;
$this->readonly=$readonly;
$this->disabled=$disabled;
$this->tabindex=$tabindex;
$this->class="";
if($id=="")
$this->id = $name;
}
function AddOption($option,$value)
{
$this->options[] = array($option,$value);
}
function AddOptionsDimensionalArray($values)
{
foreach($values as $key=>$value)
{
$this->options[] = array($value[wert],$value[schluessel]);
}
}
function AddOptionsAsocSimpleArray($values)
{
foreach($values as $key=>$value)
$this->options[] = array($value,$key);
}
function AddOptionsSimpleArray($values)
{
if(is_array($values))
{
foreach($values as $key=>$value)
{
if(!is_numeric($key))
$this->options[] = array($value,$key);
else
$this->options[] = array($value,$value);
}
}
}
function AddOptions($values)
{
$number=0;
if(count($values)>0)
{
foreach($values as $key=>$row)
foreach($row as $value)
{
if($number==0){
$option=$value;
$number=1;
}
else {
$this->options[] = array($option,$value);
$number=0;
$option="";
}
}
}
}
function Get()
{
$html = "<select name=\"{$this->name}\" size=\"{$this->size}\" tabindex=\"{$this->tabindex}\"
id=\"{$this->id}\" class=\"{$this->class}\" onchange=\"{$this->onchange}\" [COMMONREADONLYSELECT]>";
if($this->options && count($this->options)>0)
{
foreach($this->options as $key=>$value)
{
if($this->value==$value[1])
$html .="<option value=\"{$value[1]}\" selected>{$value[0]}</option>";
else
$html .="<option value=\"{$value[1]}\">{$value[0]}</option>";
}
}
$html .="</select>";
return $html;
}
function GetClose()
{
}
}

View File

@ -197,7 +197,7 @@ class Acl
break;
case 'dateien':
$sql = "SELECT objekt FROM datei_stichwoerter WHERE datei = %s LIMIT 1";
$sql = "SELECT objekt FROM datei_stichwoerter WHERE datei = %s";
$dateiModul = strtolower($this->app->DB->Select(sprintf($sql,$id)));
//TODO datei_stichwoerter.objekt ist nicht zuverlässig für alle Datentypen. Deswegen nur zur Absicherung der bekannten Fälle #604706
@ -1252,7 +1252,7 @@ Options -Indexes
# Deny access to all *.php
Order deny,allow
Allow from all
<FilesMatch "\.(css|jpg|jpeg|gif|png|svg|js|ico|css.map|js.map)$">
<FilesMatch "\.(css|jpg|jpeg|gif|png|svg|js)$">
Order Allow,Deny
Allow from all
</FilesMatch>
@ -1261,20 +1261,6 @@ Allow from all
Order Allow,Deny
Allow from all
</Files>
# Allow access to setup.php
<Files setup.php>
Order Allow,Deny
Allow from all
</Files>
# Allow access to inline PDF viewer
<Files viewer.html>
Order Allow,Deny
Allow from all
</Files>
<Files robots.txt>
Order Allow,Deny
Allow from all
</Files>
# end
');

View File

@ -1230,7 +1230,7 @@ class DB{
$sql = "UPDATE `$tablename` SET ";
foreach($ArrCols as $key=>$value) {
if($key!=$pkname && (isset($ziel[$key]) || !$zielspalten)) {
$sqla[] = "`".$key."` = '".($escape?$this->real_escape_string($value):$value)."' ";
$sqla[] = $key." = '".($escape?$this->real_escape_string($value):$value)."' ";
}
}
if(!empty($sqla)) {
@ -1424,7 +1424,7 @@ class DB{
if(empty($TableName) || empty($IDFieldName) || empty($IDToDuplicate)) {
return null;
}
/*
$sql = "SELECT * FROM $TableName WHERE $IDFieldName = $IDToDuplicate";
$result = @mysqli_query($this->connection,$sql);
if(empty($result)) {
@ -1442,23 +1442,6 @@ class DB{
}
$sql .= $RowKeys[$i] . " = '" . $this->real_escape_string($RowValues[$i]) . "'";
}
@mysqli_query($this->connection,$sql);
*/
$sql = "INSERT INTO ".$TableName." SELECT ";
$fields = $this->GetColAssocArray($TableName);
$comma = "";
foreach ($fields as $field => $value) {
if ($field != $IDFieldName) {
$sql .= $comma."`".$field."`";
} else {
$sql .= "NULL";
}
$comma = ", ";
}
$sql .= " FROM ".$TableName." WHERE id = ".$IDToDuplicate;
@mysqli_query($this->connection,$sql);
$id = $this->GetInsertID();

View File

@ -1,344 +1,340 @@
<?php
/*
**** COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
*
* Xentral (c) Xentral ERP Sorftware GmbH, Fuggerstrasse 11, D-86150 Augsburg, * Germany 2019
*
* This file is licensed under the Embedded Projects General Public License *Version 3.1.
*
* You should have received a copy of this license from your vendor and/or *along with this file; If not, please visit www.wawision.de/Lizenzhinweis
* to obtain the text of the corresponding license version.
*
**** END OF COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
/*
**** COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
*
* Xentral (c) Xentral ERP Sorftware GmbH, Fuggerstrasse 11, D-86150 Augsburg, * Germany 2019
*
* This file is licensed under the Embedded Projects General Public License *Version 3.1.
*
* You should have received a copy of this license from your vendor and/or *along with this file; If not, please visit www.wawision.de/Lizenzhinweis
* to obtain the text of the corresponding license version.
*
**** END OF COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
*/
?>
<?php
/// Secure Layer, SQL Inject. Check, Syntax Check
class Secure
{
public $GET;
public $POST;
/**
* Secure constructor.
*
* @param ApplicationCore $app
*/
public function __construct($app){
$this->app = $app;
// clear global variables, that everybody have to go over secure layer
$this->GET = $_GET;
if(isset($this->GET['msgs']) && isset($this->app->Location)) {
$this->GET['msg'] = $this->app->Location->getMessage($this->GET['msgs']);
}
// $_GET="";
$this->POST = $_POST;
// $_POST="";
if(!isset($this->app->stringcleaner) && file_exists(__DIR__. '/class.stringcleaner.php')) {
if(!class_exists('StringCleaner')) {
require_once __DIR__ . '/class.stringcleaner.php';
}
$this->app->stringcleaner = new StringCleaner($this->app);
}
$this->AddRule('notempty','reg','.'); // at least one sign
$this->AddRule('alpha','reg','[a-zA-Z]');
$this->AddRule('digit','reg','[0-9]');
$this->AddRule('space','reg','[ ]');
$this->AddRule('specialchars','reg','[_-]');
$this->AddRule('email','reg','^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.([a-zA-Z]{2,4})$');
$this->AddRule('datum','reg','([0-9]{1,2})\.([0-9]{1,2})\.([0-9]{4})');
$this->AddRule('username','glue','alpha+digit');
$this->AddRule('password','glue','alpha+digit+specialchars');
}
/**
* @param string $name
* @param null $rule
* @param string $maxlength
* @param string $sqlcheckoff
*
* @return array|mixed|string
*/
public function GetGET($name,$rule=null,$maxlength='',$sqlcheckoff='')
{
if($name === 'msg' && isset($this->app->erp) && method_exists($this, 'xss_clean')) {
$ret = $this->Syntax(isset($this->GET[$name])?$this->GET[$name]:'','',$maxlength,$sqlcheckoff);
$ret = $this->app->erp->base64_url_decode($ret);
if(strpos($ret,'"button"') === false){
$ret = $this->xss_clean($ret);
}
return $this->app->erp->base64_url_encode($ret);
}
if($rule === null) {
$rule = $this->NameToRule($name);
}
return $this->Syntax(isset($this->GET[$name])?$this->GET[$name]:'',$rule,$maxlength,$sqlcheckoff);
}
function NameToRule($name)
{
switch($name)
{
case 'id':
return 'doppelid';
break;
case 'sid':
return 'alphadigits';
break;
case 'module':
case 'smodule':
case 'action':
case 'saction':
return 'module';
break;
case 'cmd':
return 'moduleminus';
break;
}
return 'nothtml';
}
public function GetPOST($name,$rule=null,$maxlength="",$sqlcheckoff="")
{
if($rule === null) {
$rule = $this->NameToRule($name);
if(isset($this->POST['ishtml_cke_'.$name]) && $this->POST['ishtml_cke_'.$name]) {
$rule = 'nojs';
}
}
return $this->Syntax(isset($this->POST[$name])?$this->POST[$name]:'',$rule,$maxlength,$sqlcheckoff);
}
public function GetPOSTForForms($name,$rule="",$maxlength="",$sqlcheckoff="")
{
return $this->SyntaxForForms($this->POST[$name],$rule,$maxlength,$sqlcheckoff);
}
public function CleanString($string, $rule='nohtml',$sqlcheckoff='')
{
return $this->Syntax($string, $rule, '', $sqlcheckoff);
}
public function xss_clean($data)
{
return $this->app->stringcleaner->xss_clean($data);
}
public function GetPOSTArray()
{
if(!empty($this->POST) && count($this->POST)>0)
{
foreach($this->POST as $key=>$value)
{
$value = $this->GetPOST($key);
if ($value !== null) {
$ret[$key] = $value;
}
}
}
if(!empty($ret))
{
return $ret;
}
return null;
}
public function GetGETArray()
{
if(!empty($this->GET) && count($this->GET)>0)
{
foreach($this->GET as $key=>$value)
{
$value = $this->GetGET($key);
if ($value !== null) {
$ret[$key] = $value;
}
}
}
if(!empty($ret))
{
return $ret;
}
return null;
}
function stripallslashes($string) {
while(strstr($string,'\\')) {
$string = stripslashes($string);
}
return $string;
}
public function smartstripslashes($str) {
$cd1 = substr_count($str, "\"");
$cd2 = substr_count($str, "\\\"");
$cs1 = substr_count($str, "'");
$cs2 = substr_count($str, "\\'");
$tmp = strtr($str, array("\\\"" => "", "\\'" => ""));
$cb1 = substr_count($tmp, "\\");
$cb2 = substr_count($tmp, "\\\\");
if ($cd1 == $cd2 && $cs1 == $cs2 && $cb1 == 2 * $cb2) {
return strtr($str, array("\\\"" => "\"", "\\'" => "'", "\\\\" => "\\"));
}
return $str;
}
public function SyntaxForForms($value,$rule,$maxlength="",$sqlcheckoff="")
{
return $value;//mysqli_real_escape_string($this->app->DB->connection,$value);//mysqli_real_escape_string($value);
}
// check actual value with given rule
public function Syntax($value,$rule,$maxlength='',$sqlcheckoff='')
{
$striptags = false;
if(is_array($value))
{
if($sqlcheckoff != '')
{
return $value;
}
foreach($value as $k => $v)
{
if(is_array($v))
{
$value[$k] = $v;
}else{
$v = str_replace("\xef\xbb\xbf","NONBLOCKINGZERO",$v);
if($striptags){
$v = $this->stripallslashes($v);
$v = $this->smartstripslashes($v);
$v = $this->app->erp->superentities($v);
}
$value[$k] = $this->app->DB->real_escape_string($v);
}
}
return $value;
}
$value = str_replace("\xef\xbb\xbf","NONBLOCKINGZERO",$value);
if($striptags){
$value = $this->stripallslashes($value);
$value = $this->smartstripslashes($value);
$value = $this->app->erp->superentities($value);
}
if(!empty($this->app->stringcleaner)) {
if( $sqlcheckoff == '') {
return $this->app->DB->real_escape_string($this->app->stringcleaner->CleanString($value, $rule));
}
return $this->app->stringcleaner->CleanString($value, $rule);
}
if($rule === 'nohtml') {
if( $sqlcheckoff == '') {
return $this->app->DB->real_escape_string(strip_tags($value));
}
return strip_tags($value);
}
if($rule === 'nojs') {
if( $sqlcheckoff == '') {
return $this->app->DB->real_escape_string($this->xss_clean($value));
}
return $this->xss_clean($value);
}
if($rule=='' && $sqlcheckoff == '') {
return $this->app->DB->real_escape_string($value);//mysqli_real_escape_string($value);
}
if($rule=='' && $sqlcheckoff != '') {
return $value;
}
// build complete regexp
// check if rule exists
if($this->GetRegexp($rule)!=''){
//$v = '/^['.$this->GetRegexp($rule).']+$/';
$v = $this->GetRegexp($rule);
if (preg_match_all('/'.$v.'/i', $value, $teffer) ) {
if($sqlcheckoff==''){
return $this->app->DB->real_escape_string($value);//mysqli_real_escape_string($value);
}
return $value;
}
return '';
}
echo "<table border=\"1\" width=\"100%\" bgcolor=\"#FFB6C1\">
<tr><td>Rule <b>$rule</b> doesn't exists!</td></tr></table>";
return '';
}
function RuleCheck($value,$rule)
{
$found = false;
if(!empty($this->app->stringcleaner)) {
$value_ = $this->app->stringcleaner->RuleCheck($value, $rule, $found);
if($found) {
if($value_) {
return true;
}
return false;
}
}
$v = $this->GetRegexp($rule);
if (preg_match_all('/'.$v.'/i', $value, $teffer) ){
return true;
}
return false;
}
function AddRule($name,$type,$rule)
{
// type: reg = regular expression
// type: glue ( already exists rules copy to new e.g. number+digit)
$this->rules[$name]=array('type'=>$type,'rule'=>$rule);
}
// get complete regexp by rule name
function GetRegexp($rule)
{
$rules = explode('+',$rule);
$ret = '';
foreach($rules as $key) {
// check if rule is last in glue string
if($this->rules[$key]['type']==='glue') {
$subrules = explode('+',$this->rules[$key]['rule']);
if(count($subrules)>0) {
foreach($subrules as $subkey) {
$ret .= $this->GetRegexp($subkey);
}
}
}
elseif($this->rules[$key]['type']==='reg') {
$ret .= $this->rules[$key]['rule'];
}
}
if($ret==''){
$ret = 'none';
}
return $ret;
}
}
<?php
/// Secure Layer, SQL Inject. Check, Syntax Check
class Secure
{
public $GET;
public $POST;
/**
* Secure constructor.
*
* @param ApplicationCore $app
*/
public function __construct($app){
$this->app = $app;
// clear global variables, that everybody have to go over secure layer
$this->GET = $_GET;
if(isset($this->GET['msgs']) && isset($this->app->Location)) {
$this->GET['msg'] = $this->app->Location->getMessage($this->GET['msgs']);
}
// $_GET="";
$this->POST = $_POST;
// $_POST="";
if(!isset($this->app->stringcleaner) && file_exists(__DIR__. '/class.stringcleaner.php')) {
if(!class_exists('StringCleaner')) {
require_once __DIR__ . '/class.stringcleaner.php';
}
$this->app->stringcleaner = new StringCleaner($this->app);
}
$this->AddRule('notempty','reg','.'); // at least one sign
$this->AddRule('alpha','reg','[a-zA-Z]');
$this->AddRule('digit','reg','[0-9]');
$this->AddRule('space','reg','[ ]');
$this->AddRule('specialchars','reg','[_-]');
$this->AddRule('email','reg','^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.([a-zA-Z]{2,4})$');
$this->AddRule('datum','reg','([0-9]{1,2})\.([0-9]{1,2})\.([0-9]{4})');
$this->AddRule('username','glue','alpha+digit');
$this->AddRule('password','glue','alpha+digit+specialchars');
}
/**
* @param string $name
* @param null $rule
* @param string $maxlength
* @param string $sqlcheckoff
*
* @return array|mixed|string
*/
public function GetGET($name,$rule=null,$maxlength='',$sqlcheckoff='')
{
if($name === 'msg' && isset($this->app->erp) && method_exists($this, 'xss_clean')) {
$ret = $this->Syntax(isset($this->GET[$name])?$this->GET[$name]:'','',$maxlength,$sqlcheckoff);
$ret = $this->app->erp->base64_url_decode($ret);
if(strpos($ret,'"button"') === false){
$ret = $this->xss_clean($ret);
}
return $this->app->erp->base64_url_encode($ret);
}
if($rule === null) {
$rule = $this->NameToRule($name);
}
return $this->Syntax(isset($this->GET[$name])?$this->GET[$name]:'',$rule,$maxlength,$sqlcheckoff);
}
function NameToRule($name)
{
switch($name)
{
case 'id':
return 'doppelid';
break;
case 'sid':
return 'alphadigits';
break;
case 'module':
case 'smodule':
case 'action':
case 'saction':
return 'module';
break;
case 'cmd':
return 'moduleminus';
break;
}
return 'nothtml';
}
public function GetPOST($name,$rule=null,$maxlength="",$sqlcheckoff="")
{
if($rule === null) {
$rule = $this->NameToRule($name);
if(isset($this->POST['ishtml_cke_'.$name]) && $this->POST['ishtml_cke_'.$name]) {
$rule = 'nojs';
}
}
return $this->Syntax(isset($this->POST[$name])?$this->POST[$name]:'',$rule,$maxlength,$sqlcheckoff);
}
public function GetPOSTForForms($name,$rule="",$maxlength="",$sqlcheckoff="")
{
return $this->SyntaxForForms($this->POST[$name],$rule,$maxlength,$sqlcheckoff);
}
public function CleanString($string, $rule='nohtml',$sqlcheckoff='')
{
return $this->Syntax($string, $rule, '', $sqlcheckoff);
}
public function xss_clean($data)
{
return $this->app->stringcleaner->xss_clean($data);
}
public function GetPOSTArray()
{
if(!empty($this->POST) && count($this->POST)>0)
{
foreach($this->POST as $key=>$value)
{
$key = $this->GetPOST($key,"alpha+digit+specialchars",20);
$ret[$key]=$this->GetPOST($value);
}
}
if(!empty($ret))
{
return $ret;
}
return null;
}
public function GetGETArray()
{
if(!empty($this->GET) && count($this->GET)>0)
{
foreach($this->GET as $key=>$value)
{
$key = $this->GetGET($key,"alpha+digit+specialchars",20);
$ret[$key]=$this->GetGET($value);
}
}
if(!empty($ret))
{
return $ret;
}
return null;
}
function stripallslashes($string) {
while(strstr($string,'\\')) {
$string = stripslashes($string);
}
return $string;
}
public function smartstripslashes($str) {
$cd1 = substr_count($str, "\"");
$cd2 = substr_count($str, "\\\"");
$cs1 = substr_count($str, "'");
$cs2 = substr_count($str, "\\'");
$tmp = strtr($str, array("\\\"" => "", "\\'" => ""));
$cb1 = substr_count($tmp, "\\");
$cb2 = substr_count($tmp, "\\\\");
if ($cd1 == $cd2 && $cs1 == $cs2 && $cb1 == 2 * $cb2) {
return strtr($str, array("\\\"" => "\"", "\\'" => "'", "\\\\" => "\\"));
}
return $str;
}
public function SyntaxForForms($value,$rule,$maxlength="",$sqlcheckoff="")
{
return $value;//mysqli_real_escape_string($this->app->DB->connection,$value);//mysqli_real_escape_string($value);
}
// check actual value with given rule
public function Syntax($value,$rule,$maxlength='',$sqlcheckoff='')
{
$striptags = false;
if(is_array($value))
{
if($sqlcheckoff != '')
{
return $value;
}
foreach($value as $k => $v)
{
if(is_array($v))
{
$value[$k] = $v;
}else{
$v = str_replace("\xef\xbb\xbf","NONBLOCKINGZERO",$v);
if($striptags){
$v = $this->stripallslashes($v);
$v = $this->smartstripslashes($v);
$v = $this->app->erp->superentities($v);
}
$value[$k] = $this->app->DB->real_escape_string($v);
}
}
return $value;
}
$value = str_replace("\xef\xbb\xbf","NONBLOCKINGZERO",$value);
if($striptags){
$value = $this->stripallslashes($value);
$value = $this->smartstripslashes($value);
$value = $this->app->erp->superentities($value);
}
if(!empty($this->app->stringcleaner)) {
if( $sqlcheckoff == '') {
return $this->app->DB->real_escape_string($this->app->stringcleaner->CleanString($value, $rule));
}
return $this->app->stringcleaner->CleanString($value, $rule);
}
if($rule === 'nohtml') {
if( $sqlcheckoff == '') {
return $this->app->DB->real_escape_string(strip_tags($value));
}
return strip_tags($value);
}
if($rule === 'nojs') {
if( $sqlcheckoff == '') {
return $this->app->DB->real_escape_string($this->xss_clean($value));
}
return $this->xss_clean($value);
}
if($rule=='' && $sqlcheckoff == '') {
return $this->app->DB->real_escape_string($value);//mysqli_real_escape_string($value);
}
if($rule=='' && $sqlcheckoff != '') {
return $value;
}
// build complete regexp
// check if rule exists
if($this->GetRegexp($rule)!=''){
//$v = '/^['.$this->GetRegexp($rule).']+$/';
$v = $this->GetRegexp($rule);
if (preg_match_all('/'.$v.'/i', $value, $teffer) ) {
if($sqlcheckoff==''){
return $this->app->DB->real_escape_string($value);//mysqli_real_escape_string($value);
}
return $value;
}
return '';
}
echo "<table border=\"1\" width=\"100%\" bgcolor=\"#FFB6C1\">
<tr><td>Rule <b>$rule</b> doesn't exists!</td></tr></table>";
return '';
}
function RuleCheck($value,$rule)
{
$found = false;
if(!empty($this->app->stringcleaner)) {
$value_ = $this->app->stringcleaner->RuleCheck($value, $rule, $found);
if($found) {
if($value_) {
return true;
}
return false;
}
}
$v = $this->GetRegexp($rule);
if (preg_match_all('/'.$v.'/i', $value, $teffer) ){
return true;
}
return false;
}
function AddRule($name,$type,$rule)
{
// type: reg = regular expression
// type: glue ( already exists rules copy to new e.g. number+digit)
$this->rules[$name]=array('type'=>$type,'rule'=>$rule);
}
// get complete regexp by rule name
function GetRegexp($rule)
{
$rules = explode('+',$rule);
$ret = '';
foreach($rules as $key) {
// check if rule is last in glue string
if($this->rules[$key]['type']==='glue') {
$subrules = explode('+',$this->rules[$key]['rule']);
if(count($subrules)>0) {
foreach($subrules as $subkey) {
$ret .= $this->GetRegexp($subkey);
}
}
}
elseif($this->rules[$key]['type']==='reg') {
$ret .= $this->rules[$key]['rule'];
}
}
if($ret==''){
$ret = 'none';
}
return $ret;
}
}

View File

@ -1,453 +1,451 @@
<?php
/*
**** COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
*
* Xentral (c) Xentral ERP Sorftware GmbH, Fuggerstrasse 11, D-86150 Augsburg, * Germany 2019
*
* This file is licensed under the Embedded Projects General Public License *Version 3.1.
*
* You should have received a copy of this license from your vendor and/or *along with this file; If not, please visit www.wawision.de/Lizenzhinweis
* to obtain the text of the corresponding license version.
*
**** END OF COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
/*
**** COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
*
* Xentral (c) Xentral ERP Sorftware GmbH, Fuggerstrasse 11, D-86150 Augsburg, * Germany 2019
*
* This file is licensed under the Embedded Projects General Public License *Version 3.1.
*
* You should have received a copy of this license from your vendor and/or *along with this file; If not, please visit www.wawision.de/Lizenzhinweis
* to obtain the text of the corresponding license version.
*
**** END OF COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
*/
?>
<?php
class StringCleaner
{
private $elements;
private $htmlpuriferconfig;
private $htmlpurifer;
private $ruleregexps;
/** @var Application */
private $app;
/**
* StringCleaner constructor.
*
* @param null|Application $app
*/
public function __construct($app = null)
{
$this->app = $app;
if(class_exists('HTMLPurifier_Config')) {
$this->htmlpuriferconfig = HTMLPurifier_Config::createDefault();
$this->htmlpuriferconfig->set('Core.Encoding', 'UTF-8');
$this->htmlpuriferconfig->set('Attr.AllowedFrameTargets', ['_blank']); // Allow hyperlinks with target="_blank"
//$this->htmlpuriferconfig->set('HTML.AllowedElements', 'h1,h2,h3,h4,h5,h6,p,a,strong,em,ol,ul,li,img,param,div,br,form,label,fieldset,input,textarea,select,option');
$this->htmlpurifer = new HTMLPurifier($this->htmlpuriferconfig);
}
$this->elements = array('nohtml'=> array('ust_befreit','abweichendelieferadresse','bestellungsart','bearbeiter','datum','lieferdatum','name','anrede','partner','packstation_inhaber','packstation_station','packstation_ident','packstation_plz','packstation_ort','partnerid','kennen','ihrebestellnummer'
,'abteilung','unterabteilung','ansprechpartner','adresszusatz','strasse','land','bundesstaat','plz','ort','versandart','internet','transaktionsnummer','vertrieb','zahlungsweise'
,'lieferabteilung','lieferunterabteilung','lieferansprechpartner','lieferadresszusatz','lieferstrasse','lieferland','lieferbundesstaat','lieferplz','lieferort'
,'bank_inhaber','bank_institut','bank_blz','bank_konto'
,'email','telefon','telefax','ustid','partner','projekt','herstellernummer','ean','nummer','name_de','name_ean'),
'nojs' => array('anabregstext','anabregstext_en','uebersicht_de','uebersicht_en','kurztext_de','kurztext_en','internebemerkung','internebezeichnung','freitext'));
$this->rulechecks = array('digit'=>'/^[0-9]+$/'
,'alpha'=>'/^[a-zA-Z]+$/'
,'alphadigit'=>'/^[0-9a-zA-Z]+$/'
,'username'=>'/^[0-9a-zA-Z\.\-]+$/'
,'space'=>'/^[\x20]+$/'
,'module'=>'/^[0-9a-zA-Z\_]$/'
,'password'=>'/^[^\s\n]{1}[^\n]{5}.*$/'
,'email'=>'/^[^@\s\x00-\x20]+@[^@\s\x00-\x20\.]+\.[^@\s\x00-\x20\.]+[^@\s\x00-\x20]*$/'
);
$this->ruleregexps = array(
'digit'=>'/[^0-9]/'
,'username'=>'/[^0-9a-zA-Z\.\-]/'
,'alpha'=>'/[^a-zA-Z]/'
,'alphadigits'=>'/[^0-9a-zA-Z]/'
,'module'=>'/[^0-9a-zA-Z\_]/'
,'moduleminus'=>'/[^0-9a-zA-Z\_\-]/'
,'alphadigitsspecial'=>'/[^0-9a-zA-Z\_\.\(\)]/'
,'base64'=>'/[^0-9a-zA-Z\=\+\-\_\/]/'
);
}
function SyntaxByElement($key, $default = '')
{
foreach($this->elements as $type => $arr) {
if(in_array($key, $arr)) {
return $type;
}
}
return $default;
}
function CleanSQLReturn($value, $columnname, $default = '')
{
if($value == '' || is_numeric($value))
{
return $value;
}
if(in_array($columnname, array('nummer','name','kundennummer','bezeichnung','bezeichnunglieferant','lieferantennummer','mitarbeiternummer','name_de','name_en',
'kurzbezeichnung','abkuerzung',
'strasse','plz','ort','land','ansprechpartner','abteilung','unterabteilung',
'liefername','lieferstrasse','lieferplz','lieferort','lieferland','lieferansprechpartner','lieferabteilung','lieferunterabteilung'))){
return strip_tags($value);
}
if($default == 'xss_clean')
{
return $this->xss_clean($value, false);
}
if($this->htmlpurifer)
{
return $this->htmlpurifer->purify($value);
}
return $value;
}
function RuleCheck($string, $rule = null, &$found = false)
{
if(isset($this->rulechecks[$rule]))
{
$found = true;
return preg_match_all($this->rulechecks[$rule], $string, $dummy);
}
switch($rule)
{
case 'datum':
$found = true;
if(preg_match_all('/([0-9]+)\.([0-9]+)\.$/', $string, $matches))
{
$string = $matches[1][0].'.'.$matches[2][0].'.'.date('Y');
}
try {
if($x = new DateTime($string)) {
return $x->format('Y') > 0;
}
}
catch (Exception $e) {
return false;
}
return false;
break;
}
}
function CheckSQLHtml($sql)
{
$start = 0;
$len = strlen($sql);
$lvl = 0;
$col = 0;
$ret = array(0);
$instring = false;
for($i = $start; $i < $len; $i++)
{
$char = $sql[$i];
switch($char)
{
case "'":
if($instring)
{
if($sql[$i-1] != '\\')
{
$instring = false;
}
}else{
if($sql[$i-1] != '\\'){
$instring = true;
}
}
break;
case "(":
if($instring)
{
}else{
$lvl++;
}
break;
case ")":
if($instring)
{
}else{
$lvl--;
}
break;
case "<":
if($instring)
{
if(preg_match('/<[a-zA-Z]/',$char.$sql[$i+1]))
{
if($ret[$col] != 2)
{
$ret[$col] = 1;
}
}
}
break;
case ',':
if($instring)
{
}else{
if($lvl == 0)
{
$col++;
$ret[$col] = 0;
}
}
break;
case 'o':
case 'O':
if($instring)
{
if($i < $len -4)
{
if(strtolower(substr($sql, $i, 2)) == 'on')
{
if(preg_match('/^on[a-z]+(\s*)=/', substr($sql, $i)))
{
$ret[$col] = 2;
}
}
}
}
break;
case 'F':
case 'f':
if($instring)
{
}else{
if($lvl == 0)
{
if($i < $len - 4)
{
if(strtolower(substr($sql, $i, 4)) == 'from')
{
break 2;
}
}
}
}
break;
}
}
$where = strripos($sql, 'where');
$restsql = substr($sql, $i, $where - $i);
if(preg_match('/<[a-zA-Z]/', $restsql))
{
if(preg_match('/on[a-z]+(\s*)=/',$restsql))
{
if($ret)
{
foreach($ret as $k => $v)
{
$ret[$k] = 2;
}
}
}else{
if($ret)
{
foreach($ret as $k => $v)
{
if($v != 2)
{
$ret[$k] = 1;
}
}
}
}
}
return $ret;
}
public function CleanString($string, $rule = null, &$found = false)
{
if(is_null($rule))
{
$rule = 'nothml';
}
switch($rule)
{
case 'email':
if($this->RuleCheck($string, $rule))
{
return $string;
}
return '';
break;
case 'nohtml':
$found = true;
if($string == '' || is_numeric($string))
{
return $string;
}
if(strpos($string,'<') === false)
{
return $string;
}
return strip_tags($string);
break;
case 'datum':
$found = true;
$string_ = $string;
if(preg_match_all('/([0-9]+)\.([0-9]+)\.$/', $string, $matches))
{
$string_ = $matches[1][0].'.'.$matches[2][0].'.'.date('Y');
}
try
{
if($x = new DateTime($string_))
{
if($x->format('Y') <= 0)
{
return '';
}
return $string;
}
} catch (Exception $e) {
return '';
}
return '';
break;
case 'xss_clean':
$found = true;
if($string == '' || is_numeric($string))
{
return $string;
}
if(strpos($string,'<') === false){
return $string;
}
return $this->xss_clean($string, false);
break;
case 'nojs':
$found = true;
if($string == '' || is_numeric($string))return $string;
if(strpos($string,'<') === false)return $string;
if($this->htmlpurifer)
{
return $this->htmlpurifer->purify($string);
}
return $this->xss_clean($string);
break;
case 'id':
$found = true;
if((String)$string === '')
{
return $string;
}
return (int)$string;
break;
case 'doppelid':
$found = true;
if((String)$string === '')
{
return $string;
}
$stringa = explode('-', $string, 2);
if(count($stringa) == 1)return (int)$stringa[0];
return ($stringa[0]===''?'':(int)$stringa[0]).'-'.(int)$stringa[1];
break;
case 'module':
$found = true;
return preg_replace ($this->ruleregexps[$rule], '' , $string);
break;
default:
if(isset($this->ruleregexps[$rule]))
{
$found = true;
return preg_replace ($this->ruleregexps[$rule], '' , $string);
}
break;
}
return $string;
}
public function xss_clean($data, $usepurify = true)
{
if($usepurify && !empty($this->htmlpurifer))
{
return $this->htmlpurifer->purify($data);
}
// Fix &entity\n;
$data = str_replace(array('&amp;','&lt;','&gt;'), array('&amp;amp;','&amp;lt;','&amp;gt;'), $data);
$data = preg_replace('/(&#*\w+)[\x00-\x20]+;/u', '$1;', $data);
$data = preg_replace('/(&#x*[0-9A-F]+);*/iu', '$1;', $data);
$data = html_entity_decode($data, ENT_COMPAT, 'UTF-8');
return $data;
// Remove any attribute starting with "on" or xmlns
$data = preg_replace('#(<[^>]+?[\x00-\x20"\'])(?:on|xmlns)[^>]*+>#iu', '$1>', $data);
// Remove javascript: and vbscript: protocols
$data = preg_replace('#([a-z]*)[\x00-\x20]*=[\x00-\x20]*([`\'"]*)[\x00-\x20]*j[\x00-\x20]*a[\x00-\x20]*v[\x00-\x20]*a[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iu', '$1=$2nojavascript...', $data);
$data = preg_replace('#([a-z]*)[\x00-\x20]*=([\'"]*)[\x00-\x20]*v[\x00-\x20]*b[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iu', '$1=$2novbscript...', $data);
$data = preg_replace('#([a-z]*)[\x00-\x20]*=([\'"]*)[\x00-\x20]*-moz-binding[\x00-\x20]*:#u', '$1=$2nomozbinding...', $data);
// Only works in IE: <span style="width: expression(alert('Ping!'));"></span>
$data = preg_replace('#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?expression[\x00-\x20]*\([^>]*+>#i', '$1>', $data);
$data = preg_replace('#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?behaviour[\x00-\x20]*\([^>]*+>#i', '$1>', $data);
$data = preg_replace('#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:*[^>]*+>#iu', '$1>', $data);
// Remove namespaced elements (we do not need them)
$data = preg_replace('#</*\w+:\w[^>]*+>#i', '', $data);
do
{
// Remove really unwanted tags
$old_data = $data;
$data = preg_replace('#</*(?:applet|b(?:ase|gsound|link)|embed|frame(?:set)?|i(?:frame|layer)|l(?:ayer|ink)|meta|object|s(?:cript|tyle)|title|xml)[^>]*+>#i', '', $data);
}
while ($old_data !== $data);
return $data;
}
function XMLArray_clean(&$xml, $lvl = 0)
{
if(is_string($xml))
{
}elseif(is_array($xml))
{
if(count($xml) > 0)
{
foreach($xml as $k => $v)
{
if(is_string($v))
{
$xml[$k] = $this->CleanString($v, $this->SyntaxByElement($k,'nojs'));
}
if($lvl < 10)
{
$this->XMLArray_clean($v, $lvl + 1);
}
}
}
}elseif(is_object($xml))
{
$xml = (array) $xml;
if(count($xml) > 0)
{
foreach($xml as $k => $v)
{
$v = (array) $v;
if(count($v) > 0)
{
if($lvl < 10)
{
$this->XMLArray_clean($v, $lvl + 1);
}
}elseif((String)$v != '')
{
if(isset($xml->$k))
{
//$xml->$k = $this->CleanString($v, $this->SyntaxByElement($k,'nojs'));
}
}
}
}
}
return $xml;
}
}
<?php
class StringCleaner
{
private $elements;
private $htmlpuriferconfig;
private $htmlpurifer;
private $ruleregexps;
/** @var Application */
private $app;
/**
* StringCleaner constructor.
*
* @param null|Application $app
*/
public function __construct($app = null)
{
$this->app = $app;
if(class_exists('HTMLPurifier_Config')) {
$this->htmlpuriferconfig = HTMLPurifier_Config::createDefault();
$this->htmlpuriferconfig->set('Core.Encoding', 'UTF-8');
$this->htmlpuriferconfig->set('Attr.AllowedFrameTargets', ['_blank']); // Allow hyperlinks with target="_blank"
//$this->htmlpuriferconfig->set('HTML.AllowedElements', 'h1,h2,h3,h4,h5,h6,p,a,strong,em,ol,ul,li,img,param,div,br,form,label,fieldset,input,textarea,select,option');
$this->htmlpurifer = new HTMLPurifier($this->htmlpuriferconfig);
}
$this->elements = array('nohtml'=> array('ust_befreit','abweichendelieferadresse','bestellungsart','bearbeiter','datum','lieferdatum','name','anrede','partner','packstation_inhaber','packstation_station','packstation_ident','packstation_plz','packstation_ort','partnerid','kennen','ihrebestellnummer'
,'abteilung','unterabteilung','ansprechpartner','adresszusatz','strasse','land','bundesstaat','plz','ort','versandart','internet','transaktionsnummer','vertrieb','zahlungsweise'
,'lieferabteilung','lieferunterabteilung','lieferansprechpartner','lieferadresszusatz','lieferstrasse','lieferland','lieferbundesstaat','lieferplz','lieferort'
,'bank_inhaber','bank_institut','bank_blz','bank_konto'
,'email','telefon','telefax','ustid','partner','projekt','herstellernummer','ean','nummer','name_de','name_ean'),
'nojs' => array('anabregstext','anabregstext_en','uebersicht_de','uebersicht_en','kurztext_de','kurztext_en','internebemerkung','internebezeichnung','freitext'));
$this->rulechecks = array('digit'=>'/^[0-9]+$/'
,'alpha'=>'/^[a-zA-Z]+$/'
,'alphadigit'=>'/^[0-9a-zA-Z]+$/'
,'username'=>'/^[0-9a-zA-Z\.\-]+$/'
,'space'=>'/^[\x20]+$/'
,'module'=>'/^[0-9a-zA-Z\_]$/'
,'password'=>'/^[^\s\n]{1}[^\n]{5}.*$/'
,'email'=>'/^[^@\s\x00-\x20]+@[^@\s\x00-\x20\.]+\.[^@\s\x00-\x20\.]+[^@\s\x00-\x20]*$/'
);
$this->ruleregexps = array(
'digit'=>'/[^0-9]/'
,'username'=>'/[^0-9a-zA-Z\.\-]/'
,'alpha'=>'/[^a-zA-Z]/'
,'alphadigits'=>'/[^0-9a-zA-Z]/'
,'module'=>'/[^0-9a-zA-Z\_]/'
,'moduleminus'=>'/[^0-9a-zA-Z\_\-]/'
,'alphadigitsspecial'=>'/[^0-9a-zA-Z\_\.\(\)]/'
,'base64'=>'/[^0-9a-zA-Z\=\+\-\_\/]/'
);
}
function SyntaxByElement($key, $default = '')
{
foreach($this->elements as $type => $arr) {
if(in_array($key, $arr)) {
return $type;
}
}
return $default;
}
function CleanSQLReturn($value, $columnname, $default = '')
{
if($value == '' || is_numeric($value))
{
return $value;
}
if(in_array($columnname, array('nummer','name','kundennummer','bezeichnung','bezeichnunglieferant','lieferantennummer','mitarbeiternummer','name_de','name_en',
'kurzbezeichnung','abkuerzung',
'strasse','plz','ort','land','ansprechpartner','abteilung','unterabteilung',
'liefername','lieferstrasse','lieferplz','lieferort','lieferland','lieferansprechpartner','lieferabteilung','lieferunterabteilung'))){
return strip_tags($value);
}
if($default == 'xss_clean')
{
return $this->xss_clean($value, false);
}
if($this->htmlpurifer)
{
return $this->htmlpurifer->purify($value);
}
return $value;
}
function RuleCheck($string, $rule = null, &$found = false)
{
if(isset($this->rulechecks[$rule]))
{
$found = true;
return preg_match_all($this->rulechecks[$rule], $string, $dummy);
}
switch($rule)
{
case 'datum':
$found = true;
if(preg_match_all('/([0-9]+)\.([0-9]+)\.$/', $string, $matches))
{
$string = $matches[1][0].'.'.$matches[2][0].'.'.date('Y');
}
try {
if($x = new DateTime($string)) {
return $x->format('Y') > 0;
}
}
catch (Exception $e) {
return false;
}
return false;
break;
}
}
function CheckSQLHtml($sql)
{
$start = 0;
$len = strlen($sql);
$lvl = 0;
$col = 0;
$ret = array(0);
$instring = false;
for($i = $start; $i < $len; $i++)
{
$char = $sql[$i];
switch($char)
{
case "'":
if($instring)
{
if($sql[$i-1] != '\\')
{
$instring = false;
}
}else{
if($sql[$i-1] != '\\'){
$instring = true;
}
}
break;
case "(":
if($instring)
{
}else{
$lvl++;
}
break;
case ")":
if($instring)
{
}else{
$lvl--;
}
break;
case "<":
if($instring)
{
if(preg_match('/<[a-zA-Z]/',$char.$sql[$i+1]))
{
if($ret[$col] != 2)
{
$ret[$col] = 1;
}
}
}
break;
case ',':
if($instring)
{
}else{
if($lvl == 0)
{
$col++;
$ret[$col] = 0;
}
}
break;
case 'o':
case 'O':
if($instring)
{
if($i < $len -4)
{
if(strtolower(substr($sql, $i, 2)) == 'on')
{
if(preg_match('/^on[a-z]+(\s*)=/', substr($sql, $i)))
{
$ret[$col] = 2;
}
}
}
}
break;
case 'F':
case 'f':
if($instring)
{
}else{
if($lvl == 0)
{
if($i < $len - 4)
{
if(strtolower(substr($sql, $i, 4)) == 'from')
{
break 2;
}
}
}
}
break;
}
}
$where = strripos($sql, 'where');
$restsql = substr($sql, $i, $where - $i);
if(preg_match('/<[a-zA-Z]/', $restsql))
{
if(preg_match('/on[a-z]+(\s*)=/',$restsql))
{
if($ret)
{
foreach($ret as $k => $v)
{
$ret[$k] = 2;
}
}
}else{
if($ret)
{
foreach($ret as $k => $v)
{
if($v != 2)
{
$ret[$k] = 1;
}
}
}
}
}
return $ret;
}
public function CleanString($string, $rule = null, &$found = false)
{
if(is_null($rule))
{
$rule = 'nothml';
}
switch($rule)
{
case 'email':
if($this->RuleCheck($string, $rule))
{
return $string;
}
return '';
break;
case 'nohtml':
$found = true;
if($string == '' || is_numeric($string))
{
return $string;
}
if(strpos($string,'<') === false)
{
return $string;
}
return strip_tags($string);
break;
case 'datum':
$found = true;
$string_ = $string;
if(preg_match_all('/([0-9]+)\.([0-9]+)\.$/', $string, $matches))
{
$string_ = $matches[1][0].'.'.$matches[2][0].'.'.date('Y');
}
try
{
if($x = new DateTime($string_))
{
if($x->format('Y') <= 0)
{
return '';
}
return $string;
}
} catch (Exception $e) {
return '';
}
return '';
break;
case 'xss_clean':
$found = true;
if($string == '' || is_numeric($string))
{
return $string;
}
if(strpos($string,'<') === false){
return $string;
}
return $this->xss_clean($string, false);
break;
case 'nojs':
$found = true;
if($string == '' || is_numeric($string))return $string;
if(strpos($string,'<') === false)return $string;
if($this->htmlpurifer)
{
return $this->htmlpurifer->purify($string);
}
return $this->xss_clean($string);
break;
case 'id':
$found = true;
if((String)$string === '')
{
return $string;
}
return (int)$string;
break;
case 'doppelid':
$found = true;
if((String)$string === '')
{
return $string;
}
$stringa = explode('-', $string, 2);
if(count($stringa) == 1)return (int)$stringa[0];
return ($stringa[0]===''?'':(int)$stringa[0]).'-'.(int)$stringa[1];
break;
case 'module':
$found = true;
return preg_replace ($this->ruleregexps[$rule], '' , $string);
break;
default:
if(isset($this->ruleregexps[$rule]))
{
$found = true;
return preg_replace ($this->ruleregexps[$rule], '' , $string);
}
break;
}
return $string;
}
public function xss_clean($data, $usepurify = true)
{
if($usepurify && !empty($this->htmlpurifer))
{
return $this->htmlpurifer->purify($data);
}
// Fix &entity\n;
$data = str_replace(array('&amp;','&lt;','&gt;'), array('&amp;amp;','&amp;lt;','&amp;gt;'), $data);
$data = preg_replace('/(&#*\w+)[\x00-\x20]+;/u', '$1;', $data);
$data = preg_replace('/(&#x*[0-9A-F]+);*/iu', '$1;', $data);
$data = html_entity_decode($data, ENT_COMPAT, 'UTF-8');
return $data;
// Remove any attribute starting with "on" or xmlns
$data = preg_replace('#(<[^>]+?[\x00-\x20"\'])(?:on|xmlns)[^>]*+>#iu', '$1>', $data);
// Remove javascript: and vbscript: protocols
$data = preg_replace('#([a-z]*)[\x00-\x20]*=[\x00-\x20]*([`\'"]*)[\x00-\x20]*j[\x00-\x20]*a[\x00-\x20]*v[\x00-\x20]*a[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iu', '$1=$2nojavascript...', $data);
$data = preg_replace('#([a-z]*)[\x00-\x20]*=([\'"]*)[\x00-\x20]*v[\x00-\x20]*b[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iu', '$1=$2novbscript...', $data);
$data = preg_replace('#([a-z]*)[\x00-\x20]*=([\'"]*)[\x00-\x20]*-moz-binding[\x00-\x20]*:#u', '$1=$2nomozbinding...', $data);
// Only works in IE: <span style="width: expression(alert('Ping!'));"></span>
$data = preg_replace('#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?expression[\x00-\x20]*\([^>]*+>#i', '$1>', $data);
$data = preg_replace('#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?behaviour[\x00-\x20]*\([^>]*+>#i', '$1>', $data);
$data = preg_replace('#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:*[^>]*+>#iu', '$1>', $data);
// Remove namespaced elements (we do not need them)
$data = preg_replace('#</*\w+:\w[^>]*+>#i', '', $data);
do
{
// Remove really unwanted tags
$old_data = $data;
$data = preg_replace('#</*(?:applet|b(?:ase|gsound|link)|embed|frame(?:set)?|i(?:frame|layer)|l(?:ayer|ink)|meta|object|s(?:cript|tyle)|title|xml)[^>]*+>#i', '', $data);
}
while ($old_data !== $data);
return $data;
}
function XMLArray_clean(&$xml, $lvl = 0)
{
if(is_string($xml))
{
}elseif(is_array($xml))
{
if(count($xml) > 0)
{
foreach($xml as $k => $v)
{
if(is_string($v))
{
$xml[$k] = $this->CleanString($v, $this->SyntaxByElement($k,'nojs'));
}
if($lvl < 10)
{
$this->XMLArray_clean($v, $lvl + 1);
}
}
}
}elseif(is_object($xml))
{
if(count($xml) > 0)
{
foreach($xml as $k => $v)
{
if(count($v) > 0)
{
if($lvl < 10)
{
$this->XMLArray_clean($v, $lvl + 1);
}
}elseif((String)$v != '')
{
if(isset($xml->$k))
{
//$xml->$k = $this->CleanString($v, $this->SyntaxByElement($k,'nojs'));
}
}
}
}
}
return $xml;
}
}

View File

@ -1,11 +1,4 @@
<?php
/*
* SPDX-FileCopyrightText: 2022 Andreas Palm
* SPDX-FileCopyrightText: 2019 Xentral (c) Xentral ERP Software GmbH, Fuggerstrasse 11, D-86150 Augsburg, Germany
*
* SPDX-License-Identifier: LicenseRef-EGPL-3.1
*/
<?php
/*
**** COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
*
@ -17,8 +10,8 @@
* to obtain the text of the corresponding license version.
*
**** END OF COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
*/
?>
*/
?>
<?php
/****************************************************************************
@ -170,17 +163,28 @@ class TemplateParser {
public function addMessage($class, $text, $html = false, $_var = 'MESSAGE')
{
if(!in_array($class, ['error', 'warning', 'info', 'success']))
$class = 'info';
$ret = '';
switch($class)
{
case 'error':
case 'warning':
case 'info':
break;
default:
$class = 'info';
break;
}
if(!$html)
{
$text = $this->htmlspecialchars($text);
}
$ret = sprintf('<div class="%s">%s</div>', $class, $text);
$ret .= '<div class="'.$class.'">'.$text.'</div>';
if($_var === 'return')
{
return $ret;
$this->app->Tpl->Add($_var, $ret);
}
return $this->app->Tpl->Add($_var, $ret);
}
public function addSelect($_var, $id, $name, $options, $selected = '', $class = '')

File diff suppressed because it is too large Load Diff

View File

@ -388,7 +388,7 @@ class EasyTable {
{
$editcols = array(4,5,6,7);
}else{
$einkaufspreiseerlaubt = true;
$einkaufspreiseerlaubt = false;
if($einkaufspreiseerlaubt)
{
$editcols =array(4,5,6,7,8,9);

View File

@ -0,0 +1,6 @@
{
"host": "localhost",
"database": "openxe",
"user": "openxe",
"passwd": "openxe"
}

View File

@ -0,0 +1,343 @@
<?php
/*
* Helper to compare database structures from files vs. database
*
* Copyright (c) 2022 OpenXE project
*
*/
/*
MariaDB [openxe]> SHOW FULL db_def;
+----------------------------------------------+------------+
| Tables_in_openxe | Table_type |
+----------------------------------------------+------------+
| abrechnungsartikel | BASE TABLE |
| abrechnungsartikel_gruppe | BASE TABLE |
| abschlagsrechnung_rechnung | BASE TABLE |
| accordion | BASE TABLE |
| adapterbox | BASE TABLE |
| adapterbox_log | BASE TABLE |
| adapterbox_request_log | BASE TABLE |
| adresse | BASE TABLE |
| adresse_abosammelrechnungen | BASE TABLE |
| adresse_accounts | BASE TABLE |
| adresse_filter | BASE TABLE |
| adresse_filter_gruppen | BASE TABLE |
...
MariaDB [openxe]> SHOW FULL COLUMNS FROM wiki;
+-------------------+--------------+--------------------+------+-----+---------+----------------+---------------------------------+---------+
| Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment |
+-------------------+--------------+--------------------+------+-----+---------+----------------+---------------------------------+---------+
| id | int(11) | NULL | NO | PRI | NULL | auto_increment | select,insert,update,references | |
| name | varchar(255) | utf8mb3_general_ci | YES | MUL | NULL | | select,insert,update,references | |
| content | longtext | utf8mb3_general_ci | NO | | NULL | | select,insert,update,references | |
| lastcontent | longtext | utf8mb3_general_ci | NO | | NULL | | select,insert,update,references | |
| wiki_workspace_id | int(11) | NULL | NO | | 0 | | select,insert,update,references | |
| parent_id | int(11) | NULL | NO | | 0 | | select,insert,update,references | |
| language | varchar(32) | utf8mb3_general_ci | NO | | | | select,insert,update,references | |
+-------------------+--------------+--------------------+------+-----+---------+----------------+---------------------------------+---------+
MariaDB [openxe]> show keys from wiki;
+-------+------------+----------+--------------+-------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+---------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment | Ignored |
+-------+------------+----------+--------------+-------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+---------+
| wiki | 0 | PRIMARY | 1 | id | A | 244 | NULL | NULL | | BTREE | | | NO |
| wiki | 0 | suche | 1 | name | A | 244 | NULL | NULL | YES | BTREE | | | NO |
| wiki | 0 | suche | 2 | wiki_workspace_id | A | 244 | NULL | NULL | | BTREE | | | NO |
| wiki | 1 | name | 1 | name | A | 244 | NULL | NULL | YES | BTREE | | | NO |
+-------+------------+----------+--------------+-------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+---------+
*/
require('mustal_mysql_upgrade_tool.php');
$connection_info_file_name = "connection_info.json";
$target_folder = ".";
$tables_file_name_wo_folder = "db_schema.json";
$tables_file_name_w_folder = $target_folder."/".$tables_file_name_wo_folder;
$delimiter = ";";
$quote = '"';
$sql_file_name = "upgrade.sql";
$color_red = "\033[31m";
$color_green = "\033[32m";
$color_yellow = "\033[33m";
$color_default = "\033[39m";
// -------------------------------- START
echo("\n");
if ($argc > 1) {
if (in_array('-v', $argv)) {
$verbose = true;
} else {
$verbose = false;
}
if (in_array('-f', $argv)) {
$force = true;
} else {
$force = false;
}
if (in_array('-e', $argv)) {
$export = true;
} else {
$export = false;
}
if (in_array('-c', $argv)) {
$compare = true;
} else {
$compare = false;
}
if (in_array('-i', $argv)) {
$onlytables = true;
} else {
$onlytables = false;
}
if (in_array('-upgrade', $argv)) {
$upgrade = true;
} else {
$upgrade = false;
}
if (in_array('-do', $argv)) {
$doupgrade = true;
} else {
$doupgrade = false;
}
if (in_array('-clean', $argv)) {
$clean = true;
} else {
$clean = false;
}
if (in_array('-utf8fix', $argv)) {
$utf8fix = true;
} else {
$utf8fix = false;
}
$connection_info_contents = file_get_contents($connection_info_file_name);
if (!$connection_info_contents) {
echo("Unable to load $connection_info_file_name\n");
exit;
}
$connection_info = json_decode($connection_info_contents, true);
$host = $connection_info['host'];
$user = $connection_info['user'];
$passwd = $connection_info['passwd'];
$schema = $connection_info['database'];
echo("--------------- Loading from database '$schema@$host'... ---------------\n");
$db_def = mustal_load_tables_from_db($host, $schema, $user, $passwd, $mustal_replacers);
if (empty($db_def)) {
echo ("Could not load from $schema@$host\n");
exit;
}
echo("--------------- Loading from database '$schema@$host' complete. ---------------\n");
if ($export) {
echo("--------------- Export to JSON... ---------------\n");
// $result = save_tables_to_csv($db_def, $target_folder, $tables_file_name_wo_folder, $delimiter, $quote, $keys_postfix, $force);
$result = mustal_save_tables_to_json($db_def, $target_folder, $tables_file_name_wo_folder, $force);
if ($result != 0) {
$result_texts = array("ok","key postfix error","table list file error","table file error","key file error");
echo ("Could not save to JSON (".$result_texts[$result]."). To overwrite, use -f.\n");
exit;
}
echo("Exported ".count($db_def['tables'])." tables.\n");
echo("--------------- Export to JSON ($tables_file_name_w_folder) complete. ---------------\n");
}
if ($compare || $upgrade) {
// Results here as ['text'] ['diff']
$compare_differences = array();
echo("--------------- Loading from JSON... ---------------\n");
$compare_def = mustal_load_tables_from_json($target_folder, $tables_file_name_wo_folder);
if (empty($compare_def)) {
echo ("Could not load from JSON $tables_file_name_w_folder\n");
exit;
}
echo("--------------- Loading from JSON complete. ---------------\n");
// Do the comparison
/*
echo("--------------- Comparing JSON '".$compare_def['database']."@".$compare_def['host']."' vs. database '$schema@$host' ---------------\n");
echo(count($compare_def['tables'])." tables in JSON, ".count($db_def['tables'])." tables in database.\n");
$compare_differences = compare_table_array($db_def,"in DB",$compare_def,"in JSON",false);
echo("Comparison found ".(empty($compare_differences)?0:count($compare_differences))." differences.\n");
if ($verbose) {
foreach ($compare_differences as $compare_difference) {
$comma = "";
foreach ($compare_difference as $key => $value) {
echo($comma."$key => '$value'");
$comma = ", ";
}
echo("\n");
}
}*/
echo("--------------- Comparing database '$schema@$host' vs. JSON '".$compare_def['database']."@".$compare_def['host']."' ---------------\n");
if($utf8fix) {
$column_collation_aliases = array(
['utf8mb3_general_ci','utf8_general_ci']
);
} else {
$column_collation_aliases = array();
}
$compare_differences = mustal_compare_table_array($compare_def,"in JSON",$db_def,"in DB",true,$column_collation_aliases);
echo((empty($compare_differences)?0:count($compare_differences))." differences.\n");
if ($verbose) {
foreach ($compare_differences as $compare_difference) {
$comma = "";
foreach ($compare_difference as $key => $value) {
echo($comma."$key => [$value]");
$comma = ", ";
}
echo("\n");
}
}
echo("--------------- Comparison complete. ---------------\n");
}
if ($upgrade) {
// First create all db_def that are missing in the db
echo("--------------- Calculating database upgrade for '$schema@$host'... ---------------\n");
$upgrade_sql = array();
$result = mustal_calculate_db_upgrade($compare_def, $db_def, $upgrade_sql, $mustal_replacers);
if ($result != 0) {
echo("Error: $result\n");
exit;
}
if (!empty($result)) {
echo(count($result)." errors.\n");
if ($verbose) {
foreach($result as $error) {
echo("Code: ".$error[0]." '".$error[1]."'.");
}
}
return(-1);
}
echo("--------------- Database upgrade for '$schema@$host'... ---------------\n");
if ($verbose) {
foreach($upgrade_sql as $statement) {
echo($statement."\n");
}
}
echo(count($upgrade_sql)." upgrade statements\n");
echo("--------------- Database upgrade calculated for '$schema@$host' (show SQL with -v). ---------------\n");
if ($doupgrade) {
echo("--------------- Executing database upgrade for '$schema@$host' database will be written! ---------------\n");
// First get the contents of the database table structure
$mysqli = mysqli_connect($host, $user, $passwd, $schema);
/* Check if the connection succeeded */
if (!$mysqli) {
echo ("Failed to connect!\n");
} else {
$counter = 0;
$error_counter = 0;
$number_of_statements = count($upgrade_sql);
foreach ($upgrade_sql as $sql) {
$counter++;
echo("\rUpgrade step $counter of $number_of_statements... ");
if ($verbose) {
echo("(".substr($sql,0,100)."...) ");
}
$query_result = mysqli_query($mysqli, $sql);
if (!$query_result) {
$error = " not ok: ". mysqli_error($mysqli)."\n";
echo($error);
file_put_contents("./errors.txt",$error.$sql."\n",FILE_APPEND);
$error_counter++;
} else {
echo("ok.\r");
}
}
echo("--------------- Executing database upgrade for '$schema@$host' executed. ---------------\n");
echo("$error_counter errors.\n");
echo("--------------- Executing database upgrade for '$schema@$host' done. ---------------\n");
echo("--------------- Checking database upgrade for '$schema@$host'... ---------------\n");
$db_def = mustal_load_tables_from_db($host, $schema, $user, $passwd, $mustal_replacers);
echo("--------------- Comparing database '$schema@$host' vs. JSON '".$compare_def['database']."@".$compare_def['host']."' ---------------\n");
$compare_differences = mustal_compare_table_array($compare_def,"in JSON",$db_def,"in DB",true);
echo((empty($compare_differences)?0:count($compare_differences))." differences.\n");
}
}
} // upgrade
echo("--------------- Done. ---------------\n");
echo("\n");
} else {
info();
exit;
}
function info() {
echo("OpenXE database compare\n");
echo("Copyright 2022 (c) OpenXE project\n");
echo("\n");
echo("Export database structures in a defined format for database comparison / upgrade\n");
echo("Options:\n");
echo("\t-v: verbose output\n");
echo("\t-f: force override of existing files\n");
echo("\t-e: export database structure to files\n");
echo("\t-c: compare content of files with database structure\n");
echo("\t-i: ignore column definitions\n");
echo("\t-utf8fix: apply fix for 'utf8' != 'utf8mb3'\n");
echo("\t-upgrade: Create the needed SQL to upgrade the database to match the JSON\n");
echo("\t-do: Execute the SQL to upgrade the database to match the JSON (risky!)\n");
echo("\t-clean: (not yet implemented) Create the needed SQL to remove items from the database not in the JSON\n");
echo("\n");
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,661 @@
<?php
/*
MUSTAL Mysql Upgrade Schema Tool by Alex Ledis
Helper to compare database structures from JSON files vs. database and upgrade database
Copyright (c) 2022 Alex Ledis
Licensed under AGPL v3
Version 1.0
function mustal_load_tables_from_db(string $host, string $schema, string $user, string $passwd, $replacers) : array
Load structure from db connection to an array.
function mustal_save_tables_to_json(array $db_def, string $path, string $tables_file_name, bool $force) : int
Save structure from array to a JSON file.
function mustal_load_tables_from_json(string $path, string $tables_file_name) : array
Load structure from JSON file into array.
function mustal_compare_table_array(array $nominal, string $nominal_name, array $actual, string $actual_name, bool $check_column_definitions) : array
Compare two database structures
Returns a structured array containing information on all the differences.
function mustal_calculate_db_upgrade(array $compare_def, array $db_def, array &$upgrade_sql) : int
Generate the SQL needed to upgrade the database to match the definition, based on a comparison.
Data structure in Array and JSON
{
"host": "hostname",
"database": "schemaname",
"user": "username",
"tables": [
{
"name": "",
"type": "",
"columns": [
{
"Field": "",
"Type": "",
"Collation": "",
"Null": "",
"Key": "",
"Default": "",
"Extra": "",
"Privileges": "",
"Comment": ""
}
],
"keys": [
{
"Key_name": "",
"columns": [
"",
""
]
}
]
}
]
}
*/
// These default values will not be in quotes, converted to lowercase and be replaced by the second entry
$mustal_replacers = [
['current_timestamp','current_timestamp()'],
['on update current_timestamp','on update current_timestamp()']
];
// Load all db_def from a DB connection into a db_def array
function mustal_load_tables_from_db(string $host, string $schema, string $user, string $passwd, $replacers) : array {
// First get the contents of the database table structure
$mysqli = mysqli_connect($host, $user, $passwd, $schema);
/* Check if the connection succeeded */
if (!$mysqli) {
return(array());
}
// Get db_def and views
$sql = "SHOW FULL tables";
$query_result = mysqli_query($mysqli, $sql);
if (!$query_result) {
return(array());
}
while ($row = mysqli_fetch_assoc($query_result)) {
$table = array();
$table['name'] = $row['Tables_in_'.$schema];
$table['type'] = $row['Table_type'];
$tables[] = $table; // Add table to list of tables
}
// Get and add columns of the table
foreach ($tables as &$table) {
$sql = "SHOW FULL COLUMNS FROM ".$table['name'];
$query_result = mysqli_query($mysqli, $sql);
if (!$query_result) {
return(array());
}
$columns = array();
while ($column = mysqli_fetch_assoc($query_result)) {
// Do some harmonization
if ($column['Default'] !== NULL) {
mustal_sql_replace_reserved_functions($column,$replacers);
$column['Default'] = mustal_mysql_put_text_type_in_quotes($column['Type'],$column['Default']);
}
$columns[] = $column; // Add column to list of columns
}
$table['columns'] = $columns;
$sql = "SHOW KEYS FROM ".$table['name'];
$query_result = mysqli_query($mysqli, $sql);
if (!$query_result) {
return(array());
}
$keys = array();
while ($key = mysqli_fetch_assoc($query_result)) {
$keys[] = $key; // Add key to list of keys
}
// Compose comparable format for keys
$composed_keys = array();
foreach ($keys as $key) {
// Check if this key exists already
$key_pos = array_search($key['Key_name'],array_column($composed_keys,'Key_name'));
if ($key_pos == false) {
// New key
$composed_key = array();
$composed_key['Key_name'] = $key['Key_name'];
$composed_key['Index_type'] = $key['Index_type'];
$composed_key['columns'][] = $key['Column_name'];
$composed_keys[] = $composed_key;
} else {
// Given key, add column
$composed_keys[$key_pos]['columns'][] .= $key['Column_name'];
}
}
unset($key);
$table['keys'] = $composed_keys;
unset($composed_keys);
}
unset($table);
$result = array();
$result['host'] = $host;
$result['database'] = $schema;
$result['user'] = $user;
$result['tables'] = $tables;
return($result);
}
function mustal_save_tables_to_json(array $db_def, string $path, string $tables_file_name, bool $force) : int {
// Prepare db_def file
if (!is_dir($path)) {
mkdir($path);
}
if (!$force && file_exists($path."/".$tables_file_name)) {
return(2);
}
$tables_file = fopen($path."/".$tables_file_name, "w");
if (empty($tables_file)) {
return(2);
}
fwrite($tables_file, json_encode($db_def,JSON_PRETTY_PRINT));
fclose($tables_file);
return(0);
}
// Load all db_def from JSON file
function mustal_load_tables_from_json(string $path, string $tables_file_name) : array {
$db_def = array();
$contents = file_get_contents($path."/".$tables_file_name);
if (!$contents) {
return(array());
}
$db_def = json_decode($contents, true);
if (!$db_def) {
return(array());
}
return($db_def);
}
// Compare two definitions
// Report based on the first array
// Return Array
// $column_collation_aliases may contain synonyms for collations e.g. utf8mb3_general_ci vs utf8_general_ci
function mustal_compare_table_array(array $nominal, string $nominal_name, array $actual, string $actual_name, bool $check_column_definitions, array $column_collation_aliases = array()) : array {
$compare_differences = array();
if (count($nominal['tables']) != count($actual['tables'])) {
$compare_difference = array();
$compare_difference['type'] = "Table count";
$compare_difference[$nominal_name] = count($nominal['tables']);
$compare_difference[$actual_name] = count($actual['tables']);
$compare_differences[] = $compare_difference;
}
foreach ($nominal['tables'] as $database_table) {
$found_table = array();
foreach ($actual['tables'] as $compare_table) {
if ($database_table['name'] == $compare_table['name']) {
$found_table = $compare_table;
break;
}
}
unset($compare_table);
if ($found_table) {
// Check type table vs view
if ($database_table['type'] != $found_table['type']) {
$compare_difference = array();
$compare_difference['type'] = "Table type";
$compare_difference['table'] = $database_table['name'];
$compare_difference[$nominal_name] = $database_table['type'];
$compare_difference[$actual_name] = $found_table['type'];
$compare_differences[] = $compare_difference;
}
// Only BASE TABLE supported now
if ($found_table['type'] != 'BASE TABLE') {
continue;
}
// Check columns
$compare_table_columns = array_column($found_table['columns'],'Field');
foreach ($database_table['columns'] as $column) {
$column_name_to_find = $column['Field'];
$column_key = array_search($column_name_to_find,$compare_table_columns,true);
if ($column_key !== false) {
// Compare the properties of the columns
if ($check_column_definitions) {
$found_column = $found_table['columns'][$column_key];
foreach ($column as $key => $value) {
// Apply aliases
if (!empty($column_collation_aliases)) {
foreach($column_collation_aliases as $column_collation_alias) {
if ($value == $column_collation_alias[0]) {
$value = $column_collation_alias[1];
}
if ($found_column[$key] == $column_collation_alias[0]) {
$found_column[$key] = $column_collation_alias[1];
}
}
}
if ($found_column[$key] != $value) {
if ($key != 'Key') { // Keys will be handled separately
$compare_difference = array();
$compare_difference['type'] = "Column definition";
$compare_difference['table'] = $database_table['name'];
$compare_difference['column'] = $column['Field'];
$compare_difference['property'] = $key;
$compare_difference[$nominal_name] = $value;
$compare_difference[$actual_name] = $found_column[$key];
$compare_differences[] = $compare_difference;
}
}
}
unset($value);
} // $check_column_definitions
} else {
$compare_difference = array();
$compare_difference['type'] = "Column existence";
$compare_difference['table'] = $database_table['name'];
$compare_difference[$nominal_name] = $column['Field'];
$compare_differences[] = $compare_difference;
}
}
unset($column);
// Check keys
$compare_table_sql_indexs = array_column($found_table['keys'],'Key_name');
foreach ($database_table['keys'] as $sql_index) {
$sql_index_name_to_find = $sql_index['Key_name'];
$sql_index_key = array_search($sql_index_name_to_find,$compare_table_sql_indexs,true);
if ($sql_index_key !== false) {
// Compare the properties of the sql_indexs
if ($check_column_definitions) {
$found_sql_index = $found_table['keys'][$sql_index_key];
foreach ($sql_index as $key => $value) {
if ($found_sql_index[$key] != $value) {
// if ($key != 'permissions') {
$compare_difference = array();
$compare_difference['type'] = "Key definition";
$compare_difference['table'] = $database_table['name'];
$compare_difference['key'] = $sql_index['Key_name'];
$compare_difference['property'] = $key;
$compare_difference[$nominal_name] = implode(',',$value);
$compare_difference[$actual_name] = implode(',',$found_sql_index[$key]);
$compare_differences[] = $compare_difference;
// }
}
}
unset($value);
} // $check_sql_index_definitions
} else {
$compare_difference = array();
$compare_difference['type'] = "Key existence";
$compare_difference['table'] = $database_table['name'];
$compare_difference[$nominal_name] = $sql_index['Key_name'];
$compare_differences[] = $compare_difference;
}
}
unset($sql_index);
} else {
$compare_difference = array();
$compare_difference['type'] = "Table existence";
$compare_difference[$nominal_name] = $database_table['name'];
$compare_differences[] = $compare_difference;
}
}
unset($database_table);
return($compare_differences);
}
// Generate SQL to create or modify column
function mustal_column_sql_definition(string $table_name, array $column, array $reserved_words_without_quote) : string {
foreach($column as $key => &$value) {
$value = (string) $value;
$value = mustal_column_sql_create_property_definition($key,$value,$reserved_words_without_quote);
}
// Default handling here
if ($column['Default'] == " DEFAULT ''") {
$column['Default'] = "";
}
$sql =
$column['Type'].
$column['Null'].
$column['Default'].
$column['Extra'].
$column['Collation'];
return($sql);
}
// Generate SQL to modify a single column property
function mustal_column_sql_create_property_definition(string $property, string $property_value, array $reserved_words_without_quote) : string {
switch ($property) {
case 'Type':
break;
case 'Null':
if ($property_value == "NO") {
$property_value = " NOT NULL"; // Idiotic...
}
if ($property_value == "YES") {
$property_value = " NULL"; // Also Idiotic...
}
break;
case 'Default':
// Check for MYSQL function mustal_call as default
if (in_array(strtolower($property_value),$reserved_words_without_quote)) {
$quote = "";
} else {
// Remove quotes if there are
$property_value = trim($property_value,"'");
$quote = "'";
}
$property_value = " DEFAULT $quote".$property_value."$quote";
break;
case 'Extra':
if ($property_value != '') {
$property_value = " ".$property_value;
}
break;
case 'Collation':
if ($property_value != '') {
$property_value = " COLLATE ".$property_value;
}
break;
default:
$property_value = "";
break;
}
return($property_value);
}
// Replaces different variants of the same function mustal_to allow comparison
function mustal_sql_replace_reserved_functions(array &$column, array $replacers) {
$result = strtolower($column['Default']);
foreach ($replacers as $replace) {
if ($result == $replace[0]) {
$result = $replace[1];
}
}
$column['Default'] = $result;
$result = strtolower($column['Extra']);
foreach ($replacers as $replace) {
if ($result == $replace[0]) {
$result = $replace[1];
}
}
$column['Extra'] = $result;
}
// Is it a text type? -> Use quotes then
function mustal_mysql_put_text_type_in_quotes(string $checktype, string $value) : string {
$types = array('char','varchar','tinytext','text','mediumtext','longtext');
foreach($types as $type) {
if (stripos($checktype, $type) !== false) {
return("'".$value."'");
}
}
return($value);
}
function mustal_implode_with_quote(string $quote, string $delimiter, array $array_to_implode) : string {
return($quote.implode($quote.$delimiter.$quote, $array_to_implode).$quote);
}
// Calculate the sql neccessary to update the database
// returns array(code,text)
// Error codes:
// 0 ok
// 1 Upgrade type of table not supported
// 2 Error on table upgrade
// 3 Error on column existence upgrade
// 4 Error on column existence upgrade
// 5 Error on column definition upgrade
// 6 Error on column definition upgrade
// 7 Error on key existence upgrade
// 8 Error on key existence upgrade
// 9 Error on key definition upgrade
// 10 Error on key definition upgrade
// 11 Table type upgrade not supported
// 12 Upgrade type not supported
function mustal_calculate_db_upgrade(array $compare_def, array $db_def, array &$upgrade_sql, array $replacers) : array {
$result = array();
$upgrade_sql = array();
$compare_differences = mustal_compare_table_array($compare_def,"in JSON",$db_def,"in DB",true);
if (count($compare_differences) > 0) {
$upgrade_sql[] = ("SET SQL_MODE='ALLOW_INVALID_DATES';");
$upgrade_sql[] = ("SET SESSION innodb_strict_mode=OFF;");
}
foreach ($compare_differences as $compare_difference) {
switch ($compare_difference['type']) {
case 'Table existence':
// Get table definition from JSON
$table_name = $compare_difference['in JSON'];
$table_key = array_search($table_name,array_column($compare_def['tables'],'name'));
if ($table_key !== false) {
$table = $compare_def['tables'][$table_key];
switch ($table['type']) {
case 'BASE TABLE':
// Create table in DB
$sql = "";
$sql = "CREATE TABLE `".$table['name']."` (";
$comma = "";
foreach ($table['columns'] as $column) {
$sql .= $comma."`".$column['Field']."` ".mustal_column_sql_definition($table_name, $column,array_column($replacers,1));
$comma = ", ";
}
// Add keys
$comma = ", ";
foreach ($table['keys'] as $key) {
if ($key['Key_name'] == 'PRIMARY') {
$keystring = "PRIMARY KEY ";
} else {
if(array_key_exists('Index_type', $key)) {
$index_type = $key['Index_type'];
} else {
$index_type = "";
}
$keystring = $index_type." KEY `".$key['Key_name']."` ";
}
$sql .= $comma.$keystring."(`".implode("`,`",$key['columns'])."`) ";
}
$sql .= ")";
$upgrade_sql[] = $sql;
break;
default:
$result[] = array(1,"Upgrade type '".$table['type']."' on table '".$table['name']."' not supported.");
break;
}
} else {
$result[] = array(2,"Error table_key while creating upgrade for table existence `$table_name`.");
}
break;
case 'Column existence':
$table_name = $compare_difference['table'];
$column_name = $compare_difference['in JSON'];
$table_key = array_search($table_name,array_column($compare_def['tables'],'name'));
if ($table_key !== false) {
$table = $compare_def['tables'][$table_key];
$columns = $table['columns'];
$column_key = array_search($column_name,array_column($columns,'Field'));
if ($column_key !== false) {
$column = $table['columns'][$column_key];
$sql = "ALTER TABLE `$table_name` ADD COLUMN `".$column_name."` ";
$sql .= mustal_column_sql_definition($table_name, $column, array_column($replacers,1));
$sql .= ";";
$upgrade_sql[] = $sql;
}
else {
$result[] = array(3,"Error column_key while creating column '$column_name' in table '".$table['name']."'.");
}
}
else {
$result[] = array(4,"Error table_key while creating upgrade for column existence '$column_name' in table '$table_name'.");
}
// Add Column in DB
break;
case 'Column definition':
$table_name = $compare_difference['table'];
$column_name = $compare_difference['column'];
$table_key = array_search($table_name,array_column($compare_def['tables'],'name'));
if ($table_key !== false) {
$table = $compare_def['tables'][$table_key];
$columns = $table['columns'];
$column_names = array_column($columns,'Field');
$column_key = array_search($column_name,$column_names);
if ($column_key !== false) {
$column = $table['columns'][$column_key];
$sql = "ALTER TABLE `$table_name` MODIFY COLUMN `".$column_name."` ";
$sql .= mustal_column_sql_definition($table_name, $column,array_column($replacers,1));
$sql .= ";";
$upgrade_sql[] = $sql;
}
else {
$result[] = array(5,"Error column_key while modifying column '$column_name' in table '".$table['name']."'.");
}
}
else {
$result[] = array(6,"Error table_key while modifying column '$column_name' in table '$table_name'.");
return(6);
}
// Modify Column in DB
break;
case 'Key existence':
$table_name = $compare_difference['table'];
$key_name = $compare_difference['in JSON'];
$table_key = array_search($table_name,array_column($compare_def['tables'],'name'));
if ($table_key !== false) {
$table = $compare_def['tables'][$table_key];
$keys = $table['keys'];
$key_names = array_column($keys,'Key_name');
$key_key = array_search($key_name,$key_names);
if ($key_key !== false) {
$key = $table['keys'][$key_key];
$sql = "ALTER TABLE `$table_name` ADD KEY `".$key_name."` ";
$sql .= "(`".implode("`,`",$key['columns'])."`)";
$sql .= ";";
$upgrade_sql[] = $sql;
}
else {
$result[] = array(7,"Error key_key while adding key '$key_name' in table '".$table['name']."'.");
}
}
else {
$result[] = array(8,"Error table_key while adding key '$key_name' in table '$table_name'.");
}
break;
case "Key definition":
$table_name = $compare_difference['table'];
$key_name = $compare_difference['key'];
$table_key = array_search($table_name,array_column($compare_def['tables'],'name'));
if ($table_key !== false) {
$table = $compare_def['tables'][$table_key];
$keys = $table['keys'];
$key_names = array_column($keys,'Key_name');
$key_key = array_search($key_name,$key_names);
if ($key_key !== false) {
$key = $table['keys'][$key_key];
$sql = "ALTER TABLE `$table_name` DROP KEY `".$key_name."`;";
$upgrade_sql[] = $sql;
$sql = "ALTER TABLE `$table_name` ADD KEY `".$key_name."` ";
$sql .= "(`".implode("`,`",$key['columns'])."`)";
$sql .= ";";
$upgrade_sql[] = $sql;
}
else {
$result[] = array(9, "Error key_key while changing key '$key_name' in table '".$table['name']."'.");
}
}
else {
$result[] = array(10,"Error table_key while changing key '$key_name' in table '$table_name'.");
}
break;
case 'Table count':
// Nothing to do
break;
case 'Table type':
$result[] = array(11,"Upgrade type '".$compare_difference['type']."' on table '".$compare_difference['table']."' not supported.");
break;
default:
$result[] = array(12,"Upgrade type '".$compare_difference['type']."' not supported.");
break;
}
}
$upgrade_sql = array_unique($upgrade_sql);
return($result);
}

View File

@ -17,8 +17,6 @@
* PLACEHOLDER_GET_INPUT
* PLACEHOLDER_SET_INPUT
* PLACEHOLDER_COLUMNS
* PLACEHOLDER_ID_COLUMN
* PLACEHOLDER_HEADERS
* PLACEHOLDER_SET_TPL
*/
@ -111,7 +109,6 @@ if ($argc >= 2) {
$columns = array();
$sql_columns = array();
$edit_form = "";
$tab_pos = " "; // Tab position
/* Iterate through the result set */
echo "FIELD\t\t\t\tType\t\tNull\tKey\tDefault\tExtra\n";
@ -153,16 +150,7 @@ if ($argc >= 2) {
// <tr><td>{|Bezeichnung|}:*</td><td><input type="text" id="bezeichnung" name="bezeichnung" value="[BEZEICHNUNG]" size="40"></td></tr>
if ($row['Field'] != 'id') {
$edit_form = $edit_form.
'<tr>
<td>
{|' . ucfirst($row['Field']) . '|}:
</td>
<td>
<input type="text" name="' . $row['Field'].'" id="'.$row['Field'].'" value="[' . strtoupper($row['Field']) . ']" size="20">
</td>
</tr>
';
$edit_form = $edit_form . '<tr><td>{|' . ucfirst($row['Field']) . '|}:</td><td><input type="text" name="' . $row['Field'].'" id="'.$row['Field'].'" value="[' . strtoupper($row['Field']) . ']" size="20"></td></tr>' . "\n";
}
echo("\n");
}
@ -176,7 +164,6 @@ if ($argc >= 2) {
// Create php file
$list_of_columns = implode(', ', $columns);
$list_of_columns_headers_in_quotes = "'" . implode('\', \'', array_map('ucfirst',$columns)) . "'";
$list_of_columns_in_quotes = "'" . implode('\', \'', $columns) . "'";
$sql_list_of_columns = implode(', ', $sql_columns);
$sql_list_of_columns_in_quotes = "'" . implode('\', \'', $sql_columns) . "'";
@ -207,8 +194,6 @@ if ($argc >= 2) {
$php_file_contents = str_replace('PLACEHOLDER_GET_INPUT', $get_input, $php_file_contents);
$php_file_contents = str_replace('PLACEHOLDER_SET_INPUT', $set_input, $php_file_contents);
$php_file_contents = str_replace('PLACEHOLDER_COLUMNS', $list_of_columns_in_quotes, $php_file_contents);
$php_file_contents = str_replace('PLACEHOLDER_ID_COLUMN', $table_short_name.".id", $php_file_contents);
$php_file_contents = str_replace('PLACEHOLDER_HEADERS', $list_of_columns_headers_in_quotes, $php_file_contents);
$php_file_contents = str_replace('PLACEHOLDER_SQL_COLUMNS', $sql_list_of_columns_in_quotes, $php_file_contents);
$php_file = fopen($target_php_folder . $php_file_name, "w");

View File

@ -1,10 +1,5 @@
<div id="tabs">
<ul>
<li><a href="#tabs-1">[TABTEXT1]</a></li>
</ul>
<div id="tabs-1">
[MESSAGE]
[TAB1]
[TAB1NEXT]
</div>
<div id="tabs-1">
[MESSAGE]
[TAB1]
[TAB1NEXT]
</div>

View File

@ -30,27 +30,19 @@ class PLACEHOLDER_MODULECLASSNAME {
switch ($name) {
case "PLACEHOLDER_LIST":
$allowed['PLACEHOLDER_LIST'] = array('list');
$heading = array('','',PLACEHOLDER_HEADERS, 'Men&uuml;');
$heading = array('','',PLACEHOLDER_COLUMNS, 'Men&uuml;');
$width = array('1%','1%','10%'); // Fill out manually later
// columns that are aligned right (numbers etc)
// $alignright = array(4,5,6,7,8);
$findcols = array('PLACEHOLDER_ID_COLUMN','PLACEHOLDER_ID_COLUMN',PLACEHOLDER_SQL_COLUMNS);
$findcols = array(PLACEHOLDER_SQL_COLUMNS);
$searchsql = array(PLACEHOLDER_SQL_COLUMNS);
$defaultorder = 1;
$defaultorderdesc = 0;
$aligncenter = array();
$alignright = array();
$numbercols = array();
$sumcol = array();
$dropnbox = "PLACEHOLDER_DROPNBOX";
// $moreinfo = true; // Allow drop down details
// $moreinfoaction = "lieferschein"; // specify suffix for minidetail-URL to allow different minidetails
// $menucol = 11; // Set id col for moredata/menu
$dropnbox = "PLACEHOLDER_DROPNBOX";
$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?module=PLACEHOLDER_MODULENAME&action=edit&id=%value%\"><img src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\"></a>&nbsp;<a href=\"#\" onclick=DeleteDialog(\"index.php?module=PLACEHOLDER_MODULENAME&action=delete&id=%value%\");>" . "<img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/delete.svg\" border=\"0\"></a>" . "</td></tr></table>";
@ -101,7 +93,7 @@ class PLACEHOLDER_MODULECLASSNAME {
$id = $this->app->Secure->GetGET('id');
// Check if other users are editing this id
if($this->app->erp->DisableModul('PLACEHOLDER_MODULENAME',$id))
if($this->app->erp->DisableModul('artikel',$id))
{
return;
}
@ -126,8 +118,6 @@ class PLACEHOLDER_MODULECLASSNAME {
// Add checks here
// $input['projekt'] = $this->app->erp->ReplaceProjekt(true,$input['projekt'],true); // Parameters: Target db?, value, from form?
$columns = "id, ";
$values = "$id, ";
$update = "";
@ -163,17 +153,11 @@ class PLACEHOLDER_MODULECLASSNAME {
// Load values again from database
$dropnbox = "PLACEHOLDER_DROPNBOX";
$result = $this->app->DB->SelectArr("PLACEHOLDER_SQL_LIST"." WHERE id=$id");
$result = $this->app->DB->SelectArr("PLACEHOLDER_SQL_LIST"." WHERE id=$id");
foreach ($result[0] as $key => $value) {
$this->app->Tpl->Set(strtoupper($key), $value);
}
if (!empty($result)) {
$PLACEHOLDER_MODULENAME_from_db = $result[0];
} else {
return;
}
/*
* Add displayed items later
@ -182,11 +166,9 @@ class PLACEHOLDER_MODULECLASSNAME {
$this->app->Tpl->Add('KURZUEBERSCHRIFT2', $email);
$this->app->Tpl->Add('EMAIL', $email);
$this->app->Tpl->Add('ANGEZEIGTERNAME', $angezeigtername);
$this->app->YUI->AutoComplete("artikel", "artikelnummer");
*/
// $this->SetInput($input);
$this->app->Tpl->Parse('PAGE', "PLACEHOLDER_MODULENAME_edit.tpl");
}
@ -201,4 +183,14 @@ class PLACEHOLDER_MODULECLASSNAME {
return $input;
}
}
/*
* Set all fields in the page corresponding to $input
*/
function SetInput($input) {
// $this->app->Tpl->Set('EMAIL', $input['email']);
PLACEHOLDER_SET_INPUT
}
}

View File

@ -1,19 +1,16 @@
OpenXE upgrade system
Upgrade the OpenXE system.
NOTE:
The upgrade system is for use in LINUX only and needs to have git installed.
The following steps are executed:
1. get files from git
2. run database upgrade
Files in this directory:
UPGRADE.md -> This file
upgrade.sh -> The upgrade starter, execute with "./upgrade.sh". Execute without parameters to view possible options.
upgrade.php -> The upgrade program
Files in the data subdirectory:
upgrade.php -> The upgrade program
.in_progress.flag -> if this file exists, an upgrade is in progress, system will be locked
db_schema.json -> Contains the nominal database structure
exported_db_schema.json -> Contains the exported database structure (optional)
remote.json -> Contains the git remote & branch which should be used for upgrade
upgrade.log -> Contains the output from the last run that was started from within OpenXE

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
{
"host": "http://repo.dbxe.de/dbxe/dbxe.git",
"host": "https://github.com/openxe-org/openxe.git",
"branch": "master"
}

Some files were not shown because too many files have changed in this diff Show More