Compare commits

..

1 Commits

Author SHA1 Message Date
Florian Aders (EleRas)
601724fab9 Tagging release 0.9.1 2010-02-15 06:21:56 +00:00
1104 changed files with 46606 additions and 90115 deletions

17
.gitignore vendored
View File

@@ -1,17 +0,0 @@
install/update.log
templates/*
lib/userdata.inc.php
logs/*
.buildpath
.project
.settings/
*.diff
*~
.well-known
.idea
*.iml
!templates/Froxlor/
!templates/Sparkle/
!templates/misc/
templates/Froxlor/assets/img/logo_custom.png

561
COPYING
View File

@@ -1,280 +1,281 @@
GNU GENERAL PUBLIC LICENSE GNU GENERAL PUBLIC LICENSE
Version 2, June 1991 Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc. Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed. of this license document, but changing it is not allowed.
Preamble Preamble
The licenses for most software are designed to take away your The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to the GNU Library General Public License instead.) You can apply it to
your programs, too. your programs, too.
When we speak of free software, we are referring to freedom, not When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it this service 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 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. in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights. anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it. distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their source code. And you must show them these terms so they know their
rights. rights.
We protect your rights with two steps: (1) copyright the software, and We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy, (2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software. distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original that any problems introduced by others will not reflect on the original
authors' reputations. authors' reputations.
Finally, any free program is threatened constantly by software Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all. patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and The precise terms and conditions for copying, distribution and
modification follow. modification follow.
GNU GENERAL PUBLIC LICENSE GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains 0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below, under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program" refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law: means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it, that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you". the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program). Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does. Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's 1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty; notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License and give any other recipients of the Program a copy of this License
along with the Program. along with the Program.
You may charge a fee for the physical act of transferring a copy, and You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee. you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion 2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1 distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions: above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change. stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License. parties under the terms of this License.
c) If the modified program normally reads commands interactively c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on does not normally print such an announcement, your work based on
the Program is not required to print an announcement.) the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program, identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it. entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or exercise the right to control the distribution of derivative or
collective works based on the Program. collective works based on the Program.
In addition, mere aggregation of another work not based on the Program In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under a storage or distribution medium does not bring the other work under
the scope of this License. the scope of this License.
3. You may copy and distribute the Program (or a work based on it, 3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following: Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or, 1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or, customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such received the program in object code or executable form with such
an offer, in accord with Subsection b above.) an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component operating system on which the executable runs, unless that component
itself accompanies the executable. itself accompanies the executable.
If distribution of executable or object code is made by offering If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not distribution of the source code, even though third parties are not
compelled to copy the source along with the object code. compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program 4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License. void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such this License will not have their licenses terminated so long as such
parties remain in full compliance. parties remain in full compliance.
5. You are not required to accept this License, since you have not 5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying all its terms and conditions for copying, distributing or modifying
the Program or works based on it. the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the 6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein. restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to You are not responsible for enforcing compliance by third parties to
this License. this License.
7. If, as a consequence of a court judgment or allegation of patent 7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues), infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program. refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other apply and the section as a whole is intended to apply in other
circumstances. circumstances.
It is not the purpose of this section to induce you to infringe any It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is integrity of the free software distribution system, which is
implemented by public license practices. Many people have made implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot to distribute software through any other system and a licensee cannot
impose that choice. impose that choice.
This section is intended to make thoroughly clear what is believed to This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License. be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in 8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License. the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions 9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will of the 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 be similar in spirit to the present version, but may differ in detail to
address new problems or concerns. address new problems or concerns.
Each version is given a distinguishing version number. If the Program Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software this License, you may choose any version ever published by the Free Software
Foundation. Foundation.
10. If you wish to incorporate parts of the Program into other free 10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally. of promoting the sharing and reuse of software generally.
NO WARRANTY NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION. REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 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 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 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 PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES. POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS END OF TERMS AND CONDITIONS

View File

@@ -1,74 +0,0 @@
# Froxlor
The server administration software for your needs.
Developed by experienced server administrators, this panel simplifies the effort of managing your hosting platform.
## Installation
### Fast install
1. Ensure that your webserver serves /var/www
2. Extract froxlor into /var/www
3. Point your browser to http://[ip-of-webserver]/froxlor
4. Follow the installer
5. Login as administrator
6. Adjust "Server > Settings" according to your needs
7. Choose your distribution under "Server > Configuration"
8. Follow the steps for your services
9. Have fun!
### Detailed installation
http://redmine.froxlor.org/projects/froxlor/wiki/Installationtarball
## Help
You may find help in the following places:
### IRC
froxlor may be found on freenode.net, channel #froxlor:
irc://chat.freenode.net/froxlor
### Forum
The community is located on http://forum.froxlor.org
### Wiki
More documentation may be found in the froxlor - wiki:
http://redmine.froxlor.org/projects/froxlor/wiki
## License
May be found in COPYING
## Downloads
### Tarball
http://files.froxlor.org/releases/froxlor-latest.tar.gz [MD5](http://files.froxlor.org/releases/froxlor-latest.tar.gz.md5) [SHA1](http://files.froxlor.org/releases/froxlor-latest.tar.gz.sha1)
### Debian repository
[HowTo](http://redmine.froxlor.org/projects/froxlor/wiki/Installationdebian)
/etc/apt/sources.list.d/froxlor.list
> deb http://debian.froxlor.org {wheezy|jessie} main
### Gentoo repository
[HowTo](http://redmine.froxlor.org/projects/froxlor/wiki/Installationgentoo)
http://files.froxlor.org/gentoo/repositories.xml
## Let's Encrypt support
This version of Froxlor contains a test implementation of support for [Let's Encrypt](https://letsencrypt.org). This is (as Let's Encrypt is in itself)
still a beta version and may break your system. The way it currently works is by creating a (sub-)domain with the default system - certificate,
after which the Let's Encrypt cronjob orders the certificate for this (sub-)domain and inserts the certificates in the database. With the next run
of the default cronjob, the certificates will be updated on the disk and the webserver reloaded.
This has 2 known side-effects at the moment:
* The basic ip/port combinations don't work with the Froxlor - integration of Let's Encrypt, since it needs a certificate for the very first creation
* After creating a domain, it will have the default certificate for a short time (by default 5 minutes until the cronjob runs the next time)
It may be possible to fix these issues, but they are not a priority at the moment

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings * @package Settings
* * @version $Id$
*/ */
return array( return array(

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Language * @package Language
* * @version $Id$
*/ */
return array( return array(
@@ -32,32 +32,6 @@ return array(
'option_options_method' => 'getLanguages', 'option_options_method' => 'getLanguages',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'panel_default_theme' => array(
'label' => array('title' => $lng['panel']['theme'], 'description' => $lng['serversettings']['default_theme']),
'settinggroup' => 'panel',
'varname' => 'default_theme',
'type' => 'option',
'default' => 'Froxlor',
'option_mode' => 'one',
'option_options_method' => 'getThemes',
'save_method' => 'storeSettingDefaultTheme',
),
'panel_allow_theme_change_customer' => array(
'label' => $lng['serversettings']['panel_allow_theme_change_customer'],
'settinggroup' => 'panel',
'varname' => 'allow_theme_change_customer',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField',
),
'panel_allow_theme_change_admin' => array(
'label' => $lng['serversettings']['panel_allow_theme_change_admin'],
'settinggroup' => 'panel',
'varname' => 'allow_theme_change_admin',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField'
),
'panel_natsorting' => array( 'panel_natsorting' => array(
'label' => $lng['serversettings']['natsorting'], 'label' => $lng['serversettings']['natsorting'],
'settinggroup' => 'panel', 'settinggroup' => 'panel',
@@ -90,7 +64,7 @@ return array(
'type' => 'option', 'type' => 'option',
'default' => 'Manual', 'default' => 'Manual',
'option_mode' => 'one', 'option_mode' => 'one',
'option_options' => array('Manual' => $lng['serversettings']['manual'], 'Dropdown' => $lng['serversettings']['dropdown']), 'option_options' => array('Manual' => 'Manual', 'Dropdown' => 'Dropdown'),
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'panel_adminmail' => array( 'panel_adminmail' => array(
@@ -103,24 +77,6 @@ return array(
'default' => '', 'default' => '',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'panel_adminmail_defname' => array(
'label' => $lng['serversettings']['adminmail_defname'],
'settinggroup' => 'panel',
'varname' => 'adminmail_defname',
'type' => 'string',
'default' => 'Froxlor Administrator',
'save_method' => 'storeSettingField',
),
'panel_adminmail_return' => array(
'label' => $lng['serversettings']['adminmail_return'],
'settinggroup' => 'panel',
'varname' => 'adminmail_return',
'type' => 'string',
'string_type' => 'mail',
'string_emptyallowed' => true,
'default' => '',
'save_method' => 'storeSettingField',
),
'panel_decimal_places' => array( 'panel_decimal_places' => array(
'label' => $lng['serversettings']['decimal_places'], 'label' => $lng['serversettings']['decimal_places'],
'settinggroup' => 'panel', 'settinggroup' => 'panel',
@@ -177,29 +133,11 @@ return array(
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'admin_show_news_feed' => array( 'admin_froxlor_graphic' => array(
'label' => $lng['admin']['show_news_feed'], 'label' => $lng['admin']['froxlor_graphic'],
'settinggroup' => 'admin', 'settinggroup' => 'admin',
'varname' => 'show_news_feed', 'varname' => 'froxlor_graphic',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'customer_show_news_feed' => array(
'label' => $lng['admin']['customer_show_news_feed'],
'settinggroup' => 'customer',
'varname' => 'show_news_feed',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'customer_news_feed_url' => array(
'label' => $lng['admin']['customer_news_feed_url'],
'settinggroup' => 'customer',
'varname' => 'news_feed_url',
'type' => 'string', 'type' => 'string',
'string_type' => 'url',
'string_emptyallowed' => true,
'default' => '', 'default' => '',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
@@ -219,39 +157,6 @@ return array(
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'panel_phpconfigs_hidestdsubdomain' => array(
'label' => $lng['serversettings']['panel_phpconfigs_hidestdsubdomain'],
'settinggroup' => 'panel',
'varname' => 'phpconfigs_hidestdsubdomain',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'panel_customer_hide_options' => array(
'label' => $lng['serversettings']['panel_customer_hide_options'],
'settinggroup' => 'panel',
'varname' => 'customer_hide_options',
'type' => 'option',
'default' => '',
'option_mode' => 'multiple',
'option_emptyallowed' => true,
'option_options' => array(
'email' => $lng['menue']['email']['email'],
'mysql' => $lng['menue']['mysql']['mysql'],
'domains' => $lng['menue']['domains']['domains'],
'ftp' => $lng['menue']['ftp']['ftp'],
'extras' => $lng['menue']['extras']['extras'],
'extras.directoryprotection' => $lng['menue']['extras']['extras']." / ".$lng['menue']['extras']['directoryprotection'],
'extras.pathoptions' => $lng['menue']['extras']['extras']." / ".$lng['menue']['extras']['pathoptions'],
'extras.logger' => $lng['menue']['extras']['extras']." / ".$lng['menue']['logger']['logger'],
'extras.backup' => $lng['menue']['extras']['extras']." / ".$lng['menue']['extras']['backup'],
'traffic' => $lng['menue']['traffic']['traffic'],
'traffic.http' => $lng['menue']['traffic']['traffic']." / HTTP",
'traffic.ftp' => $lng['menue']['traffic']['traffic']." / FTP",
'traffic.mail' => $lng['menue']['traffic']['traffic']." / Mail",
),
'save_method' => 'storeSettingField',
),
), ),
), ),
), ),

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings * @package Settings
* * @version $Id$
*/ */
return array( return array(
@@ -38,14 +38,6 @@ return array(
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'login_domain_login' => array(
'label' => $lng['serversettings']['login_domain_login'],
'settinggroup' => 'login',
'varname' => 'domain_login',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'login_maxloginattempts' => array( 'login_maxloginattempts' => array(
'label' => $lng['serversettings']['maxloginattempts'], 'label' => $lng['serversettings']['maxloginattempts'],
'settinggroup' => 'login', 'settinggroup' => 'login',
@@ -62,63 +54,6 @@ return array(
'default' => 900, 'default' => 900,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'panel_password_min_length' => array(
'label' => $lng['serversettings']['panel_password_min_length'],
'settinggroup' => 'panel',
'varname' => 'password_min_length',
'type' => 'int',
'default' => 0,
'save_method' => 'storeSettingField',
),
'panel_password_alpha_lower' => array(
'label' => $lng['serversettings']['panel_password_alpha_lower'],
'settinggroup' => 'panel',
'varname' => 'password_alpha_lower',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField',
),
'panel_password_alpha_upper' => array(
'label' => $lng['serversettings']['panel_password_alpha_upper'],
'settinggroup' => 'panel',
'varname' => 'password_alpha_upper',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField',
),
'panel_password_numeric' => array(
'label' => $lng['serversettings']['panel_password_numeric'],
'settinggroup' => 'panel',
'varname' => 'password_numeric',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'panel_password_special_char_required' => array(
'label' => $lng['serversettings']['panel_password_special_char_required'],
'settinggroup' => 'panel',
'varname' => 'password_special_char_required',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'panel_password_special_char' => array(
'label' => $lng['serversettings']['panel_password_special_char'],
'settinggroup' => 'panel',
'varname' => 'password_special_char',
'type' => 'string',
'default' => '!?<>§$%+#=@',
'save_method' => 'storeSettingField',
),
'panel_password_regex' => array(
'label' => $lng['serversettings']['panel_password_regex'],
'settinggroup' => 'panel',
'varname' => 'password_regex',
'type' => 'string',
'default' => '',
/* 'plausibility_check_method' => 'checkValidRegEx', */
'save_method' => 'storeSettingField',
),
'customer_accountprefix' => array( 'customer_accountprefix' => array(
'label' => $lng['serversettings']['accountprefix'], 'label' => $lng['serversettings']['accountprefix'],
'settinggroup' => 'customer', 'settinggroup' => 'customer',
@@ -160,14 +95,6 @@ return array(
'type' => 'bool', 'type' => 'bool',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'dependency' => array(
'fieldname' => 'panel_allow_preset_admin',
'fielddata' => array(
'settinggroup' => 'panel',
'varname' => 'allow_preset_admin',
),
'onlyif' => 0
)
), ),
'panel_allow_preset_admin' => array( 'panel_allow_preset_admin' => array(
'label' => $lng['serversettings']['allow_password_reset_admin'], 'label' => $lng['serversettings']['allow_password_reset_admin'],
@@ -176,26 +103,10 @@ return array(
'type' => 'bool', 'type' => 'bool',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'dependency' => array( ),
'fieldname' => 'panel_allow_preset',
'fielddata' => array(
'settinggroup' => 'panel',
'varname' => 'allow_preset',
),
'onlyif' => 1
)
),
'system_backupenabled' => array(
'label' => $lng['serversettings']['backupenabled'],
'settinggroup' => 'system',
'varname' => 'backupenabled',
'type' => 'bool',
'default' => false,
'cronmodule' => 'froxlor/backup',
'save_method' => 'storeSettingField'
), ),
), ),
), ),
) );
);
?>

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings * @package Settings
* * @version $Id$
*/ */
return array( return array(
@@ -27,18 +27,8 @@ return array(
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'documentroot_prefix', 'varname' => 'documentroot_prefix',
'type' => 'string', 'type' => 'string',
'string_type' => 'dir',
'default' => '/var/customers/webs/', 'default' => '/var/customers/webs/',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'plausibility_check_method' => 'checkPathConflicts'
),
'system_documentroot_use_default_value' => array(
'label' => $lng['serversettings']['documentroot_use_default_value'],
'settinggroup' => 'system',
'varname' => 'documentroot_use_default_value',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
), ),
'system_ipaddress' => array( 'system_ipaddress' => array(
'label' => $lng['serversettings']['ipaddress'], 'label' => $lng['serversettings']['ipaddress'],
@@ -55,7 +45,7 @@ return array(
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'defaultip', 'varname' => 'defaultip',
'type' => 'option', 'type' => 'option',
'option_mode' => 'multiple', 'option_mode' => 'one',
'option_options_method' => 'getIpPortCombinations', 'option_options_method' => 'getIpPortCombinations',
'default' => '', 'default' => '',
'save_method' => 'storeSettingDefaultIp', 'save_method' => 'storeSettingDefaultIp',
@@ -67,23 +57,6 @@ return array(
'type' => 'string', 'type' => 'string',
'default' => '', 'default' => '',
'save_method' => 'storeSettingHostname', 'save_method' => 'storeSettingHostname',
'plausibility_check_method' => 'checkHostname',
),
'system_validatedomain' => array(
'label' => $lng['serversettings']['validate_domain'],
'settinggroup' => 'system',
'varname' => 'validate_domain',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField',
),
'system_stdsubdomain' => array(
'label' => $lng['serversettings']['stdsubdomainhost'],
'settinggroup' => 'system',
'varname' => 'stdsubdomain',
'type' => 'string',
'default' => '',
'save_method' => 'storeSettingHostname',
), ),
'system_mysql_access_host' => array( 'system_mysql_access_host' => array(
'label' => $lng['serversettings']['mysql_access_host'], 'label' => $lng['serversettings']['mysql_access_host'],
@@ -94,6 +67,15 @@ return array(
'plausibility_check_method' => 'checkMysqlAccessHost', 'plausibility_check_method' => 'checkMysqlAccessHost',
'save_method' => 'storeSettingMysqlAccessHost', 'save_method' => 'storeSettingMysqlAccessHost',
), ),
'system_realtime_port' => array(
'label' => $lng['serversettings']['system_realtime_port'],
'settinggroup' => 'system',
'varname' => 'realtime_port',
'type' => 'int',
'int_max' => 65535,
'default' => 0,
'save_method' => 'storeSettingField',
),
'system_index_file_extension' => array( 'system_index_file_extension' => array(
'label' => $lng['serversettings']['index_file_extension'], 'label' => $lng['serversettings']['index_file_extension'],
'settinggroup' => 'system', 'settinggroup' => 'system',
@@ -103,14 +85,6 @@ return array(
'default' => 'html', 'default' => 'html',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'system_store_index_file_subs' => array(
'label' => $lng['serversettings']['system_store_index_file_subs'],
'settinggroup' => 'system',
'varname' => 'store_index_file_subs',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField',
),
'system_httpuser' => array( 'system_httpuser' => array(
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'httpuser', 'varname' => 'httpuser',
@@ -123,95 +97,17 @@ return array(
'type' => 'hidden', 'type' => 'hidden',
'default' => 'www-data', 'default' => 'www-data',
), ),
'system_report_enable' => array( 'system_debug_cron' => array(
'label' => $lng['serversettings']['report']['report'], 'label' => $lng['serversettings']['cron']['debug'],
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'report_enable', 'varname' => 'debug_cron',
'type' => 'bool',
'default' => true,
'cronmodule' => 'froxlor/reports',
'save_method' => 'storeSettingField',
),
'system_report_webmax' => array(
'label' => $lng['serversettings']['report']['webmax'],
'settinggroup' => 'system',
'varname' => 'report_webmax',
'type' => 'int',
'int_min' => 0,
'int_max' => 150,
'default' => 90,
'save_method' => 'storeSettingField',
),
'system_report_trafficmax' => array(
'label' => $lng['serversettings']['report']['trafficmax'],
'settinggroup' => 'system',
'varname' => 'report_trafficmax',
'type' => 'int',
'int_min' => 0,
'int_max' => 150,
'default' => 90,
'save_method' => 'storeSettingField',
),
'system_mail_use_smtp' => array(
'label' => $lng['serversettings']['mail_use_smtp'],
'settinggroup' => 'system',
'varname' => 'mail_use_smtp',
'type' => 'bool', 'type' => 'bool',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'system_mail_smtp_host' => array(
'label' => $lng['serversettings']['mail_smtp_host'],
'settinggroup' => 'system',
'varname' => 'mail_smtp_host',
'type' => 'string',
'default' => 'localhost',
'save_method' => 'storeSettingField',
),
'system_mail_smtp_port' => array(
'label' => $lng['serversettings']['mail_smtp_port'],
'settinggroup' => 'system',
'varname' => 'mail_smtp_port',
'type' => 'int',
'int_min' => 1,
'int_max' => 65535,
'default' => 25,
'save_method' => 'storeSettingField',
),
'system_mail_smtp_usetls' => array(
'label' => $lng['serversettings']['mail_smtp_usetls'],
'settinggroup' => 'system',
'varname' => 'mail_smtp_usetls',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField',
),
'system_mail_smtp_auth' => array(
'label' => $lng['serversettings']['mail_smtp_auth'],
'settinggroup' => 'system',
'varname' => 'mail_smtp_auth',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField',
),
'system_mail_smtp_user' => array(
'label' => $lng['serversettings']['mail_smtp_user'],
'settinggroup' => 'system',
'varname' => 'mail_smtp_user',
'type' => 'string',
'default' => '',
'save_method' => 'storeSettingField',
),
'system_mail_smtp_passwd' => array(
'label' => $lng['serversettings']['mail_smtp_passwd'],
'settinggroup' => 'system',
'varname' => 'mail_smtp_passwd',
'type' => 'hiddenString',
'default' => '',
'save_method' => 'storeSettingField',
),
), ),
), ),
), ),
); );
?>

View File

@@ -1,163 +0,0 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2016 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2016-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings
*
*/
return array(
'groups' => array(
'froxlorvhost' => array(
'title' => $lng['admin']['froxlorvhost'],
'fields' => array(
/**
* Webserver-Vhost
*/
'system_froxlordirectlyviahostname' => array(
'label' => $lng['serversettings']['froxlordirectlyviahostname'],
'settinggroup' => 'system',
'varname' => 'froxlordirectlyviahostname',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField'
),
/**
* SSL / Let's Encrypt
*/
'system_le_froxlor_enabled' => array(
'label' => $lng['serversettings']['le_froxlor_enabled'],
'settinggroup' => 'system',
'varname' => 'le_froxlor_enabled',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingClearCertificates',
'visible' => Settings::Get('system.leenabled')
),
'system_le_froxlor_redirect' => array(
'label' => $lng['serversettings']['le_froxlor_redirect'],
'settinggroup' => 'system',
'varname' => 'le_froxlor_redirect',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'visible' => Settings::Get('system.leenabled')
),
/**
* FCGID
*/
'system_mod_fcgid_enabled_ownvhost' => array(
'label' => $lng['serversettings']['mod_fcgid_ownvhost'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_ownvhost',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField',
'websrv_avail' => array(
'apache2'
),
'visible' => Settings::Get('system.mod_fcgid')
),
'system_mod_fcgid_httpuser' => array(
'label' => $lng['admin']['mod_fcgid_user'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_httpuser',
'type' => 'string',
'default' => 'froxlorlocal',
'save_method' => 'storeSettingWebserverFcgidFpmUser',
'websrv_avail' => array(
'apache2'
),
'visible' => Settings::Get('system.mod_fcgid')
),
'system_mod_fcgid_httpgroup' => array(
'label' => $lng['admin']['mod_fcgid_group'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_httpgroup',
'type' => 'string',
'default' => 'froxlorlocal',
'save_method' => 'storeSettingField',
'websrv_avail' => array(
'apache2'
),
'visible' => Settings::Get('system.mod_fcgid')
),
'system_mod_fcgid_defaultini_ownvhost' => array(
'label' => $lng['serversettings']['mod_fcgid']['defaultini_ownvhost'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_defaultini_ownvhost',
'type' => 'option',
'default' => '2',
'option_mode' => 'one',
'option_options_method' => 'getPhpConfigs',
'save_method' => 'storeSettingField',
'websrv_avail' => array(
'apache2'
),
'visible' => Settings::Get('system.mod_fcgid')
),
/**
* php-fpm
*/
'system_phpfpm_enabled_ownvhost' => array(
'label' => $lng['phpfpm']['ownvhost'],
'settinggroup' => 'phpfpm',
'varname' => 'enabled_ownvhost',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField',
'visible' => Settings::Get('phpfpm.enabled')
),
'system_phpfpm_httpuser' => array(
'label' => $lng['phpfpm']['vhost_httpuser'],
'settinggroup' => 'phpfpm',
'varname' => 'vhost_httpuser',
'type' => 'string',
'default' => 'froxlorlocal',
'save_method' => 'storeSettingWebserverFcgidFpmUser',
'visible' => Settings::Get('phpfpm.enabled')
),
'system_phpfpm_httpgroup' => array(
'label' => $lng['phpfpm']['vhost_httpgroup'],
'settinggroup' => 'phpfpm',
'varname' => 'vhost_httpgroup',
'type' => 'string',
'default' => 'froxlorlocal',
'save_method' => 'storeSettingField',
'visible' => Settings::Get('phpfpm.enabled')
),
'system_phpfpm_defaultini_ownvhost' => array(
'label' => $lng['serversettings']['mod_fcgid']['defaultini_ownvhost'],
'settinggroup' => 'phpfpm',
'varname' => 'vhost_defaultini',
'type' => 'option',
'default' => '2',
'option_mode' => 'one',
'option_options_method' => 'getPhpConfigs',
'save_method' => 'storeSettingField',
'visible' => Settings::Get('phpfpm.enabled')
),
/**
* DNS
*/
'system_dns_createhostnameentry' => array(
'label' => $lng['serversettings']['dns_createhostnameentry'],
'settinggroup' => 'system',
'varname' => 'dns_createhostnameentry',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'visible' => Settings::Get('system.bind_enable')
)
)
)
)
);

View File

@@ -1,67 +0,0 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2014 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings
*
*/
return array(
'groups' => array(
'crond' => array(
'title' => $lng['admin']['cronsettings'],
'fields' => array(
'system_cronconfig' => array(
'label' => $lng['serversettings']['system_cronconfig'],
'settinggroup' => 'system',
'varname' => 'cronconfig',
'type' => 'string',
'string_type' => 'file',
'default' => '/etc/cron.d/froxlor',
'save_method' => 'storeSettingField',
),
'system_croncmdline' => array(
'label' => $lng['serversettings']['system_croncmdline'],
'settinggroup' => 'system',
'varname' => 'croncmdline',
'type' => 'string',
'default' => '/usr/bin/nice -n 5 /usr/bin/php -q',
'save_method' => 'storeSettingField',
),
'system_crondreload' => array(
'label' => $lng['serversettings']['system_crondreload'],
'settinggroup' => 'system',
'varname' => 'crondreload',
'type' => 'string',
'default' => '/etc/init.d/cron reload',
'save_method' => 'storeSettingField',
),
'system_cron_allowautoupdate' => array(
'label' => $lng['serversettings']['system_cron_allowautoupdate'],
'settinggroup' => 'system',
'varname' => 'cron_allowautoupdate',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'system_debug_cron' => array(
'label' => $lng['serversettings']['cron']['debug'],
'settinggroup' => 'system',
'varname' => 'debug_cron',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
)
)
)
)
);

View File

@@ -14,8 +14,9 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings * @package Settings
* * @version $Id$
*/ */
return array( return array(
'groups' => array( 'groups' => array(
'webserver' => array( 'webserver' => array(
@@ -26,56 +27,11 @@ return array(
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'webserver', 'varname' => 'webserver',
'type' => 'option', 'type' => 'option',
'default' => 'apache2', 'default' => 'Apache2',
'option_mode' => 'one', 'option_mode' => 'one',
'option_options' => array( 'option_options' => array('apache2' => 'Apache 2', 'lighttpd' => 'ligHTTPd'),
'apache2' => 'Apache 2', 'save_method' => 'storeSettingField',
'lighttpd' => 'ligHTTPd',
'nginx' => 'Nginx'
), ),
'save_method' => 'storeSettingField',
'plausibility_check_method' => 'checkPhpInterfaceSetting',
'overview_option' => true
),
'system_apache_24' => array(
'label' => $lng['serversettings']['apache_24'],
'settinggroup' => 'system',
'varname' => 'apache24',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'websrv_avail' => array(
'apache2'
)
),
'system_apache_itksupport' => array(
'label' => $lng['serversettings']['apache_itksupport'],
'settinggroup' => 'system',
'varname' => 'apacheitksupport',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'visible' => (Settings::Get('system.mod_fcgid') == 0 && Settings::Get('phpfpm.enabled') == 0),
'websrv_avail' => array(
'apache2'
)
),
'system_httpuser' => array(
'label' => $lng['admin']['webserver_user'],
'settinggroup' => 'system',
'varname' => 'httpuser',
'type' => 'string',
'default' => 'www-data',
'save_method' => 'storeSettingWebserverFcgidFpmUser'
),
'system_httpgroup' => array(
'label' => $lng['admin']['webserver_group'],
'settinggroup' => 'system',
'varname' => 'httpgroup',
'type' => 'string',
'default' => 'www-data',
'save_method' => 'storeSettingField'
),
'system_apacheconf_vhost' => array( 'system_apacheconf_vhost' => array(
'label' => $lng['serversettings']['apacheconf_vhost'], 'label' => $lng['serversettings']['apacheconf_vhost'],
'settinggroup' => 'system', 'settinggroup' => 'system',
@@ -83,8 +39,8 @@ return array(
'type' => 'string', 'type' => 'string',
'string_type' => 'filedir', 'string_type' => 'filedir',
'default' => '/etc/apache2/sites-enabled/', 'default' => '/etc/apache2/sites-enabled/',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), ),
'system_apacheconf_diroptions' => array( 'system_apacheconf_diroptions' => array(
'label' => $lng['serversettings']['apacheconf_diroptions'], 'label' => $lng['serversettings']['apacheconf_diroptions'],
'settinggroup' => 'system', 'settinggroup' => 'system',
@@ -92,17 +48,33 @@ return array(
'type' => 'string', 'type' => 'string',
'string_type' => 'filedir', 'string_type' => 'filedir',
'default' => '/etc/apache2/sites-enabled/', 'default' => '/etc/apache2/sites-enabled/',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), ),
'system_apacheconf_htpasswddir' => array( 'system_apacheconf_htpasswddir' => array(
'label' => $lng['serversettings']['apacheconf_htpasswddir'], 'label' => $lng['serversettings']['apacheconf_htpasswddir'],
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'apacheconf_htpasswddir', 'varname' => 'apacheconf_htpasswddir',
'type' => 'string', 'type' => 'string',
'string_type' => 'confdir', 'string_type' => 'dir',
'default' => '/etc/apache2/htpasswd/', 'default' => '/etc/apache2/htpasswd/',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), ),
'system_apachereload_command' => array(
'label' => $lng['serversettings']['apachereload_command'],
'settinggroup' => 'system',
'varname' => 'apachereload_command',
'type' => 'string',
'default' => '/etc/init.d/apache2 reload',
'save_method' => 'storeSettingField',
),
'system_mod_log_sql' => array(
'label' => $lng['serversettings']['mod_log_sql'],
'settinggroup' => 'system',
'varname' => 'mod_log_sql',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'system_logfiles_directory' => array( 'system_logfiles_directory' => array(
'label' => $lng['serversettings']['logfiles_directory'], 'label' => $lng['serversettings']['logfiles_directory'],
'settinggroup' => 'system', 'settinggroup' => 'system',
@@ -110,17 +82,8 @@ return array(
'type' => 'string', 'type' => 'string',
'string_type' => 'dir', 'string_type' => 'dir',
'default' => '/var/customers/logs/', 'default' => '/var/customers/logs/',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), ),
'system_customersslpath' => array(
'label' => $lng['serversettings']['customerssl_directory'],
'settinggroup' => 'system',
'varname' => 'customer_ssl_path',
'type' => 'string',
'string_type' => 'confdir',
'default' => '/etc/ssl/froxlor-custom/',
'save_method' => 'storeSettingField'
),
'system_phpappendopenbasedir' => array( 'system_phpappendopenbasedir' => array(
'label' => $lng['serversettings']['phpappendopenbasedir'], 'label' => $lng['serversettings']['phpappendopenbasedir'],
'settinggroup' => 'system', 'settinggroup' => 'system',
@@ -128,8 +91,8 @@ return array(
'type' => 'string', 'type' => 'string',
'string_emptyallowed' => true, 'string_emptyallowed' => true,
'default' => '', 'default' => '',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), ),
'system_deactivateddocroot' => array( 'system_deactivateddocroot' => array(
'label' => $lng['serversettings']['deactivateddocroot'], 'label' => $lng['serversettings']['deactivateddocroot'],
'settinggroup' => 'system', 'settinggroup' => 'system',
@@ -138,141 +101,70 @@ return array(
'string_type' => 'dir', 'string_type' => 'dir',
'string_emptyallowed' => true, 'string_emptyallowed' => true,
'default' => '', 'default' => '',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), ),
'system_default_vhostconf' => array( 'system_default_vhostconf' => array(
'label' => $lng['serversettings']['default_vhostconf'], 'label' => $lng['serversettings']['default_vhostconf'],
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'default_vhostconf', 'varname' => 'default_vhostconf',
'type' => 'text', 'type' => 'text',
'default' => '', 'default' => '',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
),
), ),
'system_apache_globaldiropt' => array( ),
'label' => $lng['serversettings']['apache_globaldiropt'], 'ssl' => array(
'title' => $lng['admin']['sslsettings'],
'fields' => array(
'system_ssl_enabled' => array(
'label' => $lng['serversettings']['ssl']['use_ssl'],
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'apacheglobaldiropt', 'varname' => 'use_ssl',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'system_ssl_cert_file' => array(
'label' => $lng['serversettings']['ssl']['ssl_cert_file'],
'settinggroup' => 'system',
'varname' => 'ssl_cert_file',
'type' => 'string',
'string_type' => 'file',
'string_emptyallowed' => true,
'default' => '/etc/apache2/apache2.pem',
'save_method' => 'storeSettingField',
),
'system_ssl_key_file' => array(
'label' => $lng['serversettings']['ssl']['ssl_key_file'],
'settinggroup' => 'system',
'varname' => 'ssl_key_file',
'type' => 'string',
'string_type' => 'file',
'string_emptyallowed' => true,
'default' => '/etc/apache2/apache2.key',
'save_method' => 'storeSettingField',
),
'system_ssl_ca_file' => array(
'label' => $lng['serversettings']['ssl']['ssl_ca_file'],
'settinggroup' => 'system',
'varname' => 'ssl_ca_file',
'type' => 'string',
'string_type' => 'file',
'string_emptyallowed' => true,
'default' => '',
'save_method' => 'storeSettingField',
),
'system_ssl_openssl_cnf' => array(
'label' => $lng['serversettings']['ssl']['openssl_cnf'],
'settinggroup' => 'system',
'varname' => 'openssl_cnf',
'type' => 'text', 'type' => 'text',
'default' => '', 'default' => '',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'visible' => (Settings::Get('system.mod_fcgid') == 0 && Settings::Get('phpfpm.enabled') == 0), ),
'websrv_avail' => array(
'apache2'
)
), ),
'system_apachereload_command' => array( ),
'label' => $lng['serversettings']['apachereload_command'], ),
'settinggroup' => 'system', );
'varname' => 'apachereload_command',
'type' => 'string', ?>
'default' => '/etc/init.d/apache2 reload',
'save_method' => 'storeSettingField'
),
'system_phpreload_command' => array(
'label' => $lng['serversettings']['phpreload_command'],
'settinggroup' => 'system',
'varname' => 'phpreload_command',
'type' => 'string',
'default' => '',
'save_method' => 'storeSettingField',
'websrv_avail' => array(
'nginx'
)
),
'system_nginx_php_backend' => array(
'label' => $lng['serversettings']['nginx_php_backend'],
'settinggroup' => 'system',
'varname' => 'nginx_php_backend',
'type' => 'string',
'default' => '127.0.0.1:8888',
'save_method' => 'storeSettingField',
'websrv_avail' => array(
'nginx'
)
),
'nginx_fastcgiparams' => array(
'label' => $lng['serversettings']['nginx_fastcgiparams'],
'settinggroup' => 'nginx',
'varname' => 'fastcgiparams',
'type' => 'string',
'string_type' => 'file',
'default' => '/etc/nginx/fastcgi_params',
'save_method' => 'storeSettingField',
'websrv_avail' => array(
'nginx'
)
),
'defaultwebsrverrhandler_enabled' => array(
'label' => $lng['serversettings']['defaultwebsrverrhandler_enabled'],
'settinggroup' => 'defaultwebsrverrhandler',
'varname' => 'enabled',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField'
),
'defaultwebsrverrhandler_err401' => array(
'label' => $lng['serversettings']['defaultwebsrverrhandler_err401'],
'settinggroup' => 'defaultwebsrverrhandler',
'varname' => 'err401',
'type' => 'string',
'default' => '',
'save_method' => 'storeSettingField',
'websrv_avail' => array(
'apache2',
'nginx'
)
),
'defaultwebsrverrhandler_err403' => array(
'label' => $lng['serversettings']['defaultwebsrverrhandler_err403'],
'settinggroup' => 'defaultwebsrverrhandler',
'varname' => 'err403',
'type' => 'string',
'default' => '',
'save_method' => 'storeSettingField',
'websrv_avail' => array(
'apache2',
'nginx'
)
),
'defaultwebsrverrhandler_err404' => array(
'label' => $lng['serversettings']['defaultwebsrverrhandler_err404'],
'settinggroup' => 'defaultwebsrverrhandler',
'varname' => 'err404',
'type' => 'string',
'default' => '',
'save_method' => 'storeSettingField'
),
'defaultwebsrverrhandler_err500' => array(
'label' => $lng['serversettings']['defaultwebsrverrhandler_err500'],
'settinggroup' => 'defaultwebsrverrhandler',
'varname' => 'err500',
'type' => 'string',
'default' => '',
'save_method' => 'storeSettingField',
'websrv_avail' => array(
'apache2',
'nginx'
)
),
'customredirect_enabled' => array(
'label' => $lng['serversettings']['customredirect_enabled'],
'settinggroup' => 'customredirect',
'varname' => 'enabled',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField'
),
'customredirect_default' => array(
'label' => $lng['serversettings']['customredirect_default'],
'settinggroup' => 'customredirect',
'varname' => 'default',
'type' => 'option',
'default' => '1',
'option_mode' => 'one',
'option_options_method' => 'getRedirectCodes',
'save_method' => 'storeSettingField'
)
)
)
)
);

View File

@@ -1,186 +0,0 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2003-2009 the SysCP Team (see authors).
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Florian Lippert <flo@syscp.org> (2003-2009)
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings
*
*/
return array(
'groups' => array(
'ssl' => array(
'title' => $lng['admin']['sslsettings'],
'fields' => array(
'system_ssl_enabled' => array(
'label' => $lng['serversettings']['ssl']['use_ssl'],
'settinggroup' => 'system',
'varname' => 'use_ssl',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'overview_option' => true
),
'system_ssl_cipher_list' => array(
'label' => $lng['serversettings']['ssl']['ssl_cipher_list'],
'settinggroup' => 'system',
'varname' => 'ssl_cipher_list',
'type' => 'string',
'string_emptyallowed' => false,
'default' => 'ECDH+AESGCM:ECDH+AES256:!aNULL:!MD5:!DSS:!DH:!AES128',
'save_method' => 'storeSettingField'
),
'system_ssl_cert_file' => array(
'label' => $lng['serversettings']['ssl']['ssl_cert_file'],
'settinggroup' => 'system',
'varname' => 'ssl_cert_file',
'type' => 'string',
'string_type' => 'file',
'string_emptyallowed' => true,
'default' => '/etc/apache2/apache2.pem',
'save_method' => 'storeSettingField'
),
'system_ssl_key_file' => array(
'label' => $lng['serversettings']['ssl']['ssl_key_file'],
'settinggroup' => 'system',
'varname' => 'ssl_key_file',
'type' => 'string',
'string_type' => 'file',
'string_emptyallowed' => true,
'default' => '/etc/apache2/apache2.key',
'save_method' => 'storeSettingField'
),
'system_ssl_cert_chainfile' => array(
'label' => $lng['admin']['ipsandports']['ssl_cert_chainfile'],
'settinggroup' => 'system',
'varname' => 'ssl_cert_chainfile',
'type' => 'string',
'string_type' => 'file',
'string_emptyallowed' => true,
'default' => '',
'save_method' => 'storeSettingField'
),
'system_ssl_ca_file' => array(
'label' => $lng['serversettings']['ssl']['ssl_ca_file'],
'settinggroup' => 'system',
'varname' => 'ssl_ca_file',
'type' => 'string',
'string_type' => 'file',
'string_emptyallowed' => true,
'default' => '',
'save_method' => 'storeSettingField'
),
'system_leenabled' => array(
'label' => $lng['serversettings']['leenabled'],
'settinggroup' => 'system',
'varname' => 'leenabled',
'type' => 'bool',
'default' => false,
'cronmodule' => 'froxlor/letsencrypt',
'save_method' => 'storeSettingField'
),
'system_letsencryptacmeconf' => array(
'label' => $lng['serversettings']['letsencryptacmeconf'],
'settinggroup' => 'system',
'varname' => 'letsencryptacmeconf',
'type' => 'string',
'string_type' => 'file',
'default' => '/etc/apache2/conf-enabled/acme.conf',
'save_method' => 'storeSettingField',
),
'system_letsencryptca' => array(
'label' => $lng['serversettings']['letsencryptca'],
'settinggroup' => 'system',
'varname' => 'letsencryptca',
'type' => 'option',
'default' => 'testing',
'option_mode' => 'one',
'option_options' => array(
'testing' => 'https://acme-staging.api.letsencrypt.org (Test)',
'production' => 'https://acme-v01.api.letsencrypt.org (Live)'
),
'save_method' => 'storeSettingField'
),
'system_letsencryptcountrycode' => array(
'label' => $lng['serversettings']['letsencryptcountrycode'],
'settinggroup' => 'system',
'varname' => 'letsencryptcountrycode',
'type' => 'string',
'string_emptyallowed' => false,
'default' => 'DE',
'save_method' => 'storeSettingField'
),
'system_letsencryptstate' => array(
'label' => $lng['serversettings']['letsencryptstate'],
'settinggroup' => 'system',
'varname' => 'letsencryptstate',
'type' => 'string',
'string_emptyallowed' => false,
'default' => 'Hessen',
'save_method' => 'storeSettingField'
),
'system_letsencryptchallengepath' => array(
'label' => $lng['serversettings']['letsencryptchallengepath'],
'settinggroup' => 'system',
'varname' => 'letsencryptchallengepath',
'type' => 'string',
'string_emptyallowed' => false,
'default' => FROXLOR_INSTALL_DIR,
'save_method' => 'storeSettingField'
),
'system_letsencryptkeysize' => array(
'label' => $lng['serversettings']['letsencryptkeysize'],
'settinggroup' => 'system',
'varname' => 'letsencryptkeysize',
'type' => 'int',
'int_min' => 2048,
'default' => 4096,
'save_method' => 'storeSettingField'
),
'system_letsencryptreuseold' => array(
'label' => $lng['serversettings']['letsencryptreuseold'],
'settinggroup' => 'system',
'varname' => 'letsencryptreuseold',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField'
),
'system_hsts_maxage' => array(
'label' => $lng['admin']['domain_hsts_maxage'],
'settinggroup' => 'system',
'varname' => 'hsts_maxage',
'type' => 'int',
'int_min' => 0,
'int_max' => 94608000, // 3-years
'default' => 0,
'save_method' => 'storeSettingField'
),
'system_hsts_incsub' => array(
'label' => $lng['admin']['domain_hsts_incsub'],
'settinggroup' => 'system',
'varname' => 'hsts_incsub',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField'
),
'system_hsts_preload' => array(
'label' => $lng['admin']['domain_hsts_preload'],
'settinggroup' => 'system',
'varname' => 'hsts_preload',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField'
),
)
)
)
);

View File

@@ -1,113 +0,0 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings
*
*/
return array(
'groups' => array(
'fcgid' => array(
'title' => $lng['admin']['fcgid_settings'],
'websrv_avail' => array('apache2', 'lighttpd'),
'fields' => array(
'system_mod_fcgid_enabled' => array(
'label' => $lng['serversettings']['mod_fcgid'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'plausibility_check_method' => 'checkFcgidPhpFpm',
'overview_option' => true
),
'system_mod_fcgid_configdir' => array(
'label' => $lng['serversettings']['mod_fcgid']['configdir'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_configdir',
'type' => 'string',
'string_type' => 'confdir',
'default' => '/var/www/php-fcgi-scripts/',
'plausibility_check_method' => 'checkPathConflicts',
'save_method' => 'storeSettingField',
),
'system_mod_fcgid_tmpdir' => array(
'label' => $lng['serversettings']['mod_fcgid']['tmpdir'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_tmpdir',
'type' => 'string',
'string_type' => 'dir',
'default' => '/var/customers/tmp/',
'save_method' => 'storeSettingField',
),
'system_mod_fcgid_peardir' => array(
'label' => $lng['serversettings']['mod_fcgid']['peardir'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_peardir',
'type' => 'string',
'string_type' => 'dir',
'string_delimiter' => ':',
'string_emptyallowed' => true,
'default' => '/usr/share/php/:/usr/share/php5/',
'save_method' => 'storeSettingField',
),
'system_mod_fcgid_wrapper' => array(
'label' => $lng['serversettings']['mod_fcgid']['wrapper'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_wrapper',
'type' => 'option',
'option_options' => array(0 => 'ScriptAlias', 1=> 'FcgidWrapper'),
'default' => 1,
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2')
),
'system_mod_fcgid_starter' => array(
'label' => $lng['serversettings']['mod_fcgid']['starter'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_starter',
'type' => 'int',
'default' => 0,
'save_method' => 'storeSettingField',
),
'system_mod_fcgid_maxrequests' => array(
'label' => $lng['serversettings']['mod_fcgid']['maxrequests'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_maxrequests',
'type' => 'int',
'default' => 250,
'save_method' => 'storeSettingField',
),
'system_mod_fcgid_defaultini' => array(
'label' => $lng['serversettings']['mod_fcgid']['defaultini'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_defaultini',
'type' => 'option',
'default' => '1',
'option_mode' => 'one',
'option_options_method' => 'getPhpConfigs',
'save_method' => 'storeSettingField',
),
'system_mod_fcgid_idle_timeout' => array(
'label' => $lng['serversettings']['mod_fcgid']['idle_timeout'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_idle_timeout',
'type' => 'int',
'default' => 30,
'save_method' => 'storeSettingField'
),
)
)
)
);
?>

View File

@@ -1,166 +0,0 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings
*
*/
return array(
'groups' => array(
'phpfpm' => array(
'title' => $lng['admin']['phpfpm_settings'],
'fields' => array(
'system_phpfpm_enabled' => array(
'label' => $lng['serversettings']['phpfpm'],
'settinggroup' => 'phpfpm',
'varname' => 'enabled',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'plausibility_check_method' => 'checkFcgidPhpFpm',
'overview_option' => true
),
'system_phpfpm_defaultini' => array(
'label' => $lng['serversettings']['mod_fcgid']['defaultini'],
'settinggroup' => 'phpfpm',
'varname' => 'defaultini',
'type' => 'option',
'default' => '1',
'option_mode' => 'one',
'option_options_method' => 'getPhpConfigs',
'save_method' => 'storeSettingField'
),
'system_phpfpm_configdir' => array(
'label' => $lng['serversettings']['phpfpm_settings']['configdir'],
'settinggroup' => 'phpfpm',
'varname' => 'configdir',
'type' => 'string',
'string_type' => 'confdir',
'default' => '/etc/php-fpm.d/',
'save_method' => 'storeSettingField'
),
'system_phpfpm_aliasconfigdir' => array(
'label' => $lng['serversettings']['phpfpm_settings']['aliasconfigdir'],
'settinggroup' => 'phpfpm',
'varname' => 'aliasconfigdir',
'type' => 'string',
'string_type' => 'confdir',
'default' => '/var/www/php-fpm/',
'save_method' => 'storeSettingField'
),
'system_phpfpm_tmpdir' => array(
'label' => $lng['serversettings']['mod_fcgid']['tmpdir'],
'settinggroup' => 'phpfpm',
'varname' => 'tmpdir',
'type' => 'string',
'string_type' => 'dir',
'default' => '/var/customers/tmp/',
'save_method' => 'storeSettingField'
),
'system_phpfpm_peardir' => array(
'label' => $lng['serversettings']['mod_fcgid']['peardir'],
'settinggroup' => 'phpfpm',
'varname' => 'peardir',
'type' => 'string',
'string_type' => 'dir',
'default' => '/usr/share/php/:/usr/share/php5/',
'save_method' => 'storeSettingField'
),
'system_phpfpm_fastcgi_ipcdir' => array(
'label' => $lng['serversettings']['phpfpm_settings']['ipcdir'],
'settinggroup' => 'phpfpm',
'varname' => 'fastcgi_ipcdir',
'type' => 'string',
'string_type' => 'dir',
'default' => '/var/lib/apache2/fastcgi/',
'save_method' => 'storeSettingField'
),
'system_phpfpm_reload' => array(
'label' => $lng['serversettings']['phpfpm_settings']['reload'],
'settinggroup' => 'phpfpm',
'varname' => 'reload',
'type' => 'string',
'default' => '/etc/init.d/php-fpm restart',
'save_method' => 'storeSettingField'
),
'system_phpfpm_pm' => array(
'label' => $lng['serversettings']['phpfpm_settings']['pm'],
'settinggroup' => 'phpfpm',
'varname' => 'pm',
'type' => 'option',
'default' => 'static',
'option_mode' => 'one',
'option_options' => array('static' => 'static', 'dynamic' => 'dynamic', 'ondemand' => 'ondemand'),
'save_method' => 'storeSettingField'
),
'system_phpfpm_max_children' => array(
'label' => $lng['serversettings']['phpfpm_settings']['max_children'],
'settinggroup' => 'phpfpm',
'varname' => 'max_children',
'type' => 'int',
'default' => 1,
'save_method' => 'storeSettingField'
),
'system_phpfpm_start_servers' => array(
'label' => $lng['serversettings']['phpfpm_settings']['start_servers'],
'settinggroup' => 'phpfpm',
'varname' => 'start_servers',
'type' => 'int',
'default' => 20,
'save_method' => 'storeSettingField'
),
'system_phpfpm_min_spare_servers' => array(
'label' => $lng['serversettings']['phpfpm_settings']['min_spare_servers'],
'settinggroup' => 'phpfpm',
'varname' => 'min_spare_servers',
'type' => 'int',
'default' => 5,
'save_method' => 'storeSettingField'
),
'system_phpfpm_max_spare_servers' => array(
'label' => $lng['serversettings']['phpfpm_settings']['max_spare_servers'],
'settinggroup' => 'phpfpm',
'varname' => 'max_spare_servers',
'type' => 'int',
'default' => 35,
'save_method' => 'storeSettingField'
),
'system_phpfpm_max_requests' => array(
'label' => $lng['serversettings']['phpfpm_settings']['max_requests'],
'settinggroup' => 'phpfpm',
'varname' => 'max_requests',
'type' => 'int',
'default' => 0,
'save_method' => 'storeSettingField'
),
'system_phpfpm_idle_timeout' => array(
'label' => $lng['serversettings']['phpfpm_settings']['idle_timeout'],
'settinggroup' => 'phpfpm',
'varname' => 'idle_timeout',
'type' => 'int',
'default' => 30,
'save_method' => 'storeSettingField'
),
'system_phpfpm_use_mod_proxy' => array(
'label' => $lng['phpfpm']['use_mod_proxy'],
'settinggroup' => 'phpfpm',
'varname' => 'use_mod_proxy',
'type' => 'bool',
'default' => false,
'visible' => Settings::Get('system.apache24'),
'save_method' => 'storeSettingField'
),
),
),
),
);

View File

@@ -1,65 +0,0 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings
*
*/
return array(
'groups' => array(
'perl' => array(
'title' => $lng['admin']['perl_settings'],
'fields' => array(
'perl_path' => array(
'label' => $lng['serversettings']['perl_path'],
'settinggroup' => 'system',
'varname' => 'perl_path',
'type' => 'string',
'default' => '/usr/bin/perl',
'save_method' => 'storeSettingField',
'websrv_avail' => array('lighttpd')
),
'system_perl_suexecworkaround' => array(
'label' => $lng['serversettings']['perl']['suexecworkaround'],
'settinggroup' => 'perl',
'varname' => 'suexecworkaround',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2')
),
'system_perl_suexeccgipath' => array(
'label' => $lng['serversettings']['perl']['suexeccgipath'],
'settinggroup' => 'perl',
'varname' => 'suexecpath',
'type' => 'string',
'string_type' => 'dir',
'default' => '/var/www/cgi-bin/',
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2')
),
'perl_server' => array(
'label' => $lng['serversettings']['perl_server'],
'settinggroup' => 'serversettings',
'varname' => 'perl_server',
'type' => 'string',
'default' => 'unix:/var/run/nginx/cgiwrap-dispatch.sock',
'save_method' => 'storeSettingField',
'websrv_avail' => array('nginx')
),
),
),
),
);
?>

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings * @package Settings
* * @version $Id$
*/ */
return array( return array(
@@ -40,45 +40,45 @@ return array(
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'system_awstats_domain_file' => array(
'label' => $lng['serversettings']['awstats_domain_file'],
'settinggroup' => 'system',
'varname' => 'awstats_domain_file',
'type' => 'string',
'string_type' => 'dir',
'default' => '/etc/awstats/',
'save_method' => 'storeSettingField',
),
'system_awstats_model_file' => array(
'label' => $lng['serversettings']['awstats_model_file'],
'settinggroup' => 'system',
'varname' => 'awstats_model_file',
'type' => 'string',
'string_type' => 'file',
'default' => '/etc/awstats/awstats.model.conf.syscp',
'save_method' => 'storeSettingField',
),
'system_awstats_path' => array( 'system_awstats_path' => array(
'label' => $lng['serversettings']['awstats_path'], 'label' => $lng['serversettings']['awstats_path'],
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'awstats_path', 'varname' => 'awstats_path',
'type' => 'string', 'type' => 'string',
'string_type' => 'dir', 'string_type' => 'dir',
'default' => '/usr/bin/', 'default' => '/usr/share/awstats/VERSION/webroot/cgi-bin/',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'system_awstats_awstatspath' => array( 'system_awstats_updateall_command' => array(
'label' => $lng['serversettings']['awstats_awstatspath'], 'label' => $lng['serversettings']['awstats_updateall_command'],
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'awstats_awstatspath', 'varname' => 'awstats_updateall_command',
'type' => 'string', 'type' => 'string',
'string_type' => 'dir', 'string_type' => 'file',
'default' => '/usr/bin/', 'default' => '/usr/bin/awstats_updateall.pl',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'system_awstats_conf' => array( ),
'label' => $lng['serversettings']['awstats_conf'], ),
'settinggroup' => 'system', ),
'varname' => 'awstats_conf',
'type' => 'string',
'string_type' => 'dir',
'default' => '/etc/awstats/',
'save_method' => 'storeSettingField',
),
'system_awstats_icons' => array(
'label' => $lng['serversettings']['awstats_icons'],
'settinggroup' => 'system',
'varname' => 'awstats_icons',
'type' => 'string',
'string_type' => 'dir',
'default' => '/usr/share/awstats/icon/',
'save_method' => 'storeSettingField',
)
)
)
)
); );
?> ?>

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings * @package Settings
* * @version $Id$
*/ */
return array( return array(
@@ -51,16 +51,6 @@ return array(
'default' => '/var/customers/mail/', 'default' => '/var/customers/mail/',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'system_vmail_maildirname' => array(
'label' => $lng['serversettings']['vmail_maildirname'],
'settinggroup' => 'system',
'varname' => 'vmail_maildirname',
'type' => 'string',
'string_type' => 'dir',
'default' => 'Maildir',
'string_emptyallowed' => true,
'save_method' => 'storeSettingField',
),
'panel_sendalternativemail' => array( 'panel_sendalternativemail' => array(
'label' => $lng['serversettings']['sendalternativemail'], 'label' => $lng['serversettings']['sendalternativemail'],
'settinggroup' => 'panel', 'settinggroup' => 'panel',
@@ -85,65 +75,24 @@ return array(
'default' => 100, 'default' => 100,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'system_catchall_enabled' => array( 'systen_autoresponder_enabled' => array(
'label' => $lng['serversettings']['catchall_enabled'], 'label' => $lng['serversettings']['autoresponder_active'],
'settinggroup' => 'catchall', 'settinggroup' => 'autoresponder',
'varname' => 'catchall_enabled', 'varname' => 'autoresponder_active',
'type' => 'bool', 'type' => 'bool',
'default' => true, 'default' => false,
'save_method' => 'storeSettingResetCatchall', 'cronmodule' => 'froxlor/autoresponder',
),
'system_mailtraffic_enabled' => array(
'label' => $lng['serversettings']['mailtraffic_enabled'],
'settinggroup' => 'system',
'varname' => 'mailtraffic_enabled',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'system_mdaserver' => array( 'systen_last_autoresponder_run' => array(
'label' => $lng['serversettings']['mdaserver'], 'settinggroup' => 'autoresponder',
'settinggroup' => 'system', 'varname' => 'last_autoresponder_run',
'varname' => 'mdaserver', 'type' => 'hidden',
'type' => 'option', 'default' => 0,
'option_mode' => 'one',
'default' => 'dovecot',
'option_options' => array('courier' => 'Courier', 'dovecot' => 'Dovecot'),
'save_method' => 'storeSettingField',
),
'system_mdalog' => array(
'label' => $lng['serversettings']['mdalog'],
'settinggroup' => 'system',
'varname' => 'mdalog',
'type' => 'string',
'string_type' => 'file',
'default' => '/var/log/mail.log',
'string_emptyallowed' => true,
'save_method' => 'storeSettingField',
),
'system_mtaserver' => array(
'label' => $lng['serversettings']['mtaserver'],
'settinggroup' => 'system',
'varname' => 'mtaserver',
'type' => 'option',
'option_mode' => 'one',
'default' => 'postfix',
'option_options' => array('exim4' => 'Exim4', 'postfix' => 'Postfix'),
'save_method' => 'storeSettingField',
),
'system_mtalog' => array(
'label' => $lng['serversettings']['mtalog'],
'settinggroup' => 'system',
'varname' => 'mtalog',
'type' => 'string',
'string_type' => 'file',
'default' => '/var/log/mail.log',
'string_emptyallowed' => true,
'save_method' => 'storeSettingField',
), ),
), ),
), ),
), ),
); );
?> ?>

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings * @package Settings
* * @version $Id$
*/ */
return array( return array(
@@ -22,33 +22,6 @@ return array(
'nameserver' => array( 'nameserver' => array(
'title' => $lng['admin']['nameserversettings'], 'title' => $lng['admin']['nameserversettings'],
'fields' => array( 'fields' => array(
'nameserver_enable' => array(
'label' => $lng['serversettings']['bindenable'],
'settinggroup' => 'system',
'varname' => 'bind_enable',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField',
'overview_option' => true
),
'system_dnsenabled' => array(
'label' => $lng['serversettings']['dnseditorenable'],
'settinggroup' => 'system',
'varname' => 'dnsenabled',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField'
),
'system_dns_server' => array(
'label' => $lng['serversettings']['dns_server'],
'settinggroup' => 'system',
'varname' => 'dns_server',
'type' => 'option',
'default' => 'bind',
'option_mode' => 'one',
'option_options' => array('bind' => 'Bind9', 'pdns' => 'PowerDNS'),
'save_method' => 'storeSettingField'
),
'system_bindconf_directory' => array( 'system_bindconf_directory' => array(
'label' => $lng['serversettings']['bindconf_directory'], 'label' => $lng['serversettings']['bindconf_directory'],
'settinggroup' => 'system', 'settinggroup' => 'system',
@@ -86,36 +59,9 @@ return array(
'default' => '', 'default' => '',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'system_axfrservers' => array(
'label' => $lng['serversettings']['axfrservers'],
'settinggroup' => 'system',
'varname' => 'axfrservers',
'type' => 'string',
'string_type' => 'validate_ip_incl_private',
'string_delimiter' => ',',
'string_emptyallowed' => true,
'default' => '',
'save_method' => 'storeSettingField',
),
'system_dns_createmailentry' => array(
'label' => $lng['serversettings']['mail_also_with_mxservers'],
'settinggroup' => 'system',
'varname' => 'dns_createmailentry',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField'
),
'system_defaultttl' => array(
'label' => $lng['serversettings']['defaultttl'],
'settinggroup' => 'system',
'varname' => 'defaultttl',
'type' => 'int',
'default' => 604800, /* 1 week */
'int_min' => 3600, /* 1 hour */
'int_max' => 2147483647, /* integer max */
'save_method' => 'storeSettingField',
),
), ),
), ),
), ),
); );
?>

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings * @package Settings
* * @version $Id$
*/ */
return array( return array(
@@ -29,7 +29,6 @@ return array(
'type' => 'bool', 'type' => 'bool',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'overview_option' => true
), ),
'logger_severity' => array( 'logger_severity' => array(
'label' => $lng['serversettings']['logger']['severity'], 'label' => $lng['serversettings']['logger']['severity'],
@@ -65,14 +64,8 @@ return array(
'label' => $lng['serversettings']['logger']['logcron'], 'label' => $lng['serversettings']['logger']['logcron'],
'settinggroup' => 'logger', 'settinggroup' => 'logger',
'varname' => 'log_cron', 'varname' => 'log_cron',
'type' => 'option', 'type' => 'bool',
'default' => 0, 'default' => false,
'option_mode' => 'one',
'option_options' => array(
0 => $lng['serversettings']['logger']['logcronoption']['never'],
1 => $lng['serversettings']['logger']['logcronoption']['once'],
2 => $lng['serversettings']['logger']['logcronoption']['always']
),
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
), ),
@@ -80,4 +73,4 @@ return array(
) )
); );
?> ?>

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings * @package Settings
* * @version $Id$
*/ */
return array( return array(
@@ -28,15 +28,13 @@ return array(
'varname' => 'use_dkim', 'varname' => 'use_dkim',
'type' => 'bool', 'type' => 'bool',
'default' => false, 'default' => false,
'save_method' => 'storeSettingFieldInsertBindTask', 'save_method' => 'storeSettingField',
'overview_option' => true
), ),
'dkim_prefix' => array( 'dkim_prefix' => array(
'label' => $lng['dkim']['dkim_prefix'], 'label' => $lng['dkim']['dkim_prefix'],
'settinggroup' => 'dkim', 'settinggroup' => 'dkim',
'varname' => 'dkim_prefix', 'varname' => 'dkim_prefix',
'type' => 'string', 'type' => 'string',
'string_type' => 'dir',
'default' => '/etc/postfix/dkim/', 'default' => '/etc/postfix/dkim/',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
@@ -58,66 +56,6 @@ return array(
'default' => 'dkim-keys.conf', 'default' => 'dkim-keys.conf',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'dkim_algorithm' => array(
'label' => $lng['dkim']['dkim_algorithm'],
'settinggroup' => 'dkim',
'varname' => 'dkim_algorithm',
'type' => 'option',
'default' => 'all',
'option_mode' => 'multiple',
'option_options' => array('all' => 'All', 'sha1' => 'SHA1', 'sha256' => 'SHA256'),
'save_method' => 'storeSettingFieldInsertBindTask',
),
'dkim_servicetype' => array(
'label' => $lng['dkim']['dkim_servicetype'],
'settinggroup' => 'dkim',
'varname' => 'dkim_servicetype',
'type' => 'option',
'default' => '0',
'option_mode' => 'one',
'option_options' => array('0' => 'All', '1' => 'E-Mail'),
'save_method' => 'storeSettingFieldInsertBindTask',
),
'dkim_keylength' => array(
'label' => array(
'title' => $lng['dkim']['dkim_keylength']['title'],
'description' => sprintf($lng['dkim']['dkim_keylength']['description'], Settings::Get('dkim.dkim_prefix'))
),
'settinggroup' => 'dkim',
'varname' => 'dkim_keylength',
'type' => 'option',
'default' => '1024',
'option_mode' => 'one',
'option_options' => array('1024' => '1024 Bit', '2048' => '2048 Bit'),
'save_method' => 'storeSettingFieldInsertBindTask',
),
'dkim_notes' => array(
'label' => $lng['dkim']['dkim_notes'],
'settinggroup' => 'dkim',
'varname' => 'dkim_notes',
'type' => 'string',
'string_regexp' => '/^[a-z0-9\._]+$/i',
'default' => '',
'save_method' => 'storeSettingFieldInsertBindTask',
),
'dkim_add_adsp' => array(
'label' => $lng['dkim']['dkim_add_adsp'],
'settinggroup' => 'dkim',
'varname' => 'dkim_add_adsp',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingFieldInsertBindTask',
),
'dkim_add_adsppolicy' => array(
'label' => $lng['dkim']['dkim_add_adsppolicy'],
'settinggroup' => 'dkim',
'varname' => 'dkim_add_adsppolicy',
'type' => 'option',
'default' => '1',
'option_mode' => 'one',
'option_options' => array('0' => 'Unknown', '1' => 'All', '2' => 'Discardable'),
'save_method' => 'storeSettingFieldInsertBindTask',
),
'dkimrestart_command' => array( 'dkimrestart_command' => array(
'label' => $lng['dkim']['dkimrestart_command'], 'label' => $lng['dkim']['dkimrestart_command'],
'settinggroup' => 'dkim', 'settinggroup' => 'dkim',
@@ -131,4 +69,4 @@ return array(
), ),
); );
?> ?>

View File

@@ -12,7 +12,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings * @package Settings
* * @version $Id$
*/ */
return array( return array(
@@ -26,15 +26,14 @@ return array(
'varname' => 'use_spf', 'varname' => 'use_spf',
'type' => 'bool', 'type' => 'bool',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField'
'overview_option' => true
), ),
'spf_entry' => array( 'spf_entry' => array(
'label' => $lng['spf']['spf_entry'], 'label' => $lng['spf']['spf_entry'],
'settinggroup' => 'spf', 'settinggroup' => 'spf',
'varname' => 'spf_entry', 'varname' => 'spf_entry',
'type' => 'string', 'type' => 'string',
'default' => '"v=spf1 a mx -all"', 'default' => '@ IN TXT "v=spf1 a mx -all"',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
) )
) )

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings * @package Settings
* * @version $Id$
*/ */
return array( return array(
@@ -30,7 +30,6 @@ return array(
'default' => false, 'default' => false,
'cronmodule' => 'froxlor/ticket', 'cronmodule' => 'froxlor/ticket',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'overview_option' => true
), ),
'ticket_noreply_email' => array( 'ticket_noreply_email' => array(
'label' => $lng['serversettings']['ticket']['noreply_email'], 'label' => $lng['serversettings']['ticket']['noreply_email'],
@@ -58,7 +57,6 @@ return array(
'option_mode' => 'one', 'option_mode' => 'one',
'option_options' => array(0 => html_entity_decode($lng['admin']['tickets']['daily']), 1 => html_entity_decode($lng['admin']['tickets']['weekly']), 2 => html_entity_decode($lng['admin']['tickets']['monthly']), 3 => html_entity_decode($lng['admin']['tickets']['yearly'])), 'option_options' => array(0 => html_entity_decode($lng['admin']['tickets']['daily']), 1 => html_entity_decode($lng['admin']['tickets']['weekly']), 2 => html_entity_decode($lng['admin']['tickets']['monthly']), 3 => html_entity_decode($lng['admin']['tickets']['yearly'])),
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'plausibility_check_method' => 'setCycleOfCronjob',
), ),
'ticket_concurrently_open' => array( 'ticket_concurrently_open' => array(
'label' => $lng['serversettings']['ticket']['concurrentlyopen'], 'label' => $lng['serversettings']['ticket']['concurrentlyopen'],
@@ -126,19 +124,9 @@ return array(
'type' => 'hidden', 'type' => 'hidden',
'default' => '', 'default' => '',
), ),
'ticket_default_priority' => array(
'label' => $lng['serversettings']['ticket']['default_priority'],
'settinggroup' => 'ticket',
'varname' => 'default_priority',
'type' => 'option',
'default' => 2,
'option_mode' => 'one',
'option_options' => array(1 => $lng['ticket']['high'], 2 => $lng['ticket']['normal'], 3 => $lng['ticket']['low']),
'save_method' => 'storeSettingField',
),
), ),
), ),
) )
); );
?> ?>

View File

@@ -0,0 +1,101 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2003-2009 the SysCP Team (see authors).
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Florian Lippert <flo@syscp.org> (2003-2009)
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings
* @version $Id$
*/
return array(
'groups' => array(
'aps' => array(
'title' => $lng['admin']['aps'],
'fields' => array(
'aps_enable' => array(
'label' => $lng['aps']['activate_aps'],
'settinggroup' => 'aps',
'varname' => 'aps_active',
'type' => 'bool',
'default' => false,
'cronmodule' => 'froxlor/aps',
'save_method' => 'storeSettingField',
),
'aps_items_per_page' => array(
'label' => $lng['aps']['packages_per_page'],
'settinggroup' => 'aps',
'varname' => 'items_per_page',
'type' => 'int',
'default' => 20,
'save_method' => 'storeSettingField',
),
'aps_upload_fields' => array(
'label' => $lng['aps']['upload_fields'],
'settinggroup' => 'aps',
'varname' => 'upload_fields',
'type' => 'int',
'default' => 5,
'save_method' => 'storeSettingField',
),
'aps_exceptions' => array(
'label' => $lng['aps']['exceptions'],
'type' => 'label',
),
'aps_php-extension' => array(
'label' => $lng['aps']['settings_php_extensions'],
'settinggroup' => 'aps',
'varname' => 'php-extension',
'type' => 'option',
'default' => '',
'option_mode' => 'multiple',
'option_options' => array('gd' => 'GD Library', 'pcre' => 'PCRE', 'ioncube' => 'ionCube', 'ioncube loader' => 'ionCube Loader', 'curl' => 'curl', 'mcrypt' => 'mcrypt', 'imap' => 'imap'),
'save_method' => 'storeSettingApsPhpExtensions',
),
'aps_php-function' => array(
'settinggroup' => 'aps',
'varname' => 'php-function',
'type' => 'hidden',
'default' => '',
),
'aps_php-configuration' => array(
'label' => $lng['aps']['settings_php_configuration'],
'settinggroup' => 'aps',
'varname' => 'php-configuration',
'type' => 'option',
'default' => '',
'option_mode' => 'multiple',
'option_options' => array('short_open_tag' => 'short_open_tag', 'file_uploads' => 'file_uploads', 'magic_quotes_gpc' => 'magic_quotes_gpc', 'register_globals' => 'register_globals', 'allow_url_fopen' => 'allow_url_fopen', 'safe_mode' => 'safe_mode', 'post_max_size' => 'post_max_size', 'memory_limit' => 'memory_limit', 'max_execution_time' => 'max_execution_time'),
'save_method' => 'storeSettingField',
),
'aps_webserver-module' => array(
'label' => $lng['aps']['settings_webserver_modules'],
'settinggroup' => 'aps',
'varname' => 'webserver-module',
'type' => 'option',
'default' => '',
'option_mode' => 'multiple',
'option_options' => array('mod_perl' => 'mod_perl', 'mod_rewrite' => 'mod_rewrite', 'mod_access' => 'mod_access', 'fcgid-any' => 'FastCGI/mod_fcgid', 'htaccess' => '.htaccess'),
'save_method' => 'storeSettingApsWebserverModules',
),
'aps_webserver-htaccess' => array(
'settinggroup' => 'aps',
'varname' => 'webserver-htaccess',
'type' => 'hidden',
'default' => '',
),
),
),
),
);
?>

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings * @package Settings
* * @version $Id$
*/ */
return array( return array(
@@ -38,50 +38,71 @@ return array(
'default' => true, 'default' => true,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'system_passwordcryptfunc' => array( 'system_mod_fcgid_enabled' => array(
'label' => $lng['serversettings']['passwordcryptfunc'], 'label' => $lng['serversettings']['mod_fcgid'],
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'passwordcryptfunc', 'varname' => 'mod_fcgid',
'type' => 'option',
'default' => 0,
'option_mode' => 'one',
'option_options_method' => 'getAvailablePasswordHashes',
'save_method' => 'storeSettingField',
),
'system_allow_error_report_admin' => array(
'label' => $lng['serversettings']['allow_error_report_admin'],
'settinggroup' => 'system',
'varname' => 'allow_error_report_admin',
'type' => 'bool', 'type' => 'bool',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'system_allow_error_report_customer' => array( 'system_mod_fcgid_configdir' => array(
'label' => $lng['serversettings']['allow_error_report_customer'], 'label' => $lng['serversettings']['mod_fcgid']['configdir'],
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'allow_error_report_customer', 'varname' => 'mod_fcgid_configdir',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'system_allow_customer_shell' => array(
'label' => $lng['serversettings']['allow_allow_customer_shell'],
'settinggroup' => 'system',
'varname' => 'allow_customer_shell',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'system_available_shells' => array(
'label' => $lng['serversettings']['available_shells'],
'settinggroup' => 'system',
'varname' => 'available_shells',
'type' => 'string', 'type' => 'string',
'string_emptyallowed' => true, 'string_type' => 'dir',
'default' => '', 'default' => '/var/www/php-fcgi-scripts/',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
) ),
) 'system_mod_fcgid_tmpdir' => array(
) 'label' => $lng['serversettings']['mod_fcgid']['tmpdir'],
) 'settinggroup' => 'system',
'varname' => 'mod_fcgid_tmpdir',
'type' => 'string',
'string_type' => 'dir',
'default' => '/var/customers/tmp/',
'save_method' => 'storeSettingField',
),
'system_mod_fcgid_peardir' => array(
'label' => $lng['serversettings']['mod_fcgid']['peardir'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_peardir',
'type' => 'string',
'string_type' => 'dir',
'string_delimiter' => ':',
'string_emptyallowed' => true,
'default' => '/usr/share/php/:/usr/share/php5/',
'save_method' => 'storeSettingField',
),
'system_mod_fcgid_wrapper' => array(
'label' => $lng['serversettings']['mod_fcgid']['wrapper'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_wrapper',
'type' => 'option',
'option_options' => array(0 => 'ScriptAlias', 1=> 'FCGIWrapper'),
'default' => 0,
'save_method' => 'storeSettingField',
),
'system_mod_fcgid_starter' => array(
'label' => $lng['serversettings']['mod_fcgid']['starter'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_starter',
'type' => 'int',
'default' => 0,
'save_method' => 'storeSettingField',
),
'system_mod_fcgid_maxrequests' => array(
'label' => $lng['serversettings']['mod_fcgid']['maxrequests'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_maxrequests',
'type' => 'int',
'default' => 250,
'save_method' => 'storeSettingField',
),
),
),
),
); );
?>

View File

@@ -1,60 +0,0 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2011- the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2011-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings
*
*/
return array(
'groups' => array(
'diskquota' => array(
'title' => $lng['diskquota'],
'fields' => array(
'diskquota_enabled' => array(
'label' => $lng['serversettings']['diskquota_enabled'],
'settinggroup' => 'system',
'varname' => 'diskquota_enabled',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'overview_option' => true
),
'diskquota_repquota_path' => array(
'label' => $lng['serversettings']['diskquota_repquota_path']['description'],
'settinggroup' => 'system',
'varname' => 'diskquota_repquota_path',
'type' => 'string',
'default' => '/usr/sbin/repquota',
'save_method' => 'storeSettingField',
),
'diskquota_quotatool_path' => array(
'label' => $lng['serversettings']['diskquota_quotatool_path']['description'],
'settinggroup' => 'system',
'varname' => 'diskquota_quotatool_path',
'type' => 'string',
'default' => '/usr/bin/quotatool',
'save_method' => 'storeSettingField',
),
'diskquota_customer_partition' => array(
'label' => $lng['serversettings']['diskquota_customer_partition']['description'],
'settinggroup' => 'system',
'varname' => 'diskquota_customer_partition',
'type' => 'string',
'default' => '/dev/root',
'save_method' => 'storeSettingField',
),
),
),
),
);
?>

File diff suppressed because it is too large Load Diff

View File

@@ -1,415 +0,0 @@
<?php
/*
+----------------------------------------------------------------------+
| APC |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2011 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Ralf Becker <beckerr@php.net> |
| Rasmus Lerdorf <rasmus@php.net> |
| Ilia Alshanetsky <ilia@prohost.org> |
+----------------------------------------------------------------------+
All other licensing and usage conditions are those of the PHP Group.
Based on https://github.com/krakjoe/apcu/blob/master/apc.php
Implemented into Froxlor: Janos Muzsi <muzsij@hypernics.hu>
*/
define('AREA', 'admin');
require './lib/init.php';
$horizontal_bar_size = 950; // 1280px window width
if ($action == 'delete' &&
function_exists('apcu_clear_cache') &&
$userinfo['change_serversettings'] == '1'
) {
apcu_clear_cache();
$log->logAction(ADM_ACTION, LOG_INFO, "cleared APCu cache");
header('Location: ' . $linker->getLink(array('section' => 'apcuinfo', 'page' => 'showinfo')));
exit();
}
if (!function_exists('apcu_cache_info') ||
!function_exists('apcu_sma_info')
) {
standard_error($lng['error']['no_apcuinfo']);
}
if ($page == 'showinfo'
) {
$cache = apcu_cache_info();
$mem = apcu_sma_info();
$time = time();
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_apcuinfo");
$passtime = $time - $cache['start_time'] > 0 ? $time - $cache['start_time'] : 1; // zero division
$mem_size = $mem['num_seg'] * $mem['seg_size'];
$mem_avail = $mem['avail_mem'];
$mem_used = $mem_size - $mem_avail;
$seg_size = bsize($mem['seg_size']);
$sharedmem = sprintf($lng['apcuinfo']['sharedmemval'], $mem['num_seg'], $seg_size, $cache['memory_type']);
$req_rate_user = sprintf("%.2f", $cache['num_hits'] ? (($cache['num_hits'] + $cache['num_misses']) / $passtime) : 0);
$hit_rate_user = sprintf("%.2f", $cache['num_hits'] ? (($cache['num_hits']) / $passtime) : 0);
$miss_rate_user = sprintf("%.2f", $cache['num_misses'] ? (($cache['num_misses']) / $passtime) : 0);
$insert_rate_user = sprintf("%.2f", $cache['num_inserts'] ? (($cache['num_inserts']) / $passtime) : 0);
$apcversion = phpversion('apcu');
$phpversion = phpversion();
$number_vars = $cache['num_entries'];
$starttime = date('Y-m-d H:i:s', $cache['start_time']);
$uptime_duration = duration($cache['start_time']);
$size_vars = bsize($cache['mem_size']);
// check for possible empty values that are used in the templates
if (!isset($cache['file_upload_progress'])) {
$cache['file_upload_progress'] = $lng['logger']['unknown'];
}
if (!isset($cache['num_expunges'])) {
$cache['num_expunges'] = $lng['logger']['unknown'];
}
$runtimelines = '';
foreach (ini_get_all('apcu') as $name => $v) {
$value = $v['local_value'];
eval("\$runtimelines.=\"" . getTemplate("settings/apcuinfo/runtime_line") . "\";");
}
$freemem = bsize($mem_avail) . sprintf(" (%.1f%%)", $mem_avail * 100 / $mem_size);
$usedmem = bsize($mem_used) . sprintf(" (%.1f%%)", $mem_used * 100 / $mem_size);
$hits = $cache['num_hits'] . @sprintf(" (%.1f%%)", $cache['num_hits'] * 100 / ($cache['num_hits'] + $cache['num_misses']));
$misses = $cache['num_misses'] . @sprintf(" (%.1f%%)", $cache['num_misses'] * 100 / ($cache['num_hits'] + $cache['num_misses']));
// Fragementation: (freeseg - 1) / total_seg
$nseg = $freeseg = $fragsize = $freetotal = 0;
for ($i = 0; $i < $mem['num_seg']; $i++) {
$ptr = 0;
foreach ($mem['block_lists'][$i] as $block) {
if ($block['offset'] != $ptr) {
++$nseg;
}
$ptr = $block['offset'] + $block['size'];
/* Only consider blocks <5M for the fragmentation % */
if ($block['size'] < (5 * 1024 * 1024))
$fragsize+=$block['size'];
$freetotal+=$block['size'];
}
$freeseg += count($mem['block_lists'][$i]);
}
if ($freeseg > 1) {
$frag = sprintf("%.2f%% (%s out of %s in %d fragments)", ($fragsize / $freetotal) * 100, bsize($fragsize), bsize($freetotal), $freeseg);
} else {
$frag = "0%";
}
foreach (ini_get_all('apcu') as $name => $v) {
$value = $v['local_value'];
}
$img_src1 = '';
$img_src2 = '';
$img_src3 = '';
if (graphics_avail()) {
$img_src = $linker->getLink(array('section' => 'apcuinfo', 'page' => 'img1', 'action' => mt_rand(0, 1000000)));
eval("\$img_src1=\"" . getTemplate("settings/apcuinfo/img_line") . "\";");
$img_src = $linker->getLink(array('section' => 'apcuinfo', 'page' => 'img2', 'action' => mt_rand(0, 1000000)));
eval("\$img_src2=\"" . getTemplate("settings/apcuinfo/img_line") . "\";");
$img_src = $linker->getLink(array('section' => 'apcuinfo', 'page' => 'img3', 'action' => mt_rand(0, 1000000)));
eval("\$img_src3=\"" . getTemplate("settings/apcuinfo/img_line") . "\";");
}
eval("echo \"" . getTemplate("settings/apcuinfo/showinfo") . "\";");
} elseif ($page == 'img1'
) {
$mem = apcu_sma_info();
$size = 460;
$image = imagecreate($size + 5, $size + 5);
$col_white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
$col_red = imagecolorallocate($image, 0xD0, 0x60, 0x30);
$col_green = imagecolorallocate($image, 0x60, 0xF0, 0x60);
$col_black = imagecolorallocate($image, 0, 0, 0);
imagecolortransparent($image, $col_white);
$s = $mem['num_seg'] * $mem['seg_size'];
$a = $mem['avail_mem'];
$x = $y = $size / 2;
$fuzz = 0.000001;
// This block of code creates the pie chart. It is a lot more complex than you
// would expect because we try to visualize any memory fragmentation as well.
$angle_from = 0;
$string_placement = array();
for ($i = 0; $i < $mem['num_seg']; $i++) {
$ptr = 0;
$free = $mem['block_lists'][$i];
uasort($free, 'block_sort');
foreach ($free as $block) {
if ($block['offset'] != $ptr) { // Used block
$angle_to = $angle_from + ($block['offset'] - $ptr) / $s;
if (($angle_to + $fuzz) > 1)
$angle_to = 1;
if (($angle_to * 360) - ($angle_from * 360) >= 1) {
fill_arc($image, $x, $y, $size, $angle_from * 360, $angle_to * 360, $col_black, $col_red);
if (($angle_to - $angle_from) > 0.05) {
array_push($string_placement, array($angle_from, $angle_to));
}
}
$angle_from = $angle_to;
}
$angle_to = $angle_from + ($block['size']) / $s;
if (($angle_to + $fuzz) > 1)
$angle_to = 1;
if (($angle_to * 360) - ($angle_from * 360) >= 1) {
fill_arc($image, $x, $y, $size, $angle_from * 360, $angle_to * 360, $col_black, $col_green);
if (($angle_to - $angle_from) > 0.05) {
array_push($string_placement, array($angle_from, $angle_to));
}
}
$angle_from = $angle_to;
$ptr = $block['offset'] + $block['size'];
}
if ($ptr < $mem['seg_size']) { // memory at the end
$angle_to = $angle_from + ($mem['seg_size'] - $ptr) / $s;
if (($angle_to + $fuzz) > 1)
$angle_to = 1;
fill_arc($image, $x, $y, $size, $angle_from * 360, $angle_to * 360, $col_black, $col_red);
if (($angle_to - $angle_from) > 0.05) {
array_push($string_placement, array($angle_from, $angle_to));
}
}
}
foreach ($string_placement as $angle) {
text_arc($image, $x, $y, $size, $angle[0] * 360, $angle[1] * 360, $col_black, bsize($s * ($angle[1] - $angle[0])));
}
header("Content-type: image/png");
imagepng($image);
exit;
} elseif ($page == 'img2'
) {
$cache = apcu_cache_info();
$size = $horizontal_bar_size;
$image = imagecreate($size + 5, 140);
$col_white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
$col_red = imagecolorallocate($image, 0xD0, 0x60, 0x30);
$col_green = imagecolorallocate($image, 0x60, 0xF0, 0x60);
$col_black = imagecolorallocate($image, 0, 0, 0);
imagecolortransparent($image, $col_white);
$s = $cache['num_hits'] + $cache['num_misses'];
$a = $cache['num_hits'];
fill_box($image, 1, 10, $s ? ($a * ($size - 21) / $s) : $size, 50, $col_black, $col_green/* , sprintf("%.1f%%", $s ? $cache['num_hits'] * 100 / $s : 0) */);
fill_box($image, 1, 80, $s ? max(4, ($s - $a) * ($size - 21) / $s) : $size, 50, $col_black, $col_red/* , sprintf("%.1f%%", $s ? $cache['num_misses'] * 100 / $s : 0) */);
header("Content-type: image/png");
imagepng($image);
exit;
} elseif ($page == 'img3'
) {
$mem = apcu_sma_info();
$size = $horizontal_bar_size;
$image = imagecreate($size, 70);
$col_white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
$col_red = imagecolorallocate($image, 0xD0, 0x60, 0x30);
$col_green = imagecolorallocate($image, 0x60, 0xF0, 0x60);
$col_black = imagecolorallocate($image, 0, 0, 0);
imagecolortransparent($image, $col_white);
$s = $mem['num_seg'] * $mem['seg_size'];
$a = $mem['avail_mem'];
$x = 10;
$y = 0;
// This block of code creates the bar chart. It is a lot more complex than you
// would expect because we try to visualize any memory fragmentation as well.
for ($i = 0; $i < $mem['num_seg']; $i++) {
$ptr = 0;
$free = $mem['block_lists'][$i];
uasort($free, 'block_sort');
foreach ($free as $block) {
if ($block['offset'] != $ptr) { // Used block
$h = ($size - 5) * ($block['offset'] - $ptr) / $s;
if ($h > 0) {
fill_box($image, $y, $x, $h, 50, $col_black, $col_red);
}
$y+=$h;
}
$h = ($size - 5) * ($block['size']) / $s;
if ($h > 0) {
fill_box($image, $y, $x, $h, 50, $col_black, $col_green);
}
$y+=$h;
$ptr = $block['offset'] + $block['size'];
}
if ($ptr < $mem['seg_size']) { // memory at the end
$h = ($size - 5) * ($mem['seg_size'] - $ptr) / $s;
if ($h > 0) {
fill_box($image, $y, $x, $h, 50, $col_black, $col_red, bsize($mem['seg_size'] - $ptr), $j++);
}
}
}
header("Content-type: image/png");
imagepng($image);
exit;
}
function graphics_avail() {
return extension_loaded('gd');
}
// pretty printer for byte values
//
function bsize($s) {
foreach (array('', 'K', 'M', 'G') as $i => $k) {
if ($s < 1024)
break;
$s/=1024;
}
return sprintf("%5.1f %sBytes", $s, $k);
}
function duration($ts) {
global $time;
$years = (int) ((($time - $ts) / (7 * 86400)) / 52.177457);
$rem = (int) (($time - $ts) - ($years * 52.177457 * 7 * 86400));
$weeks = (int) (($rem) / (7 * 86400));
$days = (int) (($rem) / 86400) - $weeks * 7;
$hours = (int) (($rem) / 3600) - $days * 24 - $weeks * 7 * 24;
$mins = (int) (($rem) / 60) - $hours * 60 - $days * 24 * 60 - $weeks * 7 * 24 * 60;
$str = '';
if ($years == 1)
$str .= "$years year, ";
if ($years > 1)
$str .= "$years years, ";
if ($weeks == 1)
$str .= "$weeks week, ";
if ($weeks > 1)
$str .= "$weeks weeks, ";
if ($days == 1)
$str .= "$days day,";
if ($days > 1)
$str .= "$days days,";
if ($hours == 1)
$str .= " $hours hour and";
if ($hours > 1)
$str .= " $hours hours and";
if ($mins == 1)
$str .= " 1 minute";
else
$str .= " $mins minutes";
return $str;
}
function block_sort($array1, $array2) {
if ($array1['offset'] > $array2['offset']) {
return 1;
} else {
return -1;
}
}
function fill_arc($im, $centerX, $centerY, $diameter, $start, $end, $color1, $color2, $text = '', $placeindex = 0) {
$r = $diameter / 2;
$w = deg2rad((360 + $start + ($end - $start) / 2) % 360);
if (function_exists("imagefilledarc")) {
// exists only if GD 2.0.1 is available
imagefilledarc($im, $centerX + 1, $centerY + 1, $diameter, $diameter, $start, $end, $color1, IMG_ARC_PIE);
imagefilledarc($im, $centerX, $centerY, $diameter, $diameter, $start, $end, $color2, IMG_ARC_PIE);
imagefilledarc($im, $centerX, $centerY, $diameter, $diameter, $start, $end, $color1, IMG_ARC_NOFILL | IMG_ARC_EDGED);
} else {
imagearc($im, $centerX, $centerY, $diameter, $diameter, $start, $end, $color2);
imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($start)) * $r, $centerY + sin(deg2rad($start)) * $r, $color2);
imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($start + 1)) * $r, $centerY + sin(deg2rad($start)) * $r, $color2);
imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($end - 1)) * $r, $centerY + sin(deg2rad($end)) * $r, $color2);
imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($end)) * $r, $centerY + sin(deg2rad($end)) * $r, $color2);
imagefill($im, $centerX + $r * cos($w) / 2, $centerY + $r * sin($w) / 2, $color2);
}
if ($text) {
if ($placeindex > 0) {
imageline($im, $centerX + $r * cos($w) / 2, $centerY + $r * sin($w) / 2, $diameter, $placeindex * 12, $color1);
imagestring($im, 4, $diameter, $placeindex * 12, $text, $color1);
} else {
imagestring($im, 4, $centerX + $r * cos($w) / 2, $centerY + $r * sin($w) / 2, $text, $color1);
}
}
}
function text_arc($im, $centerX, $centerY, $diameter, $start, $end, $color1, $text, $placeindex = 0) {
$r = $diameter / 2;
$w = deg2rad((360 + $start + ($end - $start) / 2) % 360);
if ($placeindex > 0) {
imageline($im, $centerX + $r * cos($w) / 2, $centerY + $r * sin($w) / 2, $diameter, $placeindex * 12, $color1);
imagestring($im, 4, $diameter, $placeindex * 12, $text, $color1);
} else {
imagestring($im, 4, $centerX + $r * cos($w) / 2, $centerY + $r * sin($w) / 2, $text, $color1);
}
}
function fill_box($im, $x, $y, $w, $h, $color1, $color2, $text = '', $placeindex = '') {
global $col_black;
$x1 = $x + $w - 1;
$y1 = $y + $h - 1;
imagerectangle($im, $x, $y1, $x1 + 1, $y + 1, $col_black);
if ($y1 > $y)
imagefilledrectangle($im, $x, $y, $x1, $y1, $color2);
else
imagefilledrectangle($im, $x, $y1, $x1, $y, $color2);
imagerectangle($im, $x, $y1, $x1, $y, $color1);
if ($text) {
if ($placeindex > 0) {
if ($placeindex < 16) {
$px = 5;
$py = $placeindex * 12 + 6;
imagefilledrectangle($im, $px + 90, $py + 3, $px + 90 - 4, $py - 3, $color2);
imageline($im, $x, $y + $h / 2, $px + 90, $py, $color2);
imagestring($im, 2, $px, $py - 6, $text, $color1);
} else {
if ($placeindex < 31) {
$px = $x + 40 * 2;
$py = ($placeindex - 15) * 12 + 6;
} else {
$px = $x + 40 * 2 + 100 * intval(($placeindex - 15) / 15);
$py = ($placeindex % 15) * 12 + 6;
}
imagefilledrectangle($im, $px, $py + 3, $px - 4, $py - 3, $color2);
imageline($im, $x + $w, $y + $h / 2, $px, $py, $color2);
imagestring($im, 2, $px + 2, $py - 6, $text, $color1);
}
} else {
imagestring($im, 4, $x + 5, $y1 - 16, $text, $color1);
}
}
}

34
admin_aps.php Normal file
View File

@@ -0,0 +1,34 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2003-2009 the SysCP Team (see authors).
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Florian Lippert <flo@syscp.org> (2003-2009)
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel
* @version $Id$
*/
// Required code
define('AREA', 'admin');
require ("./lib/init.php");
$Id = 0;
if(isset($_GET['id']))$Id = (int)$_GET['id'];
if(isset($_POST['id']))$Id = (int)$_POST['id'];
eval("echo \"" . getTemplate("aps/header") . "\";");
$Aps = new ApsParser($userinfo, $settings, $db);
$Aps->MainHandler($action);
eval("echo \"" . getTemplate("aps/footer") . "\";");
?>

View File

@@ -1,209 +0,0 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2016 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Michael Kaufmann <mkaufmann@nutime.de>
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Frontend
*
* @since 0.9.35
*
*/
define('AREA', 'admin');
require './lib/init.php';
// define update-uri
define('UPDATE_URI', "https://version.froxlor.org/Froxlor/legacy/" . $version);
define('RELEASE_URI', "https://autoupdate.froxlor.org/froxlor-{version}.zip");
define('CHECKSUM_URI', "https://autoupdate.froxlor.org/froxlor-{version}.zip.sha256");
// check for allow_url_fopen
if (ini_get('allow_url_fopen') === false) {
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 1));
}
// check for archive-stuff
if (! extension_loaded('zip')) {
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 2));
}
// display initial version check
if ($page == 'overview') {
// log our actions
$log->logAction(ADM_ACTION, LOG_NOTICE, "checking auto-update");
// check for new version
$latestversion = @file(UPDATE_URI);
if (isset($latestversion[0])) {
$latestversion = explode('|', $latestversion[0]);
if (is_array($latestversion)
&& count($latestversion) >= 1
) {
$_version = $latestversion[0];
$_message = isset($latestversion[1]) ? $latestversion[1] : '';
$_link = isset($latestversion[2]) ? $latestversion[2] : htmlspecialchars($filename . '?s=' . urlencode($s) . '&page=' . urlencode($page) . '&lookfornewversion=yes');
// add the branding so debian guys are not gettings confused
// about their version-number
$version_label = $_version.$branding;
$version_link = $_link;
$message_addinfo = $_message;
// not numeric -> error-message
if (!preg_match('/^((\d+\\.)(\d+\\.)(\d+\\.)?(\d+)?(\-(svn|dev|rc)(\d+))?)$/', $_version)) {
// check for customized version to not output
// "There is a newer version of froxlor" besides the error-message
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 3));
} elseif (version_compare2($version, $_version) == -1) {
// there is a newer version - yay
$isnewerversion = 1;
} else {
// nothing new
$isnewerversion = 0;
}
// anzeige über version-status mit ggfls. formular
// zum update schritt #1 -> download
if ($isnewerversion == 1) {
$text = 'There is a newer version available. Update to version <b>'.$_version.'</b> now?<br/>(Your current version is: '.$version.')';
$hiddenparams = '<input type="hidden" name="newversion" value="'.$_version.'" />';
$yesfile = $filename.'?s='.$s.'&amp;page=getdownload';
eval("echo \"" . getTemplate("misc/question_yesno", true) . "\";");
exit;
}
elseif ($isnewerversion == 0) {
// all good
standard_success ('noupdatesavail');
} else {
standard_error ('customized_version');
}
}
}
// error (something weird came from version.froxlor.org)
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 5));
}
// download the new archive
elseif ($page == 'getdownload') {
// retrieve the new version from the form
$newversion = isset($_POST['newversion']) ? $_POST['newversion'] : null;
// valid?
if ($newversion !== null) {
// define files to get
$toLoad = str_replace('{version}', $newversion, RELEASE_URI);
$toCheck = str_replace('{version}', $newversion, CHECKSUM_URI);
// get archive data
$newArchive = @file_get_contents($toLoad);
// check for local destination folder
if (!is_dir(FROXLOR_INSTALL_DIR.'/updates/')) {
mkdir(FROXLOR_INSTALL_DIR.'/updates/');
}
// name archive
$localArchive = FROXLOR_INSTALL_DIR.'/updates/'.basename($toLoad);
$log->logAction(ADM_ACTION, LOG_NOTICE, "Downloading ".$toLoad." to ".$localArchive);
// remove old archive
if (file_exists($localArchive)) {
@unlink($localArchive);
}
// store archive
$fh = fopen($localArchive, 'w');
if (!fwrite($fh, $newArchive)) {
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 4));
}
// close file-handle
fclose($fh);
// validate the integrity of the downloaded file
$_shouldsum = @file_get_contents($toCheck);
if (!empty($_shouldsum)) {
$_t = explode(" ", $_shouldsum);
$shouldsum = $_t[0];
} else {
$shouldsum = null;
}
$filesum = hash_file('sha256', $localArchive);
if ($filesum != $shouldsum) {
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 9));
}
// to the next step
redirectTo($filename, array('s' => $s, 'page' => 'extract', 'archive' => basename($localArchive)));
}
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 6));
}
// extract and install new version
elseif ($page == 'extract') {
$toExtract = isset($_GET['archive']) ? $_GET['archive'] : null;
$localArchive = FROXLOR_INSTALL_DIR.'/updates/'.$toExtract;
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
// decompress from zip
$zip = new ZipArchive;
$res = $zip->open($localArchive);
if ($res === true) {
$log->logAction(ADM_ACTION, LOG_NOTICE, "Extracting ".$localArchive." to ".FROXLOR_INSTALL_DIR);
$zip->extractTo(FROXLOR_INSTALL_DIR);
$zip->close();
// success - remove unused archive
@unlink($localArchive);
} else {
// error
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 8));
}
// redirect to update-page?
redirectTo('admin_updates.php', array('s' => $s));
}
if (!file_exists($localArchive)) {
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 7));
}
$text = 'Extract downloaded archive "'.$toExtract.'"?';
$hiddenparams = '';
$yesfile = $filename.'?s='.$s.'&amp;page=extract&amp;archive='.$toExtract;
eval("echo \"" . getTemplate("misc/question_yesno", true) . "\";");
}
// display error
elseif ($page == 'error') {
// retrieve error-number via url-parameter
$errno = isset($_GET['errno']) ? (int)$_GET['errno'] : 0;
// 1 = no allow_url_fopen
// 2 = no Zlib
// 3 = custom version detected
// 4 = could not store archive to local hdd
// 5 = some weird value came from version.froxlor.org
// 6 = download without valid version
// 7 = local archive does not exist
// 8 = could not extract archive
// 9 = checksum mismatch
standard_error ('autoupdate_'.$errno);
}

View File

@@ -2,6 +2,7 @@
/** /**
* This file is part of the Froxlor project. * This file is part of the Froxlor project.
* Copyright (c) 2003-2009 the SysCP Team (see authors).
* Copyright (c) 2010 the Froxlor Team (see authors). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * For the full copyright and license information, please view the COPYING
@@ -9,219 +10,172 @@
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * COPYING file online at http://files.froxlor.org/misc/COPYING.txt
* *
* @copyright (c) the authors * @copyright (c) the authors
* @author Florian Lippert <flo@syscp.org> (2003-2009)
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
* @since 0.9.34
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
require './lib/init.php';
if ($userinfo['change_serversettings'] == '1') { /**
* Include our init.php, which manages Sessions, Language etc.
*/
$customer_tmpdir = '/tmp/'; $need_db_sql_data = true;
if (Settings::Get('system.mod_fcgid') == '1' && Settings::Get('system.mod_fcgid_tmpdir') != '') require ("./lib/init.php");
require ("./lib/configfiles_index.inc.php");
$distribution = '';
$distributions_select = '';
$service = '';
$services_select = '';
$daemon = '';
$daemons_select = '';
if($userinfo['change_serversettings'] == '1')
{
if(isset($_GET['distribution'])
&& $_GET['distribution'] != ''
&& isset($configfiles[$_GET['distribution']])
&& is_array($configfiles[$_GET['distribution']]))
{ {
$customer_tmpdir = Settings::Get('system.mod_fcgid_tmpdir'); $distribution = $_GET['distribution'];
}
elseif (Settings::Get('phpfpm.enabled') == '1' && Settings::Get('phpfpm.tmpdir') != '')
{
$customer_tmpdir = Settings::Get('phpfpm.tmpdir');
}
$replace_arr = Array( if(isset($_GET['service'])
'<SQL_UNPRIVILEGED_USER>' => $sql['user'], && $_GET['service'] != ''
'<SQL_UNPRIVILEGED_PASSWORD>' => 'MYSQL_PASSWORD', && isset($configfiles[$distribution]['services'][$_GET['service']])
'<SQL_DB>' => $sql['db'], && is_array($configfiles[$distribution]['services'][$_GET['service']]))
'<SQL_HOST>' => $sql['host'], {
'<SQL_SOCKET>' => isset($sql['socket']) ? $sql['socket'] : null, $service = $_GET['service'];
'<SERVERNAME>' => Settings::Get('system.hostname'),
'<SERVERIP>' => Settings::Get('system.ipaddress'),
'<NAMESERVERS>' => Settings::Get('system.nameservers'),
'<VIRTUAL_MAILBOX_BASE>' => Settings::Get('system.vmail_homedir'),
'<VIRTUAL_UID_MAPS>' => Settings::Get('system.vmail_uid'),
'<VIRTUAL_GID_MAPS>' => Settings::Get('system.vmail_gid'),
'<SSLPROTOCOLS>' => (Settings::Get('system.use_ssl') == '1') ? 'imaps pop3s' : '',
'<CUSTOMER_TMP>' => makeCorrectDir($customer_tmpdir),
'<BASE_PATH>' => makeCorrectDir(FROXLOR_INSTALL_DIR),
'<BIND_CONFIG_PATH>' => makeCorrectDir(Settings::Get('system.bindconf_directory')),
'<WEBSERVER_RELOAD_CMD>' => Settings::Get('system.apachereload_command'),
'<CUSTOMER_LOGS>' => makeCorrectDir(Settings::Get('system.logfiles_directory')),
'<FPM_IPCDIR>' => makeCorrectDir(Settings::Get('phpfpm.fastcgi_ipcdir')),
'<WEBSERVER_GROUP>' => Settings::Get('system.httpgroup')
);
// get distro from URL param if(isset($_GET['daemon'])
$distribution = (isset($_GET['distribution']) && $_GET['distribution'] != 'choose') ? $_GET['distribution'] : ""; && $_GET['daemon'] != ''
$service = (isset($_GET['service']) && $_GET['service'] != 'choose') ? $_GET['service'] : ""; && isset($configfiles[$distribution]['services'][$service]['daemons'][$_GET['daemon']])
$daemon = (isset($_GET['daemon']) && $_GET['daemon'] != 'choose') ? $_GET['daemon'] : ""; && is_array($configfiles[$distribution]['services'][$service]['daemons'][$_GET['daemon']]))
$distributions_select = ""; {
$services_select = ""; $daemon = $_GET['daemon'];
$daemons_select = ""; }
else
$configfiles = ""; {
$services = ""; foreach($configfiles[$distribution]['services'][$service]['daemons'] as $daemon_name => $daemon_details)
$daemons = ""; {
$daemons_select.= makeoption($daemon_details['label'], $daemon_name);
$config_dir = makeCorrectDir(FROXLOR_INSTALL_DIR . '/lib/configfiles/');
if ($distribution != "") {
// create configparser object
$configfiles = new ConfigParser($config_dir . '/' . $distribution . ".xml");
// get distro-info
$dist_display = getCompleteDistroName($configfiles);
// get all the services from the distro
$services = $configfiles->getServices();
if ($service != "") {
$daemons = $services[$service]->getDaemons();
if ($daemon == "") {
foreach ($daemons as $di => $dd) {
$title = $dd->title;
if ($dd->default) {
$title = $title . " (" . strtolower($lng['panel']['default']) . ")";
}
$daemons_select .= makeoption($title, $di);
} }
} }
} else { }
foreach ($services as $si => $sd) { else
$services_select .= makeoption($sd->title, $si); {
foreach($configfiles[$distribution]['services'] as $service_name => $service_details)
{
$services_select.= makeoption($service_details['label'], $service_name);
} }
} }
} else { }
else
// show list of available distro's {
$distros = glob($config_dir . '*.xml'); foreach($configfiles as $distribution_name => $distribution_details)
// tmp array {
$distributions_select_data = array(); $distributions_select.= makeoption($distribution_details['label'], $distribution_name);
// read in all the distros
foreach ($distros as $_distribution) {
// get configparser object
$dist = new ConfigParser($_distribution);
// get distro-info
$dist_display = getCompleteDistroName($dist);
// store in tmp array
$distributions_select_data[$dist_display] = str_replace(".xml", "", strtolower(basename($_distribution)));
}
// sort by distribution name
ksort($distributions_select_data);
foreach ($distributions_select_data as $dist_display => $dist_index) {
// create select-box-option
$distributions_select .= makeoption($dist_display, $dist_index);
} }
} }
if ($distribution != "" && $service != "" && $daemon != "") { if($distribution != ''
&& $service != ''
$confarr = $daemons[$daemon]->getConfig(); && $daemon != '')
{
$replace_arr = Array(
'<SQL_UNPRIVILEGED_USER>' => $sql['user'],
'<SQL_UNPRIVILEGED_PASSWORD>' => 'MYSQL_PASSWORD',
'<SQL_DB>' => $sql['db'],
'<SQL_HOST>' => $sql['host'],
'<SERVERNAME>' => $settings['system']['hostname'],
'<SERVERIP>' => $settings['system']['ipaddress'],
'<NAMESERVERS>' => $settings['system']['nameservers'],
'<VIRTUAL_MAILBOX_BASE>' => $settings['system']['vmail_homedir'],
'<VIRTUAL_UID_MAPS>' => $settings['system']['vmail_uid'],
'<VIRTUAL_GID_MAPS>' => $settings['system']['vmail_gid'],
'<AWSTATS_PATH>' => $settings['system']['awstats_path'],
'<SSLPROTOCOLS>' => ($settings['system']['use_ssl'] == '1') ? 'imaps pop3s' : '',
'<REALTIME_PORT>' => $settings['system']['realtime_port']
);
$files = '';
$configpage = ''; $configpage = '';
foreach($configfiles[$distribution]['services'][$service]['daemons'][$daemon] as $action => $value)
$distro_editor = $configfiles->distributionEditor; {
if(substr($action, 0, 8) == 'commands')
$commands_pre = ""; {
$commands_file = "";
$commands_post = "";
$lasttype = '';
$commands = '';
foreach ($confarr as $idx => $action) {
if ($lasttype != '' && $lasttype != $action['type']) {
$commands = trim($commands);
$numbrows = count(explode("\n", $commands));
eval("\$configpage.=\"" . getTemplate("configfiles/configfiles_commands") . "\";");
$lasttype = '';
$commands = ''; $commands = '';
if(is_array($value))
{
$commands = implode("\n", $value);
if($commands != '')
{
eval("\$configpage.=\"" . getTemplate("configfiles/configfiles_commands") . "\";");
}
}
} }
switch ($action['type']) { elseif(substr($action, 0, 5) == 'files')
case "install": {
$commands .= strtr($action['content'], $replace_arr) . "\n"; $files = '';
$lasttype = "install";
break; if(is_array($value))
case "command": {
$commands .= strtr($action['content'], $replace_arr) . "\n"; while(list($filename, $realname) = each($value))
$lasttype = "command"; {
break; $file_content = file_get_contents('./templates/misc/configfiles/' . $distribution . '/' . $daemon . '/' . $filename);
case "file": $file_content = strtr($file_content, $replace_arr);
if (array_key_exists('content', $action)) { $file_content = htmlspecialchars($file_content);
$commands_file = getFileContentContainer($action['content'], $replace_arr, $action['name'], $distro_editor); $numbrows = count(explode("\n", $file_content));
} elseif (array_key_exists('subcommands', $action)) { eval("\$files.=\"" . getTemplate("configfiles/configfiles_file") . "\";");
foreach ($action['subcommands'] as $fileaction) {
if (array_key_exists('execute', $fileaction) && $fileaction['execute'] == "pre") {
$commands_pre .= $fileaction['content'] . "\n";
} elseif (array_key_exists('execute', $fileaction) && $fileaction['execute'] == "post") {
$commands_post .= $fileaction['content'] . "\n";
} elseif ($fileaction['type'] == 'file') {
$commands_file = getFileContentContainer($fileaction['content'], $replace_arr, $action['name'], $distro_editor);
}
}
} }
$realname = $action['name'];
$commands = trim($commands_pre); eval("\$configpage.=\"" . getTemplate("configfiles/configfiles_files") . "\";");
if ($commands != "") { }
$numbrows = count(explode("\n", $commands));
eval("\$commands_pre=\"" . getTemplate("configfiles/configfiles_commands") . "\";");
}
$commands = trim($commands_post);
if ($commands != "") {
$numbrows = count(explode("\n", $commands));
eval("\$commands_post=\"" . getTemplate("configfiles/configfiles_commands") . "\";");
}
eval("\$configpage.=\"" . getTemplate("configfiles/configfiles_subfileblock") . "\";");
$commands = '';
$commands_pre = '';
$commands_post = '';
break;
} }
} }
$commands = trim($commands);
if ($commands != '') { if(isset($configfiles[$distribution]['services'][$service]['daemons'][$daemon]['restart'])
$numbrows = count(explode("\n", $commands)); && is_array($configfiles[$distribution]['services'][$service]['daemons'][$daemon]['restart']))
eval("\$configpage.=\"" . getTemplate("configfiles/configfiles_commands") . "\";"); {
$restart = implode("\n", $configfiles[$distribution]['services'][$service]['daemons'][$daemon]['restart']);
} }
else
{
$restart = '';
}
eval("echo \"" . getTemplate("configfiles/configfiles") . "\";"); eval("echo \"" . getTemplate("configfiles/configfiles") . "\";");
} else { }
elseif($page == 'overview')
{
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_configfiles");
$distributions = '';
foreach($configfiles as $distribution_name => $distribution_details)
{
$services = '';
foreach($distribution_details['services'] as $service_name => $service_details)
{
$daemons = '';
foreach($service_details['daemons'] as $daemon_name => $daemon_details)
{
eval("\$daemons.=\"" . getTemplate("configfiles/choose_daemon") . "\";");
}
eval("\$services.=\"" . getTemplate("configfiles/choose_service") . "\";");
}
eval("\$distributions.=\"" . getTemplate("configfiles/choose_distribution") . "\";");
}
eval("echo \"" . getTemplate("configfiles/choose") . "\";");
}
else
{
eval("echo \"" . getTemplate("configfiles/wizard") . "\";"); eval("echo \"" . getTemplate("configfiles/wizard") . "\";");
} }
} else {
die('not allowed to see this page');
// redirect or similar here
} }
// helper functions ?>
function getFileContentContainer($file_content, &$replace_arr, $realname, $distro_editor)
{
$files = "";
$file_content = trim($file_content);
if ($file_content != '') {
$file_content = strtr($file_content, $replace_arr);
$file_content = htmlspecialchars($file_content);
$numbrows = count(explode("\n", $file_content));
eval("\$files=\"" . getTemplate("configfiles/configfiles_file") . "\";");
}
return $files;
}
function getCompleteDistroName($cparser)
{
// get distro-info
$dist_display = $cparser->distributionName;
if ($cparser->distributionCodename != '') {
$dist_display .= " " . $cparser->distributionCodename;
}
if ($cparser->distributionVersion != '') {
$dist_display .= " (" . $cparser->distributionVersion . ")";
}
if ($cparser->deprecated) {
$dist_display .= " [deprecated]";
}
return $dist_display;
}

View File

@@ -12,33 +12,42 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
require './lib/init.php';
if (isset($_POST['id'])) { require_once("./lib/init.php");
if(isset($_POST['id']))
{
$id = intval($_POST['id']); $id = intval($_POST['id']);
} elseif(isset($_GET['id'])) { }
elseif(isset($_GET['id']))
{
$id = intval($_GET['id']); $id = intval($_GET['id']);
} }
if ($page == 'cronjobs' || $page == 'overview') { if($page == 'cronjobs'
if ($action == '') { || $page == 'overview')
$log->logAction(ADM_ACTION, LOG_NOTICE, 'viewed admin_cronjobs'); {
if($action == '')
{
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_cronjobs");
$fields = array( $fields = array(
'c.lastrun' => $lng['cron']['lastrun'], 'c.lastrun' => $lng['cron']['lastrun'],
'c.interval' => $lng['cron']['interval'], 'c.interval' => $lng['cron']['interval'],
'c.isactive' => $lng['cron']['isactive'] 'c.isactive' => $lng['cron']['isactive']
); );
$paging = new paging($userinfo, TABLE_PANEL_CRONRUNS, $fields); $paging = new paging($userinfo, $db, TABLE_PANEL_CRONRUNS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
/*
* @TODO Fix sorting
*/
$crons = ''; $crons = '';
$result_stmt = Database::prepare("SELECT `c`.* FROM `" . TABLE_PANEL_CRONRUNS . "` `c` ORDER BY `module` ASC, `cronfile` ASC"); $result = $db->query("SELECT `c`.* FROM `" . TABLE_PANEL_CRONRUNS . "` `c` ORDER BY `cronfile` ASC");
Database::pexecute($result_stmt); $paging->setEntries($db->num_rows($result));
$paging->setEntries(Database::num_rows());
$sortcode = $paging->getHtmlSortCode($lng); $sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s); $arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng); $searchcode = $paging->getHtmlSearchCode($lng);
@@ -46,95 +55,62 @@ if ($page == 'cronjobs' || $page == 'overview') {
$i = 0; $i = 0;
$count = 0; $count = 0;
$cmod = '';
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while($row = $db->fetch_array($result))
if ($cmod != $row['module']) { {
$_mod = explode("/", $row['module']); if($paging->checkDisplay($i))
$module = ucfirst($_mod[1]); {
eval("\$crons.=\"" . getTemplate('cronjobs/cronjobs_cronjobmodule') . "\";");
$cmod = $row['module'];
}
if ($paging->checkDisplay($i)) {
$row = htmlentities_array($row); $row = htmlentities_array($row);
$row['lastrun'] = date('d.m.Y H:i', $row['lastrun']); $row['lastrun'] = date('d.m.Y H:i', $row['lastrun']);
$row['isactive'] = ((int)$row['isactive'] == 1) ? $lng['panel']['yes'] : $lng['panel']['no'];
if((int)$row['isactive'] == 1)
{
$row['isactive'] = $lng['panel']['yes'];
}
else
{
$row['isactive'] = $lng['panel']['no'];
}
$description = $lng['crondesc'][$row['desc_lng_key']]; $description = $lng['crondesc'][$row['desc_lng_key']];
eval("\$crons.=\"" . getTemplate('cronjobs/cronjobs_cronjob') . "\";"); /*
* don't allow deletion of 'froxlor' cronjobs
*/
$vendor_a = explode('/', $row['module']);
$vendor = $vendor_a[0];
eval("\$crons.=\"" . getTemplate("cronjobs/cronjobs_cronjob") . "\";");
$count++; $count++;
} }
$i++; $i++;
} }
eval("echo \"" . getTemplate('cronjobs/cronjobs') . "\";"); eval("echo \"" . getTemplate("cronjobs/cronjobs") . "\";");
} elseif ($action == 'new') {
/*
* @TODO later
*/
} elseif ($action == 'edit' && $id != 0) {
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_CRONRUNS . "` WHERE `id`= :id");
Database::pexecute($result_stmt, array('id' => $id));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
if ($result['cronfile'] != '') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$isactive = isset($_POST['isactive']) ? 1 : 0;
$interval_value = validate($_POST['interval_value'], 'interval_value', '/^([0-9]+)$/Di', 'stringisempty');
$interval_interval = validate($_POST['interval_interval'], 'interval_interval');
if ($isactive != 1) {
$isactive = 0;
}
$interval = $interval_value . ' ' . strtoupper($interval_interval);
$upd = Database::prepare("
UPDATE `" . TABLE_PANEL_CRONRUNS . "`
SET `isactive` = :isactive, `interval` = :int
WHERE `id` = :id"
);
Database::pexecute($upd, array('isactive' => $isactive, 'int' => $interval, 'id' => $id));
// insert task to re-generate the cron.d-file
inserttask('99');
redirectTo($filename, array('page' => $page, 's' => $s));
} else {
// interval
$interval_nfo = explode(' ', $result['interval']);
$interval_value = $interval_nfo[0];
$interval_interval = '';
$interval_interval .= makeoption($lng['cronmgmt']['minutes'], 'MINUTE', $interval_nfo[1]);
$interval_interval .= makeoption($lng['cronmgmt']['hours'], 'HOUR', $interval_nfo[1]);
$interval_interval .= makeoption($lng['cronmgmt']['days'], 'DAY', $interval_nfo[1]);
$interval_interval .= makeoption($lng['cronmgmt']['weeks'], 'WEEK', $interval_nfo[1]);
$interval_interval .= makeoption($lng['cronmgmt']['months'], 'MONTH', $interval_nfo[1]);
// end of interval
$change_cronfile = false;
if (substr($result['module'], 0, strpos($result['module'], '/')) != 'froxlor') {
$change_cronfile = true;
}
$cronjobs_edit_data = include_once dirname(__FILE__).'/lib/formfields/admin/cronjobs/formfield.cronjobs_edit.php';
$cronjobs_edit_form = htmlform::genHTMLForm($cronjobs_edit_data);
$title = $cronjobs_edit_data['cronjobs_edit']['title'];
$image = $cronjobs_edit_data['cronjobs_edit']['image'];
eval("echo \"" . getTemplate('cronjobs/cronjob_edit') . "\";");
}
}
} }
elseif ($action == 'delete' && $id != 0) { elseif($action == 'new')
{
/* /*
* @TODO later * @TODO Finish me
*/
}
elseif($action == 'edit'
&& $id != 0)
{
/*
* @TODO Finish me
*/
}
elseif($action == 'delete'
&& $id != 0)
{
/*
* @TODO Finish me
*/ */
} }
} }
?>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -14,45 +14,47 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
require './lib/init.php';
if ($action == 'logout') { /**
* Include our init.php, which manages Sessions, Language etc.
*/
require ("./lib/init.php");
if($action == 'logout')
{
$log->logAction(ADM_ACTION, LOG_NOTICE, "logged out"); $log->logAction(ADM_ACTION, LOG_NOTICE, "logged out");
$params = array('adminid' => (int)$userinfo['adminid']); if($settings['session']['allow_multiple_login'] == '1')
{
if (Settings::Get('session.allow_multiple_login') == '1') { $db->query("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid` = '" . (int)$userinfo['adminid'] . "' AND `adminsession` = '1' AND `hash` = '" . $s . "'");
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` }
WHERE `userid` = :adminid else
AND `adminsession` = '1' {
AND `hash` = :hash" $db->query("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid` = '" . (int)$userinfo['adminid'] . "' AND `adminsession` = '1'");
);
$params['hash'] = $s;
} else {
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "`
WHERE `userid` = :adminid
AND `adminsession` = '1'"
);
} }
Database::pexecute($stmt, $params);
redirectTo('index.php'); redirectTo('index.php');
exit;
} }
if (isset($_POST['id'])) { if(isset($_POST['id']))
{
$id = intval($_POST['id']); $id = intval($_POST['id']);
} elseif(isset($_GET['id'])) { }
elseif(isset($_GET['id']))
{
$id = intval($_GET['id']); $id = intval($_GET['id']);
} }
if ($page == 'overview') { if($page == 'overview')
{
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_index"); $log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_index");
$overview_stmt = Database::prepare("SELECT COUNT(*) AS `number_customers`, $overview = $db->query_first("SELECT COUNT(*) AS `number_customers`,
SUM(`diskspace_used`) AS `diskspace_used`, SUM(`diskspace_used`) AS `diskspace_used`,
SUM(`mysqls_used`) AS `mysqls_used`, SUM(`mysqls_used`) AS `mysqls_used`,
SUM(`emails_used`) AS `emails_used`, SUM(`emails_used`) AS `emails_used`,
@@ -62,126 +64,124 @@ if ($page == 'overview') {
SUM(`ftps_used`) AS `ftps_used`, SUM(`ftps_used`) AS `ftps_used`,
SUM(`tickets_used`) AS `tickets_used`, SUM(`tickets_used`) AS `tickets_used`,
SUM(`subdomains_used`) AS `subdomains_used`, SUM(`subdomains_used`) AS `subdomains_used`,
SUM(`traffic_used`) AS `traffic_used` SUM(`traffic_used`) AS `traffic_used`,
FROM `" . TABLE_PANEL_CUSTOMERS . "`" . ($userinfo['customers_see_all'] ? '' : " WHERE `adminid` = :adminid ")); SUM(`aps_packages_used`) AS `aps_packages_used`
$overview = Database::pexecute_first($overview_stmt, array('adminid' => $userinfo['adminid'])); FROM `" . TABLE_PANEL_CUSTOMERS . "`" . ($userinfo['customers_see_all'] ? '' : " WHERE `adminid` = '" . (int)$userinfo['adminid'] . "' "));
$overview['traffic_used'] = round($overview['traffic_used'] / (1024 * 1024), $settings['panel']['decimal_places']);
$dec_places = Settings::Get('panel.decimal_places'); $overview['diskspace_used'] = round($overview['diskspace_used'] / 1024, $settings['panel']['decimal_places']);
$overview['traffic_used'] = round($overview['traffic_used'] / (1024 * 1024), $dec_places); $number_domains = $db->query_first("SELECT COUNT(*) AS `number_domains` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `parentdomainid`='0'" . ($userinfo['customers_see_all'] ? '' : " AND `adminid` = '" . (int)$userinfo['adminid'] . "' "));
$overview['diskspace_used'] = round($overview['diskspace_used'] / 1024, $dec_places);
$number_domains_stmt = Database::prepare("
SELECT COUNT(*) AS `number_domains` FROM `" . TABLE_PANEL_DOMAINS . "`
WHERE `parentdomainid`='0'" . ($userinfo['customers_see_all'] ? '' : " AND `adminid` = :adminid")
);
$number_domains = Database::pexecute_first($number_domains_stmt, array('adminid' => $userinfo['adminid']));
$overview['number_domains'] = $number_domains['number_domains']; $overview['number_domains'] = $number_domains['number_domains'];
$phpversion = phpversion(); $phpversion = phpversion();
$mysqlserverversion = Database::getAttribute(PDO::ATTR_SERVER_VERSION); $phpmemorylimit = @ini_get("memory_limit");
if($phpmemorylimit == "")
{
$phpmemorylimit = $lng['admin']['memorylimitdisabled'];
}
$mysqlserverversion = mysql_get_server_info();
$mysqlclientversion = mysql_get_client_info();
$webserverinterface = strtoupper(@php_sapi_name()); $webserverinterface = strtoupper(@php_sapi_name());
if ((isset($_GET['lookfornewversion']) && $_GET['lookfornewversion'] == 'yes') if((isset($_GET['lookfornewversion']) && $_GET['lookfornewversion'] == 'yes')
|| (isset($lookfornewversion) && $lookfornewversion == 'yes') || (isset($lookfornewversion) && $lookfornewversion == 'yes'))
) { {
$update_check_uri = 'http://version.froxlor.org/Froxlor/legacy/' . $version; $update_check_uri = 'http://version.froxlor.org/Froxlor/legacy/' . $version;
if (ini_get('allow_url_fopen')) { if(strtolower(ini_get('allow_url_fopen')) == 'on')
{
$latestversion = @file($update_check_uri); $latestversion = @file($update_check_uri);
if (isset($latestversion[0])) { $latestversion = explode(':', $latestversion);
$latestversion = explode('|', $latestversion[0]);
if(is_array($latestversion)
if (is_array($latestversion) && count($latestversion) >= 2)
&& count($latestversion) >= 1 {
) { $lookfornewversion_lable = $latestversion[0];
$_version = $latestversion[0]; $lookfornewversion_link = $latestversion[1];
$_message = isset($latestversion[1]) ? $latestversion[1] : ''; $lookfornewversion_addinfo = '';
$_link = isset($latestversion[2]) ? $latestversion[2] : htmlspecialchars($filename . '?s=' . urlencode($s) . '&page=' . urlencode($page) . '&lookfornewversion=yes');
if(count($latestversion) >= 3)
// add the branding so debian guys are not gettings confused {
// about their version-number $lookfornewversion_addinfo = $latestversion[2];
$lookfornewversion_lable = $_version.$branding;
$lookfornewversion_link = $_link;
$lookfornewversion_addinfo = $_message;
// not numeric -> error-message
if (!preg_match('/^((\d+\\.)(\d+\\.)(\d+\\.)?(\d+)?(\-(svn|dev|rc)(\d+))?)$/', $_version)) {
// check for customized version to not output
// "There is a newer version of froxlor" besides the error-message
$isnewerversion = 2;
} elseif (version_compare2($version, $_version) == -1) {
$isnewerversion = 1;
} else {
$isnewerversion = 0;
}
} else {
redirectTo($update_check_uri.'/pretty', NULL, false);
} }
} else {
redirectTo($update_check_uri.'/pretty', NULL, false);
} }
} else { else
redirectTo($update_check_uri.'/pretty', NULL, false); {
redirectTo($update_check_uri.'/pretty', NULL);
}
} }
} else { else
{
redirectTo($update_check_uri.'/pretty', NULL);
}
}
else
{
$lookfornewversion_lable = $lng['admin']['lookfornewversion']['clickhere']; $lookfornewversion_lable = $lng['admin']['lookfornewversion']['clickhere'];
$lookfornewversion_link = htmlspecialchars($filename . '?s=' . urlencode($s) . '&page=' . urlencode($page) . '&lookfornewversion=yes'); $lookfornewversion_link = htmlspecialchars($filename . '?s=' . urlencode($s) . '&page=' . urlencode($page) . '&lookfornewversion=yes');
$lookfornewversion_addinfo = ''; $lookfornewversion_addinfo = '';
$isnewerversion = 0;
} }
$dec_places = Settings::Get('panel.decimal_places'); $userinfo['diskspace'] = round($userinfo['diskspace'] / 1024, $settings['panel']['decimal_places']);
$userinfo['diskspace'] = round($userinfo['diskspace'] / 1024, $dec_places); $userinfo['diskspace_used'] = round($userinfo['diskspace_used'] / 1024, $settings['panel']['decimal_places']);
$userinfo['diskspace_used'] = round($userinfo['diskspace_used'] / 1024, $dec_places); $userinfo['traffic'] = round($userinfo['traffic'] / (1024 * 1024), $settings['panel']['decimal_places']);
$userinfo['traffic'] = round($userinfo['traffic'] / (1024 * 1024), $dec_places); $userinfo['traffic_used'] = round($userinfo['traffic_used'] / (1024 * 1024), $settings['panel']['decimal_places']);
$userinfo['traffic_used'] = round($userinfo['traffic_used'] / (1024 * 1024), $dec_places); $userinfo = str_replace_array('-1', $lng['customer']['unlimited'], $userinfo, 'customers domains diskspace traffic mysqls emails email_accounts email_forwarders email_quota ftps tickets subdomains aps_packages');
$userinfo = str_replace_array('-1', $lng['customer']['unlimited'], $userinfo, 'customers domains diskspace traffic mysqls emails email_accounts email_forwarders email_quota ftps tickets subdomains');
$userinfo['custom_notes'] = ($userinfo['custom_notes'] != '') ? nl2br($userinfo['custom_notes']) : '';
$cron_last_runs = getCronjobsLastRun(); $cron_last_runs = getCronjobsLastRun();
$outstanding_tasks = getOutstandingTasks(); $outstanding_tasks = getOutstandingTasks();
$system_hostname = gethostname(); $opentickets = 0;
$meminfo= explode("\n", @file_get_contents("/proc/meminfo")); $opentickets = $db->query_first('SELECT COUNT(`id`) as `count` FROM `' . TABLE_PANEL_TICKETS . '`
$memory = ""; WHERE `answerto` = "0" AND (`status` = "0" OR `status` = "1")
for ($i = 0; $i < sizeof($meminfo); ++$i) { AND `lastreplier`="0" AND `adminid` = "' . $userinfo['adminid'] . '"');
if (substr($meminfo[$i], 0, 3) === "Mem") { $awaitingtickets = $opentickets['count'];
$memory.= $meminfo[$i] . PHP_EOL; $awaitingtickets_text = '';
}
if($opentickets > 0)
{
$awaitingtickets_text = strtr($lng['ticket']['awaitingticketreply'], array('%s' => '<a href="admin_tickets.php?page=tickets&amp;s=' . $s . '">' . $opentickets['count'] . '</a>'));
} }
if (function_exists('sys_getloadavg')) { if(function_exists('sys_getloadavg'))
{
$loadArray = sys_getloadavg(); $loadArray = sys_getloadavg();
$load = number_format($loadArray[0], 2, '.', '') . " / " . number_format($loadArray[1], 2, '.', '') . " / " . number_format($loadArray[2], 2, '.', ''); $load = number_format($loadArray[0], 2, '.', '') . " / " . number_format($loadArray[1], 2, '.', '') . " / " . number_format($loadArray[2], 2, '.', '');
} else { }
else
{
$load = @file_get_contents('/proc/loadavg'); $load = @file_get_contents('/proc/loadavg');
if (!$load) { if(!$load)
{
$load = $lng['admin']['noloadavailable']; $load = $lng['admin']['noloadavailable'];
} }
} }
if (function_exists('posix_uname')) { if(function_exists('posix_uname'))
{
$showkernel = 1; $showkernel = 1;
$kernel_nfo = posix_uname(); $kernel_nfo = posix_uname();
$kernel = $kernel_nfo['release'] . ' (' . $kernel_nfo['machine'] . ')'; $kernel = $kernel_nfo['release'] . ' (' . $kernel_nfo['machine'] . ')';
} else { }
else
{
$showkernel = 0; $showkernel = 0;
$kernel = ''; $kernel = '';
} }
// Try to get the uptime // Try to get the uptime
// First: With exec (let's hope it's enabled for the Froxlor - vHost) // First: With exec (let's hope it's enabled for the SysCP - vHost)
$uptime_array = explode(" ", @file_get_contents("/proc/uptime")); $uptime_array = explode(" ", @file_get_contents("/proc/uptime"));
if (is_array($uptime_array) if(is_array($uptime_array)
&& isset($uptime_array[0]) && isset($uptime_array[0])
&& is_numeric($uptime_array[0]) && is_numeric($uptime_array[0]))
) { {
// Some calculatioon to get a nicly formatted display // Some calculatioon to get a nicly formatted display
$seconds = round($uptime_array[0], 0); $seconds = round($uptime_array[0], 0);
$minutes = $seconds / 60; $minutes = $seconds / 60;
$hours = $minutes / 60; $hours = $minutes / 60;
@@ -192,225 +192,89 @@ if ($page == 'overview') {
$uptime = "{$days}d, {$hours}h, {$minutes}m, {$seconds}s"; $uptime = "{$days}d, {$hours}h, {$minutes}m, {$seconds}s";
// Just cleanup // Just cleanup
unset($uptime_array, $seconds, $minutes, $hours, $days); unset($uptime_array, $seconds, $minutes, $hours, $days);
} else { }
else
{
// Nothing of the above worked, show an error :/ // Nothing of the above worked, show an error :/
$uptime = ''; $uptime = '';
} }
eval("echo \"" . getTemplate("index/index") . "\";"); eval("echo \"" . getTemplate("index/index") . "\";");
}
} elseif($page == 'change_password') { elseif($page == 'change_password')
{
if (isset($_POST['send']) if(isset($_POST['send'])
&& $_POST['send'] == 'send' && $_POST['send'] == 'send')
) { {
$old_password = validate($_POST['old_password'], 'old password'); $old_password = validate($_POST['old_password'], 'old password');
if (!validatePasswordLogin($userinfo,$old_password,TABLE_PANEL_ADMINS,'adminid')) { if(md5($old_password) != $userinfo['password'])
{
standard_error('oldpasswordnotcorrect'); standard_error('oldpasswordnotcorrect');
exit;
} }
$new_password = validate($_POST['new_password'], 'new password'); $new_password = validate($_POST['new_password'], 'new password');
$new_password_confirm = validate($_POST['new_password_confirm'], 'new password confirm'); $new_password_confirm = validate($_POST['new_password_confirm'], 'new password confirm');
if ($old_password == '') { if($old_password == '')
{
standard_error(array('stringisempty', 'oldpassword')); standard_error(array('stringisempty', 'oldpassword'));
} elseif($new_password == '') { }
elseif($new_password == '')
{
standard_error(array('stringisempty', 'newpassword')); standard_error(array('stringisempty', 'newpassword'));
} elseif($new_password_confirm == '') { }
elseif($new_password_confirm == '')
{
standard_error(array('stringisempty', 'newpasswordconfirm')); standard_error(array('stringisempty', 'newpasswordconfirm'));
} elseif($new_password != $new_password_confirm) { }
elseif($new_password != $new_password_confirm)
{
standard_error('newpasswordconfirmerror'); standard_error('newpasswordconfirmerror');
} else { }
$chgpwd_stmt = Database::prepare(" else
UPDATE `" . TABLE_PANEL_ADMINS . "` {
SET `password`= :newpasswd $db->query("UPDATE `" . TABLE_PANEL_ADMINS . "` SET `password`='" . md5($new_password) . "' WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `password`='" . md5($old_password) . "'");
WHERE `adminid`= :adminid"
);
Database::pexecute($chgpwd_stmt, array(
'newpasswd' => makeCryptPassword($new_password),
'adminid' => (int)$userinfo['adminid']
));
$log->logAction(ADM_ACTION, LOG_NOTICE, 'changed password'); $log->logAction(ADM_ACTION, LOG_NOTICE, 'changed password');
redirectTo($filename, Array('s' => $s)); redirectTo($filename, Array('s' => $s));
} }
} else { }
else
{
eval("echo \"" . getTemplate("index/change_password") . "\";"); eval("echo \"" . getTemplate("index/change_password") . "\";");
} }
}
} elseif($page == 'change_language') { elseif($page == 'change_language')
{
if (isset($_POST['send']) if(isset($_POST['send'])
&& $_POST['send'] == 'send' && $_POST['send'] == 'send')
) { {
$def_language = validate($_POST['def_language'], 'default language'); $def_language = validate($_POST['def_language'], 'default language');
if (isset($languages[$def_language])) { if(isset($languages[$def_language]))
$lng_stmt = Database::prepare(" {
UPDATE `" . TABLE_PANEL_ADMINS . "` $db->query("UPDATE `" . TABLE_PANEL_ADMINS . "` SET `def_language`='" . $db->escape($def_language) . "' WHERE `adminid`='" . (int)$userinfo['adminid'] . "'");
SET `def_language`= :deflng $db->query("UPDATE `" . TABLE_PANEL_SESSIONS . "` SET `language`='" . $db->escape($def_language) . "' WHERE `hash`='" . $db->escape($s) . "'");
WHERE `adminid`= :adminid"
);
Database::pexecute($lng_stmt, array(
'deflng' => $def_language,
'adminid' => (int)$userinfo['adminid']
));
$lng_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_SESSIONS . "`
SET `language`= :lng
WHERE `hash`= :hash"
);
Database::pexecute($lng_stmt, array(
'lng' => $def_language,
'hash' => $s
));
} }
$log->logAction(ADM_ACTION, LOG_NOTICE, "changed his/her default language to '" . $def_language . "'"); $log->logAction(ADM_ACTION, LOG_NOTICE, "changed his/her default language to '" . $def_language . "'");
redirectTo($filename, array('s' => $s)); redirectTo($filename, Array('s' => $s));
}
} else { else
{
$language_options = ''; $language_options = '';
$default_lang = Settings::Get('panel.standardlanguage'); while(list($language_file, $language_name) = each($languages))
if ($userinfo['def_language'] != '') { {
$default_lang = $userinfo['def_language']; $language_options.= makeoption($language_name, $language_file, $userinfo['def_language'], true);
}
while (list($language_file, $language_name) = each($languages)) {
$language_options.= makeoption($language_name, $language_file, $default_lang, true);
} }
eval("echo \"" . getTemplate("index/change_language") . "\";"); eval("echo \"" . getTemplate("index/change_language") . "\";");
} }
} elseif ($page == 'change_theme') {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$theme = validate($_POST['theme'], 'theme');
$theme_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_ADMINS . "`
SET `theme`= :theme
WHERE `adminid`= :adminid"
);
Database::pexecute($theme_stmt, array(
'theme' => $theme,
'adminid' => (int)$userinfo['adminid']
));
$theme_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_SESSIONS . "`
SET `theme`= :theme
WHERE `hash`= :hash"
);
Database::pexecute($theme_stmt, array(
'theme' => $theme,
'hash' => $s
));
$log->logAction(ADM_ACTION, LOG_NOTICE, "changed his/her theme to '" . $theme . "'");
redirectTo($filename, array('s' => $s));
} else {
$theme_options = '';
$default_theme = Settings::Get('panel.default_theme');
if ($userinfo['theme'] != '') {
$default_theme = $userinfo['theme'];
}
$themes_avail = getThemes();
foreach ($themes_avail as $t => $d) {
$theme_options.= makeoption($d, $t, $default_theme, true);
}
eval("echo \"" . getTemplate("index/change_theme") . "\";");
}
} elseif ($page == 'send_error_report'
&& Settings::Get('system.allow_error_report_admin') == '1'
) {
// only show this if we really have an exception to report
if (isset($_GET['errorid'])
&& $_GET['errorid'] != ''
) {
$errid = $_GET['errorid'];
// read error file
$err_dir = makeCorrectDir(FROXLOR_INSTALL_DIR."/logs/");
$err_file = makeCorrectFile($err_dir."/".$errid."_sql-error.log");
if (file_exists($err_file)) {
$error_content = file_get_contents($err_file);
$error = explode("|", $error_content);
$_error = array(
'code' => str_replace("\n", "", substr($error[1], 5)),
'message' => str_replace("\n", "", substr($error[2], 4)),
'file' => str_replace("\n", "", substr($error[3], 5 + strlen(FROXLOR_INSTALL_DIR))),
'line' => str_replace("\n", "", substr($error[4], 5)),
'trace' => str_replace(FROXLOR_INSTALL_DIR, "", substr($error[5], 6))
);
// build mail-content
$mail_body = "Dear froxlor-team,\n\n";
$mail_body .= "the following error has been reported by a user:\n\n";
$mail_body .= "-------------------------------------------------------------\n";
$mail_body .= $_error['code'].' '.$_error['message']."\n\n";
$mail_body .= "File: ".$_error['file'].':'.$_error['line']."\n\n";
$mail_body .= "Trace:\n".trim($_error['trace'])."\n\n";
$mail_body .= "-------------------------------------------------------------\n\n";
$mail_body .= "Froxlor-version: ".$version."\n";
$mail_body .= "DB-version: ".$dbversion."\n\n";
$mail_body .= "End of report";
$mail_html = nl2br($mail_body);
// send actual report to dev-team
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
// send mail and say thanks
$_mailerror = false;
try {
$mail->Subject = '[Froxlor] Error report by user';
$mail->AltBody = $mail_body;
$mail->MsgHTML($mail_html);
$mail->AddAddress('error-reports@froxlor.org', 'Froxlor Developer Team');
$mail->Send();
} catch(phpmailerException $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (Exception $e) {
$mailerr_msg = $e->getMessage();
$_mailerror = true;
}
if ($_mailerror) {
// error when reporting an error...LOLFUQ
standard_error('send_report_error', $mailerr_msg);
}
// finally remove error from fs
@unlink($err_file);
redirectTo($filename, array('s' => $s));
}
// show a nice summary of the error-report
// before actually sending anything
eval("echo \"" . getTemplate("index/send_error_report") . "\";");
} else {
redirectTo($filename, array('s' => $s));
}
} else {
redirectTo($filename, array('s' => $s));
}
} }
?>

View File

@@ -14,39 +14,40 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
require './lib/init.php';
if (isset($_POST['id'])) { /**
* Include our init.php, which manages Sessions, Language etc.
*/
require ("./lib/init.php");
if(isset($_POST['id']))
{
$id = intval($_POST['id']); $id = intval($_POST['id']);
} elseif(isset($_GET['id'])) { }
elseif(isset($_GET['id']))
{
$id = intval($_GET['id']); $id = intval($_GET['id']);
} }
if ($page == 'ipsandports' if($page == 'ipsandports'
|| $page == 'overview' || $page == 'overview')
) { {
// Do not display attributes that are not used by the current webserver if($action == '')
$websrv = Settings::Get('system.webserver'); {
$is_nginx = ($websrv == 'nginx');
$is_apache = ($websrv == 'apache2');
$is_apache24 = $is_apache && (Settings::Get('system.apache24') === '1');
if ($action == '') {
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_ipsandports"); $log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_ipsandports");
$fields = array( $fields = array(
'ip' => $lng['admin']['ipsandports']['ip'], 'ip' => $lng['admin']['ipsandports']['ip'],
'port' => $lng['admin']['ipsandports']['port'] 'port' => $lng['admin']['ipsandports']['port']
); );
$paging = new paging($userinfo, TABLE_PANEL_IPSANDPORTS, $fields); $paging = new paging($userinfo, $db, TABLE_PANEL_IPSANDPORTS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
$ipsandports = ''; $ipsandports = '';
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_IPSANDPORTS . "` " . $paging->getSqlWhere(false) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit()); $result = $db->query("SELECT `id`, `ip`, `port`, `listen_statement`, `namevirtualhost_statement`, `vhostcontainer`, `vhostcontainer_servername_statement`, `specialsettings`, `ssl` FROM `" . TABLE_PANEL_IPSANDPORTS . "` " . $paging->getSqlWhere(false) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
Database::pexecute($result_stmt); $paging->setEntries($db->num_rows($result));
$paging->setEntries(Database::num_rows());
$sortcode = $paging->getHtmlSortCode($lng); $sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s); $arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng); $searchcode = $paging->getHtmlSearchCode($lng);
@@ -54,385 +55,266 @@ if ($page == 'ipsandports'
$i = 0; $i = 0;
$count = 0; $count = 0;
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while($row = $db->fetch_array($result))
{
if ($paging->checkDisplay($i)) { if($paging->checkDisplay($i))
{
$row = htmlentities_array($row); $row = htmlentities_array($row);
if (filter_var($row['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
if(filter_var($row['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6))
{
$row['ip'] = '[' . $row['ip'] . ']'; $row['ip'] = '[' . $row['ip'] . ']';
} }
eval("\$ipsandports.=\"" . getTemplate("ipsandports/ipsandports_ipandport") . "\";"); eval("\$ipsandports.=\"" . getTemplate("ipsandports/ipsandports_ipandport") . "\";");
$count++; $count++;
} }
$i++; $i++;
} }
eval("echo \"" . getTemplate("ipsandports/ipsandports") . "\";"); eval("echo \"" . getTemplate("ipsandports/ipsandports") . "\";");
}
elseif($action == 'delete'
&& $id != 0)
{
$result = $db->query_first("SELECT `id`, `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id`='" . (int)$id . "'");
} elseif($action == 'delete' if(isset($result['id'])
&& $id != 0 && $result['id'] == $id)
) { {
$result_stmt = Database::prepare("SELECT `id`, `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id` = :id"); $result_checkdomain = $db->query_first("SELECT `id` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `ipandport`='" . (int)$id . "'");
$result = Database::pexecute_first($result_stmt, array('id' => $id));
if (isset($result['id']) if($result_checkdomain['id'] == '')
&& $result['id'] == $id {
) { if($result['id'] != $settings['system']['defaultip'])
$result_checkdomain_stmt = Database::prepare(" {
SELECT `id_domain` as `id` FROM `" . TABLE_DOMAINTOIP . "` WHERE `id_ipandports` = :id" $result_sameipotherport = $db->query_first("SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ip`='" . $db->escape($result['ip']) . "' AND `id`!='" . (int)$id . "'");
);
$result_checkdomain = Database::pexecute_first($result_checkdomain_stmt, array('id' => $id));
if ($result_checkdomain['id'] == '') { if(($result['ip'] != $settings['system']['ipaddress'])
if (!in_array($result['id'], explode(',', Settings::Get('system.defaultip')))) { || ($result['ip'] == $settings['system']['ipaddress'] && $result_sameipotherport['id'] != ''))
{
$result_sameipotherport_stmt = Database::prepare(" $result = $db->query_first("SELECT `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id`='" . (int)$id . "'");
SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "`
WHERE `ip` = :ip AND `id` <> :id"
);
$result_sameipotherport = Database::pexecute_first($result_sameipotherport_stmt, array('id' => $id, 'ip' => $result['ip']));
if (($result['ip'] != Settings::Get('system.ipaddress'))
|| ($result['ip'] == Settings::Get('system.ipaddress')
&& $result_sameipotherport['id'] != '')
) {
$result_stmt = Database::prepare("
SELECT `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "`
WHERE `id` = :id"
);
$result = Database::pexecute_first($result_stmt, array('id' => $id));
if ($result['ip'] != '') {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$del_stmt = Database::prepare("
DELETE FROM `" . TABLE_PANEL_IPSANDPORTS . "`
WHERE `id` = :id"
);
Database::pexecute($del_stmt, array('id' => $id));
// also, remove connections to domains (multi-stack)
$del_stmt = Database::prepare("
DELETE FROM `".TABLE_DOMAINTOIP."` WHERE `id_ipandports` = :id"
);
Database::pexecute($del_stmt, array('id' => $id));
if($result['ip'] != '')
{
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$db->query("DELETE FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id`='" . (int)$id . "'");
$log->logAction(ADM_ACTION, LOG_WARNING, "deleted IP/port '" . $result['ip'] . ":" . $result['port'] . "'"); $log->logAction(ADM_ACTION, LOG_WARNING, "deleted IP/port '" . $result['ip'] . ":" . $result['port'] . "'");
inserttask('1'); inserttask('1');
// Using nameserver, insert a task which rebuilds the server config
inserttask('4'); inserttask('4');
redirectTo($filename, Array('page' => $page, 's' => $s));
redirectTo($filename, array('page' => $page, 's' => $s)); }
else
} else { {
ask_yesno('admin_ip_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['ip'] . ':' . $result['port']); ask_yesno('admin_ip_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['ip'] . ':' . $result['port']);
} }
} }
} else { }
else
{
standard_error('cantdeletesystemip'); standard_error('cantdeletesystemip');
} }
} else { }
else
{
standard_error('cantdeletedefaultip'); standard_error('cantdeletedefaultip');
} }
} else { }
else
{
standard_error('ipstillhasdomains'); standard_error('ipstillhasdomains');
} }
} }
}
} elseif($action == 'add') { elseif($action == 'add')
{
if (isset($_POST['send']) if(isset($_POST['send'])
&& $_POST['send'] == 'send' && $_POST['send'] == 'send')
) { {
$ip = validate_ip($_POST['ip']); $ip = validate_ip($_POST['ip']);
$port = validate($_POST['port'], 'port', '/^(([1-9])|([1-9][0-9])|([1-9][0-9][0-9])|([1-9][0-9][0-9][0-9])|([1-5][0-9][0-9][0-9][0-9])|(6[0-4][0-9][0-9][0-9])|(65[0-4][0-9][0-9])|(655[0-2][0-9])|(6553[0-5]))$/Di', array('stringisempty', 'myport')); $port = validate($_POST['port'], 'port', '/^(([1-9])|([1-9][0-9])|([1-9][0-9][0-9])|([1-9][0-9][0-9][0-9])|([1-5][0-9][0-9][0-9][0-9])|(6[0-4][0-9][0-9][0-9])|(65[0-4][0-9][0-9])|(655[0-2][0-9])|(6553[0-5]))$/Di', array('stringisempty', 'myport'));
$listen_statement = isset($_POST['listen_statement']) ? 1 : 0; $listen_statement = intval($_POST['listen_statement']);
$namevirtualhost_statement = isset($_POST['namevirtualhost_statement']) ? 1 : 0; $namevirtualhost_statement = intval($_POST['namevirtualhost_statement']);
$vhostcontainer = isset($_POST['vhostcontainer']) ? 1 : 0; $vhostcontainer = intval($_POST['vhostcontainer']);
$specialsettings = validate(str_replace("\r\n", "\n", $_POST['specialsettings']), 'specialsettings', '/^[^\0]*$/'); $specialsettings = validate(str_replace("\r\n", "\n", $_POST['specialsettings']), 'specialsettings', '/^[^\0]*$/');
$vhostcontainer_servername_statement = isset($_POST['vhostcontainer_servername_statement']) ? 1 : 0; $vhostcontainer_servername_statement = intval($_POST['vhostcontainer_servername_statement']);
$ssl = intval($_POST['ssl']);
$ssl_cert_file = validate($_POST['ssl_cert_file'], 'ssl_cert_file');
$ssl_key_file = validate($_POST['ssl_key_file'], 'ssl_key_file');
$ssl_ca_file = validate($_POST['ssl_ca_file'], 'ssl_ca_file');
$default_vhostconf_domain = validate(str_replace("\r\n", "\n", $_POST['default_vhostconf_domain']), 'default_vhostconf_domain', '/^[^\0]*$/'); $default_vhostconf_domain = validate(str_replace("\r\n", "\n", $_POST['default_vhostconf_domain']), 'default_vhostconf_domain', '/^[^\0]*$/');
$docroot = validate($_POST['docroot'], 'docroot');
if($listen_statement != '1')
if ((int)Settings::Get('system.use_ssl') == 1) { {
$ssl = isset($_POST['ssl']) ? intval($_POST['ssl']) : 0;
$ssl_cert_file = validate($_POST['ssl_cert_file'], 'ssl_cert_file');
$ssl_key_file = validate($_POST['ssl_key_file'], 'ssl_key_file');
$ssl_ca_file = validate($_POST['ssl_ca_file'], 'ssl_ca_file');
$ssl_cert_chainfile = validate($_POST['ssl_cert_chainfile'], 'ssl_cert_chainfile');
} else {
$ssl = 0;
$ssl_cert_file = '';
$ssl_key_file = '';
$ssl_ca_file = '';
$ssl_cert_chainfile = '';
}
if ($listen_statement != '1') {
$listen_statement = '0'; $listen_statement = '0';
} }
if ($namevirtualhost_statement != '1') { if($namevirtualhost_statement != '1')
{
$namevirtualhost_statement = '0'; $namevirtualhost_statement = '0';
} }
if ($vhostcontainer != '1') { if($vhostcontainer != '1')
{
$vhostcontainer = '0'; $vhostcontainer = '0';
} }
if ($vhostcontainer_servername_statement != '1') { if($vhostcontainer_servername_statement != '1')
{
$vhostcontainer_servername_statement = '0'; $vhostcontainer_servername_statement = '0';
} }
if ($ssl != '1') { if($ssl != '1')
{
$ssl = '0'; $ssl = '0';
} }
if ($ssl_cert_file != '') { if($ssl_cert_file != '')
{
$ssl_cert_file = makeCorrectFile($ssl_cert_file); $ssl_cert_file = makeCorrectFile($ssl_cert_file);
} }
if ($ssl_key_file != '') { if($ssl_key_file != '')
{
$ssl_key_file = makeCorrectFile($ssl_key_file); $ssl_key_file = makeCorrectFile($ssl_key_file);
} }
if ($ssl_ca_file != '') { if($ssl_ca_file != '')
{
$ssl_ca_file = makeCorrectFile($ssl_ca_file); $ssl_ca_file = makeCorrectFile($ssl_ca_file);
} }
if ($ssl_cert_chainfile != '') { $result_checkfordouble = $db->query_first("SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ip`='" . $db->escape($ip) . "' AND `port`='" . (int)$port . "'");
$ssl_cert_chainfile = makeCorrectFile($ssl_cert_chainfile);
}
if (strlen(trim($docroot)) > 0) { if($result_checkfordouble['id'] != '')
$docroot = makeCorrectDir($docroot); {
} else {
$docroot = '';
}
$result_checkfordouble_stmt = Database::prepare("
SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "`
WHERE `ip` = :ip AND `port` = :port"
);
$result_checkfordouble = Database::pexecute_first($result_checkfordouble_stmt, array('ip' => $ip, 'port' => $port));
if ($result_checkfordouble['id'] != '') {
standard_error('myipnotdouble'); standard_error('myipnotdouble');
} else { }
$ins_stmt = Database::prepare(" else
INSERT INTO `" . TABLE_PANEL_IPSANDPORTS . "` {
SET $db->query("INSERT INTO `" . TABLE_PANEL_IPSANDPORTS . "` (`ip`, `port`, `listen_statement`, `namevirtualhost_statement`, `vhostcontainer`, `vhostcontainer_servername_statement`, `specialsettings`, `ssl`, `ssl_cert_file`, `ssl_key_file`, `ssl_ca_file`, `default_vhostconf_domain`) VALUES ('" . $db->escape($ip) . "', '" . (int)$port . "', '" . (int)$listen_statement . "', '" . (int)$namevirtualhost_statement . "', '" . (int)$vhostcontainer . "', '" . (int)$vhostcontainer_servername_statement . "', '" . $db->escape($specialsettings) . "', '" . (int)$ssl . "', '" . $db->escape($ssl_cert_file) . "', '" . $db->escape($ssl_key_file) . "', '" . $db->escape($ssl_ca_file) . "', '" . $db->escape($default_vhostconf_domain) . "')");
`ip` = :ip, `port` = :port, `listen_statement` = :ls,
`namevirtualhost_statement` = :nvhs, `vhostcontainer` = :vhc,
`vhostcontainer_servername_statement` = :vhcss,
`specialsettings` = :ss, `ssl` = :ssl,
`ssl_cert_file` = :ssl_cert, `ssl_key_file` = :ssl_key,
`ssl_ca_file` = :ssl_ca, `ssl_cert_chainfile` = :ssl_chain,
`default_vhostconf_domain` = :dvhd, `docroot` = :docroot;
");
$ins_data = array(
'ip' => $ip,
'port' => $port,
'ls' => $listen_statement,
'nvhs' => $namevirtualhost_statement,
'vhc' => $vhostcontainer,
'vhcss' => $vhostcontainer_servername_statement,
'ss' => $specialsettings,
'ssl' => $ssl,
'ssl_cert' => $ssl_cert_file,
'ssl_key' => $ssl_key_file,
'ssl_ca' => $ssl_ca_file,
'ssl_chain' => $ssl_cert_chainfile,
'dvhd' => $default_vhostconf_domain,
'docroot' => $docroot
);
Database::pexecute($ins_stmt, $ins_data);
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { if(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6))
{
$ip = '[' . $ip . ']'; $ip = '[' . $ip . ']';
} }
$log->logAction(ADM_ACTION, LOG_WARNING, "added IP/port '" . $ip . ":" . $port . "'"); $log->logAction(ADM_ACTION, LOG_WARNING, "added IP/port '" . $ip . ":" . $port . "'");
inserttask('1'); inserttask('1');
// Using nameserver, insert a task which rebuilds the server config
inserttask('4'); inserttask('4');
redirectTo($filename, Array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
} }
}
} else { else
{
$ipsandports_add_data = include_once dirname(__FILE__).'/lib/formfields/admin/ipsandports/formfield.ipsandports_add.php'; $enable_ssl = makeyesno('ssl', '1', '0', '0');
$ipsandports_add_form = htmlform::genHTMLForm($ipsandports_add_data); $listen_statement = makeyesno('listen_statement', '1', '0', '1');
$namevirtualhost_statement = makeyesno('namevirtualhost_statement', '1', '0', '1');
$title = $ipsandports_add_data['ipsandports_add']['title']; $vhostcontainer = makeyesno('vhostcontainer', '1', '0', '1');
$image = $ipsandports_add_data['ipsandports_add']['image']; $vhostcontainer_servername_statement = makeyesno('vhostcontainer_servername_statement', '1', '0', '1');
eval("echo \"" . getTemplate("ipsandports/ipsandports_add") . "\";"); eval("echo \"" . getTemplate("ipsandports/ipsandports_add") . "\";");
} }
}
elseif($action == 'edit'
&& $id != 0)
{
$result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id`='" . (int)$id . "'");
} elseif($action == 'edit' if($result['ip'] != '')
&& $id != 0 {
) { if(isset($_POST['send'])
$result_stmt = Database::prepare(" && $_POST['send'] == 'send')
SELECT * FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id` = :id" {
);
$result = Database::pexecute_first($result_stmt, array('id' => $id));
if ($result['ip'] != '') {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$ip = validate_ip($_POST['ip']); $ip = validate_ip($_POST['ip']);
$port = validate($_POST['port'], 'port', '/^(([1-9])|([1-9][0-9])|([1-9][0-9][0-9])|([1-9][0-9][0-9][0-9])|([1-5][0-9][0-9][0-9][0-9])|(6[0-4][0-9][0-9][0-9])|(65[0-4][0-9][0-9])|(655[0-2][0-9])|(6553[0-5]))$/Di', array('stringisempty', 'myport')); $port = validate($_POST['port'], 'port', '/^(([1-9])|([1-9][0-9])|([1-9][0-9][0-9])|([1-9][0-9][0-9][0-9])|([1-5][0-9][0-9][0-9][0-9])|(6[0-4][0-9][0-9][0-9])|(65[0-4][0-9][0-9])|(655[0-2][0-9])|(6553[0-5]))$/Di', array('stringisempty', 'myport'));
$listen_statement = isset($_POST['listen_statement']) ? 1 : 0; $result_checkfordouble = $db->query_first("SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ip`='" . $db->escape($ip) . "' AND `port`='" . (int)$port . "'");
$namevirtualhost_statement = isset($_POST['namevirtualhost_statement']) ? 1 : 0; $result_sameipotherport = $db->query_first("SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ip`='" . $db->escape($result['ip']) . "' AND `id`!='" . (int)$id . "'");
$vhostcontainer = isset($_POST['vhostcontainer']) ? 1 : 0; $listen_statement = intval($_POST['listen_statement']);
$namevirtualhost_statement = intval($_POST['namevirtualhost_statement']);
$vhostcontainer = intval($_POST['vhostcontainer']);
$specialsettings = validate(str_replace("\r\n", "\n", $_POST['specialsettings']), 'specialsettings', '/^[^\0]*$/'); $specialsettings = validate(str_replace("\r\n", "\n", $_POST['specialsettings']), 'specialsettings', '/^[^\0]*$/');
$vhostcontainer_servername_statement = isset($_POST['vhostcontainer_servername_statement']) ? 1 : 0; $vhostcontainer_servername_statement = intval($_POST['vhostcontainer_servername_statement']);
$ssl = intval($_POST['ssl']);
$ssl_cert_file = validate($_POST['ssl_cert_file'], 'ssl_cert_file');
$ssl_key_file = validate($_POST['ssl_key_file'], 'ssl_key_file');
$ssl_ca_file = validate($_POST['ssl_ca_file'], 'ssl_ca_file');
$default_vhostconf_domain = validate(str_replace("\r\n", "\n", $_POST['default_vhostconf_domain']), 'default_vhostconf_domain', '/^[^\0]*$/'); $default_vhostconf_domain = validate(str_replace("\r\n", "\n", $_POST['default_vhostconf_domain']), 'default_vhostconf_domain', '/^[^\0]*$/');
$docroot = validate($_POST['docroot'], 'docroot');
if($listen_statement != '1')
$result_checkfordouble_stmt = Database::prepare(" {
SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "`
WHERE `ip` = :ip AND `port` = :port"
);
$result_checkfordouble = Database::pexecute_first($result_checkfordouble_stmt, array('ip' => $ip, 'port' => $port));
$result_sameipotherport_stmt = Database::prepare("
SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "`
WHERE `ip` = :ip AND `id` <> :id"
);
$result_sameipotherport = Database::pexecute_first($result_sameipotherport_stmt, array('ip' => $ip, 'id' => $id));
if ((int)Settings::Get('system.use_ssl') == 1
&& isset($_POST['ssl'])
&& $_POST['ssl'] != 0
) {
$ssl = 1;
$ssl_cert_file = validate($_POST['ssl_cert_file'], 'ssl_cert_file');
$ssl_key_file = validate($_POST['ssl_key_file'], 'ssl_key_file');
$ssl_ca_file = validate($_POST['ssl_ca_file'], 'ssl_ca_file');
$ssl_cert_chainfile = validate($_POST['ssl_cert_chainfile'], 'ssl_cert_chainfile');
} else {
$ssl = 0;
$ssl_cert_file = '';
$ssl_key_file = '';
$ssl_ca_file = '';
$ssl_cert_chainfile = '';
}
if ($listen_statement != '1') {
$listen_statement = '0'; $listen_statement = '0';
} }
if ($namevirtualhost_statement != '1') { if($namevirtualhost_statement != '1')
{
$namevirtualhost_statement = '0'; $namevirtualhost_statement = '0';
} }
if ($vhostcontainer != '1') { if($vhostcontainer != '1')
{
$vhostcontainer = '0'; $vhostcontainer = '0';
} }
if ($vhostcontainer_servername_statement != '1') { if($vhostcontainer_servername_statement != '1')
{
$vhostcontainer_servername_statement = '0'; $vhostcontainer_servername_statement = '0';
} }
if ($ssl != '1') { if($ssl != '1')
{
$ssl = '0'; $ssl = '0';
} }
if ($ssl_cert_file != '') { if($ssl_cert_file != '')
{
$ssl_cert_file = makeCorrectFile($ssl_cert_file); $ssl_cert_file = makeCorrectFile($ssl_cert_file);
} }
if ($ssl_key_file != '') { if($ssl_key_file != '')
{
$ssl_key_file = makeCorrectFile($ssl_key_file); $ssl_key_file = makeCorrectFile($ssl_key_file);
} }
if ($ssl_ca_file != '') { if($ssl_ca_file != '')
{
$ssl_ca_file = makeCorrectFile($ssl_ca_file); $ssl_ca_file = makeCorrectFile($ssl_ca_file);
} }
if ($ssl_cert_chainfile != '') { if($result['ip'] != $ip
$ssl_cert_chainfile = makeCorrectFile($ssl_cert_chainfile); && $result['ip'] == $settings['system']['ipaddress']
} && $result_sameipotherport['id'] == '')
{
if (strlen(trim($docroot)) > 0) {
$docroot = makeCorrectDir($docroot);
} else {
$docroot = '';
}
if ($result['ip'] != $ip
&& $result['ip'] == Settings::Get('system.ipaddress')
&& $result_sameipotherport['id'] == ''
) {
standard_error('cantchangesystemip'); standard_error('cantchangesystemip');
}
} elseif($result_checkfordouble['id'] != '' elseif($result_checkfordouble['id'] != ''
&& $result_checkfordouble['id'] != $id && $result_checkfordouble['id'] != $id)
) { {
standard_error('myipnotdouble'); standard_error('myipnotdouble');
}
} else { else
{
$upd_stmt = Database::prepare(" $db->query("UPDATE `" . TABLE_PANEL_IPSANDPORTS . "` SET `ip`='" . $db->escape($ip) . "', `port`='" . (int)$port . "', `listen_statement`='" . (int)$listen_statement . "', `namevirtualhost_statement`='" . (int)$namevirtualhost_statement . "', `vhostcontainer`='" . (int)$vhostcontainer . "', `vhostcontainer_servername_statement`='" . (int)$vhostcontainer_servername_statement . "', `specialsettings`='" . $db->escape($specialsettings) . "', `ssl`='" . (int)$ssl . "', `ssl_cert_file`='" . $db->escape($ssl_cert_file) . "', `ssl_key_file`='" . $db->escape($ssl_key_file) . "', `ssl_ca_file`='" . $db->escape($ssl_ca_file) . "', `default_vhostconf_domain`='" . $db->escape($default_vhostconf_domain) . "' WHERE `id`='" . (int)$id . "'");
UPDATE `" . TABLE_PANEL_IPSANDPORTS . "`
SET
`ip` = :ip, `port` = :port, `listen_statement` = :ls,
`namevirtualhost_statement` = :nvhs, `vhostcontainer` = :vhc,
`vhostcontainer_servername_statement` = :vhcss,
`specialsettings` = :ss, `ssl` = :ssl,
`ssl_cert_file` = :ssl_cert, `ssl_key_file` = :ssl_key,
`ssl_ca_file` = :ssl_ca, `ssl_cert_chainfile` = :ssl_chain,
`default_vhostconf_domain` = :dvhd, `docroot` = :docroot
WHERE `id` = :id;
");
$upd_data = array(
'ip' => $ip,
'port' => $port,
'ls' => $listen_statement,
'nvhs' => $namevirtualhost_statement,
'vhc' => $vhostcontainer,
'vhcss' => $vhostcontainer_servername_statement,
'ss' => $specialsettings,
'ssl' => $ssl,
'ssl_cert' => $ssl_cert_file,
'ssl_key' => $ssl_key_file,
'ssl_ca' => $ssl_ca_file,
'ssl_chain' => $ssl_cert_chainfile,
'dvhd' => $default_vhostconf_domain,
'docroot' => $docroot,
'id' => $id
);
Database::pexecute($upd_stmt, $upd_data);
$log->logAction(ADM_ACTION, LOG_WARNING, "changed IP/port from '" . $result['ip'] . ":" . $result['port'] . "' to '" . $ip . ":" . $port . "'"); $log->logAction(ADM_ACTION, LOG_WARNING, "changed IP/port from '" . $result['ip'] . ":" . $result['port'] . "' to '" . $ip . ":" . $port . "'");
inserttask('1'); inserttask('1');
// Using nameserver, insert a task which rebuilds the server config
inserttask('4'); inserttask('4');
redirectTo($filename, Array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
} }
}
} else { else
{
$enable_ssl = makeyesno('ssl', '1', '0', $result['ssl']);
$result = htmlentities_array($result); $result = htmlentities_array($result);
$listen_statement = makeyesno('listen_statement', '1', '0', $result['listen_statement']);
$ipsandports_edit_data = include_once dirname(__FILE__).'/lib/formfields/admin/ipsandports/formfield.ipsandports_edit.php'; $namevirtualhost_statement = makeyesno('namevirtualhost_statement', '1', '0', $result['namevirtualhost_statement']);
$ipsandports_edit_form = htmlform::genHTMLForm($ipsandports_edit_data); $vhostcontainer = makeyesno('vhostcontainer', '1', '0', $result['vhostcontainer']);
$vhostcontainer_servername_statement = makeyesno('vhostcontainer_servername_statement', '1', '0', $result['vhostcontainer_servername_statement']);
$title = $ipsandports_edit_data['ipsandports_edit']['title'];
$image = $ipsandports_edit_data['ipsandports_edit']['image'];
eval("echo \"" . getTemplate("ipsandports/ipsandports_edit") . "\";"); eval("echo \"" . getTemplate("ipsandports/ipsandports_edit") . "\";");
} }
} }
} }
} }
?>

View File

@@ -14,49 +14,57 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
require './lib/init.php';
if ($page == 'log' /**
&& $userinfo['change_serversettings'] == '1' * Include our init.php, which manages Sessions, Language etc.
) { */
if ($action == '') {
require ("./lib/init.php");
if($page == 'log'
&& $userinfo['change_serversettings'] == '1')
{
if($action == '')
{
$fields = array( $fields = array(
'action' => $lng['logger']['action'],
'date' => $lng['logger']['date'], 'date' => $lng['logger']['date'],
'type' => $lng['logger']['type'], 'type' => $lng['logger']['type'],
'user' => $lng['logger']['user'], 'user' => $lng['logger']['user']
'text' => $lng['logger']['action']
); );
$paging = new paging($userinfo, TABLE_PANEL_LOG, $fields, null, null, 0, 'desc'); $paging = new paging($userinfo, $db, TABLE_PANEL_LOG, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
$result_stmt = Database::query(' $paging->sortfield = 'date';
SELECT * FROM `' . TABLE_PANEL_LOG . '` ' . $paging->getSqlWhere(false) . ' ' . $paging->getSqlOrderBy() . ' ' . $paging->getSqlLimit() $paging->sortorder = 'desc';
); $result = $db->query('SELECT * FROM `' . TABLE_PANEL_LOG . '` ' . $paging->getSqlWhere(false) . ' ' . $paging->getSqlOrderBy() . ' ' . $paging->getSqlLimit());
$logs_count = Database::num_rows(); $paging->setEntries($db->num_rows($result));
$paging->setEntries($logs_count);
$sortcode = $paging->getHtmlSortCode($lng); $sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s); $arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng); $searchcode = $paging->getHtmlSearchCode($lng);
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s); $pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
$clog = array(); $clog = array();
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while($row = $db->fetch_array($result))
{
if (!isset($clog[$row['action']]) if(!isset($clog[$row['action']])
|| !is_array($clog[$row['action']]) || !is_array($clog[$row['action']]))
) { {
$clog[$row['action']] = array(); $clog[$row['action']] = array();
} }
$clog[$row['action']][$row['logid']] = $row; $clog[$row['action']][$row['logid']] = $row;
} }
if ($paging->sortfield == 'date' if($paging->sortfield == 'date'
&& $paging->sortorder == 'desc' && $paging->sortorder == 'desc')
) { {
krsort($clog); krsort($clog);
} else { }
else
{
ksort($clog); ksort($clog);
} }
@@ -64,69 +72,100 @@ if ($page == 'log'
$count = 0; $count = 0;
$log_count = 0; $log_count = 0;
$log = ''; $log = '';
foreach ($clog as $action => $logrows) { foreach($clog as $action => $logrows)
{
$_action = 0; $_action = 0;
foreach ($logrows as $row) { foreach($logrows as $row)
if ($paging->checkDisplay($i)) { {
if($paging->checkDisplay($i))
{
$row = htmlentities_array($row); $row = htmlentities_array($row);
$row['date'] = date("d.m.y H:i:s", $row['date']); $row['date'] = date("d.m.y H:i:s", $row['date']);
if ($_action != $action) { if($_action != $action)
switch ($action) { {
switch($action)
{
case USR_ACTION: case USR_ACTION:
$_action = $lng['admin']['customer']; $_action = $lng['admin']['customer'];
break; break;
case RES_ACTION: case RES_ACTION:
$_action = $lng['logger']['reseller']; $_action = 'Reseller';
break; break;
case ADM_ACTION: case ADM_ACTION:
$_action = $lng['logger']['admin']; $_action = 'Administrator';
break; break;
case CRON_ACTION: case CRON_ACTION:
$_action = $lng['logger']['cron']; $_action = 'Cronjob';
break;
case LOGIN_ACTION:
$_action = $lng['logger']['login'];
break; break;
case LOG_ERROR: case LOG_ERROR:
$_action = $lng['logger']['intern']; $_action = 'Internal';
break; break;
default: default:
$_action = $lng['logger']['unknown']; $_action = 'Unknown';
break; break;
} }
$row['action'] = $_action; $row['action'] = $_action;
eval("\$log.=\"" . getTemplate('logger/logger_action') . "\";"); eval("\$log.=\"" . getTemplate("logger/logger_action") . "\";");
} }
$log_count++; $log_count++;
$row['type'] = getLogLevelDesc($row['type']); $type = $row['type'];
eval("\$log.=\"" . getTemplate('logger/logger_log') . "\";"); $_type = 'unknown';
switch($type)
{
case LOG_INFO:
$_type = 'Information';
break;
case LOG_NOTICE:
$_type = 'Notice';
break;
case LOG_WARNING:
$_type = 'Warning';
break;
case LOG_ERR:
$_type = 'Error';
break;
case LOG_CRIT:
$_type = 'Critical';
break;
default:
$_type = 'Unknown';
break;
}
$row['type'] = $_type;
eval("\$log.=\"" . getTemplate("logger/logger_log") . "\";");
$count++; $count++;
$_action = $action; $_action = $action;
} }
$i++;
} }
$i++; $i++;
} }
eval("echo \"" . getTemplate('logger/logger') . "\";"); eval("echo \"" . getTemplate("logger/logger") . "\";");
}
elseif($action == 'truncate')
{
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$yesterday = time() - (60 * 10);
} elseif ($action == 'truncate') { /* (60*60*24); */
if (isset($_POST['send']) $db->query("DELETE FROM `" . TABLE_PANEL_LOG . "` WHERE `date` < '" . $yesterday . "'");
&& $_POST['send'] == 'send' $log->logAction(ADM_ACTION, LOG_WARNING, "truncated the system-log (mysql)");
) { redirectTo($filename, Array('page' => $page, 's' => $s));
$truncatedate = time() - (60 * 10); }
$trunc_stmt = Database::prepare(" else
DELETE FROM `" . TABLE_PANEL_LOG . "` WHERE `date` < :trunc" {
);
Database::pexecute($trunc_stmt, array('trunc' => $truncatedate));
$log->logAction(ADM_ACTION, LOG_WARNING, 'truncated the system-log (mysql)');
redirectTo($filename, array('page' => $page, 's' => $s));
} else {
ask_yesno('logger_reallytruncate', $filename, array('page' => $page, 'action' => $action), TABLE_PANEL_LOG); ask_yesno('logger_reallytruncate', $filename, array('page' => $page, 'action' => $action), TABLE_PANEL_LOG);
} }
} }
} }
?>

View File

@@ -14,108 +14,135 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
require './lib/init.php';
if (isset($_POST['id'])) { /**
* Include our init.php, which manages Sessions, Language etc.
*/
require ("./lib/init.php");
if(isset($_POST['id']))
{
$id = intval($_POST['id']); $id = intval($_POST['id']);
} elseif (isset($_GET['id'])) { }
elseif(isset($_GET['id']))
{
$id = intval($_GET['id']); $id = intval($_GET['id']);
} }
if ($page == 'message') { if($page == 'message')
if ($action == '') { {
$log->logAction(ADM_ACTION, LOG_NOTICE, 'viewed panel_message'); if($action == '')
{
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed panel_message");
if (isset($_POST['send']) if(isset($_POST['send'])
&& $_POST['send'] == 'send' && $_POST['send'] == 'send')
) { {
if ($_POST['receipient'] == 0 if($_POST['receipient'] == 0
&& $userinfo['customers_see_all'] == '1' && $userinfo['customers_see_all'] == '1')
) { {
$log->logAction(ADM_ACTION, LOG_NOTICE, 'sending messages to admins'); $log->logAction(ADM_ACTION, LOG_NOTICE, "sending messages to admins");
$result = Database::query('SELECT `name`, `email` FROM `' . TABLE_PANEL_ADMINS . "`"); $result = $db->query('SELECT `name`, `email` FROM `' . TABLE_PANEL_ADMINS . "`");
} elseif ($_POST['receipient'] == 1) { }
if ($userinfo['customers_see_all'] == '1') { elseif($_POST['receipient'] == 1)
$log->logAction(ADM_ACTION, LOG_NOTICE, 'sending messages to ALL customers'); {
$result = Database::query('SELECT `firstname`, `name`, `company`, `email` FROM `' . TABLE_PANEL_CUSTOMERS . "`"); if($userinfo['customers_see_all'] == "1")
} else { {
$log->logAction(ADM_ACTION, LOG_NOTICE, 'sending messages to customers'); $log->logAction(ADM_ACTION, LOG_NOTICE, "sending messages to ALL customers");
$result = Database::prepare(' $result = $db->query('SELECT `firstname`, `name`, `email` FROM `' . TABLE_PANEL_CUSTOMERS . "`");
SELECT `firstname`, `name`, `company`, `email` FROM `' . TABLE_PANEL_CUSTOMERS . "`
WHERE `adminid` = :adminid"
);
Database::pexecute($result, array('adminid' => $userinfo['adminid']));
} }
} else { else
{
$log->logAction(ADM_ACTION, LOG_NOTICE, "sending messages to customers");
$result = $db->query('SELECT `firstname`, `name`, `email` FROM `' . TABLE_PANEL_CUSTOMERS . "` WHERE `adminid`='" . $userinfo['adminid'] . "'");
}
}
else
{
standard_error('noreceipientsgiven'); standard_error('noreceipientsgiven');
} }
$subject = $_POST['subject']; $subject = $_POST['subject'];
$message = wordwrap($_POST['message'], 70); $message = wordwrap($_POST['message'], 70);
if (!empty($message)) { if(!empty($message))
{
$mailcounter = 0; $mailcounter = 0;
$mail->Body = $message; $mail->Body = $message;
$mail->Subject = $subject; $mail->Subject = $subject;
while ($row = $result->fetch(PDO::FETCH_ASSOC)) { while($row = $db->fetch_array($result))
{
$row['firstname'] = isset($row['firstname']) ? $row['firstname'] : ''; $mail->AddAddress($row['email'], (isset($row['firstname']) ? $row['firstname'] . ' ' : '') . $row['name']);
$row['company'] = isset($row['company']) ? $row['company'] : '';
$mail->AddAddress($row['email'], getCorrectUserSalutation(array('firstname' => $row['firstname'], 'name' => $row['name'], 'company' => $row['company'])));
$mail->From = $userinfo['email']; $mail->From = $userinfo['email'];
$mail->FromName = (isset($userinfo['firstname']) ? $userinfo['firstname'] . ' ' : '') . $userinfo['name']; $mail->FromName = (isset($userinfo['firstname']) ? $userinfo['firstname'] . ' ' : '') . $userinfo['name'];
if (!$mail->Send()) { if(!$mail->Send())
if ($mail->ErrorInfo != '') { {
if($mail->ErrorInfo != '')
{
$mailerr_msg = $mail->ErrorInfo; $mailerr_msg = $mail->ErrorInfo;
} else { }
$mailerr_msg = $row['email']; else
{
$mailerr_msg = $row["email"];
} }
$log->logAction(ADM_ACTION, LOG_ERR, 'Error sending mail: ' . $mailerr_msg); $log->logAction(ADM_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
standard_error('errorsendingmail', $row['email']); standard_error('errorsendingmail', $row["email"]);
} }
$mailcounter++; $mailcounter++;
$mail->ClearAddresses(); $mail->ClearAddresses();
} }
redirectTo($filename, array('page' => $page, 's' => $s, 'action' => 'showsuccess', 'sentitems' => $mailcounter)); redirectTo($filename, Array('page' => $page, 's' => $s, 'action' => 'showsuccess', 'sentitems' => $mailcounter));
} else { }
else
{
standard_error('nomessagetosend'); standard_error('nomessagetosend');
} }
} }
} }
if ($action == 'showsuccess') { if($action == 'showsuccess')
{
$success = 1; $success = 1;
$sentitems = isset($_GET['sentitems']) ? (int)$_GET['sentitems'] : 0; $sentitems = isset($_GET['sentitems']) ? (int)$_GET['sentitems'] : 0;
if ($sentitems == 0) { if($sentitems == 0)
{
$successmessage = $lng['message']['noreceipients']; $successmessage = $lng['message']['noreceipients'];
} else { }
else
{
$successmessage = str_replace('%s', $sentitems, $lng['message']['success']); $successmessage = str_replace('%s', $sentitems, $lng['message']['success']);
} }
} else { $action = '';
}
else
{
$success = 0; $success = 0;
$sentitems = 0; $sentitems = 0;
$successmessage = ''; $successmessage = '';
$action = '';
} }
$action = '';
$receipients = ''; $receipients = '';
if ($userinfo['customers_see_all'] == '1') { if($userinfo['customers_see_all'] == "1")
{
$receipients.= makeoption($lng['panel']['reseller'], 0); $receipients.= makeoption($lng['panel']['reseller'], 0);
} }
$receipients .= makeoption($lng['panel']['customer'], 1); $receipients.= makeoption($lng['panel']['customer'], 1);
eval("echo \"" . getTemplate('message/message') . "\";"); eval("echo \"" . getTemplate("message/message") . "\";");
} }
?>

View File

@@ -1,158 +0,0 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Janos Muzsi <muzsij@hypernics.hu> (2016)
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel
*
* Based on https://github.com/amnuts/opcache-gui
*
*/
define('AREA', 'admin');
require './lib/init.php';
if ($action == 'reset' &&
function_exists('opcache_reset') &&
$userinfo['change_serversettings'] == '1'
) {
opcache_reset();
$log->logAction(ADM_ACTION, LOG_INFO, "reseted OPcache");
header('Location: ' . $linker->getLink(array('section' => 'opcacheinfo', 'page' => 'showinfo')));
exit();
}
if (!function_exists('opcache_get_configuration')
) {
standard_error($lng['error']['no_opcacheinfo']);
}
if ($page == 'showinfo'
) {
$opcache_info = opcache_get_configuration();
$opcache_status = opcache_get_status(false);
$time = time();
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed OPcache info");
$runtimelines = '';
if (isset($opcache_info['directives']) && is_array($opcache_info['directives'])) {
foreach ($opcache_info['directives'] as $name => $value) {
$linkname= str_replace('_', '-', $name);
if ($name=='opcache.optimization_level' && is_integer($value)) {
$value='0x'.dechex($value);
}
if ($name=='opcache.memory_consumption' && is_integer($value) && $value%(1024*1024)==0) {
$value=$value/(1024*1024);
}
if ($value===null || $value==='') {
$value=$lng['opcacheinfo']['novalue'];
}
if ($value===true) {
$value=$lng['opcacheinfo']['true'];
}
if ($value===false) {
$value=$lng['opcacheinfo']['false'];
}
if (is_integer($value)) {
$value=number_format($value,0,'.',' ');
}
$name=str_replace('_', ' ', $name);
eval("\$runtimelines.=\"" . getTemplate("settings/opcacheinfo/runtime_line") . "\";");
}
}
$cachehits=@$opcache_status['opcache_statistics']['hits'] ?: 0;
$cachemiss=@$opcache_status['opcache_statistics']['misses'] ?: 0;
$blacklistmiss=@$opcache_status['opcache_statistics']['blacklist_misses'] ?: 0;
$cachetotal=$cachehits+$cachemiss+$blacklistmiss;
$general=array(
'version' => (isset($opcache_info['version']['opcache_product_name']) ? $opcache_info['version']['opcache_product_name'].' ' : '').$opcache_info['version']['version'],
'phpversion' => phpversion(),
'start_time' => @$opcache_status['opcache_statistics']['start_time'] ? date('Y-m-d H:i:s',$opcache_status['opcache_statistics']['start_time']) : '',
'last_restart_time' => @$opcache_status['opcache_statistics']['last_restart_time'] ? date('Y-m-d H:i:s',$opcache_status['opcache_statistics']['last_restart_time']) : $lng['opcacheinfo']['never'],
'oom_restarts' => number_format(@$opcache_status['opcache_statistics']['oom_restarts'] ?: 0,0,'.',' '),
'hash_restarts' => number_format(@$opcache_status['opcache_statistics']['hash_restarts'] ?: 0,0,'.',' '),
'manual_restarts' => number_format(@$opcache_status['opcache_statistics']['manual_restarts'] ?: 0,0,'.',' '),
'status' => (@$opcache_status['restart_in_progress'] ? $lng['opcacheinfo']['restartinprogress'] :
(@$opcache_status['restart_pending'] ? $lng['opcacheinfo']['restartpending'] :
(@$opcache_status['cache_full'] ? $lng['opcacheinfo']['cachefull'] :
(@$opcache_status['opcache_enabled'] ? $lng['opcacheinfo']['enabled'] : $lng['opcacheinfo']['novalue'])))),
'cachedscripts' => number_format(@$opcache_status['opcache_statistics']['num_cached_scripts'] ?: 0,0,'.',' '),
'cachehits' => number_format($cachehits,0,'.',' ') . ($cachetotal>0 ? sprintf(" (%.1f %%)", $cachehits/($cachetotal)*100) : ''),
'cachemiss' => number_format($cachemiss,0,'.',' ') . ($cachetotal>0 ? sprintf(" (%.1f %%)", $cachemiss/($cachetotal)*100) : ''),
'blacklistmiss' => number_format($blacklistmiss,0,'.',' ') . ($cachetotal>0 ? sprintf(" (%.1f %%)", $blacklistmiss/($cachetotal)*100) : ''),
);
$usedmem=@$opcache_status['memory_usage']['used_memory'] ?: 0;
$usedmemstr=bsize($usedmem);
$freemem=@$opcache_status['memory_usage']['free_memory'] ?: 0;
$freememstr=bsize($freemem);
$totalmem=$usedmem+$freemem;
$wastedmem=@$opcache_status['memory_usage']['wasted_memory'] ?: 0;
$wastedmemstr=bsize($wastedmem);
if ($totalmem) {
$memory=array(
'total' => bsize($totalmem),
'used' => $usedmemstr . ($totalmem>0 ? sprintf(" (%.1f %%)", $usedmem/($totalmem)*100) : ''),
'free' => $freememstr . ($totalmem>0 ? sprintf(" (%.1f %%)", $freemem/($totalmem)*100) : ''),
'wasted' => $wastedmemstr . ($totalmem>0 ? sprintf(" (%.1f %%)", $wastedmem/($totalmem)*100) : ''),
);
}
if (isset($opcache_status['interned_strings_usage'])) {
$usedstring=@$opcache_status['interned_strings_usage']['used_memory'] ?: 0;
$usedstringstr=bsize($usedstring);
$freestring=@$opcache_status['interned_strings_usage']['free_memory'] ?: 0;
$freestringstr=bsize($freestring);
$totalstring=$usedstring+$freestring;
$stringbuffer=array(
'total' => bsize($totalstring),
'used' => $usedstringstr . ($totalstring>0 ? sprintf(" (%.1f %%)", $usedstring/$totalstring*100) : ''),
'free' => $freestringstr . ($totalstring>0 ? sprintf(" (%.1f %%)", $freestring/$totalstring*100) : ''),
'strcount' => number_format(@$opcache_status['interned_strings_usage']['number_of_strings'] ?: 0,0,'.',' '),
);
}
$usedkey=@$opcache_status['opcache_statistics']['num_cached_keys'] ?: 0;
$usedkeystr=number_format($usedkey,0,'.',' ');
$totalkey=@$opcache_status['opcache_statistics']['max_cached_keys'] ?: 0;
$wastedkey=$usedkey - (@$opcache_status['opcache_statistics']['num_cached_scripts'] ?: 0);
if (isset($opcache_status['opcache_statistics'])) {
$keystat=array(
'total' => number_format($totalkey,0,'.',' '),
'used' => $usedkeystr . ($totalkey>0 ? sprintf(" (%.1f %%)", $usedkey/($totalkey)*100) : ''),
'wasted' => number_format($wastedkey,0,'.',' ') . ($totalkey>0 ? sprintf(" (%.1f %%)", $wastedkey/($totalkey)*100) : ''),
);
}
$blacklistlines = '';
if (isset($opcache_info['blacklist']) && is_array($opcache_info['blacklist'])) {
foreach ($opcache_info['blacklist'] as $value) {
eval("\$blacklistlines.=\"" . getTemplate("settings/opcacheinfo/blacklist_line") . "\";");
}
}
eval("echo \"" . getTemplate("settings/opcacheinfo/showinfo") . "\";");
}
function bsize($s) {
foreach (array('', 'K', 'M', 'G') as $i => $k) {
if ($s < 1024)
break;
$s/=1024;
}
return sprintf("%5.1f %sBytes", $s, $k);
}

View File

@@ -14,85 +14,60 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
require './lib/init.php';
if (isset($_POST['id'])) { /**
* Include our init.php, which manages Sessions, Language etc.
*/
require ("./lib/init.php");
if(isset($_POST['id']))
{
$id = intval($_POST['id']); $id = intval($_POST['id']);
} elseif (isset($_GET['id'])) { }
elseif(isset($_GET['id']))
{
$id = intval($_GET['id']); $id = intval($_GET['id']);
} }
if ($page == 'overview') { if($page == 'overview')
{
if ($action == '') { if($action == '')
{
$tablecontent = ''; $tablecontent = '';
$count = 0; $result = $db->query("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "`");
$result = Database::query("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "`");
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
while($row = $db->fetch_array($result))
{
$domainresult = false; $domainresult = false;
$query_params = array('id' => $row['id']);
$query = "SELECT * FROM `".TABLE_PANEL_DOMAINS."` if((int)$userinfo['domains_see_all'] == 0)
WHERE `phpsettingid` = :id {
AND `parentdomainid` = '0'"; $domainresult = $db->query("SELECT * FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `adminid` = " . (int)$userinfo['userid'] . " AND `phpsettingid` = " . (int)$row['id']);
if ((int)$userinfo['domains_see_all'] == 0) {
$query .= " AND `adminid` = :adminid";
$query_params['adminid'] = $userinfo['adminid'];
} }
else
if ((int)Settings::Get('panel.phpconfigs_hidestdsubdomain') == 1) { {
$ssdids_res = Database::query(" $domainresult = $db->query("SELECT * FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `phpsettingid` = " . (int)$row['id']);
SELECT DISTINCT `standardsubdomain` FROM `".TABLE_PANEL_CUSTOMERS."`
WHERE `standardsubdomain` > 0 ORDER BY `standardsubdomain` ASC;"
);
$ssdids = array();
while ($ssd = $ssdids_res->fetch(PDO::FETCH_ASSOC)) {
$ssdids[] = $ssd['standardsubdomain'];
}
if (count($ssdids) > 0) {
$query .= " AND `id` NOT IN (".implode(', ', $ssdids).")";
}
} }
$domainresult_stmt = Database::prepare($query);
Database::pexecute($domainresult_stmt, $query_params);
$domains = ''; $domains = '';
if (Database::num_rows() > 0) {
while ($row2 = $domainresult_stmt->fetch(PDO::FETCH_ASSOC)) { if($db->num_rows($domainresult) > 0)
{
while($row2 = $db->fetch_array($domainresult))
{
$domains.= $row2['domain'] . '<br/>'; $domains.= $row2['domain'] . '<br/>';
} }
} }
else
// check whether we use that config as froxor-vhost config {
if (Settings::Get('system.mod_fcgid_defaultini_ownvhost') == $row['id']
|| Settings::Get('phpfpm.vhost_defaultini') == $row['id']
) {
$domains .= Settings::Get('system.hostname');
}
if ($domains == '') {
$domains = $lng['admin']['phpsettings']['notused']; $domains = $lng['admin']['phpsettings']['notused'];
} }
// check whether this is our default config
if ((Settings::Get('system.mod_fcgid') == '1'
&& Settings::Get('system.mod_fcgid_defaultini') == $row['id'])
|| (Settings::Get('phpfpm.enabled') == '1'
&& Settings::Get('phpfpm.defaultini') == $row['id'])
) {
$row['description'] = '<b>'.$row['description'].'</b>';
}
$count ++;
eval("\$tablecontent.=\"" . getTemplate("phpconfig/overview_overview") . "\";"); eval("\$tablecontent.=\"" . getTemplate("phpconfig/overview_overview") . "\";");
} }
@@ -100,245 +75,111 @@ if ($page == 'overview') {
eval("echo \"" . getTemplate("phpconfig/overview") . "\";"); eval("echo \"" . getTemplate("phpconfig/overview") . "\";");
} }
if ($action == 'add') { if($action == 'add')
{
if ((int)$userinfo['change_serversettings'] == 1) { if((int)$userinfo['change_serversettings'] == 1)
{
if (isset($_POST['send']) if(isset($_POST['send'])
&& $_POST['send'] == 'send' && $_POST['send'] == 'send')
) { {
$description = validate($_POST['description'], 'description'); $description = validate($_POST['description'], 'description');
$binary = makeCorrectFile(validate($_POST['binary'], 'binary'));
$file_extensions = validate($_POST['file_extensions'], 'file_extensions', '/^[a-zA-Z0-9\s]*$/');
$phpsettings = validate(str_replace("\r\n", "\n", $_POST['phpsettings']), 'phpsettings', '/^[^\0]*$/'); $phpsettings = validate(str_replace("\r\n", "\n", $_POST['phpsettings']), 'phpsettings', '/^[^\0]*$/');
$mod_fcgid_starter = validate($_POST['mod_fcgid_starter'], 'mod_fcgid_starter', '/^[0-9]*$/', '', array('-1', ''));
$mod_fcgid_maxrequests = validate($_POST['mod_fcgid_maxrequests'], 'mod_fcgid_maxrequests', '/^[0-9]*$/', '', array('-1', ''));
if (Settings::Get('system.mod_fcgid') == 1) { if(strlen($description) == 0
$binary = makeCorrectFile(validate($_POST['binary'], 'binary')); || strlen($description) > 50)
$file_extensions = validate($_POST['file_extensions'], 'file_extensions', '/^[a-zA-Z0-9\s]*$/'); {
$mod_fcgid_starter = validate($_POST['mod_fcgid_starter'], 'mod_fcgid_starter', '/^[0-9]*$/', '', array('-1', ''));
$mod_fcgid_maxrequests = validate($_POST['mod_fcgid_maxrequests'], 'mod_fcgid_maxrequests', '/^[0-9]*$/', '', array('-1', ''));
$mod_fcgid_umask = validate($_POST['mod_fcgid_umask'], 'mod_fcgid_umask', '/^[0-9]*$/');
// disable fpm stuff
$fpm_enableslowlog = 0;
$fpm_reqtermtimeout = 0;
$fpm_reqslowtimeout = 0;
}
elseif (Settings::Get('phpfpm.enabled') == 1) {
$fpm_enableslowlog = isset($_POST['phpfpm_enable_slowlog']) ? (int)$_POST['phpfpm_enable_slowlog'] : 0;
$fpm_reqtermtimeout = validate($_POST['phpfpm_reqtermtimeout'], 'phpfpm_reqtermtimeout', '/^([0-9]+)(|s|m|h|d)$/');
$fpm_reqslowtimeout = validate($_POST['phpfpm_reqslowtimeout'], 'phpfpm_reqslowtimeout', '/^([0-9]+)(|s|m|h|d)$/');
// disable fcgid stuff
$binary = '/usr/bin/php-cgi';
$file_extensions = 'php';
$mod_fcgid_starter = 0;
$mod_fcgid_maxrequests = 0;
$mod_fcgid_umask = "022";
}
if (strlen($description) == 0
|| strlen($description) > 50
) {
standard_error('descriptioninvalid'); standard_error('descriptioninvalid');
} }
$ins_stmt = Database::prepare(" $db->query("INSERT INTO `" . TABLE_PANEL_PHPCONFIGS . "` SET `description` = '" . $db->escape($description) . "', `binary` = '" . $db->escape($binary) . "', `file_extensions` = '" . $db->escape($file_extensions) . "', `mod_fcgid_starter` = '" . $db->escape($mod_fcgid_starter) . "', `mod_fcgid_maxrequests` = '" . $db->escape($mod_fcgid_maxrequests) . "', `phpsettings` = '" . $db->escape($phpsettings) . "'");
INSERT INTO `" . TABLE_PANEL_PHPCONFIGS . "` SET
`description` = :desc,
`binary` = :binary,
`file_extensions` = :fext,
`mod_fcgid_starter` = :starter,
`mod_fcgid_maxrequests` = :mreq,
`mod_fcgid_umask` = :umask,
`fpm_slowlog` = :fpmslow,
`fpm_reqterm` = :fpmreqterm,
`fpm_reqslow` = :fpmreqslow,
`phpsettings` = :phpsettings"
);
$ins_data = array(
'desc' => $description,
'binary' => $binary,
'fext' => $file_extensions,
'starter' => $mod_fcgid_starter,
'mreq' => $mod_fcgid_maxrequests,
'umask' => $mod_fcgid_umask,
'fpmslow' => $fpm_enableslowlog,
'fpmreqterm' => $fpm_reqtermtimeout,
'fpmreqslow' => $fpm_reqslowtimeout,
'phpsettings' => $phpsettings
);
Database::pexecute($ins_stmt, $ins_data);
inserttask('1'); inserttask('1');
$log->logAction(ADM_ACTION, LOG_INFO, "php.ini setting with description '" . $description . "' has been created by '" . $userinfo['loginname'] . "'"); $log->logAction(ADM_ACTION, LOG_INFO, "php.ini setting with description '" . $value . "' has been created by '" . $userinfo['loginname'] . "'");
redirectTo($filename, array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
}
} else { else
{
$result_stmt = Database::query("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = 1"); $result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = 1");
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
$phpconfig_add_data = include_once dirname(__FILE__).'/lib/formfields/admin/phpconfig/formfield.phpconfig_add.php';
$phpconfig_add_form = htmlform::genHTMLForm($phpconfig_add_data);
$title = $phpconfig_add_data['phpconfig_add']['title'];
$image = $phpconfig_add_data['phpconfig_add']['image'];
eval("echo \"" . getTemplate("phpconfig/overview_add") . "\";"); eval("echo \"" . getTemplate("phpconfig/overview_add") . "\";");
} }
}
} else { else
{
standard_error('nopermissionsorinvalidid'); standard_error('nopermissionsorinvalidid');
} }
} }
if ($action == 'delete') { if($action == 'delete')
{
$result_stmt = Database::prepare(" $result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = " . (int)$id);
SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = :id"
);
$result = Database::pexecute_first($result_stmt, array('id' => $id));
if ((Settings::Get('system.mod_fcgid') == '1'
&& Settings::Get('system.mod_fcgid_defaultini_ownvhost') == $id)
|| (Settings::Get('phpfpm.enabled') == '1'
&& Settings::Get('phpfpm.vhost_defaultini') == $id)
) {
standard_error('cannotdeletehostnamephpconfig');
}
if ((Settings::Get('system.mod_fcgid') == '1'
&& Settings::Get('system.mod_fcgid_defaultini') == $id)
|| (Settings::Get('phpfpm.enabled') == '1'
&& Settings::Get('phpfpm.defaultini') == $id)
) {
standard_error('cannotdeletedefaultphpconfig');
}
if ($result['id'] != 0
&& $result['id'] == $id
&& (int)$userinfo['change_serversettings'] == 1
&& $id != 1 // cannot delete the default php.config
) {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
// set php-config to default for all domains using the
// config that is to be deleted
$upd_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_DOMAINS . "` SET
`phpsettingid` = '1' WHERE `phpsettingid` = :id"
);
Database::pexecute($upd_stmt, array('id' => $id));
$del_stmt = Database::prepare("
DELETE FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = :id"
);
Database::pexecute($del_stmt, array('id' => $id));
if($result['id'] != 0
&& $result['id'] == $id
&& (int)$userinfo['change_serversettings'] == 1
&& $id != 1)
{
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$db->query("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET `phpsettingid` = 1 WHERE `phpsettingid` = " . (int)$id);
$db->query("DELETE FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = " . (int)$id);
inserttask('1'); inserttask('1');
$log->logAction(ADM_ACTION, LOG_INFO, "php.ini setting with id #" . (int)$id . " has been deleted by '" . $userinfo['loginname'] . "'"); $log->logAction(ADM_ACTION, LOG_INFO, "php.ini setting with id #" . (int)$id . " has been deleted by '" . $userinfo['loginname'] . "'");
redirectTo($filename, array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
}
} else { else
{
ask_yesno('phpsetting_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['description']); ask_yesno('phpsetting_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['description']);
} }
} else { }
else
{
standard_error('nopermissionsorinvalidid'); standard_error('nopermissionsorinvalidid');
} }
} }
if ($action == 'edit') { if($action == 'edit')
{
$result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = " . (int)$id);
$result_stmt = Database::prepare(" if($result['id'] != 0
SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = :id" && $result['id'] == $id
); && (int)$userinfo['change_serversettings'] == 1)
$result = Database::pexecute_first($result_stmt, array('id' => $id)); {
if(isset($_POST['send'])
if ($result['id'] != 0 && $_POST['send'] == 'send')
&& $result['id'] == $id {
&& (int)$userinfo['change_serversettings'] == 1
) {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$description = validate($_POST['description'], 'description'); $description = validate($_POST['description'], 'description');
$binary = makeCorrectFile(validate($_POST['binary'], 'binary'));
$file_extensions = validate($_POST['file_extensions'], 'file_extensions', '/^[a-zA-Z0-9\s]*$/');
$phpsettings = validate(str_replace("\r\n", "\n", $_POST['phpsettings']), 'phpsettings', '/^[^\0]*$/'); $phpsettings = validate(str_replace("\r\n", "\n", $_POST['phpsettings']), 'phpsettings', '/^[^\0]*$/');
$mod_fcgid_starter = validate($_POST['mod_fcgid_starter'], 'mod_fcgid_starter', '/^[0-9]*$/', '', array('-1', ''));
$mod_fcgid_maxrequests = validate($_POST['mod_fcgid_maxrequests'], 'mod_fcgid_maxrequests', '/^[0-9]*$/', '', array('-1', ''));
if (Settings::Get('system.mod_fcgid') == 1) { if(strlen($description) == 0
$binary = makeCorrectFile(validate($_POST['binary'], 'binary')); || strlen($description) > 50)
$file_extensions = validate($_POST['file_extensions'], 'file_extensions', '/^[a-zA-Z0-9\s]*$/'); {
$mod_fcgid_starter = validate($_POST['mod_fcgid_starter'], 'mod_fcgid_starter', '/^[0-9]*$/', '', array('-1', ''));
$mod_fcgid_maxrequests = validate($_POST['mod_fcgid_maxrequests'], 'mod_fcgid_maxrequests', '/^[0-9]*$/', '', array('-1', ''));
$mod_fcgid_umask = validate($_POST['mod_fcgid_umask'], 'mod_fcgid_umask', '/^[0-9]*$/');
// disable fpm stuff
$fpm_enableslowlog = 0;
$fpm_reqtermtimeout = 0;
$fpm_reqslowtimeout = 0;
}
elseif (Settings::Get('phpfpm.enabled') == 1) {
$fpm_enableslowlog = isset($_POST['phpfpm_enable_slowlog']) ? (int)$_POST['phpfpm_enable_slowlog'] : 0;
$fpm_reqtermtimeout = validate($_POST['phpfpm_reqtermtimeout'], 'phpfpm_reqtermtimeout', '/^([0-9]+)(|s|m|h|d)$/');
$fpm_reqslowtimeout = validate($_POST['phpfpm_reqslowtimeout'], 'phpfpm_reqslowtimeout', '/^([0-9]+)(|s|m|h|d)$/');
// disable fcgid stuff
$binary = '/usr/bin/php-cgi';
$file_extensions = 'php';
$mod_fcgid_starter = 0;
$mod_fcgid_maxrequests = 0;
$mod_fcgid_umask = "022";
}
if (strlen($description) == 0
|| strlen($description) > 50
) {
standard_error('descriptioninvalid'); standard_error('descriptioninvalid');
} }
$upd_stmt = Database::prepare(" $db->query("UPDATE `" . TABLE_PANEL_PHPCONFIGS . "` SET `description` = '" . $db->escape($description) . "', `binary` = '" . $db->escape($binary) . "', `file_extensions` = '" . $db->escape($file_extensions) . "', `mod_fcgid_starter` = '" . $db->escape($mod_fcgid_starter) . "', `mod_fcgid_maxrequests` = '" . $db->escape($mod_fcgid_maxrequests) . "', `phpsettings` = '" . $db->escape($phpsettings) . "' WHERE `id` = " . (int)$id);
UPDATE `" . TABLE_PANEL_PHPCONFIGS . "` SET
`description` = :desc,
`binary` = :binary,
`file_extensions` = :fext,
`mod_fcgid_starter` = :starter,
`mod_fcgid_maxrequests` = :mreq,
`mod_fcgid_umask` = :umask,
`fpm_slowlog` = :fpmslow,
`fpm_reqterm` = :fpmreqterm,
`fpm_reqslow` = :fpmreqslow,
`phpsettings` = :phpsettings
WHERE `id` = :id"
);
$upd_data = array(
'desc' => $description,
'binary' => $binary,
'fext' => $file_extensions,
'starter' => $mod_fcgid_starter,
'mreq' => $mod_fcgid_maxrequests,
'umask' => $mod_fcgid_umask,
'fpmslow' => $fpm_enableslowlog,
'fpmreqterm' => $fpm_reqtermtimeout,
'fpmreqslow' => $fpm_reqslowtimeout,
'phpsettings' => $phpsettings,
'id' => $id
);
Database::pexecute($upd_stmt, $upd_data);
inserttask('1'); inserttask('1');
$log->logAction(ADM_ACTION, LOG_INFO, "php.ini setting with description '" . $description . "' has been changed by '" . $userinfo['loginname'] . "'"); $log->logAction(ADM_ACTION, LOG_INFO, "php.ini setting with description '" . $description . "' has been changed by '" . $userinfo['loginname'] . "'");
redirectTo($filename, array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
}
} else { else
{
$phpconfig_edit_data = include_once dirname(__FILE__).'/lib/formfields/admin/phpconfig/formfield.phpconfig_edit.php';
$phpconfig_edit_form = htmlform::genHTMLForm($phpconfig_edit_data);
$title = $phpconfig_edit_data['phpconfig_edit']['title'];
$image = $phpconfig_edit_data['phpconfig_edit']['image'];
eval("echo \"" . getTemplate("phpconfig/overview_edit") . "\";"); eval("echo \"" . getTemplate("phpconfig/overview_edit") . "\";");
} }
}
} else { else
{
standard_error('nopermissionsorinvalidid'); standard_error('nopermissionsorinvalidid');
} }
} }
} }
?>

View File

@@ -14,279 +14,148 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
require './lib/init.php';
// get sql-root access data /**
Database::needRoot(true); * Include our init.php, which manages Sessions, Language etc.
Database::needSqlData(); */
$sql_root = Database::getSqlData();
Database::needRoot(false);
if ($page == 'overview' && $userinfo['change_serversettings'] == '1') { $need_db_sql_data = true;
$need_root_db_sql_data = true;
require ("./lib/init.php");
if(($page == 'settings' || $page == 'overview')
&& $userinfo['change_serversettings'] == '1')
{
$settings_data = loadConfigArrayDir('./actions/admin/settings/'); $settings_data = loadConfigArrayDir('./actions/admin/settings/');
$settings = loadSettings($settings_data); $settings = loadSettings(&$settings_data, &$db);
if (isset($_POST['send']) if(isset($_POST['send'])
&& $_POST['send'] == 'send' && $_POST['send'] == 'send')
) { {
if(processForm(&$settings_data, &$_POST, array('filename' => $filename, 'action' => $action, 'page' => $page)))
$_part = isset($_GET['part']) ? $_GET['part'] : ''; {
if ($_part == '') {
$_part = isset($_POST['part']) ? $_POST['part'] : '';
}
if ($_part != '') {
if ($_part == 'all') {
$settings_all = true;
$settings_part = false;
} else {
$settings_all = false;
$settings_part = true;
}
$only_enabledisable = false;
} else {
$settings_all = false;
$settings_part = false;
$only_enabledisable = true;
}
// check if the session timeout is too low #815
if (isset($_POST['session_sessiontimeout'])
&& $_POST['session_sessiontimeout'] < 60
) {
standard_error($lng['error']['session_timeout'], $lng['error']['session_timeout_desc']);
}
if (processFormEx(
$settings_data,
$_POST,
array('filename' => $filename, 'action' => $action, 'page' => $page),
$_part,
$settings_all,
$settings_part,
$only_enabledisable
)
) {
$log->logAction(ADM_ACTION, LOG_INFO, "rebuild configfiles due to changed setting");
inserttask('1');
// Using nameserver, insert a task which rebuilds the server config
inserttask('4');
standard_success('settingssaved', '', array('filename' => $filename, 'action' => $action, 'page' => $page)); standard_success('settingssaved', '', array('filename' => $filename, 'action' => $action, 'page' => $page));
} }
} else {
$_part = isset($_GET['part']) ? $_GET['part'] : '';
if ($_part == '') {
$_part = isset($_POST['part']) ? $_POST['part'] : '';
}
$fields = buildFormEx($settings_data, $_part);
$settings_page = '';
if ($_part == '') {
eval("\$settings_page .= \"" . getTemplate("settings/settings_overview") . "\";");
} else {
eval("\$settings_page .= \"" . getTemplate("settings/settings") . "\";");
}
eval("echo \"" . getTemplate("settings/settings_form_begin") . "\";");
eval("echo \$settings_page;");
eval("echo \"" . getTemplate("settings/settings_form_end") . "\";");
} }
else
} elseif($page == 'phpinfo' {
&& $userinfo['change_serversettings'] == '1' $fields = buildForm(&$settings_data);
) { eval("echo \"" . getTemplate("settings/settings") . "\";");
ob_start();
phpinfo();
$phpinfo = array('phpinfo' => array());
if (preg_match_all(
'#(?:<h2>(?:<a name=".*?">)?(.*?)(?:</a>)?</h2>)|(?:<tr(?: class=".*?")?><t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>)?)?</tr>)#s',
ob_get_clean(), $matches, PREG_SET_ORDER
)
) {
foreach ($matches as $match) {
$end = array_keys($phpinfo);
$end = end($end);
if (strlen($match[1])) {
$phpinfo[$match[1]] = array();
} elseif (isset($match[3])) {
$phpinfo[$end][$match[2]] = isset($match[4]) ? array($match[3], $match[4]) : $match[3];
} else {
$phpinfo[$end][] = $match[2];
}
}
$phpinfohtml = '';
foreach ($phpinfo as $name => $section) {
$phpinfoentries = "";
foreach ($section as $key => $val) {
if (is_array($val)) {
eval("\$phpinfoentries .= \"" . getTemplate("settings/phpinfo/phpinfo_3") . "\";");
} elseif (is_string($key)) {
eval("\$phpinfoentries .= \"" . getTemplate("settings/phpinfo/phpinfo_2") . "\";");
} else {
eval("\$phpinfoentries .= \"" . getTemplate("settings/phpinfo/phpinfo_1") . "\";");
}
}
// first header -> show actual php version
if (strtolower($name) == "phpinfo") {
$name = "PHP ".PHP_VERSION;
}
eval("\$phpinfohtml .= \"" . getTemplate("settings/phpinfo/phpinfo_table") . "\";");
}
$phpinfo = $phpinfohtml;
} else {
standard_error($lng['error']['no_phpinfo']);
} }
eval("echo \"" . getTemplate("settings/phpinfo") . "\";"); }
elseif($page == 'rebuildconfigs'
} elseif($page == 'rebuildconfigs' && $userinfo['change_serversettings'] == '1')
&& $userinfo['change_serversettings'] == '1' {
) { if(isset($_POST['send'])
if (isset($_POST['send']) && $_POST['send'] == 'send')
&& $_POST['send'] == 'send' {
) {
$log->logAction(ADM_ACTION, LOG_INFO, "rebuild configfiles"); $log->logAction(ADM_ACTION, LOG_INFO, "rebuild configfiles");
inserttask('1'); inserttask('1');
inserttask('10');
// Using nameserver, insert a task which rebuilds the server config
inserttask('4'); inserttask('4');
// cron.d file inserttask('5');
inserttask('99'); redirectTo('admin_index.php', array('s' => $s));
}
standard_success('rebuildingconfigs', '', array('filename' => 'admin_index.php')); else
{
} else {
ask_yesno('admin_configs_reallyrebuild', $filename, array('page' => $page)); ask_yesno('admin_configs_reallyrebuild', $filename, array('page' => $page));
} }
}
} elseif($page == 'updatecounters' elseif($page == 'updatecounters'
&& $userinfo['change_serversettings'] == '1' && $userinfo['change_serversettings'] == '1')
) { {
if(isset($_POST['send'])
if (isset($_POST['send']) && $_POST['send'] == 'send')
&& $_POST['send'] == 'send' {
) {
$log->logAction(ADM_ACTION, LOG_INFO, "updated resource-counters"); $log->logAction(ADM_ACTION, LOG_INFO, "updated resource-counters");
$updatecounters = updateCounters(true); $updatecounters = updateCounters(true);
$customers = ''; $customers = '';
foreach ($updatecounters['customers'] as $customerid => $customer) { foreach($updatecounters['customers'] as $customerid => $customer)
{
eval("\$customers.=\"" . getTemplate("settings/updatecounters_row_customer") . "\";"); eval("\$customers.=\"" . getTemplate("settings/updatecounters_row_customer") . "\";");
} }
$admins = ''; $admins = '';
foreach ($updatecounters['admins'] as $adminid => $admin) { foreach($updatecounters['admins'] as $adminid => $admin)
{
eval("\$admins.=\"" . getTemplate("settings/updatecounters_row_admin") . "\";"); eval("\$admins.=\"" . getTemplate("settings/updatecounters_row_admin") . "\";");
} }
eval("echo \"" . getTemplate("settings/updatecounters") . "\";"); eval("echo \"" . getTemplate("settings/updatecounters") . "\";");
}
} else { else
{
ask_yesno('admin_counters_reallyupdate', $filename, array('page' => $page)); ask_yesno('admin_counters_reallyupdate', $filename, array('page' => $page));
} }
}
} elseif ($page == 'wipecleartextmailpws' elseif($page == 'wipecleartextmailpws'
&& $userinfo['change_serversettings'] == '1' && $userinfo['change_serversettings'] == '1')
) { {
if(isset($_POST['send'])
if (isset($_POST['send']) && $_POST['send'] == 'send')
&& $_POST['send'] == 'send' {
) {
$log->logAction(ADM_ACTION, LOG_WARNING, "wiped all cleartext mail passwords"); $log->logAction(ADM_ACTION, LOG_WARNING, "wiped all cleartext mail passwords");
Database::query("UPDATE `" . TABLE_MAIL_USERS . "` SET `password` = '';"); $db->query("UPDATE `" . TABLE_MAIL_USERS . "` SET `password`='' ");
Database::query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '0' WHERE `settinggroup` = 'system' AND `varname` = 'mailpwcleartext'"); $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value`='0' WHERE `settinggroup`='system' AND `varname`='mailpwcleartext'");
redirectTo($filename, array('s' => $s)); redirectTo('admin_settings.php', array('s' => $s));
}
} else { else
{
ask_yesno('admin_cleartextmailpws_reallywipe', $filename, array('page' => $page)); ask_yesno('admin_cleartextmailpws_reallywipe', $filename, array('page' => $page));
} }
}
} elseif($page == 'wipequotas' elseif($page == 'wipequotas'
&& $userinfo['change_serversettings'] == '1' && $userinfo['change_serversettings'] == '1')
) { {
if(isset($_POST['send'])
if (isset($_POST['send']) && $_POST['send'] == 'send')
&& $_POST['send'] == 'send' {
) {
$log->logAction(ADM_ACTION, LOG_WARNING, "wiped all mailquotas"); $log->logAction(ADM_ACTION, LOG_WARNING, "wiped all mailquotas");
// Set the quota to 0 which means unlimited // Set the quota to 0 which means unlimited
Database::query("UPDATE `" . TABLE_MAIL_USERS . "` SET `quota` = '0';");
Database::query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `email_quota_used` = '0'");
redirectTo($filename, array('s' => $s));
} else { $db->query("UPDATE `" . TABLE_MAIL_USERS . "` SET `quota`='0' ");
$db->query("UPDATE " . TABLE_PANEL_CUSTOMERS . " SET `email_quota_used` = 0");
redirectTo('admin_settings.php', array('s' => $s));
}
else
{
ask_yesno('admin_quotas_reallywipe', $filename, array('page' => $page)); ask_yesno('admin_quotas_reallywipe', $filename, array('page' => $page));
} }
}
} elseif ($page == 'enforcequotas' elseif($page == 'enforcequotas'
&& $userinfo['change_serversettings'] == '1' && $userinfo['change_serversettings'] == '1')
) { {
if (isset($_POST['send']) if(isset($_POST['send'])
&& $_POST['send'] == 'send' && $_POST['send'] == 'send')
) { {
// Fetch all accounts // Fetch all accounts
$result_stmt = Database::query("SELECT `quota`, `customerid` FROM `" . TABLE_MAIL_USERS . "`");
if (Database::num_rows() > 0) { $result = $db->query("SELECT `quota`, `customerid` FROM " . TABLE_MAIL_USERS);
$upd_stmt = Database::prepare(" while($array = $db->fetch_array($result))
UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET {
`email_quota_used` = `email_quota_used` + :diff $difference = $settings['system']['mail_quota'] - $array['quota'];
WHERE `customerid` = :customerid $db->query("UPDATE " . TABLE_PANEL_CUSTOMERS . " SET `email_quota_used` = `email_quota_used` + " . (int)$difference . " WHERE `customerid` = '" . $array['customerid'] . "'");
");
while ($array = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
$difference = Settings::Get('system.mail_quota') - $array['quota'];
Database::pexecute($upd_stmt, array('diff' => $difference, 'customerid' => $customerid));
}
} }
// Set the new quota // Set the new quota
$upd_stmt = Database::prepare("
UPDATE `" . TABLE_MAIL_USERS . "` SET `quota` = :quota $db->query("UPDATE `" . TABLE_MAIL_USERS . "` SET `quota`='" . $settings['system']['mail_quota'] . "'");
");
Database::pexecute($upd_stmt, array('quota' => Settings::Get('system.mail_quota')));
// Update the Customer, if the used quota is bigger than the allowed quota // Update the Customer, if the used quota is bigger than the allowed quota
Database::query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `email_quota` = `email_quota_used` WHERE `email_quota` < `email_quota_used`");
$log->logAction(ADM_ACTION, LOG_WARNING, 'enforcing mailquota to all customers: ' . Settings::Get('system.mail_quota') . ' MB');
redirectTo($filename, array('s' => $s));
} else { $db->query("UPDATE " . TABLE_PANEL_CUSTOMERS . " SET `email_quota` = `email_quota_used` WHERE `email_quota` < `email_quota_used`");
$log->logAction(ADM_ACTION, LOG_WARNING, 'enforcing mailquota to all customers: ' . $settings['system']['mail_quota'] . ' MB');
redirectTo('admin_settings.php', array('s' => $s));
}
else
{
ask_yesno('admin_quotas_reallyenforce', $filename, array('page' => $page)); ask_yesno('admin_quotas_reallyenforce', $filename, array('page' => $page));
} }
} elseif ($page == 'integritycheck'
&& $userinfo['change_serversettings'] == '1'
) {
$integrity = new IntegrityCheck();
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$integrity->fixAll();
} elseif(isset($_GET['action'])
&& $_GET['action'] == "fix") {
ask_yesno('admin_integritycheck_reallyfix', $filename, array('page' => $page));
}
$integritycheck = '';
foreach ($integrity->available as $id => $check) {
$displayid = $id + 1;
$result = $integrity->$check();
$checkdesc = $lng['integrity_check'][$check];
eval("\$integritycheck.=\"" . getTemplate("settings/integritycheck_row") . "\";");
}
eval("echo \"" . getTemplate("settings/integritycheck") . "\";");
} }
?>

View File

@@ -14,83 +14,77 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
require './lib/init.php';
if (isset($_POST['subjectid'])) { /**
* Include our init.php, which manages Sessions, Language etc.
*/
require ("./lib/init.php");
if(isset($_POST['subjectid']))
{
$subjectid = intval($_POST['subjectid']); $subjectid = intval($_POST['subjectid']);
$mailbodyid = intval($_POST['mailbodyid']); $mailbodyid = intval($_POST['mailbodyid']);
}
} elseif(isset($_GET['subjectid'])) { elseif(isset($_GET['subjectid']))
{
$subjectid = intval($_GET['subjectid']); $subjectid = intval($_GET['subjectid']);
$mailbodyid = intval($_GET['mailbodyid']); $mailbodyid = intval($_GET['mailbodyid']);
} }
if (isset($_POST['id'])) { if(isset($_POST['id']))
{
$id = intval($_POST['id']); $id = intval($_POST['id']);
}
} elseif(isset($_GET['id'])) { elseif(isset($_GET['id']))
{
$id = intval($_GET['id']); $id = intval($_GET['id']);
} }
$available_templates = array( $available_templates = array(
'createcustomer', 'createcustomer',
'pop_success', 'pop_success',
'new_database_by_customer', 'trafficninetypercent',
'new_ftpaccount_by_customer', 'new_ticket_by_customer',
'password_reset' 'new_ticket_for_customer',
'new_ticket_by_staff',
'new_reply_ticket_by_customer',
'new_reply_ticket_by_staff'
); );
// only show templates of features that are enabled #1191
if ((int)Settings::Get('system.report_enable') == 1) {
array_push($available_templates,
'trafficmaxpercent',
'diskmaxpercent'
);
}
if ((int)Settings::Get('ticket.enabled') == 1) {
array_push($available_templates,
'new_ticket_by_customer',
'new_ticket_for_customer',
'new_ticket_by_staff',
'new_reply_ticket_by_customer',
'new_reply_ticket_by_staff'
);
}
$file_templates = array( $file_templates = array(
'index_html' 'index_html'
); );
if ($action == '') { if($action == '')
{
//email templates //email templates
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_templates"); $log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_templates");
if (Settings::Get('panel.sendalternativemail') == 1) { if($settings['panel']['sendalternativemail'] == 1)
{
$available_templates[] = 'pop_success_alternative'; $available_templates[] = 'pop_success_alternative';
} }
$templates_array = array(); $templates_array = array();
$result_stmt = Database::prepare(" $result = $db->query("SELECT `id`, `language`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `templategroup`='mails' ORDER BY `language`, `varname`");
SELECT `id`, `language`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `templategroup`='mails'
ORDER BY `language`, `varname`"
);
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid']));
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while($row = $db->fetch_array($result))
{
$parts = array(); $parts = array();
preg_match('/^([a-z]([a-z_]+[a-z])*)_(mailbody|subject)$/', $row['varname'], $parts); preg_match('/^([a-z]([a-z_]+[a-z])*)_(mailbody|subject)$/', $row['varname'], $parts);
$templates_array[$row['language']][$parts[1]][$parts[3]] = $row['id']; $templates_array[$row['language']][$parts[1]][$parts[3]] = $row['id'];
} }
$templates = ''; $templates = '';
foreach ($templates_array as $language => $template_defs) { foreach($templates_array as $language => $template_defs)
foreach ($template_defs as $action => $email) { {
foreach($template_defs as $action => $email)
{
$subjectid = $email['subject']; $subjectid = $email['subject'];
$mailbodyid = $email['mailbody']; $mailbodyid = $email['mailbody'];
$template = $lng['admin']['templates'][$action]; $template = $lng['admin']['templates'][$action];
@@ -99,417 +93,289 @@ if ($action == '') {
} }
$add = false; $add = false;
while (list($language_file, $language_name) = each($languages)) {
while(list($language_file, $language_name) = each($languages))
{
$templates_done = array(); $templates_done = array();
$result_stmt = Database::prepare(" $result = $db->query('SELECT `varname` FROM `' . TABLE_PANEL_TEMPLATES . '` WHERE `adminid`=\'' . (int)$userinfo['adminid'] . '\' AND `language`=\'' . $db->escape($language_name) . '\' AND `templategroup`=\'mails\' AND `varname` LIKE \'%_subject\'');
SELECT `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `language`= :lang
AND `templategroup` = 'mails' AND `varname` LIKE '%_subject'"
);
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'lang' => $language_name));
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while(($row = $db->fetch_array($result)) != false)
{
$templates_done[] = str_replace('_subject', '', $row['varname']); $templates_done[] = str_replace('_subject', '', $row['varname']);
} }
if (count(array_diff($available_templates, $templates_done)) > 0) { if(count(array_diff($available_templates, $templates_done)) > 0)
{
$add = true; $add = true;
} }
} }
//filetemplates //filetemplates
$filetemplates = ''; $filetemplates = '';
$filetemplateadd = false; $filetemplateadd = false;
$result_stmt = Database::prepare(" $result = $db->query("SELECT `id`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `templategroup`='files'");
SELECT `id`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `templategroup`='files'"
);
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid']));
if (Database::num_rows() != count($file_templates)) { if($db->num_rows($result) != count($file_templates))$filetemplateadd = true;
$filetemplateadd = true;
}
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while($row = $db->fetch_array($result))
{
eval("\$filetemplates.=\"" . getTemplate("templates/templates_filetemplate") . "\";"); eval("\$filetemplates.=\"" . getTemplate("templates/templates_filetemplate") . "\";");
} }
eval("echo \"" . getTemplate("templates/templates") . "\";"); eval("echo \"" . getTemplate("templates/templates") . "\";");
}
} elseif($action == 'delete' elseif($action == 'delete'
&& $subjectid != 0 && $subjectid != 0
&& $mailbodyid != 0 && $mailbodyid != 0)
) { {
//email templates //email templates
$result_stmt = Database::prepare("
SELECT `language`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `id` = :id"
);
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'id' => $subjectid));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
if ($result['varname'] != '') { $result = $db->query_first("SELECT `language`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `id`='" . (int)$subjectid . "'");
if (isset($_POST['send'])
&& $_POST['send'] == 'send' if($result['varname'] != '')
) { {
$del_stmt = Database::prepare(" if(isset($_POST['send'])
DELETE FROM `" . TABLE_PANEL_TEMPLATES . "` && $_POST['send'] == 'send')
WHERE `adminid` = :adminid {
AND (`id` = :ida OR `id` = :idb)" $db->query("DELETE FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND (`id`='" . (int)$subjectid . "' OR `id`='" . (int)$mailbodyid . "')");
);
Database::pexecute($del_stmt, array(
'adminid' => $userinfo['adminid'],
'ida' => $subjectid,
'idb' => $mailbodyid
));
$log->logAction(ADM_ACTION, LOG_INFO, "deleted template '" . $result['language'] . ' - ' . $lng['admin']['templates'][str_replace('_subject', '', $result['varname'])] . "'"); $log->logAction(ADM_ACTION, LOG_INFO, "deleted template '" . $result['language'] . ' - ' . $lng['admin']['templates'][str_replace('_subject', '', $result['varname'])] . "'");
redirectTo($filename, array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
}
} else { else
{
ask_yesno('admin_template_reallydelete', $filename, array('subjectid' => $subjectid, 'mailbodyid' => $mailbodyid, 'page' => $page, 'action' => $action), $result['language'] . ' - ' . $lng['admin']['templates'][str_replace('_subject', '', $result['varname'])]); ask_yesno('admin_template_reallydelete', $filename, array('subjectid' => $subjectid, 'mailbodyid' => $mailbodyid, 'page' => $page, 'action' => $action), $result['language'] . ' - ' . $lng['admin']['templates'][str_replace('_subject', '', $result['varname'])]);
} }
} }
}
} elseif($action == 'deletef' elseif($action == 'delete'
&& $id != 0 && $id != 0)
) { {
//file templates //file templates
$result_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `id` = :id"
);
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'id' => $id));
if (Database::num_rows() > 0) { $result = $db->query("SELECT * FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `id`='" . (int)$id . "'");
$row = $result_stmt->fetch(PDO::FETCH_ASSOC); if($db->num_rows($result) > 0)
{
$row = $db->fetch_array($result);
if (isset($_POST['send']) if(isset($_POST['send'])
&& $_POST['send'] == 'send' && $_POST['send'] == 'send')
) { {
$del_stmt = Database::prepare(" $db->query("DELETE FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `adminid`=" . (int)$userinfo['adminid'] . " AND `id`=" . (int)$id . "");
DELETE FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `id` = :id"
);
Database::pexecute($del_stmt, array('adminid' => $userinfo['adminid'], 'id' => $id));
$log->logAction(ADM_ACTION, LOG_INFO, "deleted template '" . $lng['admin']['templates'][$row['varname']] . "'"); $log->logAction(ADM_ACTION, LOG_INFO, "deleted template '" . $lng['admin']['templates'][$row['varname']] . "'");
redirectTo($filename, array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
}
} else { else
{
ask_yesno('admin_template_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $lng['admin']['templates'][$row['varname']]); ask_yesno('admin_template_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $lng['admin']['templates'][$row['varname']]);
} }
} else {
standard_error('templatenotfound');
} }
else
} elseif($action == 'add') { {
standard_error('templatenotfound');
if (Settings::Get('panel.sendalternativemail') == 1) { exit;
}
}
elseif($action == 'add')
{
if($settings['panel']['sendalternativemail'] == 1)
{
$available_templates[] = 'pop_success_alternative'; $available_templates[] = 'pop_success_alternative';
} }
if (isset($_POST['prepare']) if(isset($_POST['prepare'])
&& $_POST['prepare'] == 'prepare' && $_POST['prepare'] == 'prepare')
) { {
//email templates //email templates
$language = htmlentities(validate($_POST['language'], 'language', '/^[^\r\n\0"\']+$/', 'nolanguageselect'));
$template = validate($_POST['template'], 'template');
$lng_bak = $lng; $language = validate($_POST['language'], 'language');
foreach ($langs['English'] as $key => $value) {
include_once makeSecurePath($value['file']);
}
if ($language != 'English') {
foreach ($langs[$language] as $key => $value) {
include makeSecurePath($value['file']);
}
}
$subject = $lng['mails'][$template]['subject'];
$body = str_replace('\n', "\n", $lng['mails'][$template]['mailbody']);
$lng = $lng_bak;
$template_add_data = include_once dirname(__FILE__).'/lib/formfields/admin/templates/formfield.template_add.php';
$template_add_form = htmlform::genHTMLForm($template_add_data);
$title = $template_add_data['template_add']['title'];
$image = $template_add_data['template_add']['image'];
eval("echo \"" . getTemplate("templates/templates_add_2") . "\";");
} elseif(isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
//email templates
$language = htmlentities(validate($_POST['language'], 'language', '/^[^\r\n\0"\']+$/', 'nolanguageselect'));
$template = validate($_POST['template'], 'template');
$subject = validate($_POST['subject'], 'subject', '/^[^\r\n\0]+$/', 'nosubjectcreate');
$mailbody = validate($_POST['mailbody'], 'mailbody', '/^[^\0]+$/', 'nomailbodycreate');
$templates = array(); $templates = array();
$result_stmt = Database::prepare(" $result = $db->query('SELECT `varname` FROM `' . TABLE_PANEL_TEMPLATES . '` WHERE `adminid`=\'' . (int)$userinfo['adminid'] . '\' AND `language`=\'' . $db->escape($language) . '\' AND `templategroup`=\'mails\' AND `varname` LIKE \'%_subject\'');
SELECT `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `language` = :lang
AND `templategroup` = 'mails' AND `varname` LIKE '%_subject'"
);
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'lang' => $language));
while($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while(($row = $db->fetch_array($result)) != false)
{
$templates[] = str_replace('_subject', '', $row['varname']); $templates[] = str_replace('_subject', '', $row['varname']);
} }
$templates = array_diff($available_templates, $templates); $templates = array_diff($available_templates, $templates);
if (array_search($template, $templates) === false) { $template_options = '';
standard_error('templatenotfound'); foreach($templates as $template)
{
} else { $template_options.= makeoption($lng['admin']['templates'][$template], $template, NULL, true);
$ins_stmt = Database::prepare("
INSERT INTO `" . TABLE_PANEL_TEMPLATES . "` SET
`adminid` = :adminid,
`language` = :lang,
`templategroup` = 'mails',
`varname` = :var,
`value` = :value"
);
// mail-subject
$ins_data = array(
'adminid' => $userinfo['adminid'],
'lang' => $language,
'var' => $template.'_subject',
'value' => $subject
);
Database::pexecute($ins_stmt, $ins_data);
// mail-body
$ins_data = array(
'adminid' => $userinfo['adminid'],
'lang' => $language,
'var' => $template.'_mailbody',
'value' => $mailbody
);
Database::pexecute($ins_stmt, $ins_data);
$log->logAction(ADM_ACTION, LOG_INFO, "added template '" . $language . ' - ' . $template . "'");
redirectTo($filename, array('page' => $page, 's' => $s));
} }
} elseif(isset($_POST['filesend']) eval("echo \"" . getTemplate("templates/templates_add_2") . "\";");
&& $_POST['filesend'] == 'filesend' }
) { elseif(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
//email templates
$language = validate($_POST['language'], 'language', '/^[^\r\n\0"\']+$/', 'nolanguageselect');
$template = validate($_POST['template'], 'template');
$subject = validate($_POST['subject'], 'subject', '/^[^\r\n\0]+$/', 'nosubjectcreate');
$mailbody = validate($_POST['mailbody'], 'mailbody', '/^[^\0]+$/', 'nomailbodycreate');
$templates = array();
$result = $db->query('SELECT `varname` FROM `' . TABLE_PANEL_TEMPLATES . '` WHERE `adminid`=\'' . (int)$userinfo['adminid'] . '\' AND `language`=\'' . $db->escape($language) . '\' AND `templategroup`=\'mails\' AND `varname` LIKE \'%_subject\'');
while(($row = $db->fetch_array($result)) != false)
{
$templates[] = str_replace('_subject', '', $row['varname']);
}
$templates = array_diff($available_templates, $templates);
if(array_search($template, $templates) === false)
{
standard_error('templatenotfound');
}
else
{
$result = $db->query("INSERT INTO `" . TABLE_PANEL_TEMPLATES . "` (`adminid`, `language`, `templategroup`, `varname`, `value`)
VALUES ('" . (int)$userinfo['adminid'] . "', '" . $db->escape($language) . "', 'mails', '" . $db->escape($template) . "_subject','" . $db->escape($subject) . "')");
$result = $db->query("INSERT INTO `" . TABLE_PANEL_TEMPLATES . "` (`adminid`, `language`, `templategroup`, `varname`, `value`)
VALUES ('" . (int)$userinfo['adminid'] . "', '" . $db->escape($language) . "', 'mails', '" . $db->escape($template) . "_mailbody','" . $db->escape($mailbody) . "')");
$log->logAction(ADM_ACTION, LOG_INFO, "added template '" . $language . ' - ' . $template . "'");
redirectTo($filename, Array('page' => $page, 's' => $s));
}
}
elseif(isset($_POST['filesend'])
&& $_POST['filesend'] == 'filesend')
{
//file templates //file templates
$template = validate($_POST['template'], 'template'); $template = validate($_POST['template'], 'template');
$filecontent = validate($_POST['filecontent'], 'filecontent', '/^[^\0]+$/', 'filecontentnotset'); $filecontent = validate($_POST['filecontent'], 'filecontent', '/^[^\0]+$/', 'filecontentnotset');
$db->query("INSERT INTO `" . TABLE_PANEL_TEMPLATES . "` (`adminid`, `language`, `templategroup`, `varname`, `value`)
$ins_stmt = Database::prepare(" VALUES ('" . (int)$userinfo['adminid'] . "', '', 'files', '" . $db->escape($template) . "','" . $db->escape($filecontent) . "')");
INSERT INTO `" . TABLE_PANEL_TEMPLATES . "` SET
`adminid` = :adminid,
`language` = '',
`templategroup` = 'files',
`varname` = :var,
`value` = :value"
);
$ins_data = array(
'adminid' => $userinfo['adminid'],
'var' => $template,
'value' => $filecontent
);
Database::pexecute($ins_stmt, $ins_data);
$log->logAction(ADM_ACTION, LOG_INFO, "added template '" . $template . "'"); $log->logAction(ADM_ACTION, LOG_INFO, "added template '" . $template . "'");
redirectTo($filename, array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
}
} elseif(!isset($_GET['files'])) { elseif(!isset($_GET['files']))
{
//email templates //email templates
$add = false; $add = false;
$language_options = ''; $language_options = '';
$template_options = '';
while (list($language_file, $language_name) = each($languages)) { while(list($language_file, $language_name) = each($languages))
{
$templates = array(); $templates = array();
$result_stmt = Database::prepare(" $result = $db->query('SELECT `varname` FROM `' . TABLE_PANEL_TEMPLATES . '` WHERE `adminid`=\'' . (int)$userinfo['adminid'] . '\' AND `language`=\'' . $db->escape($language_name) . '\' AND `templategroup`=\'mails\' AND `varname` LIKE \'%_subject\'');
SELECT `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `language` = :lang
AND `templategroup` = 'mails' AND `varname` LIKE '%_subject'"
);
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'lang' => $language_name));
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while(($row = $db->fetch_array($result)) != false)
{
$templates[] = str_replace('_subject', '', $row['varname']); $templates[] = str_replace('_subject', '', $row['varname']);
} }
if (count(array_diff($available_templates, $templates)) > 0) { if(count(array_diff($available_templates, $templates)) > 0)
{
$add = true; $add = true;
$language_options.= makeoption($language_name, $language_file, $userinfo['language'], true, true); $language_options.= makeoption($language_name, $language_file, $userinfo['language'], true);
$templates = array_diff($available_templates, $templates);
foreach ($templates as $template) {
$template_options.= makeoption($lng['admin']['templates'][$template], $template, NULL, true, true, $language_file) . "\n";
}
} }
} }
if ($add) { if($add)
{
eval("echo \"" . getTemplate("templates/templates_add_1") . "\";"); eval("echo \"" . getTemplate("templates/templates_add_1") . "\";");
} else {
standard_error('alltemplatesdefined');
} }
else
} else { {
//filetemplates
$result_stmt = Database::prepare("
SELECT `id`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `templategroup`='files'"
);
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid']));
if (Database::num_rows() == count($file_templates)) {
standard_error('alltemplatesdefined'); standard_error('alltemplatesdefined');
exit;
}
}
else
{
//filetemplates
} else { $result = $db->query("SELECT `id`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `templategroup`='files'");
if($db->num_rows($result) == count($file_templates))
{
standard_error('alltemplatesdefined');
exit;
}
else
{
$templatesdefined = array(); $templatesdefined = array();
$free_templates = ''; $free_templates = '';
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while($row = $db->fetch_array($result))$templatesdefined[] = $row['varname'];
$templatesdefined[] = $row['varname']; foreach(array_diff($file_templates, $templatesdefined) as $template)
} {
foreach (array_diff($file_templates, $templatesdefined) as $template) {
$free_templates.= makeoption($lng['admin']['templates'][$template], $template, '', true); $free_templates.= makeoption($lng['admin']['templates'][$template], $template, '', true);
} }
$filetemplate_add_data = include_once dirname(__FILE__).'/lib/formfields/admin/templates/formfield.filetemplate_add.php';
$filetemplate_add_form = htmlform::genHTMLForm($filetemplate_add_data);
$title = $filetemplate_add_data['filetemplate_add']['title'];
$image = $filetemplate_add_data['filetemplate_add']['image'];
eval("echo \"" . getTemplate("templates/filetemplates_add") . "\";"); eval("echo \"" . getTemplate("templates/filetemplates_add") . "\";");
} }
} }
}
} elseif($action == 'edit' elseif($action == 'edit'
&& $subjectid != 0 && $subjectid != 0
&& $mailbodyid != 0 && $mailbodyid != 0)
) { {
//email templates //email templates
$result_stmt = Database::prepare("
SELECT `language`, `varname`, `value` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `id` = :subjectid"
);
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'subjectid' => $subjectid));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
if ($result['varname'] != '') { $result = $db->query_first("SELECT `language`, `varname`, `value` FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `id`='" . (int)$subjectid . "'");
if (isset($_POST['send']) if($result['varname'] != '')
&& $_POST['send'] == 'send' {
) { if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$subject = validate($_POST['subject'], 'subject', '/^[^\r\n\0]+$/', 'nosubjectcreate'); $subject = validate($_POST['subject'], 'subject', '/^[^\r\n\0]+$/', 'nosubjectcreate');
$mailbody = validate($_POST['mailbody'], 'mailbody', '/^[^\0]+$/', 'nomailbodycreate'); $mailbody = validate($_POST['mailbody'], 'mailbody', '/^[^\0]+$/', 'nomailbodycreate');
$db->query("UPDATE `" . TABLE_PANEL_TEMPLATES . "` SET `value`='" . $db->escape($subject) . "' WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `id`='" . (int)$subjectid . "'");
$upd_stmt = Database::prepare(" $db->query("UPDATE `" . TABLE_PANEL_TEMPLATES . "` SET `value`='" . $db->escape($mailbody) . "' WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `id`='" . (int)$mailbodyid . "'");
UPDATE `" . TABLE_PANEL_TEMPLATES . "` SET
`value` = :value
WHERE `adminid` = :adminid AND `id` = :id"
);
// subject
Database::pexecute($upd_stmt, array(
'value' => $subject,
'adminid' => $userinfo['adminid'],
'id' => $subjectid
));
// same query but mailbody
Database::pexecute($upd_stmt, array(
'value' => $mailbody,
'adminid' => $userinfo['adminid'],
'id' => $mailbodyid
));
$log->logAction(ADM_ACTION, LOG_INFO, "edited template '" . $result['varname'] . "'"); $log->logAction(ADM_ACTION, LOG_INFO, "edited template '" . $result['varname'] . "'");
redirectTo($filename, array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
}
} else { else
{
$result = htmlentities_array($result); $result = htmlentities_array($result);
$template = $lng['admin']['templates'][str_replace('_subject', '', $result['varname'])]; $template = $lng['admin']['templates'][str_replace('_subject', '', $result['varname'])];
$subject = $result['value']; $subject = $result['value'];
$result_stmt = Database::prepare(" $result = $db->query_first("SELECT `language`, `varname`, `value` FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `id`='$mailbodyid'");
SELECT `language`, `varname`, `value`
FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `id` = :id"
);
Database::pexecute($result_stmt, array('id' => $mailbodyid));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
$template_name = str_replace('_mailbody', '', $result['varname']);
// don't escape the already escaped language-string so save up before htmlentities()
$language = $result['language'];
$result = htmlentities_array($result); $result = htmlentities_array($result);
$mailbody = $result['value']; $mailbody = $result['value'];
$template_edit_data = include_once dirname(__FILE__).'/lib/formfields/admin/templates/formfield.template_edit.php';
$template_edit_form = htmlform::genHTMLForm($template_edit_data);
$title = $template_edit_data['template_edit']['title'];
$image = $template_edit_data['template_edit']['image'];
eval("echo \"" . getTemplate("templates/templates_edit") . "\";"); eval("echo \"" . getTemplate("templates/templates_edit") . "\";");
} }
} }
}
} elseif($action == 'editf' elseif($action == 'edit'
&& $id != 0 && $id != 0)
) { {
//file templates //file templates
$result_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `id` = :id"
);
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'id' => $id));
if(Database::num_rows() > 0) { $result = $db->query("SELECT * FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `id`='" . (int)$id . "'");
$row = $result_stmt->fetch(PDO::FETCH_ASSOC); if($db->num_rows($result) > 0)
{
$row = $db->fetch_array($result);
//filetemplates //filetemplates
if (isset($_POST['filesend'])
&& $_POST['filesend'] == 'filesend' if(isset($_POST['filesend'])
) { && $_POST['filesend'] == 'filesend')
{
$filecontent = validate($_POST['filecontent'], 'filecontent', '/^[^\0]+$/', 'filecontentnotset'); $filecontent = validate($_POST['filecontent'], 'filecontent', '/^[^\0]+$/', 'filecontentnotset');
$upd_stmt = Database::prepare(" $db->query("UPDATE `" . TABLE_PANEL_TEMPLATES . "` SET `value`='" . $db->escape($filecontent) . "' WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `id`='" . (int)$id . "'");
UPDATE `" . TABLE_PANEL_TEMPLATES . "` SET
`value` = :value
WHERE `adminid` = :adminid AND `id` = :id"
);
Database::pexecute($upd_stmt, array(
'value' => $filecontent,
'adminid' => $userinfo['adminid'],
'id' => $id
));
$log->logAction(ADM_ACTION, LOG_INFO, "edited template '" . $row['varname'] . "'"); $log->logAction(ADM_ACTION, LOG_INFO, "edited template '" . $row['varname'] . "'");
redirectTo($filename, array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
}
} else { else
{
$row = htmlentities_array($row); $row = htmlentities_array($row);
$filetemplate_edit_data = include_once dirname(__FILE__).'/lib/formfields/admin/templates/formfield.filetemplate_edit.php';
$filetemplate_edit_form = htmlform::genHTMLForm($filetemplate_edit_data);
$title = $filetemplate_edit_data['filetemplate_edit']['title'];
$image = $filetemplate_edit_data['filetemplate_edit']['image'];
eval("echo \"" . getTemplate("templates/filetemplates_edit") . "\";"); eval("echo \"" . getTemplate("templates/filetemplates_edit") . "\";");
} }
}
} else { else
{
standard_error('templatenotfound'); standard_error('templatenotfound');
exit;
} }
} }
?>

File diff suppressed because it is too large Load Diff

View File

@@ -1,141 +0,0 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2003-2009 the SysCP Team (see authors).
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Morton Jonuschat <m.jonuschat@chrome-it.de>
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
* @package Panel
*
*/
define('AREA', 'admin');
require './lib/init.php';
if ($action == 'logout') {
$logout_stmt = Database::prepare("
DELETE FROM `" . TABLE_PANEL_SESSIONS . "`
WHERE `userid` = :adminid
AND `adminsession` = '1'"
);
Database::pexecute($logout_stmt, array('adminid' => $userinfo['adminid']));
redirectTo('index.php');
}
if (isset($_POST['id'])) {
$id = intval($_POST['id']);
} elseif(isset($_GET['id'])) {
$id = intval($_GET['id']);
}
$months = array(
'0' => 'empty',
'1' => 'jan',
'2' => 'feb',
'3' => 'mar',
'4' => 'apr',
'5' => 'may',
'6' => 'jun',
'7' => 'jul',
'8' => 'aug',
'9' => 'sep',
'10' => 'oct',
'11' => 'nov',
'12' => 'dec',
);
if ($page == 'overview' || $page == 'customers') {
$customerview = 1;
$stats_tables = '';
$minyear_stmt = Database::query("SELECT `year` FROM `". TABLE_PANEL_TRAFFIC . "` ORDER BY `year` ASC LIMIT 1");
$minyear = $minyear_stmt->fetch(PDO::FETCH_ASSOC);
if (!isset($minyear['year']) || $minyear['year'] == 0) {
$maxyears = 0;
} else {
$maxyears = date("Y") - $minyear['year'];
}
for ($years = 0; $years<=$maxyears; $years++) {
$overview['year'] = date("Y")-$years;
$overview['type'] = $lng['traffic']['customer'];
$domain_list = '';
$totals = array(
'jan' => 0,
'feb' => 0,
'mar' => 0,
'apr' => 0,
'may' => 0,
'jun' => 0,
'jul' => 0,
'aug' => 0,
'sep' => 0,
'oct' => 0,
'nov' => 0,
'dec' => 0,
);
$customer_name_list_stmt = Database::prepare("
SELECT `customerid`,`company`,`name`,`firstname`
FROM `" . TABLE_PANEL_CUSTOMERS . "`
WHERE `deactivated`='0'" .
($userinfo['customers_see_all'] ? '' : " AND `adminid` = :id") . "
ORDER BY name"
);
Database::pexecute($customer_name_list_stmt, array('id' => $userinfo['adminid']));
while($customer_name = $customer_name_list_stmt->fetch(PDO::FETCH_ASSOC)) {
$virtual_host = array(
'name' => ($customer_name['company'] == '' ? $customer_name['name'] . ", " . $customer_name['firstname'] : $customer_name['company']),
'customerid' => $customer_name['customerid'],
'jan' => '-',
'feb' => '-',
'mar' => '-',
'apr' => '-',
'may' => '-',
'jun' => '-',
'jul' => '-',
'aug' => '-',
'sep' => '-',
'oct' => '-',
'nov' => '-',
'dec' => '-',
);
$traffic_list_stmt = Database::prepare("
SELECT month, SUM(http+ftp_up+ftp_down+mail)*1024 AS traffic
FROM `" . TABLE_PANEL_TRAFFIC . "`
WHERE year = :year AND `customerid` = :id
GROUP BY month ORDER BY month"
);
Database::pexecute($traffic_list_stmt, array('year' => (date("Y")-$years), 'id' => $customer_name['customerid']));
while ($traffic_month = $traffic_list_stmt->fetch(PDO::FETCH_ASSOC)) {
$virtual_host[$months[(int)$traffic_month['month']]] = size_readable($traffic_month['traffic'], 'GiB', 'bi', '%01.'.(int)Settings::Get('panel.decimal_places').'f %s');
$totals[$months[(int)$traffic_month['month']]] += $traffic_month['traffic'];
}
eval("\$domain_list .= sprintf(\"%s\", \"" . getTemplate("traffic/index_table_row") . "\");");
}
// sum up totals
$virtual_host = array(
'name' => $lng['traffic']['months']['total'],
);
foreach ($totals as $month => $bytes) {
$virtual_host[$month] = ($bytes == 0 ? '-' : size_readable($bytes, 'GiB', 'bi', '%01.'.(int)Settings::Get('panel.decimal_places').'f %s'));
}
$customerview = 0;
eval("\$total_list = sprintf(\"%s\", \"" . getTemplate("traffic/index_table_row") . "\");");
eval("\$stats_tables .= sprintf(\"%s\", \"" . getTemplate("traffic/index_table") . "\");");
}
eval("echo \"" . getTemplate("traffic/index") . "\";");
}

View File

@@ -12,110 +12,56 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
require './lib/init.php'; require ("./lib/init.php");
if ($page == 'overview') { if($page == 'overview')
{
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_updates"); $log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_updates");
/** if(hasUpdates($version))
* this is a dirty hack but syscp 1.4.2.1 does not {
* have any version/dbversion in the database (don't know why) if(isset($_POST['send'])
* so we have to set them both to run a correct upgrade && $_POST['send'] == 'send')
*/ {
if (!isFroxlor()) {
if (Settings::Get('panel.version') == null eval("echo \"" . getTemplate("update/update_start") . "\";");
|| Settings::Get('panel.version') == ''
) { include_once('./install/updatesql.php');
Settings::Set('panel.version', '1.4.2.1');
$redirect_url = 'admin_index.php';
eval("echo \"" . getTemplate("update/update_end") . "\";");
updateCounters();
inserttask('1');
@chmod('./lib/userdata.inc.php', 0440);
} }
if (Settings::Get('system.dbversion') == null else
|| Settings::Get('system.dbversion') == '' {
) { $current_version = $settings['panel']['version'];
/** $new_version = $version;
* for syscp-stable (1.4.2.1) this value has to be 0
* so the required table-fields are added correctly $ui_text = $lng['update']['update_information'];
* and the svn-version has its value in the database $ui_text = str_replace('%curversion', $current_version, $ui_text);
* -> bug #54 $ui_text = str_replace('%newversion', $new_version, $ui_text);
*/ $update_information = $ui_text;
$result_stmt = Database::query("
SELECT `value` FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `varname` = 'dbversion'" eval("echo \"" . getTemplate("update/index") . "\";");
);
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
if (isset($result['value'])) {
Settings::Set('system.dbversion', (int)$result['value'], false);
} else {
Settings::Set('system.dbversion', 0, false);
}
} }
} }
else
{
/*
* @TODO version-webcheck check here
*/
if (hasDbUpdates($dbversion) || hasUpdates($version)) {
$successful_update = false;
$message = '';
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
if ((isset($_POST['update_preconfig'])
&& isset($_POST['update_changesagreed'])
&& intval($_POST['update_changesagreed']) != 0)
|| !isset($_POST['update_preconfig'])
) {
eval("echo \"" . getTemplate('update/update_start') . "\";");
include_once './install/updatesql.php';
$redirect_url = 'admin_index.php?s=' . $s;
eval("echo \"" . getTemplate('update/update_end') . "\";");
updateCounters();
inserttask('1');
@chmod('./lib/userdata.inc.php', 0440);
$successful_update = true;
} else {
$message = '<br /><strong class="red">You have to agree that you have read the update notifications.</strong>';
}
}
if (!$successful_update) {
$current_version = Settings::Get('panel.version');
$current_db_version = Settings::Get('panel.db_version');
if (empty($current_db_version)) {
$current_db_version = "0";
}
$new_version = $version;
$new_db_version = $dbversion;
$ui_text = $lng['update']['update_information']['part_a'];
if ($version != $current_version) {
$ui_text = str_replace('%curversion', $current_version, $ui_text);
$ui_text = str_replace('%newversion', $new_version, $ui_text);
} else {
// show db version
$ui_text = str_replace('%curversion', $current_db_version, $ui_text);
$ui_text = str_replace('%newversion', $new_db_version, $ui_text);
}
$update_information = $ui_text;
include_once './install/updates/preconfig.php';
$preconfig = getPreConfig($current_version, $current_db_version);
if ($preconfig != '') {
$update_information .= '<br />' . $preconfig . $message;
}
$update_information .= $lng['update']['update_information']['part_b'];
eval("echo \"" . getTemplate('update/index') . "\";");
}
} else {
$success_message = $lng['update']['noupdatesavail']; $success_message = $lng['update']['noupdatesavail'];
$redirect_url = 'admin_index.php?s=' . $s; $redirect_url = 'admin_index.php';
eval("echo \"" . getTemplate('update/noupdatesavail') . "\";"); eval("echo \"" . getTemplate("update/noupdatesavail") . "\";");
} }
} }
?>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 369 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 387 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 280 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 287 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

File diff suppressed because one or more lines are too long

34
customer_aps.php Normal file
View File

@@ -0,0 +1,34 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2003-2009 the SysCP Team (see authors).
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Florian Lippert <flo@syscp.org> (2003-2009)
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel
* @version $Id$
*/
// Required code
define('AREA', 'customer');
require ("./lib/init.php");
$Id = 0;
if(isset($_GET['id']))$Id = (int)$_GET['id'];
if(isset($_POST['id']))$Id = (int)$_POST['id'];
eval("echo \"" . getTemplate("aps/header") . "\";");
$Aps = new ApsParser($userinfo, $settings, $db);
$Aps->MainHandler($action);
eval("echo \"" . getTemplate("aps/footer") . "\";");
?>

306
customer_autoresponder.php Normal file
View File

@@ -0,0 +1,306 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2003-2009 the SysCP Team (see authors).
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Florian Lippert <flo@syscp.org> (2003-2009)
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel
* @version $Id$
*/
// Required code
define('AREA', 'customer');
require ("./lib/init.php");
// Create new autoresponder
if($action == "add")
{
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$account = trim($_POST['account']);
$subject = trim($_POST['subject']);
$message = trim($_POST['message']);
$date_from_off = isset($_POST['date_from_off']) ? -1 : 0;
$date_until_off = isset($_POST['date_until_off']) ? -1 : 0;
/*
* @TODO validate date (DD-MM-YYYY)
*/
$ts_from = -1;
$ts_until = -1;
if($date_from_off > -1)
{
$date_from = $_POST['date_from'];
$ts_from = mktime(0, 0, 0, substr($date_from, 3, 2), substr($date_from, 0, 2), substr($date_from, 6, 4));
}
if($date_until_off > -1)
{
$date_until = $_POST['date_until'];
$ts_until = mktime(0, 0, 0, substr($date_until, 3, 2), substr($date_until, 0, 2), substr($date_until, 6, 4));
}
if(empty($account)
|| empty($subject)
|| empty($message))
{
standard_error('missingfields');
}
// Does account exist?
$result = $db->query("SELECT `email` FROM `" . TABLE_MAIL_USERS . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' AND `email` = '" . $db->escape($account) . "' LIMIT 0,1");
if($db->num_rows($result) == 0)
{
standard_error('accountnotexisting');
}
// Does autoresponder exist?
$result = $db->query("SELECT `email` FROM `" . TABLE_MAIL_AUTORESPONDER . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' AND `email` = '" . $db->escape($account) . "' LIMIT 0,1");
if($db->num_rows($result) == 1)
{
standard_error('autoresponderalreadyexists');
}
$db->query("INSERT INTO `" . TABLE_MAIL_AUTORESPONDER . "`
SET `email` = '" . $db->escape($account) . "',
`message` = '" . $db->escape($message) . "',
`enabled` = '" . (int)$_POST['active'] . "',
`date_from` = '" . (int)$ts_from . "',
`date_until` = '" . (int)$ts_until . "',
`subject` = '" . $db->escape($subject) . "',
`customerid` = '" . $db->escape((int)$userinfo['customerid']) . "'
");
redirectTo($filename, Array('s' => $s));
}
// Get accounts
$result = $db->query("SELECT `email` FROM `" . TABLE_MAIL_USERS . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' AND `email` NOT IN (SELECT `email` FROM `" . TABLE_MAIL_AUTORESPONDER . "`) ORDER BY email ASC");
if($db->num_rows($result) == 0)
{
standard_error('noemailaccount');
}
$accounts = '';
while($row = $db->fetch_array($result))
{
$accounts.= "<option value=\"" . $row['email'] . "\">" . $row['email'] . "</option>";
}
$date_from_off = makecheckbox('date_from_off', $lng['panel']['not_activated'], '-1', false, '-1', true, true);
$date_until_off = makecheckbox('date_from_off', $lng['panel']['not_activated'], '-1', false, '-1', true, true);
eval("echo \"" . getTemplate("email/autoresponder_add") . "\";");
}
// Edit autoresponder
else
if($action == "edit")
{
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$account = trim($_POST['account']);
$subject = trim($_POST['subject']);
$message = trim($_POST['message']);
$date_from_off = isset($_POST['date_from_off']) ? -1 : 0;
$date_until_off = isset($_POST['date_until_off']) ? -1 : 0;
/*
* @TODO validate date (DD-MM-YYYY)
*/
$ts_from = -1;
$ts_until = -1;
if($date_from_off > -1)
{
$date_from = $_POST['date_from'];
$ts_from = mktime(0, 0, 0, substr($date_from, 3, 2), substr($date_from, 0, 2), substr($date_from, 6, 4));
}
if($date_until_off > -1)
{
$date_until = $_POST['date_until'];
$ts_until = mktime(0, 0, 0, substr($date_until, 3, 2), substr($date_until, 0, 2), substr($date_until, 6, 4));
}
if(empty($account)
|| empty($subject)
|| empty($message))
{
standard_error('missingfields');
}
// Does account exist?
$result = $db->query("SELECT `email` FROM `" . TABLE_MAIL_USERS . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' AND `email` = '" . $db->escape($account) . "' LIMIT 0,1");
if($db->num_rows($result) == 0)
{
standard_error('accountnotexisting');
}
// Does autoresponder exist?
$result = $db->query("SELECT `email` FROM `" . TABLE_MAIL_AUTORESPONDER . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' AND `email` = '" . $db->escape($account) . "' LIMIT 0,1");
if($db->num_rows($result) == 0)
{
standard_error('invalidautoresponder');
}
$ResponderActive = 0;
if(isset($_POST['active'])
&& $_POST['active'] == '1')
{
$ResponderActive = 1;
}
$db->query("UPDATE `" . TABLE_MAIL_AUTORESPONDER . "`
SET `message` = '" . $db->escape($message) . "',
`enabled` = '" . (int)$ResponderActive . "',
`date_from` = '" . (int)$ts_from . "',
`date_until` = '" . (int)$ts_until . "',
`subject` = '" . $db->escape($subject) . "'
WHERE `email` = '" . $db->escape($account) . "'
AND `customerid` = '" . $db->escape((int)$userinfo['customerid']) . "'
");
redirectTo($filename, Array('s' => $s));
}
$email = trim(htmlspecialchars($_GET['email']));
// Get account data
$result = $db->query("SELECT * FROM `" . TABLE_MAIL_AUTORESPONDER . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' AND `email` = '" . $db->escape($email) . "' LIMIT 0,1");
if($db->num_rows($result) == 0)
{
standard_error('invalidautoresponder');
}
$row = $db->fetch_array($result);
$subject = htmlspecialchars($row['subject']);
$message = htmlspecialchars($row['message']);
$date_from = (int)$row['date_from'];
$date_until = (int)$row['date_until'];
if($date_from == -1)
{
$deactivated = '-1';
}
else
{
$deactivated = '0';
$date_from = date('d-m-Y', $date_from);
}
$date_from_off = makecheckbox('date_from_off', $lng['panel']['not_activated'], '-1', false, $deactivated, true, true);
if($date_until == -1)
{
$deactivated = '-1';
$date_until = '-1';
}
else
{
$deactivated = '0';
$date_until = date('d-m-Y', $date_until);
}
$date_from_off = makecheckbox('date_until_off', $lng['panel']['not_activated'], '-1', false, $deactivated, true, true);
$checked = '';
if($row['enabled'] == 1)
{
$checked = "checked=\"checked\"";
}
eval("echo \"" . getTemplate("email/autoresponder_edit") . "\";");
}
// Delete autoresponder
else
if($action == "delete")
{
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$account = trim($_POST['account']);
// Does autoresponder exist?
$result = $db->query("SELECT `email` FROM `" . TABLE_MAIL_AUTORESPONDER . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' AND `email` = '" . $db->escape($account) . "' LIMIT 0,1");
if($db->num_rows($result) == 0)
{
standard_error('invalidautoresponder');
}
$db->query("DELETE FROM `" . TABLE_MAIL_AUTORESPONDER . "`
WHERE `email` = '" . $db->escape($account) . "'
AND `customerid` = '" . $db->escape((int)$userinfo['customerid']) . "'
");
redirectTo($filename, Array('s' => $s));
}
$email = trim(htmlspecialchars($_GET['email']));
ask_yesno('autoresponderdelete', $filename, array('action' => $action, 'account' => $email));
}
// List existing autoresponders
else
{
$autoresponder = '';
$result = $db->query("SELECT * FROM `" . TABLE_MAIL_AUTORESPONDER . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' ORDER BY email ASC");
while($row = $db->fetch_array($result))
{
if($row['date_from'] == -1 && $row['date_until'] == -1)
{
$activated_date = $lng['panel']['not_activated'];
}
elseif($row['date_from'] == -1 && $row['date_until'] != -1)
{
$activated_date = $lng['autoresponder']['date_until'].': '.date('d-m-Y', $row['date_until']);
}
elseif($row['date_from'] != -1 && $row['date_until'] == -1)
{
$activated_date = $lng['autoresponder']['date_from'].': '.date('d-m-Y', $row['date_from']);
}
else
{
$activated_date = date('d-m-Y', $row['date_from']) . ' - ' . date('d-m-Y', $row['date_until']);
}
eval("\$autoresponder.=\"" . getTemplate("email/autoresponder_autoresponder") . "\";");
}
eval("echo \"" . getTemplate("email/autoresponder") . "\";");
}
?>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -14,45 +14,43 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'customer'); define('AREA', 'customer');
require './lib/init.php';
// redirect if this customer page is hidden via settings /**
if (Settings::IsInList('panel.customer_hide_options','extras')) { * Include our init.php, which manages Sessions, Language etc.
redirectTo('customer_index.php'); */
}
if (isset($_POST['id'])) { require ("./lib/init.php");
if(isset($_POST['id']))
{
$id = intval($_POST['id']); $id = intval($_POST['id']);
} elseif (isset($_GET['id'])) { }
elseif(isset($_GET['id']))
{
$id = intval($_GET['id']); $id = intval($_GET['id']);
} }
if ($page == 'overview') { if($page == 'overview')
{
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_extras"); $log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_extras");
eval("echo \"" . getTemplate("extras/extras") . "\";"); eval("echo \"" . getTemplate("extras/extras") . "\";");
} elseif ($page == 'htpasswds') { }
elseif($page == 'htpasswds')
// redirect if this customer sub-page is hidden via settings {
if (Settings::IsInList('panel.customer_hide_options','extras.directoryprotection')) { if($action == '')
redirectTo('customer_index.php'); {
}
if ($action == '') {
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_extras::htpasswds"); $log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_extras::htpasswds");
$fields = array( $fields = array(
'username' => $lng['login']['username'], 'username' => $lng['login']['username'],
'path' => $lng['panel']['path'] 'path' => $lng['panel']['path']
); );
$paging = new paging($userinfo, TABLE_PANEL_HTPASSWDS, $fields); $paging = new paging($userinfo, $db, TABLE_PANEL_HTPASSWDS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_HTPASSWDS . "` $result = $db->query("SELECT `id`, `username`, `path` FROM `" . TABLE_PANEL_HTPASSWDS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
WHERE `customerid`= :customerid " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit()); $paging->setEntries($db->num_rows($result));
Database::pexecute($result_stmt, array(
"customerid" => $userinfo['customerid']
));
$paging->setEntries(Database::num_rows());
$sortcode = $paging->getHtmlSortCode($lng); $sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s); $arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng); $searchcode = $paging->getHtmlSearchCode($lng);
@@ -61,241 +59,173 @@ if ($page == 'overview') {
$count = 0; $count = 0;
$htpasswds = ''; $htpasswds = '';
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while($row = $db->fetch_array($result))
if ($paging->checkDisplay($i)) { {
if (strpos($row['path'], $userinfo['documentroot']) === 0) { if($paging->checkDisplay($i))
$row['path'] = str_replace($userinfo['documentroot'], "/", $row['path']); {
if(strpos($row['path'], $userinfo['documentroot']) === 0)
{
$row['path'] = substr($row['path'], strlen($userinfo['documentroot']));
} }
$row['path'] = makeCorrectDir($row['path']);
$row = htmlentities_array($row); $row = htmlentities_array($row);
eval("\$htpasswds.=\"" . getTemplate("extras/htpasswds_htpasswd") . "\";"); eval("\$htpasswds.=\"" . getTemplate("extras/htpasswds_htpasswd") . "\";");
$count ++; $count++;
} }
$i ++; $i++;
} }
eval("echo \"" . getTemplate("extras/htpasswds") . "\";"); eval("echo \"" . getTemplate("extras/htpasswds") . "\";");
} elseif ($action == 'delete' && $id != 0) { }
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_HTPASSWDS . "` elseif($action == 'delete'
WHERE `customerid`= :customerid && $id != 0)
AND `id`= :id"); {
Database::pexecute($result_stmt, array( $result = $db->query_first("SELECT `id`, `customerid`, `username`, `path` FROM `" . TABLE_PANEL_HTPASSWDS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
"customerid" => $userinfo['customerid'],
"id" => $id
));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
if (isset($result['username']) && $result['username'] != '') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_HTPASSWDS . "`
WHERE `customerid`= :customerid
AND `id`= :id");
Database::pexecute($stmt, array(
"customerid" => $userinfo['customerid'],
"id" => $id
));
if(isset($result['username'])
&& $result['username'] != '')
{
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$db->query("DELETE FROM `" . TABLE_PANEL_HTPASSWDS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='$id'");
$log->logAction(USR_ACTION, LOG_INFO, "deleted htpasswd for '" . $result['username'] . " (" . $result['path'] . ")'"); $log->logAction(USR_ACTION, LOG_INFO, "deleted htpasswd for '" . $result['username'] . " (" . $result['path'] . ")'");
inserttask('1'); inserttask('1');
redirectTo($filename, array( redirectTo($filename, Array('page' => $page, 's' => $s));
'page' => $page, }
's' => $s else
)); {
} else { if(strpos($result['path'], $userinfo['documentroot']) === 0)
if (strpos($result['path'], $userinfo['documentroot']) === 0) { {
$result['path'] = str_replace($userinfo['documentroot'], "/", $result['path']); $result['path'] = substr($result['path'], strlen($userinfo['documentroot']));
} }
ask_yesno('extras_reallydelete', $filename, array( ask_yesno('extras_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['username'] . ' (' . $result['path'] . ')');
'id' => $id,
'page' => $page,
'action' => $action
), $result['username'] . ' (' . $result['path'] . ')');
} }
} }
} elseif ($action == 'add') { }
if (isset($_POST['send']) && $_POST['send'] == 'send') { elseif($action == 'add')
{
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$path = makeCorrectDir(validate($_POST['path'], 'path')); $path = makeCorrectDir(validate($_POST['path'], 'path'));
$userpath = $path; $userpath = $path;
$path = makeCorrectDir($userinfo['documentroot'] . '/' . $path); $path = makeCorrectDir($userinfo['documentroot'] . '/' . $path);
$username = validate($_POST['username'], 'username', '/^[a-zA-Z0-9][a-zA-Z0-9\-_]+\$?$/'); $username = validate($_POST['username'], 'username', '/^[a-zA-Z0-9][a-zA-Z0-9\-_]+\$?$/');
$authname = validate($_POST['directory_authname'], 'directory_authname', '/^[a-zA-Z0-9][a-zA-Z0-9\-_ ]+\$?$/');
validate($_POST['directory_password'], 'password'); validate($_POST['directory_password'], 'password');
$username_path_check = $db->query_first("SELECT `id`, `username`, `path` FROM `" . TABLE_PANEL_HTPASSWDS . "` WHERE `username`='" . $db->escape($username) . "' AND `path`='" . $db->escape($path) . "' AND `customerid`='" . (int)$userinfo['customerid'] . "'");
$username_path_check_stmt = Database::prepare("SELECT `id`, `username`, `path` FROM `" . TABLE_PANEL_HTPASSWDS . "` if(CRYPT_STD_DES == 1)
WHERE `username`= :username {
AND `path`= :path
AND `customerid`= :customerid");
$params = array(
"username" => $username,
"path" => $path,
"customerid" => $userinfo['customerid']
);
Database::pexecute($username_path_check_stmt, $params);
$username_path_check = $username_path_check_stmt->fetch(PDO::FETCH_ASSOC);
if (CRYPT_STD_DES == 1) {
$saltfordescrypt = substr(md5(uniqid(microtime(), 1)), 4, 2); $saltfordescrypt = substr(md5(uniqid(microtime(), 1)), 4, 2);
$password = crypt($_POST['directory_password'], $saltfordescrypt); $password = crypt($_POST['directory_password'], $saltfordescrypt);
} else { }
else
{
$password = crypt($_POST['directory_password']); $password = crypt($_POST['directory_password']);
} }
if (! $_POST['path']) { if(!$_POST['path'])
{
standard_error('invalidpath'); standard_error('invalidpath');
} }
if ($username == '') { if($username == '')
standard_error(array( {
'stringisempty', standard_error(array('stringisempty', 'myloginname'));
'myloginname' }
)); elseif($username_path_check['username'] == $username
} elseif ($username_path_check['username'] == $username && $username_path_check['path'] == $path) { && $username_path_check['path'] == $path)
{
standard_error('userpathcombinationdupe'); standard_error('userpathcombinationdupe');
} elseif ($_POST['directory_password'] == '') { }
standard_error(array( elseif($_POST['directory_password'] == '')
'stringisempty', {
'mypassword' standard_error(array('stringisempty', 'mypassword'));
)); }
} elseif ($path == '') { elseif($path == '')
{
standard_error('patherror'); standard_error('patherror');
} elseif ($_POST['directory_password'] == $username) { }
standard_error('passwordshouldnotbeusername'); else
} else { {
$stmt = Database::prepare("INSERT INTO `" . TABLE_PANEL_HTPASSWDS . "` SET $db->query("INSERT INTO `" . TABLE_PANEL_HTPASSWDS . "` (`customerid`, `username`, `password`, `path`) VALUES ('" . (int)$userinfo['customerid'] . "', '" . $db->escape($username) . "', '" . $db->escape($password) . "', '" . $db->escape($path) . "')");
`customerid` = :customerid,
`username` = :username,
`password` = :password,
`path` = :path,
`authname` = :authname");
$params = array(
"customerid" => $userinfo['customerid'],
"username" => $username,
"password" => $password,
"path" => $path,
"authname" => $authname
);
Database::pexecute($stmt, $params);
$log->logAction(USR_ACTION, LOG_INFO, "added htpasswd for '" . $username . " (" . $path . ")'"); $log->logAction(USR_ACTION, LOG_INFO, "added htpasswd for '" . $username . " (" . $path . ")'");
inserttask('1'); inserttask('1');
redirectTo($filename, array( redirectTo($filename, Array('page' => $page, 's' => $s));
'page' => $page,
's' => $s
));
} }
} else { }
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']); else
{
$htpasswd_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/extras/formfield.htpasswd_add.php'; $pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit']);
$htpasswd_add_form = htmlform::genHTMLForm($htpasswd_add_data);
$title = $htpasswd_add_data['htpasswd_add']['title'];
$image = $htpasswd_add_data['htpasswd_add']['image'];
eval("echo \"" . getTemplate("extras/htpasswds_add") . "\";"); eval("echo \"" . getTemplate("extras/htpasswds_add") . "\";");
} }
} elseif ($action == 'edit' && $id != 0) { }
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_HTPASSWDS . "` elseif($action == 'edit'
WHERE `customerid`= :customerid && $id != 0)
AND `id`= :id"); {
Database::pexecute($result_stmt, array( $result = $db->query_first("SELECT `id`, `username`, `path` FROM `" . TABLE_PANEL_HTPASSWDS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
"customerid" => $userinfo['customerid'],
"id" => $id
));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
if (isset($result['username']) && $result['username'] != '') { if(isset($result['username'])
if (isset($_POST['send']) && $_POST['send'] == 'send') { && $result['username'] != '')
{
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
validate($_POST['directory_password'], 'password'); validate($_POST['directory_password'], 'password');
$authname = validate($_POST['directory_authname'], 'directory_authname', '/^[a-zA-Z0-9][a-zA-Z0-9\-_ ]+\$?$/');
if (CRYPT_STD_DES == 1) { if(CRYPT_STD_DES == 1)
{
$saltfordescrypt = substr(md5(uniqid(microtime(), 1)), 4, 2); $saltfordescrypt = substr(md5(uniqid(microtime(), 1)), 4, 2);
$password = crypt($_POST['directory_password'], $saltfordescrypt); $password = crypt($_POST['directory_password'], $saltfordescrypt);
} else { }
else
{
$password = crypt($_POST['directory_password']); $password = crypt($_POST['directory_password']);
} }
if ($_POST['directory_password'] == $result['username']) { if($_POST['directory_password'] == '')
standard_error('passwordshouldnotbeusername'); {
standard_error(array('stringisempty', 'mypassword'));
} }
else
$params = array( {
"customerid" => $userinfo['customerid'], $db->query("UPDATE `" . TABLE_PANEL_HTPASSWDS . "` SET `password`='" . $db->escape($password) . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
"id" => $id
);
$pwd_sql = '';
if ($_POST['directory_password'] != '') {
$pwd_sql = "`password`= :password ";
$params["password"] = $password;
}
$auth_sql = '';
if ($authname != $result['authname']) {
$auth_sql = "`authname`= :authname ";
$params["authname"] = $authname;
}
if ($pwd_sql != '' || $auth_sql != '') {
if ($pwd_sql != '' && $auth_sql != '') {
$pwd_sql .= ', ';
}
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_HTPASSWDS . "`
SET " . $pwd_sql . $auth_sql . "
WHERE `customerid`= :customerid
AND `id`= :id");
Database::pexecute($stmt, $params);
$log->logAction(USR_ACTION, LOG_INFO, "edited htpasswd for '" . $result['username'] . " (" . $result['path'] . ")'"); $log->logAction(USR_ACTION, LOG_INFO, "edited htpasswd for '" . $result['username'] . " (" . $result['path'] . ")'");
inserttask('1'); inserttask('1');
redirectTo($filename, array( redirectTo($filename, Array('page' => $page, 's' => $s));
'page' => $page,
's' => $s
));
} }
} else { }
if (strpos($result['path'], $userinfo['documentroot']) === 0) { else
$result['path'] = str_replace($userinfo['documentroot'], "/", $result['path']); {
if(strpos($result['path'], $userinfo['documentroot']) === 0)
{
$result['path'] = substr($result['path'], strlen($userinfo['documentroot']));
} }
$result = htmlentities_array($result); $result = htmlentities_array($result);
$htpasswd_edit_data = include_once dirname(__FILE__) . '/lib/formfields/customer/extras/formfield.htpasswd_edit.php';
$htpasswd_edit_form = htmlform::genHTMLForm($htpasswd_edit_data);
$title = $htpasswd_edit_data['htpasswd_edit']['title'];
$image = $htpasswd_edit_data['htpasswd_edit']['image'];
eval("echo \"" . getTemplate("extras/htpasswds_edit") . "\";"); eval("echo \"" . getTemplate("extras/htpasswds_edit") . "\";");
} }
} }
} }
} elseif ($page == 'htaccess') { }
elseif($page == 'htaccess')
// redirect if this customer sub-page is hidden via settings {
if (Settings::IsInList('panel.customer_hide_options','extras.pathoptions')) { if($action == '')
redirectTo('customer_index.php'); {
}
if ($action == '') {
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_extras::htaccess"); $log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_extras::htaccess");
$fields = array( $fields = array(
'path' => $lng['panel']['path'], 'path' => $lng['panel']['path'],
'options_indexes' => $lng['extras']['view_directory'], 'options_indexes' => $lng['extras']['view_directory'],
'error404path' => $lng['extras']['error404path'], 'error404path' => $lng['extras']['error404path'],
'error403path' => $lng['extras']['error403path'], 'error403path' => $lng['extras']['error403path'],
'error500path' => $lng['extras']['error500path'], 'error500path' => $lng['extras']['error500path']
'options_cgi' => $lng['extras']['execute_perl']
); );
$paging = new paging($userinfo, TABLE_PANEL_HTACCESS, $fields); $paging = new paging($userinfo, $db, TABLE_PANEL_HTACCESS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_HTACCESS . "` $result = $db->query("SELECT `id`, `path`, `options_indexes`, `error404path`, `error403path`, `error500path` FROM `" . TABLE_PANEL_HTACCESS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
WHERE `customerid`= :customerid " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit()); $paging->setEntries($db->num_rows($result));
Database::pexecute($result_stmt, array(
"customerid" => $userinfo['customerid']
));
$paging->setEntries(Database::num_rows());
$sortcode = $paging->getHtmlSortCode($lng); $sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s); $arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng); $searchcode = $paging->getHtmlSearchCode($lng);
@@ -304,337 +234,195 @@ if ($page == 'overview') {
$count = 0; $count = 0;
$htaccess = ''; $htaccess = '';
$cperlenabled = customerHasPerlEnabled($userinfo['customerid']); while($row = $db->fetch_array($result))
{
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { if($paging->checkDisplay($i))
if ($paging->checkDisplay($i)) { {
if (strpos($row['path'], $userinfo['documentroot']) === 0) { if(strpos($row['path'], $userinfo['documentroot']) === 0)
$row['path'] = str_replace($userinfo['documentroot'], "/", $row['path']); {
$row['path'] = substr($row['path'], strlen($userinfo['documentroot']));
} }
$row['path'] = makeCorrectDir($row['path']);
$row['options_indexes'] = str_replace('1', $lng['panel']['yes'], $row['options_indexes']); $row['options_indexes'] = str_replace('1', $lng['panel']['yes'], $row['options_indexes']);
$row['options_indexes'] = str_replace('0', $lng['panel']['no'], $row['options_indexes']); $row['options_indexes'] = str_replace('0', $lng['panel']['no'], $row['options_indexes']);
$row['options_cgi'] = str_replace('1', $lng['panel']['yes'], $row['options_cgi']);
$row['options_cgi'] = str_replace('0', $lng['panel']['no'], $row['options_cgi']);
$row = htmlentities_array($row); $row = htmlentities_array($row);
eval("\$htaccess.=\"" . getTemplate("extras/htaccess_htaccess") . "\";"); eval("\$htaccess.=\"" . getTemplate("extras/htaccess_htaccess") . "\";");
$count ++; $count++;
} }
$i ++; $i++;
} }
eval("echo \"" . getTemplate("extras/htaccess") . "\";"); eval("echo \"" . getTemplate("extras/htaccess") . "\";");
} elseif ($action == 'delete' && $id != 0) { }
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_HTACCESS . "` elseif($action == 'delete'
WHERE `customerid` = :customerid && $id != 0)
AND `id` = :id"); {
Database::pexecute($result_stmt, array( $result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_HTACCESS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
"customerid" => $userinfo['customerid'],
"id" => $id
));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
if (isset($result['customerid']) && $result['customerid'] != '' && $result['customerid'] == $userinfo['customerid']) { if(isset($result['customerid'])
if (isset($_POST['send']) && $_POST['send'] == 'send') { && $result['customerid'] != ''
// do we have to remove the symlink and folder in suexecpath? && $result['customerid'] == $userinfo['customerid'])
if ((int) Settings::Get('perl.suexecworkaround') == 1) { {
$loginname = getCustomerDetail($result['customerid'], 'loginname'); if(isset($_POST['send'])
$suexecpath = makeCorrectDir(Settings::Get('perl.suexecpath') . '/' . $loginname . '/' . md5($result['path']) . '/'); && $_POST['send'] == 'send')
$perlsymlink = makeCorrectFile($result['path'] . '/cgi-bin'); {
// remove symlink $db->query("DELETE FROM `" . TABLE_PANEL_HTACCESS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
if (file_exists($perlsymlink)) { $log->logAction(USR_ACTION, LOG_INFO, "deleted htaccess for '" . str_replace($userinfo['documentroot'], '', $result['path']) . "'");
safe_exec('rm -f ' . escapeshellarg($perlsymlink));
$log->logAction(USR_ACTION, LOG_DEBUG, "deleted suexecworkaround symlink '" . $perlsymlink . "'");
}
// remove folder in suexec-path
if (file_exists($suexecpath)) {
safe_exec('rm -rf ' . escapeshellarg($suexecpath));
$log->logAction(USR_ACTION, LOG_DEBUG, "deleted suexecworkaround path '" . $suexecpath . "'");
}
}
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_HTACCESS . "`
WHERE `customerid`= :customerid
AND `id`= :id");
Database::pexecute($stmt, array(
"customerid" => $userinfo['customerid'],
"id" => $id
));
$log->logAction(USR_ACTION, LOG_INFO, "deleted htaccess for '" . str_replace($userinfo['documentroot'], '/', $result['path']) . "'");
inserttask('1'); inserttask('1');
redirectTo($filename, array( redirectTo($filename, Array('page' => $page, 's' => $s));
'page' => $page, }
's' => $s else
)); {
} else { ask_yesno('extras_reallydelete_pathoptions', $filename, array('id' => $id, 'page' => $page, 'action' => $action), str_replace($userinfo['documentroot'], '', $result['path']));
ask_yesno('extras_reallydelete_pathoptions', $filename, array(
'id' => $id,
'page' => $page,
'action' => $action
), str_replace($userinfo['documentroot'], '/', $result['path']));
} }
} }
} elseif ($action == 'add') { }
if (isset($_POST['send']) && $_POST['send'] == 'send') { elseif($action == 'add')
{
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$path = makeCorrectDir(validate($_POST['path'], 'path')); $path = makeCorrectDir(validate($_POST['path'], 'path'));
$userpath = $path; $userpath = $path;
$path = makeCorrectDir($userinfo['documentroot'] . '/' . $path); $path = makeCorrectDir($userinfo['documentroot'] . '/' . $path);
$path_dupe_check_stmt = Database::prepare("SELECT `id`, `path` FROM `" . TABLE_PANEL_HTACCESS . "` $path_dupe_check = $db->query_first("SELECT `id`, `path` FROM `" . TABLE_PANEL_HTACCESS . "` WHERE `path`='" . $db->escape($path) . "' AND `customerid`='" . (int)$userinfo['customerid'] . "'");
WHERE `path`= :path
AND `customerid`= :customerid");
Database::pexecute($path_dupe_check_stmt, array(
"path" => $path,
"customerid" => $userinfo['customerid']
));
$path_dupe_check = $path_dupe_check_stmt->fetch(PDO::FETCH_ASSOC);
if (! $_POST['path']) { if(!$_POST['path'])
{
standard_error('invalidpath'); standard_error('invalidpath');
} }
if (isset($_POST['options_cgi']) && (int) $_POST['options_cgi'] != 0) { if(($_POST['error404path'] === '')
$options_cgi = '1'; || (validateUrl($idna_convert->encode($_POST['error404path']))))
} else { {
$options_cgi = '0'; $error404path = $_POST['error404path'];
}
else
{
standard_error('mustbeurl');
} }
$error404path = ''; if(($_POST['error403path'] === '')
if (isset($_POST['error404path'])) { || (validateUrl($idna_convert->encode($_POST['error403path']))))
$error404path = correctErrorDocument($_POST['error404path']); {
$error403path = $_POST['error403path'];
}
else
{
standard_error('mustbeurl');
} }
$error403path = ''; if(($_POST['error500path'] === '')
if (isset($_POST['error403path'])) { || (validateUrl($idna_convert->encode($_POST['error500path']))))
$error403path = correctErrorDocument($_POST['error403path']); {
$error500path = $_POST['error500path'];
}
else
{
standard_error('mustbeurl');
} }
$error500path = ''; if($path_dupe_check['path'] == $path)
if (isset($_POST['error500path'])) { {
$error500path = correctErrorDocument($_POST['error500path']);
}
if ($path_dupe_check['path'] == $path) {
standard_error('errordocpathdupe', $userpath); standard_error('errordocpathdupe', $userpath);
} elseif ($path == '') { }
elseif($path == '')
{
standard_error('patherror'); standard_error('patherror');
} else { }
$stmt = Database::prepare('INSERT INTO `' . TABLE_PANEL_HTACCESS . '` SET else
`customerid` = :customerid, {
`path` = :path, $db->query('INSERT INTO `' . TABLE_PANEL_HTACCESS . '` (`customerid`, `path`, `options_indexes`, `error404path`, `error403path`, `error500path` ) VALUES ("' . (int)$userinfo['customerid'] . '", "' . $db->escape($path) . '", "' . $db->escape($_POST['options_indexes'] == '1' ? '1' : '0') . '", "' . $db->escape($error404path) . '", "' . $db->escape($error403path) . '", "' . $db->escape($error500path) . '" )');
`options_indexes` = :options_indexes,
`error404path` = :error404path,
`error403path` = :error403path,
`error500path` = :error500path,
`options_cgi` = :options_cgi');
$params = array(
"customerid" => $userinfo['customerid'],
"path" => $path,
"options_indexes" => $_POST['options_indexes'] == '1' ? '1' : '0',
"error403path" => $error403path,
"error404path" => $error404path,
"error500path" => $error500path,
"options_cgi" => $options_cgi
);
Database::pexecute($stmt, $params);
$log->logAction(USR_ACTION, LOG_INFO, "added htaccess for '" . $path . "'"); $log->logAction(USR_ACTION, LOG_INFO, "added htaccess for '" . $path . "'");
inserttask('1'); inserttask('1');
redirectTo($filename, array( redirectTo($filename, Array('page' => $page, 's' => $s));
'page' => $page,
's' => $s
));
} }
} else { }
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']); else
$cperlenabled = customerHasPerlEnabled($userinfo['customerid']); {
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit']);
$htaccess_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/extras/formfield.htaccess_add.php'; $options_indexes = makeyesno('options_indexes', '1', '0', '1');
$htaccess_add_form = htmlform::genHTMLForm($htaccess_add_data);
$title = $htaccess_add_data['htaccess_add']['title'];
$image = $htaccess_add_data['htaccess_add']['image'];
eval("echo \"" . getTemplate("extras/htaccess_add") . "\";"); eval("echo \"" . getTemplate("extras/htaccess_add") . "\";");
} }
} elseif (($action == 'edit') && ($id != 0)) { }
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_HTACCESS . "` elseif(($action == 'edit')
WHERE `customerid` = :customerid && ($id != 0))
AND `id` = :id"); {
Database::pexecute($result_stmt, array( $result = $db->query_first('SELECT * FROM `' . TABLE_PANEL_HTACCESS . '` WHERE `customerid` = "' . (int)$userinfo['customerid'] . '" AND `id` = "' . (int)$id . '"');
"customerid" => $userinfo['customerid'],
"id" => $id
));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
if ((isset($result['customerid'])) && ($result['customerid'] != '') && ($result['customerid'] == $userinfo['customerid'])) { if((isset($result['customerid']))
if (isset($_POST['send']) && $_POST['send'] == 'send') { && ($result['customerid'] != '')
&& ($result['customerid'] == $userinfo['customerid']))
{
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$option_indexes = intval($_POST['options_indexes']); $option_indexes = intval($_POST['options_indexes']);
$options_cgi = isset($_POST['options_cgi']) ? intval($_POST['options_cgi']) : 0;
if ($option_indexes != '1') { if($option_indexes != '1')
{
$option_indexes = '0'; $option_indexes = '0';
} }
if ($options_cgi != '1') { if(($_POST['error404path'] === '')
$options_cgi = '0'; || (validateUrl($idna_convert->encode($_POST['error404path']))))
{
$error404path = $_POST['error404path'];
}
else
{
standard_error('mustbeurl');
} }
$error404path = correctErrorDocument($_POST['error404path']); if(($_POST['error403path'] === '')
$error403path = correctErrorDocument($_POST['error403path']); || (validateUrl($idna_convert->encode($_POST['error403path']))))
$error500path = correctErrorDocument($_POST['error500path']); {
$error403path = $_POST['error403path'];
}
else
{
standard_error('mustbeurl');
}
if (($option_indexes != $result['options_indexes']) || ($error404path != $result['error404path']) || ($error403path != $result['error403path']) || ($error500path != $result['error500path']) || ($options_cgi != $result['options_cgi'])) { if(($_POST['error500path'] === '')
|| (validateUrl($idna_convert->encode($_POST['error500path']))))
{
$error500path = $_POST['error500path'];
}
else
{
standard_error('mustbeurl');
}
if(($option_indexes != $result['options_indexes'])
|| ($error404path != $result['error404path'])
|| ($error403path != $result['error403path'])
|| ($error500path != $result['error500path']))
{
inserttask('1'); inserttask('1');
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_HTACCESS . "` $db->query('UPDATE `' . TABLE_PANEL_HTACCESS . '` SET `options_indexes` = "' . $db->escape($option_indexes) . '", `error404path` = "' . $db->escape($error404path) . '", `error403path` = "' . $db->escape($error403path) . '", `error500path` = "' . $db->escape($error500path) . '" WHERE `customerid` = "' . (int)$userinfo['customerid'] . '" AND `id` = "' . (int)$id . '"');
SET `options_indexes` = :options_indexes, $log->logAction(USR_ACTION, LOG_INFO, "edited htaccess for '" . str_replace($userinfo['documentroot'], '', $result['path']) . "'");
`error404path` = :error404path,
`error403path` = :error403path,
`error500path` = :error500path,
`options_cgi` = :options_cgi
WHERE `customerid` = :customerid
AND `id` = :id");
$params = array(
"customerid" => $userinfo['customerid'],
"options_indexes" => $_POST['options_indexes'] == '1' ? '1' : '0',
"error403path" => $error403path,
"error404path" => $error404path,
"error500path" => $error500path,
"options_cgi" => $options_cgi,
"id" => $id
);
Database::pexecute($stmt, $params);
$log->logAction(USR_ACTION, LOG_INFO, "edited htaccess for '" . str_replace($userinfo['documentroot'], '/', $result['path']) . "'");
} }
redirectTo($filename, array( redirectTo($filename, Array('page' => $page, 's' => $s));
'page' => $page, }
's' => $s else
)); {
} else { if(strpos($result['path'], $userinfo['documentroot']) === 0)
if (strpos($result['path'], $userinfo['documentroot']) === 0) { {
$result['path'] = str_replace($userinfo['documentroot'], "/", $result['path']); $result['path'] = substr($result['path'], strlen($userinfo['documentroot']));
} }
$result['error404path'] = $result['error404path']; $result['error404path'] = $result['error404path'];
$result['error403path'] = $result['error403path']; $result['error403path'] = $result['error403path'];
$result['error500path'] = $result['error500path']; $result['error500path'] = $result['error500path'];
$cperlenabled = customerHasPerlEnabled($userinfo['customerid']); $options_indexes = makeyesno('options_indexes', '1', '0', $result['options_indexes']);
/*
* $options_indexes = makeyesno('options_indexes', '1', '0', $result['options_indexes']);
* $options_cgi = makeyesno('options_cgi', '1', '0', $result['options_cgi']);
*/
$result = htmlentities_array($result); $result = htmlentities_array($result);
$htaccess_edit_data = include_once dirname(__FILE__) . '/lib/formfields/customer/extras/formfield.htaccess_edit.php';
$htaccess_edit_form = htmlform::genHTMLForm($htaccess_edit_data);
$title = $htaccess_edit_data['htaccess_edit']['title'];
$image = $htaccess_edit_data['htaccess_edit']['image'];
eval("echo \"" . getTemplate("extras/htaccess_edit") . "\";"); eval("echo \"" . getTemplate("extras/htaccess_edit") . "\";");
} }
} }
} }
} elseif ($page == 'backup') {
// redirect if this customer sub-page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options','extras.backup')) {
redirectTo('customer_index.php');
}
if (Settings::Get('system.backupenabled') == 1)
{
if ($action == 'abort' && isset($_POST['send']) && $_POST['send'] == 'send') {
$log->logAction(USR_ACTION, LOG_NOTICE, "customer_extras::backup - aborted scheduled backupjob");
$entry = isset($_POST['backup_job_entry']) ? (int)$_POST['backup_job_entry'] : 0;
if ($entry > 0) {
$del_stmt = Database::prepare("DELETE FROM `".TABLE_PANEL_TASKS."` WHERE `id` = :tid");
Database::pexecute($del_stmt, array('tid' => $entry));
standard_success('backupaborted');
}
redirectTo($filename, array('page' => $page, 'action' => '', 's' => $s));
}
if ($action == '') {
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_extras::backup");
// check whether there is a backup-job for this customer
$sel_stmt = Database::prepare("SELECT * FROM `".TABLE_PANEL_TASKS."` WHERE `type` = '20'");
Database::pexecute($sel_stmt);
$existing_backupJob = null;
while ($entry = $sel_stmt->fetch())
{
$data = unserialize($entry['data']);
if ($data['customerid'] == $userinfo['customerid']) {
$existing_backupJob = $entry;
break;
}
}
if (isset($_POST['send']) && $_POST['send'] == 'send') {
if (! $_POST['path']) {
standard_error('invalidpath');
}
$path = makeCorrectDir(validate($_POST['path'], 'path'));
$path = makeCorrectDir($userinfo['documentroot'] . '/' . $path);
$backup_dbs = isset($_POST['backup_dbs']) ? intval($_POST['backup_dbs']) : 0;
$backup_mail = isset($_POST['backup_mail']) ? intval($_POST['backup_mail']) : 0;
$backup_web = isset($_POST['backup_web']) ? intval($_POST['backup_web']) : 0;
if ($backup_dbs != '1') {
$backup_dbs = '0';
}
if ($backup_mail != '1') {
$backup_mail = '0';
}
if ($backup_web != '1') {
$backup_web = '0';
}
$task_data = array(
'customerid' => $userinfo['customerid'],
'uid' => $userinfo['guid'],
'gid' => $userinfo['guid'],
'loginname' => $userinfo['loginname'],
'destdir' => $path,
'backup_dbs' => $backup_dbs,
'backup_mail' => $backup_mail,
'backup_web' => $backup_web
);
// schedule backup job
inserttask('20', $task_data);
standard_success('backupscheduled');
} else {
if (!empty($existing_backupJob)) {
$action = "abort";
$row = unserialize($entry['data']);
$row['path'] = makeCorrectDir(str_replace($userinfo['documentroot'], "/", $row['destdir']));
$row['backup_web'] = ($row['backup_web'] == '1') ? $lng['panel']['yes'] : $lng['panel']['no'];
$row['backup_mail'] = ($row['backup_mail'] == '1') ? $lng['panel']['yes'] : $lng['panel']['no'];
$row['backup_dbs'] = ($row['backup_dbs'] == '1') ? $lng['panel']['yes'] : $lng['panel']['no'];
}
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']);
$backup_data = include_once dirname(__FILE__) . '/lib/formfields/customer/extras/formfield.backup.php';
$backup_form = htmlform::genHTMLForm($backup_data);
$title = $backup_data['backup']['title'];
$image = $backup_data['backup']['image'];
if (!empty($existing_backupJob)) {
// overwrite backup_form after we took everything from it we needed
eval("\$backup_form = \"" . getTemplate("extras/backup_listexisting") . "\";");
}
eval("echo \"" . getTemplate("extras/backup") . "\";");
}
}
}
else
{
standard_error('backupfunctionnotenabled');
}
} }
?>

View File

@@ -14,43 +14,43 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'customer'); define('AREA', 'customer');
require './lib/init.php';
// redirect if this customer page is hidden via settings /**
if (Settings::IsInList('panel.customer_hide_options','ftp')) { * Include our init.php, which manages Sessions, Language etc.
redirectTo('customer_index.php'); */
}
$id = 0; require ("./lib/init.php");
if (isset($_POST['id'])) {
if(isset($_POST['id']))
{
$id = intval($_POST['id']); $id = intval($_POST['id']);
} elseif (isset($_GET['id'])) { }
elseif(isset($_GET['id']))
{
$id = intval($_GET['id']); $id = intval($_GET['id']);
} }
if ($page == 'overview') { if($page == 'overview')
{
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_ftp"); $log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_ftp");
eval("echo \"" . getTemplate('ftp/ftp') . "\";"); eval("echo \"" . getTemplate("ftp/ftp") . "\";");
} elseif ($page == 'accounts') { }
if ($action == '') { elseif($page == 'accounts')
{
if($action == '')
{
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_ftp::accounts"); $log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_ftp::accounts");
$fields = array( $fields = array(
'username' => $lng['login']['username'], 'username' => $lng['login']['username'],
'homedir' => $lng['panel']['path'], 'homedir' => $lng['panel']['path']
'description' => $lng['panel']['ftpdesc']
); );
$paging = new paging($userinfo, TABLE_FTP_USERS, $fields); $paging = new paging($userinfo, $db, TABLE_FTP_USERS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
$result = $db->query("SELECT `id`, `username`, `homedir` FROM `" . TABLE_FTP_USERS . "` WHERE `customerid`='" . $userinfo['customerid'] . "' " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
$result_stmt = Database::prepare("SELECT `id`, `username`, `description`, `homedir`, `shell` FROM `" . TABLE_FTP_USERS . "` $paging->setEntries($db->num_rows($result));
WHERE `customerid`= :customerid " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit()
);
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid']));
$ftps_count = Database::num_rows();
$paging->setEntries($ftps_count);
$sortcode = $paging->getHtmlSortCode($lng); $sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s); $arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng); $searchcode = $paging->getHtmlSearchCode($lng);
@@ -59,430 +59,187 @@ if ($page == 'overview') {
$count = 0; $count = 0;
$accounts = ''; $accounts = '';
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while($row = $db->fetch_array($result))
if ($paging->checkDisplay($i)) { {
if (strpos($row['homedir'], $userinfo['documentroot']) === 0) { if($paging->checkDisplay($i))
$row['documentroot'] = str_replace($userinfo['documentroot'], "/", $row['homedir']); {
} else { if(strpos($row['homedir'], $userinfo['documentroot']) === 0)
{
$row['documentroot'] = substr($row['homedir'], strlen($userinfo['documentroot']));
}
else
{
$row['documentroot'] = $row['homedir']; $row['documentroot'] = $row['homedir'];
} }
$row['documentroot'] = makeCorrectDir($row['documentroot']); $row['documentroot'] = makeCorrectDir($row['documentroot']);
$row = htmlentities_array($row); $row = htmlentities_array($row);
eval("\$accounts.=\"" . getTemplate('ftp/accounts_account') . "\";"); eval("\$accounts.=\"" . getTemplate("ftp/accounts_account") . "\";");
$count++; $count++;
} }
$i++; $i++;
} }
eval("echo \"" . getTemplate('ftp/accounts') . "\";"); $ftps_count = $db->num_rows($result);
} elseif ($action == 'delete' && $id != 0) { eval("echo \"" . getTemplate("ftp/accounts") . "\";");
$result_stmt = Database::prepare("SELECT `id`, `username`, `homedir`, `up_count`, `up_bytes`, `down_count`, `down_bytes` FROM `" . TABLE_FTP_USERS . "` }
WHERE `customerid` = :customerid elseif($action == 'delete'
AND `id` = :id" && $id != 0)
); {
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'], "id" => $id)); $result = $db->query_first("SELECT `id`, `username`, `homedir`, `up_count`, `up_bytes`, `down_count`, `down_bytes` FROM `" . TABLE_FTP_USERS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
if (isset($result['username']) && $result['username'] != $userinfo['loginname']) {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$stmt = Database::prepare("UPDATE `" . TABLE_FTP_USERS . "`
SET `up_count` = `up_count` + :up_count,
`up_bytes` = `up_bytes` + :up_bytes,
`down_count` = `down_count` + :down_count,
`down_bytes` = `down_bytes` + :down_bytes
WHERE `username` = :username"
);
$params = array(
"up_count" => $result['up_count'],
"up_bytes" => $result['up_bytes'],
"down_count" => $result['down_count'],
"down_bytes" => $result['down_bytes'],
"username" => $userinfo['loginname']
);
Database::pexecute($stmt, $params);
$result_stmt = Database::prepare("SELECT `username`, `homedir` FROM `" . TABLE_FTP_USERS . "`
WHERE `customerid` = :customerid
AND `id` = :id"
);
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'], "id" => $id));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
$stmt = Database::prepare("DELETE FROM `" . TABLE_FTP_QUOTATALLIES . "` WHERE `name` = :name");
Database::pexecute($stmt, array("name" => $result['username']));
$stmt = Database::prepare("DELETE FROM `" . TABLE_FTP_USERS . "`
WHERE `customerid` = :customerid
AND `id` = :id"
);
Database::pexecute($stmt, array("customerid" => $userinfo['customerid'], "id" => $id));
$stmt = Database::prepare("
UPDATE `" . TABLE_FTP_GROUPS . "` SET
`members` = REPLACE(`members`, :username,'')
WHERE `customerid` = :customerid
");
Database::pexecute($stmt, array("username" => ",".$result['username'], "customerid" => $userinfo['customerid']));
if(isset($result['username'])
&& $result['username'] != $userinfo['loginname'])
{
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$db->query("UPDATE `" . TABLE_FTP_USERS . "` SET `up_count`=`up_count`+'" . (int)$result['up_count'] . "', `up_bytes`=`up_bytes`+'" . (int)$result['up_bytes'] . "', `down_count`=`down_count`+'" . (int)$result['down_count'] . "', `down_bytes`=`down_bytes`+'" . (int)$result['down_bytes'] . "' WHERE `username`='" . $db->escape($userinfo['loginname']) . "'");
$db->query("DELETE FROM `" . TABLE_FTP_USERS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
$log->logAction(USR_ACTION, LOG_INFO, "deleted ftp-account '" . $result['username'] . "'"); $log->logAction(USR_ACTION, LOG_INFO, "deleted ftp-account '" . $result['username'] . "'");
$db->query("UPDATE `" . TABLE_FTP_GROUPS . "` SET `members`=REPLACE(`members`,'," . $db->escape($result['username']) . "','') WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
$resetaccnumber = ($userinfo['ftps_used'] == '1') ? " , `ftp_lastaccountnumber`='0'" : ''; // $db->query("DELETE FROM `".TABLE_FTP_GROUPS."` WHERE `customerid`='".$userinfo['customerid']."' AND `id`='$id'");
// refs #293 if($userinfo['ftps_used'] == '1')
if (isset($_POST['delete_userfiles']) && (int)$_POST['delete_userfiles'] == 1) { {
inserttask('8', $userinfo['loginname'], $result['homedir']); $resetaccnumber = " , `ftp_lastaccountnumber`='0'";
}
else
{
$resetaccnumber = '';
} }
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` $result = $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `ftps_used`=`ftps_used`-1 $resetaccnumber WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
SET `ftps_used` = `ftps_used` - 1 $resetaccnumber redirectTo($filename, Array('page' => $page, 's' => $s));
WHERE `customerid` = :customerid"
);
Database::pexecute($stmt, array("customerid" => $userinfo['customerid']));
redirectTo($filename, array('page' => $page, 's' => $s));
} else {
ask_yesno_withcheckbox('ftp_reallydelete', 'admin_customer_alsoremoveftphomedir', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['username']);
} }
} else { else
{
ask_yesno('ftp_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['username']);
}
}
else
{
standard_error('ftp_cantdeletemainaccount'); standard_error('ftp_cantdeletemainaccount');
} }
} elseif ($action == 'add') { }
if ($userinfo['ftps_used'] < $userinfo['ftps'] || $userinfo['ftps'] == '-1') { elseif($action == 'add')
if (isset($_POST['send']) {
&& $_POST['send'] == 'send') { if($userinfo['ftps_used'] < $userinfo['ftps']
$description = validate($_POST['ftp_description'], 'description'); || $userinfo['ftps'] == '-1')
// @FIXME use a good path-validating regex here (refs #1231) {
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$path = validate($_POST['path'], 'path'); $path = validate($_POST['path'], 'path');
$password = validate($_POST['ftp_password'], 'password'); $password = validate($_POST['ftp_password'], 'password');
$password = validatePassword($password);
$shell = "/bin/false";
if (Settings::Get('system.allow_customer_shell') == '1') {
$shell = isset($_POST['shell']) ? validate($_POST['shell'], 'shell') : '/bin/false';
}
$sendinfomail = isset($_POST['sendinfomail']) ? 1 : 0; if($settings['customer']['ftpatdomain'] == '1')
if ($sendinfomail != 1) { {
$sendinfomail = 0;
}
if (Settings::Get('customer.ftpatdomain') == '1') {
$ftpusername = validate($_POST['ftp_username'], 'username', '/^[a-zA-Z0-9][a-zA-Z0-9\-_]+\$?$/'); $ftpusername = validate($_POST['ftp_username'], 'username', '/^[a-zA-Z0-9][a-zA-Z0-9\-_]+\$?$/');
if ($ftpusername == '') { if($ftpusername == '')
{
standard_error(array('stringisempty', 'username')); standard_error(array('stringisempty', 'username'));
} }
$ftpdomain = $idna_convert->encode(validate($_POST['ftp_domain'], 'domain')); $ftpdomain = $idna_convert->encode(validate($_POST['ftp_domain'], 'domain'));
$ftpdomain_check_stmt = Database::prepare("SELECT `id`, `domain`, `customerid` FROM `" . TABLE_PANEL_DOMAINS . "` $ftpdomain_check = $db->query_first("SELECT `id`, `domain`, `customerid` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `domain`='" . $db->escape($ftpdomain) . "' AND `customerid`='" . (int)$userinfo['customerid'] . "'");
WHERE `domain` = :domain if($ftpdomain_check['domain'] != $ftpdomain)
AND `customerid` = :customerid" {
);
Database::pexecute($ftpdomain_check_stmt, array("domain" => $ftpdomain, "customerid" => $userinfo['customerid']));
$ftpdomain_check = $ftpdomain_check_stmt->fetch(PDO::FETCH_ASSOC);
if ($ftpdomain_check['domain'] != $ftpdomain) {
standard_error('maindomainnonexist', $domain); standard_error('maindomainnonexist', $domain);
} }
$username = $ftpusername . "@" . $ftpdomain; $username = $ftpusername . "@" . $ftpdomain;
} else {
$username = $userinfo['loginname'] . Settings::Get('customer.ftpprefix') . (intval($userinfo['ftp_lastaccountnumber']) + 1);
} }
else
$username_check_stmt = Database::prepare("SELECT * FROM `" . TABLE_FTP_USERS . "` {
WHERE `username` = :username" $username = $userinfo['loginname'] . $settings['customer']['ftpprefix'] . (intval($userinfo['ftp_lastaccountnumber']) + 1);
); }
Database::pexecute($username_check_stmt, array("username" => $username));
$username_check = $username_check_stmt->fetch(PDO::FETCH_ASSOC); $username_check = $db->query_first('SELECT * FROM `' . TABLE_FTP_USERS .'` WHERE `username` = \'' . $db->escape($username) . '\'');
if (!empty($username_check) && $username_check['username'] = $username) { if(!empty($username_check) && $username_check['username'] = $username)
{
standard_error('usernamealreadyexists', $username); standard_error('usernamealreadyexists', $username);
} elseif ($password == '') { }
elseif($password == '')
{
standard_error(array('stringisempty', 'mypassword')); standard_error(array('stringisempty', 'mypassword'));
} elseif ($path == '') { }
elseif($path == '')
{
standard_error('patherror'); standard_error('patherror');
} elseif ($username == $password) { }
standard_error('passwordshouldnotbeusername'); else
} else { {
$userpath = makeCorrectDir($path);
$path = makeCorrectDir($userinfo['documentroot'] . '/' . $path); $path = makeCorrectDir($userinfo['documentroot'] . '/' . $path);
$db->query("INSERT INTO `" . TABLE_FTP_USERS . "` (`customerid`, `username`, `password`, `homedir`, `login_enabled`, `uid`, `gid`) VALUES ('" . (int)$userinfo['customerid'] . "', '" . $db->escape($username) . "', ENCRYPT('" . $db->escape($password) . "'), '" . $db->escape($path) . "', 'y', '" . (int)$userinfo['guid'] . "', '" . (int)$userinfo['guid'] . "')");
$db->query("UPDATE `" . TABLE_FTP_GROUPS . "` SET `members`=CONCAT_WS(',',`members`,'" . $db->escape($username) . "') WHERE `customerid`='" . $userinfo['customerid'] . "' AND `gid`='" . (int)$userinfo['guid'] . "'");
$cryptPassword = makeCryptPassword($password); // $db->query("INSERT INTO `".TABLE_FTP_GROUPS."` (`customerid`, `groupname`, `gid`, `members`) VALUES ('".$userinfo['customerid']."', '$username', '$uid', '$username')");
$stmt = Database::prepare("INSERT INTO `" . TABLE_FTP_USERS . "` $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `ftps_used`=`ftps_used`+1, `ftp_lastaccountnumber`=`ftp_lastaccountnumber`+1 WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
(`customerid`, `username`, `description`, `password`, `homedir`, `login_enabled`, `uid`, `gid`, `shell`)
VALUES (:customerid, :username, :description, :password, :homedir, 'y', :guid, :guid, :shell)"
);
$params = array(
"customerid" => $userinfo['customerid'],
"username" => $username,
"description" => $description,
"password" => $cryptPassword,
"homedir" => $path,
"guid" => $userinfo['guid'],
"shell" => $shell
);
Database::pexecute($stmt, $params);
$result_stmt = Database::prepare("SELECT `bytes_in_used` FROM `" . TABLE_FTP_QUOTATALLIES . "` // $db->query("UPDATE `".TABLE_PANEL_SETTINGS."` SET `value`='$uid' WHERE settinggroup='ftp' AND varname='lastguid'");
WHERE `name` = :name"
);
Database::pexecute($result_stmt, array("name" => $userinfo['loginname']));
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
$stmt = Database::prepare("INSERT INTO `" . TABLE_FTP_QUOTATALLIES . "`
(`name`, `quota_type`, `bytes_in_used`, `bytes_out_used`, `bytes_xfer_used`, `files_in_used`, `files_out_used`, `files_xfer_used`)
VALUES (:name, 'user', :bytes_in_used, '0', '0', '0', '0', '0')"
);
Database::pexecute($stmt, array("name" => $username, "bytes_in_used" => $row['bytes_in_used']));
}
$stmt = Database::prepare("UPDATE `" . TABLE_FTP_GROUPS . "`
SET `members` = CONCAT_WS(',',`members`, :username)
WHERE `customerid`= :customerid
AND `gid`= :guid"
);
$params = array(
"username" => $username,
"customerid" => $userinfo['customerid'],
"guid" => $userinfo['guid']
);
Database::pexecute($stmt, $params);
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CUSTOMERS . "`
SET `ftps_used` = `ftps_used` + 1,
`ftp_lastaccountnumber` = `ftp_lastaccountnumber` + 1
WHERE `customerid` = :customerid"
);
Database::pexecute($stmt, array("customerid" => $userinfo['customerid']));
$log->logAction(USR_ACTION, LOG_INFO, "added ftp-account '" . $username . " (" . $path . ")'"); $log->logAction(USR_ACTION, LOG_INFO, "added ftp-account '" . $username . " (" . $path . ")'");
inserttask(5); inserttask(5);
redirectTo($filename, Array('page' => $page, 's' => $s));
if ($sendinfomail == 1) {
$replace_arr = array(
'SALUTATION' => getCorrectUserSalutation($userinfo),
'CUST_NAME' => getCorrectUserSalutation($userinfo), // < keep this for compatibility
'USR_NAME' => $username,
'USR_PASS' => $password,
'USR_PATH' => makeCorrectDir(str_replace($userinfo['documentroot'], "/", $path))
);
$def_language = $userinfo['def_language'];
$result_stmt = Database::prepare("SELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid
AND `language` = :lang
AND `templategroup`='mails'
AND `varname`='new_ftpaccount_by_customer_subject'"
);
Database::pexecute($result_stmt, array("adminid" => $userinfo['adminid'], "lang" => $def_language));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
$mail_subject = html_entity_decode(replace_variables((($result['value'] != '') ? $result['value'] : $lng['mails']['new_ftpaccount_by_customer']['subject']), $replace_arr));
$def_language = $userinfo['def_language'];
$result_stmt = Database::prepare("SELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid
AND `language` = :lang
AND `templategroup`='mails'
AND `varname`='new_ftpaccount_by_customer_mailbody'"
);
Database::pexecute($result_stmt, array("adminid" => $userinfo['adminid'], "lang" => $def_language));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
$mail_body = html_entity_decode(replace_variables((($result['value'] != '') ? $result['value'] : $lng['mails']['new_ftpaccount_by_customer']['mailbody']), $replace_arr));
$_mailerror = false;
try {
$mail->Subject = $mail_subject;
$mail->AltBody = $mail_body;
$mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
$mail->AddAddress($userinfo['email'], getCorrectUserSalutation($userinfo));
$mail->Send();
} catch(phpmailerException $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (Exception $e) {
$mailerr_msg = $e->getMessage();
$_mailerror = true;
}
if ($_mailerror) {
$log->logAction(USR_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
standard_error('errorsendingmail', $userinfo['email']);
}
$mail->ClearAddresses();
}
redirectTo($filename, array('page' => $page, 's' => $s));
} }
} else { }
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], '/'); else
{
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit']);
if (Settings::Get('customer.ftpatdomain') == '1') { if($settings['customer']['ftpatdomain'] == '1')
$domainlist = array(); {
$domains = ''; $domains = '';
$result_domains_stmt = Database::prepare("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "` $result_domains = $db->query("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
WHERE `customerid`= :customerid"
);
Database::pexecute($result_domains_stmt, array("customerid" => $userinfo['customerid']));
while ($row_domain = $result_domains_stmt->fetch(PDO::FETCH_ASSOC)) { while($row_domain = $db->fetch_array($result_domains))
$domainlist[] = $row_domain['domain']; {
} $domains.= makeoption($idna_convert->decode($row_domain['domain']), $row_domain['domain']);
sort($domainlist);
if (isset($domainlist[0]) && $domainlist[0] != '') {
foreach ($domainlist as $dom) {
$domains .= makeoption($idna_convert->decode($dom), $dom);
}
} }
} }
if (Settings::Get('system.allow_customer_shell') == '1') { eval("echo \"" . getTemplate("ftp/accounts_add") . "\";");
$shells = makeoption("/bin/false", "/bin/false", "/bin/false");
$shells_avail = Settings::Get('system.available_shells');
if (!empty($shells_avail)) {
$shells_avail = explode(",", $shells_avail);
$shells_avail = array_map("trim", $shells_avail);
foreach ($shells_avail as $_shell) {
$shells .= makeoption($_shell, $_shell, "/bin/false");
}
}
}
//$sendinfomail = makeyesno('sendinfomail', '1', '0', '0');
$ftp_add_data = include_once dirname(__FILE__).'/lib/formfields/customer/ftp/formfield.ftp_add.php';
$ftp_add_form = htmlform::genHTMLForm($ftp_add_data);
$title = $ftp_add_data['ftp_add']['title'];
$image = $ftp_add_data['ftp_add']['image'];
eval("echo \"" . getTemplate('ftp/accounts_add') . "\";");
} }
} }
} elseif ($action == 'edit' && $id != 0) { }
$result_stmt = Database::prepare("SELECT `id`, `username`, `description`, `homedir`, `uid`, `gid`, `shell` FROM `" . TABLE_FTP_USERS . "` elseif($action == 'edit'
WHERE `customerid` = :customerid && $id != 0)
AND `id` = :id" {
); $result = $db->query_first("SELECT `id`, `username`, `homedir` FROM `" . TABLE_FTP_USERS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'], "id" => $id));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
if (isset($result['username']) && $result['username'] != '') { if(isset($result['username'])
if (isset($_POST['send']) && $_POST['send'] == 'send') { && $result['username'] != '')
// @FIXME use a good path-validating regex here (refs #1231) {
$path = validate($_POST['path'], 'path'); if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$password = validate($_POST['ftp_password'], 'password');
$shell = "/bin/false"; if($password == '')
if (Settings::Get('system.allow_customer_shell') == '1') { {
$shell = isset($_POST['shell']) ? validate($_POST['shell'], 'shell') : '/bin/false'; standard_error(array('stringisempty', 'mypassword'));
exit;
} }
else
$_setnewpass = false; {
if (isset($_POST['ftp_password']) && $_POST['ftp_password'] != '') { $db->query("UPDATE `" . TABLE_FTP_USERS . "` SET `password`=ENCRYPT('" . $db->escape($password) . "') WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
$password = validate($_POST['ftp_password'], 'password'); $log->logAction(USR_ACTION, LOG_INFO, "edited ftp-account '" . $result['username'] . "'");
$password = validatePassword($password); redirectTo($filename, Array('page' => $page, 's' => $s));
$_setnewpass = true;
} }
}
if ($_setnewpass) { else
if ($password == '') { {
standard_error(array('stringisempty', 'mypassword')); eval("echo \"" . getTemplate("ftp/accounts_edit") . "\";");
} elseif ($result['username'] == $password) {
standard_error('passwordshouldnotbeusername');
}
$log->logAction(USR_ACTION, LOG_INFO, "updated ftp-account password for '" . $result['username'] . "'");
$cryptPassword = makeCryptPassword($password);
$stmt = Database::prepare("UPDATE `" . TABLE_FTP_USERS . "`
SET `password` = :password
WHERE `customerid` = :customerid
AND `id` = :id"
);
Database::pexecute($stmt, array("customerid" => $userinfo['customerid'], "id" => $id, "password" => $cryptPassword));
}
if ($path != '') {
$path = makeCorrectDir($userinfo['documentroot'] . '/' . $path);
if ($path != $result['homedir']) {
if (!file_exists($path)) {
// it's the task for "new ftp" but that will
// create all directories and correct their permissions
inserttask(5);
}
$log->logAction(USR_ACTION, LOG_INFO, "updated ftp-account homdir for '" . $result['username'] . "'");
$stmt = Database::prepare("UPDATE `" . TABLE_FTP_USERS . "`
SET `homedir` = :homedir
WHERE `customerid` = :customerid
AND `id` = :id"
);
$params = array(
"homedir" => $path,
"customerid" => $userinfo['customerid'],
"id" => $id
);
Database::pexecute($stmt, $params);
}
}
$log->logAction(USR_ACTION, LOG_INFO, "edited ftp-account '" . $result['username'] . "'");
$description = validate($_POST['ftp_description'], 'description');
$stmt = Database::prepare("UPDATE `" . TABLE_FTP_USERS . "`
SET `description` = :desc, `shell` = :shell
WHERE `customerid` = :customerid
AND `id` = :id"
);
Database::pexecute($stmt, array("desc" => $description, "shell" => $shell, "customerid" => $userinfo['customerid'], "id" => $id));
redirectTo($filename, array('page' => $page, 's' => $s));
} else {
if (strpos($result['homedir'], $userinfo['documentroot']) === 0) {
$homedir = str_replace($userinfo['documentroot'], "/", $result['homedir']);
} else {
$homedir = $result['homedir'];
}
$homedir = makeCorrectDir($homedir);
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $homedir);
if (Settings::Get('customer.ftpatdomain') == '1') {
$domains = '';
$result_domains_stmt = Database::prepare("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "`
WHERE `customerid` = :customerid"
);
Database::pexecute($result_domains_stmt, array("customerid" => $userinfo['customerid']));
while ($row_domain = $result_domains_stmt->fetch(PDO::FETCH_ASSOC)) {
$domains .= makeoption($idna_convert->decode($row_domain['domain']), $row_domain['domain']);
}
}
if (Settings::Get('system.allow_customer_shell') == '1') {
$shells = makeoption("/bin/false", "/bin/false", $result['shell']);
$shells_avail = Settings::Get('system.available_shells');
if (!empty($shells_avail)) {
$shells_avail = explode(",", $shells_avail);
$shells_avail = array_map("trim", $shells_avail);
foreach ($shells_avail as $_shell) {
$shells .= makeoption($_shell, $_shell, $result['shell']);
}
}
}
$ftp_edit_data = include_once dirname(__FILE__).'/lib/formfields/customer/ftp/formfield.ftp_edit.php';
$ftp_edit_form = htmlform::genHTMLForm($ftp_edit_data);
$title = $ftp_edit_data['ftp_edit']['title'];
$image = $ftp_edit_data['ftp_edit']['image'];
eval("echo \"" . getTemplate('ftp/accounts_edit') . "\";");
} }
} }
} }
} }
?>

View File

@@ -14,308 +14,171 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'customer'); define('AREA', 'customer');
require './lib/init.php';
if ($action == 'logout') { /**
$log->logAction(USR_ACTION, LOG_NOTICE, 'logged out'); * Include our init.php, which manages Sessions, Language etc.
*/
$params = array("customerid" => $userinfo['customerid']); require ("./lib/init.php");
if (Settings::Get('session.allow_multiple_login') == '1') {
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` if($action == 'logout')
WHERE `userid` = :customerid {
AND `adminsession` = '0' $log->logAction(USR_ACTION, LOG_NOTICE, "logged out");
AND `hash` = :hash"
); if($settings['session']['allow_multiple_login'] == '1')
$params["hash"] = $s; {
} else { $db->query("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid` = '" . (int)$userinfo['customerid'] . "' AND `adminsession` = '0' AND `hash` = '" . $s . "'");
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` }
WHERE `userid` = :customerid else
AND `adminsession` = '0'" {
); $db->query("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid` = '" . (int)$userinfo['customerid'] . "' AND `adminsession` = '0'");
} }
Database::pexecute($stmt, $params);
redirectTo('index.php'); redirectTo('index.php');
exit;
} }
if ($page == 'overview') { if($page == 'overview')
{
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_index"); $log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_index");
$domain_stmt = Database::prepare("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "`
WHERE `customerid` = :customerid
AND `parentdomainid` = '0'
AND `id` <> :standardsubdomain
");
Database::pexecute($domain_stmt, array("customerid" => $userinfo['customerid'], "standardsubdomain" => $userinfo['standardsubdomain']));
$domains = ''; $domains = '';
$result = $db->query("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `parentdomainid`='0' AND `id` <> '" . (int)$userinfo['standardsubdomain'] . "' ");
$domainArray = array(); $domainArray = array();
while ($row = $domain_stmt->fetch(PDO::FETCH_ASSOC)) { while($row = $db->fetch_array($result))
{
$domainArray[] = $idna_convert->decode($row['domain']); $domainArray[] = $idna_convert->decode($row['domain']);
} }
natsort($domainArray); natsort($domainArray);
$domains = implode(',<br />', $domainArray); $domains = implode(', ', $domainArray);
// standard-subdomain
$stdsubdomain = '';
if ($userinfo['standardsubdomain'] != '0') {
$std_domain_stmt = Database::prepare("
SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "`
WHERE `customerid` = :customerid
AND `id` = :standardsubdomain
");
$std_domain = Database::pexecute_first($std_domain_stmt, array("customerid" => $userinfo['customerid'], "standardsubdomain" => $userinfo['standardsubdomain']));
$stdsubdomain = $std_domain['domain'];
}
$userinfo['email'] = $idna_convert->decode($userinfo['email']); $userinfo['email'] = $idna_convert->decode($userinfo['email']);
$yesterday = time() - (60 * 60 * 24); $yesterday = time() - (60 * 60 * 24);
$month = date('M Y', $yesterday); $month = date('M Y', $yesterday);
// get disk-space usages for web, mysql and mail /* $traffic=$db->query_first("SELECT SUM(http) AS http_sum, SUM(ftp_up) AS ftp_up_sum, SUM(ftp_down) AS ftp_down_sum, SUM(mail) AS mail_sum FROM ".TABLE_PANEL_TRAFFIC." WHERE year='".date('Y')."' AND month='".date('m')."' AND day<='".date('d')."' AND customerid='".$userinfo['customerid']."'");
$usages_stmt = Database::prepare("SELECT * FROM `".TABLE_PANEL_DISKSPACE."` WHERE `customerid` = :cid ORDER BY `stamp` DESC LIMIT 1"); $userinfo['traffic_used']=$traffic['http_sum']+$traffic['ftp_up_sum']+$traffic['ftp_down_sum']+$traffic['mail_sum'];*/
$usages = Database::pexecute_first($usages_stmt, array('cid' => $userinfo['customerid']));
$userinfo['diskspace'] = round($userinfo['diskspace'] / 1024, Settings::Get('panel.decimal_places')); $userinfo['diskspace'] = round($userinfo['diskspace'] / 1024, $settings['panel']['decimal_places']);
$userinfo['diskspace_used'] = round($usages['webspace'] / 1024, Settings::Get('panel.decimal_places')); $userinfo['diskspace_used'] = round($userinfo['diskspace_used'] / 1024, $settings['panel']['decimal_places']);
$userinfo['mailspace_used'] = round($usages['mail'] / 1024, Settings::Get('panel.decimal_places')); $userinfo['traffic'] = round($userinfo['traffic'] / (1024 * 1024), $settings['panel']['decimal_places']);
$userinfo['dbspace_used'] = round($usages['mysql'] / 1024, Settings::Get('panel.decimal_places')); $userinfo['traffic_used'] = round($userinfo['traffic_used'] / (1024 * 1024), $settings['panel']['decimal_places']);
$userinfo = str_replace_array('-1', $lng['customer']['unlimited'], $userinfo, 'diskspace traffic mysqls emails email_accounts email_forwarders email_quota ftps tickets subdomains aps_packages');
$opentickets = 0;
$opentickets = $db->query_first('SELECT COUNT(`id`) as `count` FROM `' . TABLE_PANEL_TICKETS . '`
WHERE `customerid` = "' . $userinfo['customerid'] . '"
AND `answerto` = "0"
AND (`status` = "0" OR `status` = "2")
AND `lastreplier`="1"');
$awaitingtickets = $opentickets['count'];
$awaitingtickets_text = '';
$userinfo['traffic'] = round($userinfo['traffic'] / (1024 * 1024), Settings::Get('panel.decimal_places')); if($opentickets > 0)
$userinfo['traffic_used'] = round($userinfo['traffic_used'] / (1024 * 1024), Settings::Get('panel.decimal_places')); {
$userinfo = str_replace_array('-1', $lng['customer']['unlimited'], $userinfo, 'diskspace traffic mysqls emails email_accounts email_forwarders email_quota ftps tickets subdomains'); $awaitingtickets_text = strtr($lng['ticket']['awaitingticketreply'], array('%s' => '<a href="customer_tickets.php?page=tickets&amp;s=' . $s . '">' . $opentickets['count'] . '</a>'));
}
$userinfo['custom_notes'] = ($userinfo['custom_notes'] != '') ? nl2br($userinfo['custom_notes']) : ''; eval("echo \"" . getTemplate("index/index") . "\";");
}
$services_enabled = ""; elseif($page == 'change_password')
$se = array(); {
if ($userinfo['imap'] == '1') $se[] = "IMAP"; if(isset($_POST['send'])
if ($userinfo['pop3'] == '1') $se[] = "POP3"; && $_POST['send'] == 'send')
if ($userinfo['phpenabled'] == '1') $se[] = "PHP"; {
if ($userinfo['perlenabled'] == '1') $se[] = "Perl/CGI";
$services_enabled = implode(", ", $se);
eval("echo \"" . getTemplate('index/index') . "\";");
} elseif ($page == 'change_password') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$old_password = validate($_POST['old_password'], 'old password'); $old_password = validate($_POST['old_password'], 'old password');
if (!validatePasswordLogin($userinfo,$old_password,TABLE_PANEL_CUSTOMERS,'customerid')) {
if(md5($old_password) != $userinfo['password'])
{
standard_error('oldpasswordnotcorrect'); standard_error('oldpasswordnotcorrect');
exit;
} }
$new_password = validatePassword($_POST['new_password'], 'new password'); $new_password = validate($_POST['new_password'], 'new password');
$new_password_confirm = validatePassword($_POST['new_password_confirm'], 'new password confirm'); $new_password_confirm = validate($_POST['new_password_confirm'], 'new password confirm');
if ($old_password == '') { if($old_password == '')
{
standard_error(array('stringisempty', 'oldpassword')); standard_error(array('stringisempty', 'oldpassword'));
} elseif ($new_password == '') { }
elseif($new_password == '')
{
standard_error(array('stringisempty', 'newpassword')); standard_error(array('stringisempty', 'newpassword'));
} elseif ($new_password_confirm == '') { }
elseif($new_password_confirm == '')
{
standard_error(array('stringisempty', 'newpasswordconfirm')); standard_error(array('stringisempty', 'newpasswordconfirm'));
} elseif ($new_password != $new_password_confirm) { }
elseif($new_password != $new_password_confirm)
{
standard_error('newpasswordconfirmerror'); standard_error('newpasswordconfirmerror');
} else { }
// Update user password else
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` {
SET `password` = :newpassword $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `password`='" . md5($new_password) . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `password`='" . md5($old_password) . "'");
WHERE `customerid` = :customerid"
);
$params = array(
"newpassword" => makeCryptPassword($new_password),
"customerid" => $userinfo['customerid']
);
Database::pexecute($stmt, $params);
$log->logAction(USR_ACTION, LOG_NOTICE, 'changed password'); $log->logAction(USR_ACTION, LOG_NOTICE, 'changed password');
// Update ftp password if(isset($_POST['change_main_ftp'])
if (isset($_POST['change_main_ftp']) && $_POST['change_main_ftp'] == 'true') { && $_POST['change_main_ftp'] == 'true')
$cryptPassword = makeCryptPassword($new_password); {
$stmt = Database::prepare("UPDATE `" . TABLE_FTP_USERS . "` $db->query("UPDATE `" . TABLE_FTP_USERS . "` SET `password`=ENCRYPT('" . $db->escape($new_password) . "') WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `username`='" . $db->escape($userinfo['loginname']) . "'");
SET `password` = :password
WHERE `customerid` = :customerid
AND `username` = :username"
);
$params = array(
"password" => $cryptPassword,
"customerid" => $userinfo['customerid'],
"username" => $userinfo['loginname']
);
Database::pexecute($stmt, $params);
$log->logAction(USR_ACTION, LOG_NOTICE, 'changed main ftp password'); $log->logAction(USR_ACTION, LOG_NOTICE, 'changed main ftp password');
} }
// Update webalizer password if(isset($_POST['change_webalizer'])
if (isset($_POST['change_webalizer']) && $_POST['change_webalizer'] == 'true') { && $_POST['change_webalizer'] == 'true')
if (CRYPT_STD_DES == 1) { {
if(CRYPT_STD_DES == 1)
{
$saltfordescrypt = substr(md5(uniqid(microtime(), 1)), 4, 2); $saltfordescrypt = substr(md5(uniqid(microtime(), 1)), 4, 2);
$new_webalizer_password = crypt($new_password, $saltfordescrypt); $new_webalizer_password = crypt($new_password, $saltfordescrypt);
} else { }
else
{
$new_webalizer_password = crypt($new_password); $new_webalizer_password = crypt($new_password);
} }
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_HTPASSWDS . "` $db->query("UPDATE `" . TABLE_PANEL_HTPASSWDS . "` SET `password`='" . $db->escape($new_webalizer_password) . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `username`='" . $db->escape($userinfo['loginname']) . "'");
SET `password` = :password
WHERE `customerid` = :customerid
AND `username` = :username"
);
$params = array(
"password" => $new_webalizer_password,
"customerid" => $userinfo['customerid'],
"username" => $userinfo['loginname']
);
Database::pexecute($stmt, $params);
} }
redirectTo($filename, array('s' => $s)); redirectTo($filename, Array('s' => $s));
} }
} else {
eval("echo \"" . getTemplate('index/change_password') . "\";");
} }
} elseif ($page == 'change_language') { else
if (isset($_POST['send']) && $_POST['send'] == 'send') { {
eval("echo \"" . getTemplate("index/change_password") . "\";");
}
}
elseif($page == 'change_language')
{
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$def_language = validate($_POST['def_language'], 'default language'); $def_language = validate($_POST['def_language'], 'default language');
if (isset($languages[$def_language])) {
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CUSTOMERS . "`
SET `def_language` = :lang
WHERE `customerid` = :customerid"
);
Database::pexecute($stmt, array("lang" => $def_language, "customerid" => $userinfo['customerid']));
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_SESSIONS . "`
SET `language` = :lang
WHERE `hash` = :hash"
);
Database::pexecute($stmt, array("lang" => $def_language, "hash" => $s));
if(isset($languages[$def_language]))
{
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `def_language`='" . $db->escape($def_language) . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
$db->query("UPDATE `" . TABLE_PANEL_SESSIONS . "` SET `language`='" . $db->escape($def_language) . "' WHERE `hash`='" . $db->escape($s) . "'");
$log->logAction(USR_ACTION, LOG_NOTICE, "changed default language to '" . $def_language . "'"); $log->logAction(USR_ACTION, LOG_NOTICE, "changed default language to '" . $def_language . "'");
} }
redirectTo($filename, array('s' => $s)); redirectTo($filename, Array('s' => $s));
} else { }
$default_lang = Settings::Get('panel.standardlanguage'); else
if ($userinfo['def_language'] != '') { {
$default_lang = $userinfo['def_language'];
}
$language_options = ''; $language_options = '';
while (list($language_file, $language_name) = each($languages)) {
$language_options .= makeoption($language_name, $language_file, $default_lang, true); while(list($language_file, $language_name) = each($languages))
{
$language_options.= makeoption($language_name, $language_file, $userinfo['def_language'], true);
} }
eval("echo \"" . getTemplate('index/change_language') . "\";"); eval("echo \"" . getTemplate("index/change_language") . "\";");
}
} elseif ($page == 'change_theme') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$theme = validate($_POST['theme'], 'theme');
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CUSTOMERS . "`
SET `theme` = :theme
WHERE `customerid` = :customerid"
);
Database::pexecute($stmt, array("theme" => $theme, "customerid" => $userinfo['customerid']));
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_SESSIONS . "`
SET `theme` = :theme
WHERE `hash` = :hash"
);
Database::pexecute($stmt, array("theme" => $theme, "hash" => $s));
$log->logAction(USR_ACTION, LOG_NOTICE, "changed default theme to '" . $theme . "'");
redirectTo($filename, array('s' => $s));
} else {
$default_theme = Settings::Get('panel.default_theme');
if ($userinfo['theme'] != '') {
$default_theme = $userinfo['theme'];
}
$theme_options = '';
$themes_avail = getThemes();
foreach ($themes_avail as $t => $d) {
$theme_options.= makeoption($d, $t, $default_theme, true);
}
eval("echo \"" . getTemplate('index/change_theme') . "\";");
}
} elseif ($page == 'send_error_report' && Settings::Get('system.allow_error_report_customer') == '1') {
// only show this if we really have an exception to report
if (isset($_GET['errorid']) && $_GET['errorid'] != '') {
$errid = $_GET['errorid'];
// read error file
$err_dir = makeCorrectDir(FROXLOR_INSTALL_DIR."/logs/");
$err_file = makeCorrectFile($err_dir."/".$errid."_sql-error.log");
if (file_exists($err_file)) {
$error_content = file_get_contents($err_file);
$error = explode("|", $error_content);
$_error = array(
'code' => str_replace("\n", "", substr($error[1], 5)),
'message' => str_replace("\n", "", substr($error[2], 4)),
'file' => str_replace("\n", "", substr($error[3], 5 + strlen(FROXLOR_INSTALL_DIR))),
'line' => str_replace("\n", "", substr($error[4], 5)),
'trace' => str_replace(FROXLOR_INSTALL_DIR, "", substr($error[5], 6))
);
// build mail-content
$mail_body = "Dear froxlor-team,\n\n";
$mail_body .= "the following error has been reported by a user:\n\n";
$mail_body .= "-------------------------------------------------------------\n";
$mail_body .= $_error['code'].' '.$_error['message']."\n\n";
$mail_body .= "File: ".$_error['file'].':'.$_error['line']."\n\n";
$mail_body .= "Trace:\n".trim($_error['trace'])."\n\n";
$mail_body .= "-------------------------------------------------------------\n\n";
$mail_body .= "Froxlor-version: ".$version."\n";
$mail_body .= "DB-version: ".$dbversion."\n\n";
$mail_body .= "End of report";
$mail_html = str_replace("\n", "<br />", $mail_body);
// send actual report to dev-team
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
// send mail and say thanks
$_mailerror = false;
try {
$mail->Subject = '[Froxlor] Error report by user';
$mail->AltBody = $mail_body;
$mail->MsgHTML($mail_html);
$mail->AddAddress('error-reports@froxlor.org', 'Froxlor Developer Team');
$mail->Send();
} catch(phpmailerException $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (Exception $e) {
$mailerr_msg = $e->getMessage();
$_mailerror = true;
}
if ($_mailerror) {
// error when reporting an error...LOLFUQ
standard_error('send_report_error', $mailerr_msg);
}
// finally remove error from fs
@unlink($err_file);
redirectTo($filename, array('s' => $s));
}
// show a nice summary of the error-report
// before actually sending anything
eval("echo \"" . getTemplate("index/send_error_report") . "\";");
} else {
redirectTo($filename, array('s' => $s));
}
} else {
redirectTo($filename, array('s' => $s));
} }
} }
?>

View File

@@ -1,122 +0,0 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2003-2009 the SysCP Team (see authors).
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Florian Lippert <flo@syscp.org> (2003-2009)
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel
*
*/
define('AREA', 'customer');
require './lib/init.php';
// redirect if this customer page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options','extras.logger')) {
redirectTo('customer_index.php');
}
if ($page == 'log'
) {
if ($action == '') {
$fields = array(
'date' => $lng['logger']['date'],
'type' => $lng['logger']['type'],
'user' => $lng['logger']['user'],
'text' => $lng['logger']['action']
);
$paging = new paging($userinfo, TABLE_PANEL_LOG, $fields, null, null, 0, 'desc');
$result_stmt = Database::prepare('
SELECT * FROM `' . TABLE_PANEL_LOG . '` WHERE `user` = :loginname ' . $paging->getSqlWhere(true) . ' ' . $paging->getSqlOrderBy() . ' ' . $paging->getSqlLimit()
);
Database::pexecute($result_stmt, array("loginname" => $userinfo['loginname']));
$logs_count = Database::num_rows();
$paging->setEntries($logs_count);
$sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng);
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
$clog = array();
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
if (!isset($clog[$row['action']])
|| !is_array($clog[$row['action']])
) {
$clog[$row['action']] = array();
}
$clog[$row['action']][$row['logid']] = $row;
}
if ($paging->sortfield == 'date'
&& $paging->sortorder == 'desc'
) {
krsort($clog);
} else {
ksort($clog);
}
$i = 0;
$count = 0;
$log_count = 0;
$log = '';
foreach ($clog as $action => $logrows) {
$_action = 0;
foreach ($logrows as $row) {
if ($paging->checkDisplay($i)) {
$row = htmlentities_array($row);
$row['date'] = date("d.m.y H:i:s", $row['date']);
if ($_action != $action) {
switch ($action) {
case USR_ACTION:
$_action = $lng['admin']['customer'];
break;
case RES_ACTION:
$_action = $lng['logger']['reseller'];
break;
case ADM_ACTION:
$_action = $lng['logger']['admin'];
break;
case CRON_ACTION:
$_action = $lng['logger']['cron'];
break;
case LOGIN_ACTION:
$_action = $lng['logger']['login'];
break;
case LOG_ERROR:
$_action = $lng['logger']['intern'];
break;
default:
$_action = $lng['logger']['unknown'];
break;
}
$row['action'] = $_action;
eval("\$log.=\"" . getTemplate('logger/logger_action') . "\";");
}
$log_count++;
$row['type'] = getLogLevelDesc($row['type']);
eval("\$log.=\"" . getTemplate('logger/logger_log') . "\";");
$count++;
$_action = $action;
}
$i++;
}
$i++;
}
eval("echo \"" . getTemplate('logger/logger') . "\";");
}
}

View File

@@ -14,50 +14,46 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'customer'); define('AREA', 'customer');
require './lib/init.php';
// redirect if this customer page is hidden via settings /**
if (Settings::IsInList('panel.customer_hide_options','mysql')) { * Include our init.php, which manages Sessions, Language etc.
redirectTo('customer_index.php'); */
}
// get sql-root access data $need_db_sql_data = true;
Database::needRoot(true); $need_root_db_sql_data = true;
Database::needSqlData(); require ("./lib/init.php");
$sql_root = Database::getSqlData();
Database::needRoot(false);
if (isset($_POST['id'])) { if(isset($_POST['id']))
{
$id = intval($_POST['id']); $id = intval($_POST['id']);
} elseif (isset($_GET['id'])) { }
elseif(isset($_GET['id']))
{
$id = intval($_GET['id']); $id = intval($_GET['id']);
} }
if ($page == 'overview') { if($page == 'overview')
{
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_mysql"); $log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_mysql");
Database::needSqlData();
$sql = Database::getSqlData();
$lng['mysql']['description'] = str_replace('<SQL_HOST>', $sql['host'], $lng['mysql']['description']); $lng['mysql']['description'] = str_replace('<SQL_HOST>', $sql['host'], $lng['mysql']['description']);
eval("echo \"" . getTemplate('mysql/mysql') . "\";"); eval("echo \"" . getTemplate("mysql/mysql") . "\";");
} elseif ($page == 'mysqls') { }
if ($action == '') { elseif($page == 'mysqls')
{
if($action == '')
{
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_mysql::mysqls"); $log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_mysql::mysqls");
$fields = array( $fields = array(
'databasename' => $lng['mysql']['databasename'], 'databasename' => $lng['mysql']['databasename'],
'description' => $lng['mysql']['databasedescription'] 'description' => $lng['mysql']['databasedescription']
); );
$paging = new paging($userinfo, TABLE_PANEL_DATABASES, $fields); $paging = new paging($userinfo, $db, TABLE_PANEL_DATABASES, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_DATABASES . "` $result = $db->query("SELECT `id`, `databasename`, `description`, `dbserver` FROM `" . TABLE_PANEL_DATABASES . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
WHERE `customerid`= :customerid " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit() $paging->setEntries($db->num_rows($result));
);
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid']));
$mysqls_count = Database::num_rows();
$paging->setEntries($mysqls_count);
$sortcode = $paging->getHtmlSortCode($lng); $sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s); $arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng); $searchcode = $paging->getHtmlSearchCode($lng);
@@ -66,308 +62,194 @@ if ($page == 'overview') {
$count = 0; $count = 0;
$mysqls = ''; $mysqls = '';
$dbservers_stmt = Database::query("SELECT COUNT(DISTINCT `dbserver`) as numservers FROM `".TABLE_PANEL_DATABASES."`"); while($row = $db->fetch_array($result))
$dbserver = $dbservers_stmt->fetch(PDO::FETCH_ASSOC); {
$count_mysqlservers = $dbserver['numservers']; if($paging->checkDisplay($i))
{
// Begin root-session
Database::needRoot(true);
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
if ($paging->checkDisplay($i)) {
$row = htmlentities_array($row); $row = htmlentities_array($row);
$mbdata_stmt = Database::prepare("SELECT SUM(data_length + index_length) as MB FROM information_schema.TABLES eval("\$mysqls.=\"" . getTemplate("mysql/mysqls_database") . "\";");
WHERE table_schema = :table_schema
GROUP BY table_schema"
);
Database::pexecute($mbdata_stmt, array("table_schema" => $row['databasename']));
$mbdata = $mbdata_stmt->fetch(PDO::FETCH_ASSOC);
$row['size'] = size_readable($mbdata['MB'], 'GiB', 'bi', '%01.' . (int)Settings::Get('panel.decimal_places') . 'f %s');
eval("\$mysqls.=\"" . getTemplate('mysql/mysqls_database') . "\";");
$count++; $count++;
} }
$i++; $i++;
} }
Database::needRoot(false);
// End root-session
eval("echo \"" . getTemplate('mysql/mysqls') . "\";"); $mysqls_count = $db->num_rows($result);
eval("echo \"" . getTemplate("mysql/mysqls") . "\";");
}
elseif($action == 'delete'
&& $id != 0)
{
$result = $db->query_first('SELECT `id`, `databasename`, `dbserver` FROM `' . TABLE_PANEL_DATABASES . '` WHERE `customerid`="' . (int)$userinfo['customerid'] . '" AND `id`="' . (int)$id . '"');
} elseif ($action == 'delete' && $id != 0) { if(isset($result['databasename'])
$result_stmt = Database::prepare('SELECT `id`, `databasename`, `description`, `dbserver` FROM `' . TABLE_PANEL_DATABASES . '` && $result['databasename'] != '')
WHERE `customerid`="' . (int)$userinfo['customerid'] . '" {
AND `id`="' . (int)$id . '"' if(!isset($sql_root[$result['dbserver']]) || !is_array($sql_root[$result['dbserver']]))
); {
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid']));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
if (isset($result['databasename']) && $result['databasename'] != '') {
Database::needRoot(true, $result['dbserver']);
Database::needSqlData();
$sql_root = Database::getSqlData();
Database::needRoot(false);
if (!isset($sql_root[$result['dbserver']]) || !is_array($sql_root[$result['dbserver']])) {
$result['dbserver'] = 0; $result['dbserver'] = 0;
} }
if (isset($_POST['send']) && $_POST['send'] == 'send') { if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
// Begin root-session // Begin root-session
Database::needRoot(true, $result['dbserver']);
$dbm = new DbManager($log); $db_root = new db($sql_root[$result['dbserver']]['host'], $sql_root[$result['dbserver']]['user'], $sql_root[$result['dbserver']]['password'], '');
$dbm->getManager()->deleteDatabase($result['databasename']); unset($db_root->password);
$log->logAction(USR_ACTION, LOG_INFO, "deleted database '" . $result['databasename'] . "'"); foreach(array_map('trim', array_unique(explode(',', $settings['system']['mysql_access_host']))) as $mysql_access_host)
Database::needRoot(false); {
$db_root->query('REVOKE ALL PRIVILEGES ON * . * FROM `' . $db_root->escape($result['databasename']) . '`@`' . $db_root->escape($mysql_access_host) . '`');
$db_root->query('REVOKE ALL PRIVILEGES ON `' . str_replace('_', '\_', $db_root->escape($result['databasename'])) . '` . * FROM `' . $db_root->escape($result['databasename']) . '`@`' . $db_root->escape($mysql_access_host) . '`');
$db_root->query('DELETE FROM `mysql`.`user` WHERE `User` = "' . $db_root->escape($result['databasename']) . '" AND `Host` = "' . $db_root->escape($mysql_access_host) . '"');
}
$db_root->query('DROP DATABASE IF EXISTS `' . $db_root->escape($result['databasename']) . '`');
$db_root->query('FLUSH PRIVILEGES');
$db_root->close();
// End root-session // End root-session
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_DATABASES . "` $db->query('DELETE FROM `' . TABLE_PANEL_DATABASES . '` WHERE `customerid`="' . (int)$userinfo['customerid'] . '" AND `id`="' . (int)$id . '"');
WHERE `customerid` = :customerid
AND `id` = :id"
);
Database::pexecute($stmt, array("customerid" => $userinfo['customerid'], "id" => $id));
$resetaccnumber = ($userinfo['mysqls_used'] == '1') ? " , `mysql_lastaccountnumber` = '0' " : ''; if($userinfo['mysqls_used'] == '1')
{
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` $resetaccnumber = " , `mysql_lastaccountnumber`='0' ";
SET `mysqls_used` = `mysqls_used` - 1 " . $resetaccnumber . "
WHERE `customerid` = :customerid"
);
Database::pexecute($stmt, array("customerid" => $userinfo['customerid']));
redirectTo($filename, array('page' => $page, 's' => $s));
} else {
$dbnamedesc = $result['databasename'];
if (isset($result['description']) && $result['description'] != '') {
$dbnamedesc .= ' ('.$result['description'].')';
} }
ask_yesno('mysql_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $dbnamedesc); else
{
$resetaccnumber = '';
}
$result = $db->query('UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `mysqls_used`=`mysqls_used`-1 ' . $resetaccnumber . 'WHERE `customerid`="' . (int)$userinfo['customerid'] . '"');
redirectTo($filename, Array('page' => $page, 's' => $s));
}
else
{
ask_yesno('mysql_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['databasename']);
} }
} }
} elseif ($action == 'add') { }
if ($userinfo['mysqls_used'] < $userinfo['mysqls'] || $userinfo['mysqls'] == '-1') { elseif($action == 'add')
if (isset($_POST['send']) && $_POST['send'] == 'send') { {
if($userinfo['mysqls_used'] < $userinfo['mysqls']
|| $userinfo['mysqls'] == '-1')
{
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$password = validate($_POST['mysql_password'], 'password'); $password = validate($_POST['mysql_password'], 'password');
$password = validatePassword($password);
$sendinfomail = isset($_POST['sendinfomail']) ? 1 : 0; if($password == '')
if ($sendinfomail != 1) { {
$sendinfomail = 0;
}
if ($password == '') {
standard_error(array('stringisempty', 'mypassword')); standard_error(array('stringisempty', 'mypassword'));
} else { }
$dbserver = 0; else
$dbservers_stmt = Database::query("SELECT COUNT(DISTINCT `dbserver`) as numservers FROM `".TABLE_PANEL_DATABASES."`"); {
$_dbserver = $dbservers_stmt->fetch(PDO::FETCH_ASSOC); $username = $userinfo['loginname'] . $settings['customer']['mysqlprefix'] . (intval($userinfo['mysql_lastaccountnumber']) + 1);
$count_mysqlservers = $_dbserver['numservers'];
if ($count_mysqlservers > 1) { if(count($sql_root) > 1)
{
$dbserver = validate($_POST['mysql_server'], html_entity_decode($lng['mysql']['mysql_server']), '', '', 0); $dbserver = validate($_POST['mysql_server'], html_entity_decode($lng['mysql']['mysql_server']), '', '', 0);
Database::needRoot(true, $dbserver);
Database::needSqlData(); if(!isset($sql_root[$dbserver]) || !is_array($sql_root[$dbserver]))
$sql_root = Database::getSqlData(); {
Database::needRoot(false);
if (!isset($sql_root) || !is_array($sql_root)) {
$dbserver = 0; $dbserver = 0;
} }
} }
else
// validate description before actual adding the database, #1052 {
$databasedescription = validate(trim($_POST['description']), 'description'); $dbserver = 0;
// create database, user, set permissions, etc.pp.
$dbm = new DbManager($log);
$username = $dbm->createDatabase(
$userinfo['loginname'],
$password,
$userinfo['mysql_lastaccountnumber']
);
// we've checked against the password in dbm->createDatabase
if ($username == false) {
standard_error('passwordshouldnotbeusername');
}
// Statement modified for Database description -- PH 2004-11-29
$stmt = Database::prepare('INSERT INTO `' . TABLE_PANEL_DATABASES . '`
(`customerid`, `databasename`, `description`, `dbserver`)
VALUES (:customerid, :databasename, :description, :dbserver)'
);
$params = array(
"customerid" => $userinfo['customerid'],
"databasename" => $username,
"description" => $databasedescription,
"dbserver" => $dbserver
);
Database::pexecute($stmt, $params);
$stmt = Database::prepare('UPDATE `' . TABLE_PANEL_CUSTOMERS . '`
SET `mysqls_used` = `mysqls_used` + 1, `mysql_lastaccountnumber` = `mysql_lastaccountnumber` + 1
WHERE `customerid` = :customerid'
);
Database::pexecute($stmt, array("customerid" => $userinfo['customerid']));
if ($sendinfomail == 1) {
$pma = $lng['admin']['notgiven'];
if (Settings::Get('panel.phpmyadmin_url') != '') {
$pma = Settings::Get('panel.phpmyadmin_url');
}
Database::needRoot(true, $dbserver);
Database::needSqlData();
$sql_root = Database::getSqlData();
Database::needRoot(false);
$replace_arr = array(
'SALUTATION' => getCorrectUserSalutation($userinfo),
'CUST_NAME' => getCorrectUserSalutation($userinfo), // < keep this for compatibility
'DB_NAME' => $username,
'DB_PASS' => $password,
'DB_DESC' => $databasedescription,
'DB_SRV' => $sql_root['host'],
'PMA_URI' => $pma
);
$def_language = $userinfo['def_language'];
$result_stmt = Database::prepare("SELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid
AND `language` = :lang
AND `templategroup`='mails'
AND `varname`='new_database_by_customer_subject'"
);
Database::pexecute($result_stmt, array("adminid" => $userinfo['adminid'], "lang" => $def_language));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
$mail_subject = html_entity_decode(replace_variables((($result['value'] != '') ? $result['value'] : $lng['mails']['new_database_by_customer']['subject']), $replace_arr));
$result_stmt = Database::prepare("SELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid`= :adminid
AND `language`= :lang
AND `templategroup` = 'mails'
AND `varname` = 'new_database_by_customer_mailbody'"
);
Database::pexecute($result_stmt, array("adminid" => $userinfo['adminid'], "lang" => $def_language));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
$mail_body = html_entity_decode(replace_variables((($result['value'] != '') ? $result['value'] : $lng['mails']['new_database_by_customer']['mailbody']), $replace_arr));
$_mailerror = false;
try {
$mail->Subject = $mail_subject;
$mail->AltBody = $mail_body;
$mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
$mail->AddAddress($userinfo['email'], getCorrectUserSalutation($userinfo));
$mail->Send();
} catch(phpmailerException $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (Exception $e) {
$mailerr_msg = $e->getMessage();
$_mailerror = true;
}
if ($_mailerror) {
$log->logAction(USR_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
standard_error('errorsendingmail', $userinfo['email']);
}
$mail->ClearAddresses();
}
redirectTo($filename, array('page' => $page, 's' => $s));
}
} else {
$dbservers_stmt = Database::query("SELECT DISTINCT `dbserver` FROM `".TABLE_PANEL_DATABASES."`");
$mysql_servers = '';
$count_mysqlservers = 0;
while ($dbserver = $dbservers_stmt->fetch(PDO::FETCH_ASSOC)) {
Database::needRoot(true, $dbserver['dbserver']);
Database::needSqlData();
$sql_root = Database::getSqlData();
$mysql_servers .= makeoption($sql_root['caption'], $dbserver['dbserver']);
$count_mysqlservers++;
}
Database::needRoot(false);
$mysql_add_data = include_once dirname(__FILE__).'/lib/formfields/customer/mysql/formfield.mysql_add.php';
$mysql_add_form = htmlform::genHTMLForm($mysql_add_data);
$title = $mysql_add_data['mysql_add']['title'];
$image = $mysql_add_data['mysql_add']['image'];
eval("echo \"" . getTemplate('mysql/mysqls_add') . "\";");
}
}
} elseif ($action == 'edit' && $id != 0) {
$result_stmt = Database::prepare("SELECT `id`, `databasename`, `description`, `dbserver` FROM `" . TABLE_PANEL_DATABASES . "`
WHERE `customerid` = :customerid
AND `id` = :id"
);
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'], "id" => $id));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
if (isset($result['databasename']) && $result['databasename'] != '') {
if (!isset($sql_root[$result['dbserver']]) || !is_array($sql_root[$result['dbserver']])) {
$result['dbserver'] = 0;
}
if (isset($_POST['send']) && $_POST['send'] == 'send') {
// Only change Password if it is set, do nothing if it is empty! -- PH 2004-11-29
$password = validate($_POST['mysql_password'], 'password');
if ($password != '') {
// validate password
$password = validatePassword($password);
if ($password == $result['databasename']) {
standard_error('passwordshouldnotbeusername');
} }
// Begin root-session // Begin root-session
Database::needRoot(true);
foreach (array_map('trim', explode(',', Settings::Get('system.mysql_access_host'))) as $mysql_access_host) { $db_root = new db($sql_root[$dbserver]['host'], $sql_root[$dbserver]['user'], $sql_root[$dbserver]['password'], '');
$stmt = Database::prepare("SET PASSWORD FOR :dbname@:host = PASSWORD(:password)"); unset($db_root->password);
$params = array( $db_root->query('CREATE DATABASE `' . $db_root->escape($username) . '`');
"dbname" => $result['databasename'], $log->logAction(USR_ACTION, LOG_INFO, "created database '" . $username . "'");
"host" => $mysql_access_host, foreach(array_map('trim', explode(',', $settings['system']['mysql_access_host'])) as $mysql_access_host)
"password" => $password {
); $db_root->query('GRANT ALL PRIVILEGES ON `' . str_replace('_', '\_', $db_root->escape($username)) . '`.* TO `' . $db_root->escape($username) . '`@`' . $db_root->escape($mysql_access_host) . '` IDENTIFIED BY \'password\'');
Database::pexecute($stmt, $params); $db_root->query('SET PASSWORD FOR `' . $db_root->escape($username) . '`@`' . $db_root->escape($mysql_access_host) . '` = PASSWORD(\'' . $db_root->escape($password) . '\')');
$log->logAction(USR_ACTION, LOG_NOTICE, "grant all privileges for '" . $username . "'@'" . $mysql_access_host . "'");
} }
$stmt = Database::prepare("FLUSH PRIVILEGES"); $db_root->query('FLUSH PRIVILEGES');
Database::pexecute($stmt); $db_root->close();
Database::needRoot(false);
// End root-session
// Statement modifyed for Database description -- PH 2004-11-29
$databasedescription = validate($_POST['description'], 'description');
$result = $db->query('INSERT INTO `' . TABLE_PANEL_DATABASES . '` (`customerid`, `databasename`, `description`, `dbserver`) VALUES ("' . (int)$userinfo['customerid'] . '", "' . $db->escape($username) . '", "' . $db->escape($databasedescription) . '", "' . $db->escape($dbserver) . '")');
$result = $db->query('UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `mysqls_used`=`mysqls_used`+1, `mysql_lastaccountnumber`=`mysql_lastaccountnumber`+1 WHERE `customerid`="' . (int)$userinfo['customerid'] . '"');
redirectTo($filename, Array('page' => $page, 's' => $s));
}
}
else
{
$mysql_servers = '';
foreach($sql_root as $mysql_server => $mysql_server_details)
{
$mysql_servers .= makeoption($mysql_server_details['caption'], $mysql_server);
}
eval("echo \"" . getTemplate("mysql/mysqls_add") . "\";");
}
}
}
elseif($action == 'edit'
&& $id != 0)
{
$result = $db->query_first('SELECT `id`, `databasename`, `description`, `dbserver` FROM `' . TABLE_PANEL_DATABASES . '` WHERE `customerid`="' . $userinfo['customerid'] . '" AND `id`="' . $id . '"');
if(isset($result['databasename'])
&& $result['databasename'] != '')
{
if(!isset($sql_root[$result['dbserver']]) || !is_array($sql_root[$result['dbserver']]))
{
$result['dbserver'] = 0;
}
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
// Only change Password if it is set, do nothing if it is empty! -- PH 2004-11-29
$password = validate($_POST['mysql_password'], 'password');
if($password != '')
{
// Begin root-session
$db_root = new db($sql_root[$result['dbserver']]['host'], $sql_root[$result['dbserver']]['user'], $sql_root[$result['dbserver']]['password'], '');
unset($db_root->password);
foreach(array_map('trim', explode(',', $settings['system']['mysql_access_host'])) as $mysql_access_host)
{
$db_root->query('SET PASSWORD FOR `' . $db_root->escape($result['databasename']) . '`@`' . $db_root->escape($mysql_access_host) . '` = PASSWORD(\'' . $db_root->escape($password) . '\')');
}
$db_root->query('FLUSH PRIVILEGES');
$db_root->close();
// End root-session // End root-session
} }
// Update the Database description -- PH 2004-11-29 // Update the Database description -- PH 2004-11-29
$log->logAction(USR_ACTION, LOG_INFO, "edited database '" . $result['databasename'] . "'"); $log->logAction(USR_ACTION, LOG_INFO, "edited database '" . $result['databasename'] . "'");
$databasedescription = validate($_POST['description'], 'description'); $databasedescription = validate($_POST['description'], 'description');
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_DATABASES . "` $result = $db->query('UPDATE `' . TABLE_PANEL_DATABASES . '` SET `description`="' . $db->escape($databasedescription) . '" WHERE `customerid`="' . (int)$userinfo['customerid'] . '" AND `id`="' . (int)$id . '"');
SET `description` = :desc redirectTo($filename, Array('page' => $page, 's' => $s));
WHERE `customerid` = :customerid }
AND `id` = :id" else
); {
Database::pexecute($stmt, array("desc" => $databasedescription, "customerid" => $userinfo['customerid'], "id" => $id)); eval("echo \"" . getTemplate("mysql/mysqls_edit") . "\";");
redirectTo($filename, array('page' => $page, 's' => $s));
} else {
$dbservers_stmt = Database::query("SELECT COUNT(DISTINCT `dbserver`) as numservers FROM `".TABLE_PANEL_DATABASES."`");
$dbserver = $dbservers_stmt->fetch(PDO::FETCH_ASSOC);
$count_mysqlservers = $dbserver['numservers'];
Database::needRoot(true, $result['dbserver']);
Database::needSqlData();
$sql_root = Database::getSqlData();
Database::needRoot(false);
$mysql_edit_data = include_once dirname(__FILE__).'/lib/formfields/customer/mysql/formfield.mysql_edit.php';
$mysql_edit_form = htmlform::genHTMLForm($mysql_edit_data);
$title = $mysql_edit_data['mysql_edit']['title'];
$image = $mysql_edit_data['mysql_edit']['image'];
eval("echo \"" . getTemplate('mysql/mysqls_edit') . "\";");
} }
} }
} }
} }
?>

View File

@@ -14,56 +14,49 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'customer'); define('AREA', 'customer');
require './lib/init.php';
// redirect if this customer page is hidden via settings /**
if (Settings::IsInList('panel.customer_hide_options','domains')) { * Include our init.php, which manages Sessions, Language etc.
redirectTo('customer_index.php'); */
}
if (isset($_POST['id'])) { require ("./lib/init.php");
if(isset($_POST['id']))
{
$id = intval($_POST['id']); $id = intval($_POST['id']);
}
//Check if the current user is allowed to see the current ticket. elseif(isset($_GET['id']))
$stmt = Database::prepare("SELECT `id` FROM `panel_tickets` WHERE `id` = :id AND `customerid` = :customerid"); {
$result = Database::pexecute_first($stmt, array("id" => $id, "customerid" => $userinfo['customerid']));
if ($result == null) {
// no rights to see the requested ticket
standard_error(array('ticketnotaccessible'));
}
} elseif (isset($_GET['id'])) {
$id = intval($_GET['id']); $id = intval($_GET['id']);
} }
if ($page == 'overview') { if($page == 'overview')
{
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_tickets"); $log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_tickets");
eval("echo \"" . getTemplate("tickets/ticket") . "\";"); eval("echo \"" . getTemplate("ticket/ticket") . "\";");
} elseif ($page == 'tickets') { }
if ($action == '') { elseif($page == 'tickets')
{
if($action == '')
{
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_tickets::tickets"); $log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_tickets::tickets");
$fields = array( $fields = array(
'status' => $lng['ticket']['status'], 'status' => $lng['ticket']['status'],
'priority' => $lng['ticket']['priority'],
'lastchange' => $lng['ticket']['lastchange'], 'lastchange' => $lng['ticket']['lastchange'],
'ticket_answers' => $lng['ticket']['ticket_answers'],
'subject' => $lng['ticket']['subject'], 'subject' => $lng['ticket']['subject'],
'lastreplier' => $lng['ticket']['lastreplier'] 'lastreplier' => $lng['ticket']['lastreplier']
); );
$paging = new paging($userinfo, TABLE_PANEL_TICKETS, $fields); $paging = new paging($userinfo, $db, TABLE_PANEL_TICKETS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
$stmt = Database::prepare('SELECT `main`.`id`, (SELECT COUNT(`sub`.`id`) FROM `' . TABLE_PANEL_TICKETS . '` `sub` $paging->sortfield = 'lastchange';
WHERE `sub`.`answerto` = `main`.`id`) AS `ticket_answers`, `main`.`lastchange`, `main`.`subject`, `main`.`status`, `main`.`lastreplier`, `main`.`priority` $paging->sortorder = 'desc';
FROM `' . TABLE_PANEL_TICKETS . '` as `main` $result = $db->query('SELECT `main`.`id`, (SELECT COUNT(`sub`.`id`) FROM `' . TABLE_PANEL_TICKETS . '` `sub` WHERE `sub`.`answerto` = `main`.`id`) as `ticket_answers`, `main`.`lastchange`, `main`.`subject`, `main`.`status`, `main`.`lastreplier`, `main`.`priority` FROM `' . TABLE_PANEL_TICKETS . '` as `main` WHERE `main`.`answerto` = "0" AND `archived` = "0" AND `customerid`="' . (int)$userinfo['customerid'] . '" AND `adminid`="' . (int)$userinfo['adminid'] . '" ' . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
WHERE `main`.`answerto` = "0" $paging->setEntries($db->num_rows($result));
AND `archived` = "0"
AND `customerid`= :customerid ' . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit()
);
Database::pexecute($stmt, array("customerid" => $userinfo['customerid']));
$paging->setEntries(Database::num_rows());
$sortcode = $paging->getHtmlSortCode($lng); $sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s); $arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng); $searchcode = $paging->getHtmlSearchCode($lng);
@@ -73,37 +66,44 @@ if ($page == 'overview') {
$tickets = ''; $tickets = '';
$tickets_count = 0; $tickets_count = 0;
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { while($row = $db->fetch_array($result))
if ($paging->checkDisplay($i)) { {
if($paging->checkDisplay($i))
{
$tickets_count++; $tickets_count++;
$row = htmlentities_array($row); $row = htmlentities_array($row);
$row['lastchange'] = date("d.m.y H:i", $row['lastchange']); $row['lastchange'] = date("d.m.y H:i", $row['lastchange']);
if ($row['status'] >= 0 && $row['status'] <= 2) { if($row['status'] >= 0
&& $row['status'] <= 2)
{
$reopen = 0; $reopen = 0;
} else { }
else
{
$reopen = 1; $reopen = 1;
} }
$row['status'] = ticket::getStatusText($lng, $row['status']); $row['status'] = ticket::getStatusText($lng, $row['status']);
$row['priority'] = ticket::getPriorityText($lng, $row['priority']); $row['priority'] = ticket::getPriorityText($lng, $row['priority']);
if ($row['lastreplier'] == '1') { if($row['lastreplier'] == '1')
{
$row['lastreplier'] = $lng['ticket']['staff']; $row['lastreplier'] = $lng['ticket']['staff'];
$cananswer = 1; $cananswer = 1;
} else { }
else
{
$row['lastreplier'] = $lng['ticket']['customer']; $row['lastreplier'] = $lng['ticket']['customer'];
$cananswer = 0; $cananswer = 0;
} }
$row['subject'] = html_entity_decode($row['subject']); if(strlen($row['subject']) > 20)
if (strlen($row['subject']) > 30) { {
$ts = wordwrap($row['subject'], 30, "|"); $row['subject'] = substr($row['subject'], 0, 17) . '...';
$ts = explode("|", $ts);
$row['subject'] = $ts[0]. '...';
} }
eval("\$tickets.=\"" . getTemplate("tickets/tickets_tickets") . "\";"); eval("\$tickets.=\"" . getTemplate("ticket/tickets_tickets") . "\";");
$count++; $count++;
} }
@@ -113,46 +113,60 @@ if ($page == 'overview') {
$supportavailable = 0; $supportavailable = 0;
$time = date("Hi", time()); $time = date("Hi", time());
$day = date("w", time()); $day = date("w", time());
$start = substr(Settings::Get('ticket.worktime_begin'), 0, 2) . substr(Settings::Get('ticket.worktime_begin'), 3, 2); $start = substr($settings['ticket']['worktime_begin'], 0, 2) . substr($settings['ticket']['worktime_begin'], 3, 2);
$end = substr(Settings::Get('ticket.worktime_end'), 0, 2) . substr(Settings::Get('ticket.worktime_end'), 3, 2); $end = substr($settings['ticket']['worktime_end'], 0, 2) . substr($settings['ticket']['worktime_end'], 3, 2);
if ($time >= $start && $time <= $end) { if($time >= $start
&& $time <= $end)
{
$supportavailable = 1; $supportavailable = 1;
} }
if (Settings::Get('ticket.worktime_sat') == "0" && $day == "6") { if($settings['ticket']['worktime_sat'] == "0"
&& $day == "6")
{
$supportavailable = 0; $supportavailable = 0;
} }
if (Settings::Get('ticket.worktime_sun') == "0" && $day == "0") { if($settings['ticket']['worktime_sun'] == "0"
&& $day == "0")
{
$supportavailable = 0; $supportavailable = 0;
} }
if (Settings::Get('ticket.worktime_all') == "1") { if($settings['ticket']['worktime_all'] == "1")
{
$supportavailable = 1; $supportavailable = 1;
} }
$ticketsopen = 0; $ticketsopen = 0;
$stmt = Database::prepare('SELECT COUNT(`id`) as `count` FROM `' . TABLE_PANEL_TICKETS . '` $opentickets = $db->query_first('SELECT COUNT(`id`) as `count` FROM `' . TABLE_PANEL_TICKETS . '`
WHERE `customerid` = :customerid WHERE `customerid` = "' . $userinfo['customerid'] . '"
AND `answerto` = "0" AND `answerto` = "0"
AND (`status` = "0" OR `status` = "1" OR `status` = "2")' AND (`status` = "0" OR `status` = "1" OR `status` = "2")');
);
$opentickets = Database::pexecute_first($stmt, array("customerid" => $userinfo['customerid']));
if (Settings::Get('ticket.concurrently_open') != - 1 && Settings::Get('ticket.concurrently_open') != '') { if($settings['ticket']['concurrently_open'] != - 1
$notmorethanxopentickets = strtr($lng['ticket']['notmorethanxopentickets'], array('%s' => Settings::Get('ticket.concurrently_open'))); && $settings['ticket']['concurrently_open'] != '')
} else { {
$notmorethanxopentickets = strtr($lng['ticket']['notmorethanxopentickets'], array('%s' => $settings['ticket']['concurrently_open']));
}
else
{
$notmorethanxopentickets = ''; $notmorethanxopentickets = '';
} }
$ticketsopen = (int)$opentickets['count']; $ticketsopen = (int)$opentickets['count'];
eval("echo \"" . getTemplate("tickets/tickets") . "\";"); eval("echo \"" . getTemplate("ticket/tickets") . "\";");
}
} elseif ($action == 'new') { elseif($action == 'new')
if ($userinfo['tickets_used'] < $userinfo['tickets'] || $userinfo['tickets'] == '-1') { {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if($userinfo['tickets_used'] < $userinfo['tickets']
$newticket = ticket::getInstanceOf($userinfo, -1); || $userinfo['tickets'] == '-1')
{
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$newticket = ticket::getInstanceOf($userinfo, $db, $settings, -1);
$newticket->Set('subject', validate($_POST['subject'], 'subject'), true, false); $newticket->Set('subject', validate($_POST['subject'], 'subject'), true, false);
$newticket->Set('priority', validate($_POST['priority'], 'priority'), true, false); $newticket->Set('priority', validate($_POST['priority'], 'priority'), true, false);
$newticket->Set('category', validate($_POST['category'], 'category'), true, false); $newticket->Set('category', validate($_POST['category'], 'category'), true, false);
@@ -160,11 +174,16 @@ if ($page == 'overview') {
$newticket->Set('admin', (int)$userinfo['adminid'], true, false); $newticket->Set('admin', (int)$userinfo['adminid'], true, false);
$newticket->Set('message', validate(str_replace("\r\n", "\n", $_POST['message']), 'message', '/^[^\0]*$/'), true, false); $newticket->Set('message', validate(str_replace("\r\n", "\n", $_POST['message']), 'message', '/^[^\0]*$/'), true, false);
if ($newticket->Get('subject') == null) { if($newticket->Get('subject') == null)
{
standard_error(array('stringisempty', 'mysubject')); standard_error(array('stringisempty', 'mysubject'));
} elseif ($newticket->Get('message') == null) { }
elseif($newticket->Get('message') == null)
{
standard_error(array('stringisempty', 'mymessage')); standard_error(array('stringisempty', 'mymessage'));
} else { }
else
{
$now = time(); $now = time();
$newticket->Set('dt', $now, true, true); $newticket->Set('dt', $now, true, true);
$newticket->Set('lastchange', $now, true, true); $newticket->Set('lastchange', $now, true, true);
@@ -174,84 +193,86 @@ if ($page == 'overview') {
$newticket->Set('by', '0', true, true); $newticket->Set('by', '0', true, true);
$newticket->Insert(); $newticket->Insert();
$log->logAction(USR_ACTION, LOG_NOTICE, "opened support-ticket '" . $newticket->Get('subject') . "'"); $log->logAction(USR_ACTION, LOG_NOTICE, "opened support-ticket '" . $newticket->Get('subject') . "'");
$db->query('UPDATE `' . TABLE_PANEL_CUSTOMERS . '`
$stmt = Database::prepare('UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `tickets_used`=`tickets_used`+1 WHERE `customerid`="' . (int)$userinfo['customerid'] . '"');
SET `tickets_used`=`tickets_used` + 1
WHERE `customerid`= :customerid'
);
Database::pexecute($stmt, array("customerid" => $userinfo['customerid']));
// Customer mail // Customer mail
$newticket->sendMail((int)$userinfo['customerid'], 'new_ticket_for_customer_subject', $lng['mails']['new_ticket_for_customer']['subject'], 'new_ticket_for_customer_mailbody', $lng['mails']['new_ticket_for_customer']['mailbody']); $newticket->sendMail((int)$userinfo['customerid'], 'new_ticket_for_customer_subject', $lng['mails']['new_ticket_for_customer']['subject'], 'new_ticket_for_customer_mailbody', $lng['mails']['new_ticket_for_customer']['mailbody']);
// Admin mail // Admin mail
$newticket->sendMail(-1, 'new_ticket_by_customer_subject', $lng['mails']['new_ticket_by_customer']['subject'], 'new_ticket_by_customer_mailbody', $lng['mails']['new_ticket_by_customer']['mailbody']); $newticket->sendMail(-1, 'new_ticket_by_customer_subject', $lng['mails']['new_ticket_by_customer']['subject'], 'new_ticket_by_customer_mailbody', $lng['mails']['new_ticket_by_customer']['mailbody']);
redirectTo($filename, array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
} }
} else { }
else
{
$categories = ''; $categories = '';
$result_stmt = Database::prepare('SELECT `id`, `name` FROM `' . TABLE_PANEL_TICKET_CATS . '` $result = $db->query_first('SELECT `id`, `name` FROM `' . TABLE_PANEL_TICKET_CATS . '` ORDER BY `name` ASC');
WHERE `adminid` = :adminid
ORDER BY `logicalorder`, `name` ASC'
);
$result = Database::pexecute_first($result_stmt, array("adminid" => $userinfo['adminid']));
if (isset($result['name']) && $result['name'] != '') { if(isset($result['name'])
$result2_stmt = Database::prepare('SELECT `id`, `name` FROM `' . TABLE_PANEL_TICKET_CATS . '` && $result['name'] != '')
WHERE `adminid` = :adminid {
ORDER BY `logicalorder`, `name` ASC' $result2 = $db->query('SELECT `id`, `name` FROM `' . TABLE_PANEL_TICKET_CATS . '` ORDER BY `name` ASC');
);
Database::pexecute($result2_stmt, array("adminid" => $userinfo['adminid']));
while ($row = $result2_stmt->fetch(PDO::FETCH_ASSOC)) { while($row = $db->fetch_array($result2))
{
$categories.= makeoption($row['name'], $row['id']); $categories.= makeoption($row['name'], $row['id']);
} }
} else { }
else
{
$categories = makeoption($lng['ticket']['no_cat'], '0'); $categories = makeoption($lng['ticket']['no_cat'], '0');
} }
$priorities = makeoption($lng['ticket']['high'], '1'); $priorities = makeoption($lng['ticket']['unf_high'], '1');
$priorities.= makeoption($lng['ticket']['normal'], '2'); $priorities.= makeoption($lng['ticket']['unf_normal'], '2');
$priorities.= makeoption($lng['ticket']['low'], '3'); $priorities.= makeoption($lng['ticket']['unf_low'], '3');
$ticketsopen = 0; $ticketsopen = 0;
$opentickets_stmt = Database::prepare('SELECT COUNT(`id`) as `count` FROM `' . TABLE_PANEL_TICKETS . '` $opentickets = $db->query_first('SELECT COUNT(`id`) as `count` FROM `' . TABLE_PANEL_TICKETS . '`
WHERE `customerid` = :customerid WHERE `customerid` = "' . $userinfo['customerid'] . '"
AND `answerto` = "0" AND `answerto` = "0"
AND (`status` = "0" OR `status` = "1" OR `status` = "2")' AND (`status` = "0" OR `status` = "1" OR `status` = "2")');
);
$opentickets = Database::pexecute_first($opentickets_stmt, array("customerid" => $userinfo['customerid']));
if (Settings::Get('ticket.concurrently_open') != -1 && Settings::Get('ticket.concurrently_open') != '') { if($settings['ticket']['concurrently_open'] != - 1
$notmorethanxopentickets = strtr($lng['ticket']['notmorethanxopentickets'], array('%s' => Settings::Get('ticket.concurrently_open'))); && $settings['ticket']['concurrently_open'] != '')
} else { {
$notmorethanxopentickets = strtr($lng['ticket']['notmorethanxopentickets'], array('%s' => $settings['ticket']['concurrently_open']));
}
else
{
$notmorethanxopentickets = ''; $notmorethanxopentickets = '';
} }
$ticketsopen = (int)$opentickets['count']; $ticketsopen = (int)$opentickets['count'];
eval("echo \"" . getTemplate("ticket/tickets_new") . "\";");
$ticket_add_data = include_once dirname(__FILE__).'/lib/formfields/customer/tickets/formfield.ticket_add.php';
$ticket_add_form = htmlform::genHTMLForm($ticket_add_data);
$title = $ticket_add_data['ticket_add']['title'];
$image = $ticket_add_data['ticket_add']['image'];
eval("echo \"" . getTemplate("tickets/tickets_new") . "\";");
} }
} else { }
else
{
standard_error('nomoreticketsavailable'); standard_error('nomoreticketsavailable');
} }
} elseif ($action == 'answer' && $id != 0) { }
if (isset($_POST['send']) && $_POST['send'] == 'send') { elseif($action == 'answer'
$replyticket = ticket::getInstanceOf($userinfo, -1); && $id != 0)
{
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$replyticket = ticket::getInstanceOf($userinfo, $db, $settings, -1);
$replyticket->Set('subject', validate($_POST['subject'], 'subject'), true, false); $replyticket->Set('subject', validate($_POST['subject'], 'subject'), true, false);
$replyticket->Set('priority', validate($_POST['priority'], 'priority'), true, false); $replyticket->Set('priority', validate($_POST['priority'], 'priority'), true, false);
$replyticket->Set('message', validate(str_replace("\r\n", "\n", $_POST['message']), 'message', '/^[^\0]*$/'), true, false); $replyticket->Set('message', validate(str_replace("\r\n", "\n", $_POST['message']), 'message', '/^[^\0]*$/'), true, false);
if ($replyticket->Get('message') == null) { if($replyticket->Get('message') == null)
{
standard_error(array('stringisempty', 'mymessage')); standard_error(array('stringisempty', 'mymessage'));
} else { }
else
{
$now = time(); $now = time();
$replyticket->Set('customer', (int)$userinfo['customerid'], true, true); $replyticket->Set('customerid', (int)$userinfo['customerid'], true, true);
$replyticket->Set('lastchange', $now, true, true); $replyticket->Set('lastchange', $now, true, true);
$replyticket->Set('ip', $_SERVER['REMOTE_ADDR'], true, true); $replyticket->Set('ip', $_SERVER['REMOTE_ADDR'], true, true);
$replyticket->Set('status', '1', true, true); $replyticket->Set('status', '1', true, true);
@@ -260,9 +281,11 @@ if ($page == 'overview') {
$replyticket->Insert(); $replyticket->Insert();
// Update priority if changed // Update priority if changed
$mainticket = ticket::getInstanceOf($userinfo, (int)$id);
if ($replyticket->Get('priority') != $mainticket->Get('priority')) { $mainticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$id);
if($replyticket->Get('priority') != $mainticket->Get('priority'))
{
$mainticket->Set('priority', $replyticket->Get('priority'), true); $mainticket->Set('priority', $replyticket->Get('priority'), true);
} }
@@ -272,121 +295,120 @@ if ($page == 'overview') {
$mainticket->Update(); $mainticket->Update();
$log->logAction(USR_ACTION, LOG_NOTICE, "answered support-ticket '" . $mainticket->Get('subject') . "'"); $log->logAction(USR_ACTION, LOG_NOTICE, "answered support-ticket '" . $mainticket->Get('subject') . "'");
$mainticket->sendMail(-1, 'new_reply_ticket_by_customer_subject', $lng['mails']['new_reply_ticket_by_customer']['subject'], 'new_reply_ticket_by_customer_mailbody', $lng['mails']['new_reply_ticket_by_customer']['mailbody']); $mainticket->sendMail(-1, 'new_reply_ticket_by_customer_subject', $lng['mails']['new_reply_ticket_by_customer']['subject'], 'new_reply_ticket_by_customer_mailbody', $lng['mails']['new_reply_ticket_by_customer']['mailbody']);
redirectTo($filename, array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
} }
} else { }
else
{
$ticket_replies = ''; $ticket_replies = '';
$mainticket = ticket::getInstanceOf($userinfo, (int)$id); $mainticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$id);
$dt = date("d.m.Y H:i\h", $mainticket->Get('dt')); $dt = date("d.m.Y H:i\h", $mainticket->Get('dt'));
$status = ticket::getStatusText($lng, $mainticket->Get('status')); $status = ticket::getStatusText($lng, $mainticket->Get('status'));
if ($mainticket->Get('status') >= 0 && $mainticket->Get('status') <= 2) { if($mainticket->Get('status') >= 0
&& $mainticket->Get('status') <= 2)
{
$isclosed = 0; $isclosed = 0;
} else { }
else
{
$isclosed = 1; $isclosed = 1;
} }
if ($mainticket->Get('by') == '1') { if($mainticket->Get('by') == '1')
{
$by = $lng['ticket']['staff']; $by = $lng['ticket']['staff'];
} else { }
$cid = $mainticket->Get('customer'); else
$usr_stmt = Database::prepare('SELECT `customerid`, `firstname`, `name`, `company`, `loginname` {
FROM `' . TABLE_PANEL_CUSTOMERS . '` $by = $lng['ticket']['customer'];
WHERE `customerid` = :customerid '
);
$usr = Database::pexecute_first($usr_stmt, array("customerid" => $cid));
$by = getCorrectFullUserDetails($usr);
} }
$subject = $mainticket->Get('subject'); $subject = $mainticket->Get('subject');
$message = $mainticket->Get('message'); $message = $mainticket->Get('message');
eval("\$ticket_replies.=\"" . getTemplate("tickets/tickets_tickets_main") . "\";"); eval("\$ticket_replies.=\"" . getTemplate("ticket/tickets_tickets_main") . "\";");
$result_stmt = Database::prepare('SELECT `name` FROM `' . TABLE_PANEL_TICKET_CATS . '` $result = $db->query('SELECT `name` FROM `' . TABLE_PANEL_TICKET_CATS . '`
WHERE `id`= :id ' WHERE `id`="' . (int)$mainticket->Get('category') . '"');
); $row = $db->fetch_array($result);
$row = Database::pexecute_first($result_stmt, array("id" => $mainticket->Get('category'))); $andere = $db->query('SELECT * FROM `' . TABLE_PANEL_TICKETS . '` WHERE `answerto`="' . (int)$id . '" ORDER BY `lastchange` ASC');
$andere_stmt = Database::prepare('SELECT * FROM `' . TABLE_PANEL_TICKETS . '` while($row2 = $db->fetch_array($andere))
WHERE `answerto`= :answerto {
ORDER BY `lastchange` ASC' $subticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$row2['id']);
);
Database::pexecute($andere_stmt, array("answerto" => $id));
$numrows_andere = Database::num_rows();
while ($row2 = $andere_stmt->fetch(PDO::FETCH_ASSOC)) {
$subticket = ticket::getInstanceOf($userinfo, (int)$row2['id']);
$lastchange = date("d.m.Y H:i\h", $subticket->Get('lastchange')); $lastchange = date("d.m.Y H:i\h", $subticket->Get('lastchange'));
if ($subticket->Get('by') == '1') { if($subticket->Get('by') == '1')
{
$by = $lng['ticket']['staff']; $by = $lng['ticket']['staff'];
} else { }
$cid = $subticket->Get('customer'); else
$usr_stmt = Database::prepare(' {
SELECT `customerid`, `firstname`, `name`, `company`, `loginname` $by = $lng['ticket']['customer'];
FROM `' . TABLE_PANEL_CUSTOMERS . '`
WHERE `customerid` = :customerid '
);
$usr = Database::pexecute_first($usr_stmt, array("customerid" => $cid));
$by = getCorrectFullUserDetails($usr);
} }
$subject = $subticket->Get('subject'); $subject = $subticket->Get('subject');
$message = $subticket->Get('message'); $message = $subticket->Get('message');
eval("\$ticket_replies.=\"" . getTemplate("ticket/tickets_tickets_list") . "\";");
$row2 = htmlentities_array($row2);
eval("\$ticket_replies.=\"" . getTemplate("tickets/tickets_tickets_list") . "\";");
} }
$priorities = makeoption($lng['ticket']['high'], '1', $mainticket->Get('priority'), true, true); $priorities = makeoption($lng['ticket']['high'], '1', $mainticket->Get('priority'), true, true);
$priorities.= makeoption($lng['ticket']['normal'], '2', $mainticket->Get('priority'), true, true); $priorities.= makeoption($lng['ticket']['normal'], '2', $mainticket->Get('priority'), true, true);
$priorities.= makeoption($lng['ticket']['low'], '3', $mainticket->Get('priority'), true, true); $priorities.= makeoption($lng['ticket']['low'], '3', $mainticket->Get('priority'), true, true);
$subject = htmlentities($mainticket->Get('subject')); $subject = $mainticket->Get('subject');
$ticket_replies_count = $numrows_andere + 1; $ticket_replies_count = $db->num_rows($andere) + 1;
// don't forget the main-ticket! // don't forget the main-ticket!
$ticket_reply_data = include_once dirname(__FILE__).'/lib/formfields/customer/tickets/formfield.ticket_reply.php';
$ticket_reply_form = htmlform::genHTMLForm($ticket_reply_data);
$title = $ticket_reply_data['ticket_reply']['title']; eval("echo \"" . getTemplate("ticket/tickets_reply") . "\";");
$image = $ticket_reply_data['ticket_reply']['image'];
eval("echo \"" . getTemplate("tickets/tickets_reply") . "\";");
} }
} elseif ($action == 'close' && $id != 0) { }
if (isset($_POST['send']) && $_POST['send'] == 'send') { elseif($action == 'close'
&& $id != 0)
{
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$now = time(); $now = time();
$mainticket = ticket::getInstanceOf($userinfo, (int)$id); $mainticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$id);
$mainticket->Set('lastchange', $now, true, true); $mainticket->Set('lastchange', $now, true, true);
$mainticket->Set('lastreplier', '0', true, true); $mainticket->Set('lastreplier', '0', true, true);
$mainticket->Set('status', '3', true, true); $mainticket->Set('status', '3', true, true);
$mainticket->Update(); $mainticket->Update();
$log->logAction(USR_ACTION, LOG_NOTICE, "closed support-ticket '" . $mainticket->Get('subject') . "'"); $log->logAction(USR_ACTION, LOG_NOTICE, "closed support-ticket '" . $mainticket->Get('subject') . "'");
redirectTo($filename, array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
} else { }
$mainticket = ticket::getInstanceOf($userinfo, (int)$id); else
{
$mainticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$id);
ask_yesno('ticket_reallyclose', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $mainticket->Get('subject')); ask_yesno('ticket_reallyclose', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $mainticket->Get('subject'));
} }
} elseif ($action == 'reopen' && $id != 0) { }
elseif($action == 'reopen'
&& $id != 0)
{
$ticketsopen = 0; $ticketsopen = 0;
$opentickets_stmt = Database::prepare('SELECT COUNT(`id`) as `count` FROM `' . TABLE_PANEL_TICKETS . '` $opentickets = $db->query_first('SELECT COUNT(`id`) as `count` FROM `' . TABLE_PANEL_TICKETS . '`
WHERE `customerid` = :customerid WHERE `customerid` = "' . $userinfo['customerid'] . '"
AND `answerto` = "0" AND `answerto` = "0"
AND (`status` = "0" OR `status` = "1" OR `status` = "2")' AND (`status` = "0" OR `status` = "1" OR `status` = "2")');
);
$opentickets = Database::pexecute_first($opentickets_stmt, array("customerid" => $userinfo['customerid']));
$ticketsopen = (int)$opentickets['count']; $ticketsopen = (int)$opentickets['count'];
if ($ticketsopen > Settings::Get('ticket.concurrently_open') && Settings::Get('ticket.concurrently_open') != - 1 && Settings::Get('ticket.concurrently_open') != '') { if($ticketsopen > $settings['ticket']['concurrently_open']
standard_error('notmorethanxopentickets', Settings::Get('ticket.concurrently_open')); && $settings['ticket']['concurrently_open'] != - 1
&& $settings['ticket']['concurrently_open'] != '')
{
standard_error('notmorethanxopentickets', $settings['ticket']['concurrently_open']);
} }
$now = time(); $now = time();
$mainticket = ticket::getInstanceOf($userinfo, (int)$id); $mainticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$id);
$mainticket->Set('lastchange', $now, true, true); $mainticket->Set('lastchange', $now, true, true);
$mainticket->Set('lastreplier', '0', true, true); $mainticket->Set('lastreplier', '0', true, true);
$mainticket->Set('status', '0', true, true); $mainticket->Set('status', '0', true, true);
$mainticket->Update(); $mainticket->Update();
$log->logAction(USR_ACTION, LOG_NOTICE, "reopened support-ticket '" . $mainticket->Get('subject') . "'"); $log->logAction(USR_ACTION, LOG_NOTICE, "reopened support-ticket '" . $mainticket->Get('subject') . "'");
redirectTo($filename, array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
} }
} }
?>

View File

@@ -14,152 +14,266 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'customer'); define('AREA', 'customer');
$intrafficpage = 1;
require './lib/init.php';
// redirect if this customer page is hidden via settings /**
if (Settings::IsInList('panel.customer_hide_options','traffic')) { * Include our init.php, which manages Sessions, Language etc.
redirectTo('customer_index.php'); */
}
require ("./lib/init.php");
$traffic = ''; $traffic = '';
$month = null; $month = null;
$year = null; $year = null;
if (isset($_POST['month']) && isset($_POST['year'])) { if(isset($_POST['month'])
&& isset($_POST['year']))
{
$month = intval($_POST['month']); $month = intval($_POST['month']);
$year = intval($_POST['year']); $year = intval($_POST['year']);
} elseif (isset($_GET['month']) && isset($_GET['year'])) { }
elseif(isset($_GET['month'])
&& isset($_GET['year']))
{
$month = intval($_GET['month']); $month = intval($_GET['month']);
$year = intval($_GET['year']); $year = intval($_GET['year']);
} }
//BAM! $_GET??? //BAM! $_GET???
elseif (isset($_GET['page']) && $_GET['page'] == 'current') {
if (date('d') != '01') { elseif (isset($_GET['page'])
&& $_GET['page'] == "current")
{
if(date('d') != '01')
{
$month = date('m'); $month = date('m');
$year = date('Y'); $year = date('Y');
} else { }
if (date('m') == '01') { else
{
if(date('m') == '01')
{
$month = 12; $month = 12;
$year = date('Y') - 1; $year = date('Y') - 1;
} else { }
else
{
$month = date('m') - 1; $month = date('m') - 1;
$year = date('Y'); $year = date('Y');
} }
} }
} }
if (!is_null($month) && !is_null($year)) { if(!is_null($month)
&& !is_null($year))
{
$traf['byte'] = 0; $traf['byte'] = 0;
$result_stmt = Database::prepare("SELECT SUM(`http`) as 'http', SUM(`ftp_up`) AS 'ftp_up', SUM(`ftp_down`) as 'ftp_down', SUM(`mail`) as 'mail', `day`, `month`, `year` $result = $db->query("SELECT MAX(`http`), MAX(`ftp_up`+`ftp_down`), MAX(`mail`)
FROM `" . TABLE_PANEL_TRAFFIC . "` FROM `" . TABLE_PANEL_TRAFFIC . "`
WHERE `customerid`= :customerid WHERE `customerid`='" . $userinfo['customerid'] . "'
AND `month` = :month AND `month` = '" . $month . "'
AND `year` = :year AND `year` = '" . $year . "'");
GROUP BY `day` $row = mysql_fetch_row($result);
ORDER BY `day` DESC" rsort($row);
); $traf['max'] = ($row[0] > $row[1] ? ($row[0] > $row[2] ? $row[0] : $row[2]) : ($row[1] > $row[2] ? $row[1] : $row[2]));;
$params = array( $result = $db->query("SELECT
"customerid" => $userinfo['customerid'], SUM(`http`) as 'http', SUM(`ftp_up`) AS 'ftp_up', SUM(`ftp_down`) as 'ftp_down', SUM(`mail`) as 'mail',
"month" => $month, `day`, `month`, `year`
"year" => $year FROM `" . TABLE_PANEL_TRAFFIC . "`
); WHERE `customerid`='" . $userinfo['customerid'] . "'
Database::pexecute($result_stmt, $params); AND `month` = '" . $month . "' AND `year` = '" . $year . "'
GROUP BY `day` ORDER BY `day` ASC");
$traffic_complete['http'] = 0; $traffic_complete['http'] = 0;
$traffic_complete['ftp'] = 0; $traffic_complete['ftp'] = 0;
$traffic_complete['mail'] = 0; $traffic_complete['mail'] = 0;
$show = ''; $show = '';
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while($row = $db->fetch_array($result))
{
$http = $row['http']; $http = $row['http'];
$ftp = $row['ftp_up'] + $row['ftp_down']; $ftp = $row['ftp_up'] + $row['ftp_down'];
$mail = $row['mail']; $mail = $row['mail'];
$traf['byte'] = $http + $ftp + $mail; $traf['byte'] = $http + $ftp + $mail;
$traffic_complete['http'] += $http; $traffic_complete['http']+= $http;
$traffic_complete['ftp'] += $ftp; $traffic_complete['ftp']+= $ftp;
$traffic_complete['mail'] += $mail; $traffic_complete['mail']+= $mail;
$traf['day'] = $row['day'] . '.'; $traf['day'] = $row['day'];
if (extension_loaded('bcmath')) { if(extension_loaded('bcmath'))
$traf['ftptext'] = bcdiv($row['ftp_up'], 1024, Settings::Get('panel.decimal_places')) . " MiB up/ " . bcdiv($row['ftp_down'], 1024, Settings::Get('panel.decimal_places')) . " MiB down (FTP)"; {
$traf['httptext'] = bcdiv($http, 1024, Settings::Get('panel.decimal_places')) . " MiB (HTTP)"; $traf['ftptext'] = bcdiv($row['ftp_up'], 1024, $settings['panel']['decimal_places']) . " MB up/ " . bcdiv($row['ftp_down'], 1024, $settings['panel']['decimal_places']) . " MB down (FTP)";
$traf['mailtext'] = bcdiv($mail, 1024, Settings::Get('panel.decimal_places')) . " MiB (Mail)"; $traf['httptext'] = bcdiv($http, 1024, $settings['panel']['decimal_places']) . " MB (HTTP)";
$traf['ftp'] = bcdiv($ftp, 1024, Settings::Get('panel.decimal_places')); $traf['mailtext'] = bcdiv($mail, 1024, $settings['panel']['decimal_places']) . " MB (Mail)";
$traf['http'] = bcdiv($http, 1024, Settings::Get('panel.decimal_places')); }
$traf['mail'] = bcdiv($mail, 1024, Settings::Get('panel.decimal_places')); else
$traf['byte'] = bcdiv($traf['byte'], 1024, Settings::Get('panel.decimal_places')); {
} else { $traf['ftptext'] = round($row['ftp_up'] / 1024, $settings['panel']['decimal_places']) . " MB up/ " . round($row['ftp_down'] / 1024, $settings['panel']['decimal_places']) . " MB down (FTP)";
$traf['ftptext'] = round($row['ftp_up'] / 1024, Settings::Get('panel.decimal_places')) . " MiB up/ " . round($row['ftp_down'] / 1024, Settings::Get('panel.decimal_places')) . " MiB down (FTP)"; $traf['httptext'] = round($http / 1024, $settings['panel']['decimal_places']) . " MB (HTTP)";
$traf['httptext'] = round($http / 1024, Settings::Get('panel.decimal_places')) . " MiB (HTTP)"; $traf['mailtext'] = round($mail / 1024, $settings['panel']['decimal_places']) . " MB (Mail)";
$traf['mailtext'] = round($mail / 1024, Settings::Get('panel.decimal_places')) . " MiB (Mail)";
$traf['http'] = round($http, Settings::Get('panel.decimal_places'));
$traf['ftp'] = round($ftp, Settings::Get('panel.decimal_places'));
$traf['mail'] = round($mail, Settings::Get('panel.decimal_places'));
$traf['byte'] = round($traf['byte'] / 1024, Settings::Get('panel.decimal_places'));
} }
eval("\$traffic.=\"" . getTemplate('traffic/traffic_month') . "\";"); if($traf['byte'] != 0
$show = $lng['traffic']['months'][intval($row['month'])] . ' ' . $row['year']; && $traf['max'] != 0)
{
$proz = $traf['max'] / 100;
$traf['http'] = round($http / $proz, 0);
$traf['ftp'] = round($ftp / $proz, 0);
$traf['mail'] = round($mail / $proz, 0);
if($traf['http'] == 0)
{
$traf['http'] = 1;
}
if($traf['ftp'] == 0)
{
$traf['ftp'] = 1;
}
if($traf['mail'] == 0)
{
$traf['mail'] = 1;
}
}
else
{
$traf['http'] = 0;
$traf['ftp'] = 0;
$traf['mail'] = 0;
}
if(extension_loaded('bcmath'))
{
$traf['byte'] = bcdiv($traf['byte'], 1024, $settings['panel']['decimal_places']);
}
else
{
$traf['byte'] = round($traf['byte'] / 1024, $settings['panel']['decimal_places']);
}
eval("\$traffic.=\"" . getTemplate("traffic/traffic_month") . "\";");
$show = $lng['traffic']['months'][intval($row['month'])] . " " . $row['year'];
} }
$traffic_complete['http'] = size_readable($traffic_complete['http'] * 1024, 'GiB', 'bi', '%01.'.(int)Settings::Get('panel.decimal_places').'f %s'); if(extension_loaded('bcmath'))
$traffic_complete['ftp'] = size_readable($traffic_complete['ftp'] * 1024, 'GiB', 'bi', '%01.'.(int)Settings::Get('panel.decimal_places').'f %s'); {
$traffic_complete['mail'] = size_readable($traffic_complete['mail'] * 1024, 'GiB', 'bi', '%01.'.(int)Settings::Get('panel.decimal_places').'f %s'); $traffic_complete['http'] = bcdiv($traffic_complete['http'], 1024, $settings['panel']['decimal_places']);
$traffic_complete['ftp'] = bcdiv($traffic_complete['ftp'], 1024, $settings['panel']['decimal_places']);
$traffic_complete['mail'] = bcdiv($traffic_complete['mail'], 1024, $settings['panel']['decimal_places']);
}
else
{
$traffic_complete['http'] = round($traffic_complete['http'] / 1024, $settings['panel']['decimal_places']);
$traffic_complete['ftp'] = round($traffic_complete['ftp'] / 1024, $settings['panel']['decimal_places']);
$traffic_complete['mail'] = round($traffic_complete['mail'] / 1024, $settings['panel']['decimal_places']);
}
eval("echo \"" . getTemplate('traffic/traffic_details') . "\";"); eval("echo \"" . getTemplate("traffic/traffic_details") . "\";");
} else { }
$result_stmt = Database::prepare("SELECT `month`, `year`, SUM(`http`) AS http, SUM(`ftp_up`) AS ftp_up, SUM(`ftp_down`) AS ftp_down, SUM(`mail`) AS mail else
FROM `" . TABLE_PANEL_TRAFFIC . "` {
WHERE `customerid` = :customerid $result = $db->query("(SELECT SUM(`http`) as sum FROM `" . TABLE_PANEL_TRAFFIC . "`
GROUP BY `year` DESC, `month` DESC WHERE `customerid` = '" . $userinfo['customerid'] . "'
LIMIT 12" GROUP BY CONCAT(`year`,`month`) ORDER BY CONCAT(`year`,`month`) DESC LIMIT 12) UNION
); (SELECT SUM(`ftp_up`+`ftp_down`) FROM `" . TABLE_PANEL_TRAFFIC . "`
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'])); WHERE `customerid` = '" . $userinfo['customerid'] . "'
GROUP BY CONCAT(`year`,`month`) ORDER BY CONCAT(`year`,`month`) DESC LIMIT 12) UNION
(SELECT SUM(`mail`) FROM `" . TABLE_PANEL_TRAFFIC . "`
WHERE `customerid` = '" . $userinfo['customerid'] . "'
GROUP BY CONCAT(`year`,`month`) ORDER BY CONCAT(`year`,`month`) DESC LIMIT 12) ORDER BY sum DESC LIMIT 1");
$row = $db->fetch_array($result);
$traf['max'] = ($row[0] > $row[1] ? ($row[0] > $row[2] ? $row[0] : $row[2]) : ($row[1] > $row[2] ? $row[1] : $row[2]));;
$result = $db->query("SELECT `month`, `year`, SUM(`http`) AS http, SUM(`ftp_up`) AS ftp_up, SUM(`ftp_down`) AS ftp_down, SUM(`mail`) AS mail
FROM `" . TABLE_PANEL_TRAFFIC . "` WHERE `customerid` = '" . $userinfo['customerid'] . "'
GROUP BY CONCAT(`year`,`month`) ORDER BY CONCAT(`year`,`month`) DESC LIMIT 12");
$traffic_complete['http'] = 0; $traffic_complete['http'] = 0;
$traffic_complete['ftp'] = 0; $traffic_complete['ftp'] = 0;
$traffic_complete['mail'] = 0; $traffic_complete['mail'] = 0;
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while($row = $db->fetch_array($result))
{
$http = $row['http']; $http = $row['http'];
$ftp_up = $row['ftp_up']; $ftp_up = $row['ftp_up'];
$ftp_down = $row['ftp_down']; $ftp_down = $row['ftp_down'];
$mail = $row['mail']; $mail = $row['mail'];
$traffic_complete['http'] += $http; $traffic_complete['http']+= $http;
$traffic_complete['ftp'] += $ftp_up + $ftp_down; $traffic_complete['ftp']+= $ftp_up + $ftp_down;
$traffic_complete['mail'] += $mail; $traffic_complete['mail']+= $mail;
$traf['month'] = $row['month']; $traf['month'] = $row['month'];
$traf['year'] = $row['year']; $traf['year'] = $row['year'];
$traf['monthname'] = $lng['traffic']['months'][intval($row['month'])] . " " . $row['year']; $traf['monthname'] = $lng['traffic']['months'][intval($row['month'])] . " " . $row['year'];
$traf['byte'] = $http + $ftp_up + $ftp_down + $mail; $traf['byte'] = $http + $ftp_up + $ftp_down + $mail;
if (extension_loaded('bcmath')) { if(extension_loaded('bcmath'))
$traf['ftptext'] = bcdiv($ftp_up, 1024, Settings::Get('panel.decimal_places')) . " MiB up/ " . bcdiv($ftp_down, 1024, Settings::Get('panel.decimal_places')) . " MiB down (FTP)"; {
$traf['httptext'] = bcdiv($http, 1024, Settings::Get('panel.decimal_places')) . " MiB (HTTP)"; $traf['ftptext'] = bcdiv($ftp_up, 1024 * 1024, $settings['panel']['decimal_places']) . " GB up/ " . bcdiv($ftp_down, 1024 * 1024, $settings['panel']['decimal_places']) . " GB down (FTP)";
$traf['mailtext'] = bcdiv($mail, 1024, Settings::Get('panel.decimal_places')) . " MiB (Mail)"; $traf['httptext'] = bcdiv($http, 1024 * 1024, $settings['panel']['decimal_places']) . " GB (HTTP)";
$traf['ftp'] = bcdiv(($ftp_up + $ftp_down), 1024, Settings::Get('panel.decimal_places')); $traf['mailtext'] = bcdiv($mail, 1024 * 1024, $settings['panel']['decimal_places']) . " GB (Mail)";
$traf['http'] = bcdiv($http, 1024, Settings::Get('panel.decimal_places')); }
$traf['mail'] = bcdiv($mail, 1024, Settings::Get('panel.decimal_places')); else
$traf['byte'] = bcdiv($traf['byte'], 1024 * 1024, Settings::Get('panel.decimal_places')); {
} else { $traf['ftptext'] = round($ftp_up / 1024 * 1024, $settings['panel']['decimal_places']) . " GB up/ " . round($ftp_down / 1024 * 1024, $settings['panel']['decimal_places']) . " GB down (FTP)";
$traf['ftptext'] = round($ftp_up / 1024, Settings::Get('panel.decimal_places')) . " MiB up/ " . round($ftp_down / 1024, Settings::Get('panel.decimal_places')) . " MiB down (FTP)"; $traf['httptext'] = round($http / 1024 * 1024, $settings['panel']['decimal_places']) . " GB (HTTP)";
$traf['httptext'] = round($http / 1024, Settings::Get('panel.decimal_places')) . " MiB (HTTP)"; $traf['mailtext'] = round($mail / 1024 * 1024, $settings['panel']['decimal_places']) . " GB (Mail)";
$traf['mailtext'] = round($mail / 1024, Settings::Get('panel.decimal_places')) . " MiB (Mail)";
$traf['ftp'] = round(($ftp_up + $ftp_down) / 1024, Settings::Get('panel.decimal_places'));
$traf['http'] = round($http / 1024, Settings::Get('panel.decimal_places'));
$traf['mail'] = round($mail / 1024, Settings::Get('panel.decimal_places'));
$traf['byte'] = round($traf['byte'] / (1024 * 1024), Settings::Get('panel.decimal_places'));
} }
eval("\$traffic.=\"" . getTemplate('traffic/traffic_traffic') . "\";"); if($traf['max'] != 0)
{
$proz = $traf['max'] / 100;
$traf['ftp'] = round(($ftp_up + $ftp_down) / $proz, 0);
$traf['http'] = round($http / $proz, 0);
$traf['mail'] = round($mail / $proz, 0);
if($traf['http'] == 0)
{
$traf['http'] = 1;
}
if($traf['ftp'] == 0)
{
$traf['ftp'] = 1;
}
if($traf['mail'] == 0)
{
$traf['mail'] = 1;
}
}
else
{
$traf['ftp'] = 0;
$traf['http'] = 0;
$traf['mail'] = 0;
}
if(extension_loaded('bcmath'))
{
$traf['byte'] = bcadd($traf['byte'] / (1024 * 1024), 0.0000, 4);
}
else
{
$traf['byte'] = round($traf['byte'] + (1024 * 1024), 4);
}
eval("\$traffic.=\"" . getTemplate("traffic/traffic_traffic") . "\";");
} }
$traffic_complete['http'] = size_readable($traffic_complete['http'] * 1024, 'GiB', 'bi', '%01.'.(int)Settings::Get('panel.decimal_places').'f %s'); if(extension_loaded('bcmath'))
$traffic_complete['ftp'] = size_readable($traffic_complete['ftp'] * 1024, 'GiB', 'bi', '%01.'.(int)Settings::Get('panel.decimal_places').'f %s'); {
$traffic_complete['mail'] = size_readable($traffic_complete['mail'] * 1024, 'GiB', 'bi', '%01.'.(int)Settings::Get('panel.decimal_places').'f %s'); $traffic_complete['http'] = bcdiv($traffic_complete['http'], 1024 * 1024, $settings['panel']['decimal_places']);
$traffic_complete['ftp'] = bcdiv($traffic_complete['ftp'], 1024 * 1024, $settings['panel']['decimal_places']);
$traffic_complete['mail'] = bcdiv($traffic_complete['mail'], 1024 * 1024, $settings['panel']['decimal_places']);
}
else
{
$traffic_complete['http'] = round($traffic_complete['http'] / 1024 * 1024, $settings['panel']['decimal_places']);
$traffic_complete['ftp'] = round($traffic_complete['ftp'] / 1024 * 1024, $settings['panel']['decimal_places']);
$traffic_complete['mail'] = round($traffic_complete['mail'] / 1024 * 1024, $settings['panel']['decimal_places']);
}
eval("echo \"" . getTemplate('traffic/traffic') . "\";"); eval("echo \"" . getTemplate("traffic/traffic") . "\";");
} }
?>

View File

@@ -1,306 +0,0 @@
<?php
if (! defined('AREA'))
die('You cannot access this file directly!');
/**
* This file is part of the Froxlor project.
* Copyright (c) 2016 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2016-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel
*
*/
// This file is being included in admin_domains and customer_domains
// and therefore does not need to require lib/init.php
$domain_id = isset($_GET['domain_id']) ? (int) $_GET['domain_id'] : null;
$record = isset($_POST['record']['record']) ? trim($_POST['record']['record']) : null;
$type = isset($_POST['record']['type']) ? $_POST['record']['type'] : 'A';
$prio = isset($_POST['record']['prio']) ? (int) $_POST['record']['prio'] : null;
$content = isset($_POST['record']['content']) ? trim($_POST['record']['content']) : null;
$ttl = isset($_POST['record']['ttl']) ? (int) $_POST['record']['ttl'] : 18000;
// get domain-name
$domain = getAllowedDomainEntry($domain_id, AREA, $userinfo, $idna_convert);
// select all entries
$sel_stmt = Database::prepare("SELECT * FROM `" . TABLE_DOMAIN_DNS . "` WHERE domain_id = :did");
Database::pexecute($sel_stmt, array(
'did' => $domain_id
));
$dom_entries = $sel_stmt->fetchAll(PDO::FETCH_ASSOC);
$errors = array();
$success_message = "";
// action for adding a new entry
if ($action == 'add_record' && ! empty($_POST)) {
// validation
if (empty($record)) {
$record = "@";
}
$record = strtolower($record);
if ($record != '@' && $record != '*') {
// validate record
if (strpos($record, '--') !== false) {
$errors[] = $lng['error']['domain_nopunycode'];
} else {
$record = $idna_convert->encode($record);
if ($type != 'SRV' && $type != 'TXT') {
$check_dom = $record . '.example.com';
if (! validateDomain($check_dom)) {
$errors[] = sprintf($lng['error']['subdomainiswrong'], $idna_convert->decode($record));
}
}
if (strlen($record) > 63) {
$errors[] = $lng['error']['dns_record_toolong'];
}
}
}
// TODO regex validate content for invalid characters
if ($ttl <= 0) {
$ttl = 18000;
}
if (empty($content)) {
$errors[] = $lng['error']['dns_content_empty'];
}
// types
if ($type == 'A' && filter_var($content, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) === false) {
$errors[] = $lng['error']['dns_arec_noipv4'];
} elseif ($type == 'AAAA' && filter_var($content, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === false) {
$errors[] = $lng['error']['dns_aaaarec_noipv6'];
} elseif ($type == 'MX') {
if ($prio === null || $prio < 0) {
$errors[] = $lng['error']['dns_mx_prioempty'];
}
// check for trailing dot
if (substr($content, - 1) == '.') {
// remove it for checks
$content = substr($content, 0, - 1);
}
if (! validateDomain($content)) {
$errors[] = $lng['error']['dns_mx_needdom'];
} else {
// check whether there is a CNAME-record for the same resource
foreach ($dom_entries as $existing_entries) {
$fqdn = $existing_entries['record'] . '.' . $domain;
if ($existing_entries['type'] == 'CNAME' && $fqdn == $content) {
$errors[] = $lng['error']['dns_mx_noalias'];
break;
}
}
}
// append trailing dot (again)
$content .= '.';
} elseif ($type == 'CNAME') {
// check for trailing dot
if (substr($content, - 1) == '.') {
// remove it for checks
$content = substr($content, 0, - 1);
}
if (! validateDomain($content)) {
$errors[] = $lng['error']['dns_cname_invaliddom'];
} else {
// check whether there are RR-records for the same resource
foreach ($dom_entries as $existing_entries) {
if (($existing_entries['type'] == 'A' || $existing_entries['type'] == 'AAAA' || $existing_entries['type'] == 'MX' || $existing_entries['type'] == 'NS') && $existing_entries['record'] == $record) {
$errors[] = $lng['error']['dns_cname_nomorerr'];
break;
}
}
}
// append trailing dot (again)
$content .= '.';
} elseif ($type == 'NS') {
// check for trailing dot
if (substr($content, - 1) == '.') {
// remove it for checks
$content = substr($content, 0, - 1);
}
if (! validateDomain($content)) {
$errors[] = $lng['error']['dns_ns_invaliddom'];
}
// append trailing dot (again)
$content .= '.';
} elseif ($type == 'TXT' && ! empty($content)) {
// check that TXT content is enclosed in " "
$content = encloseTXTContent($content);
} elseif ($type == 'SRV') {
if ($prio === null || $prio < 0) {
$errors[] = $lng['error']['dns_srv_prioempty'];
}
// check only last part of content, as it can look like:
// _service._proto.name. TTL class SRV priority weight port target.
$_split_content = explode(" ", $content);
// SRV content must be [weight] [port] [target]
if (count($_split_content) != 3) {
$errors[] = $lng['error']['dns_srv_invalidcontent'];
}
$target = trim($_split_content[count($_split_content) - 1]);
if ($target != '.') {
// check for trailing dot
if (substr($target, - 1) == '.') {
// remove it for checks
$target = substr($target, 0, - 1);
}
}
if ($target != '.' && ! validateDomain($target)) {
$errors[] = $lng['error']['dns_srv_needdom'];
} else {
// check whether there is a CNAME-record for the same resource
foreach ($dom_entries as $existing_entries) {
$fqdn = $existing_entries['record'] . '.' . $domain;
if ($existing_entries['type'] == 'CNAME' && $fqdn == $target) {
$errors[] = $lng['error']['dns_srv_noalias'];
break;
}
}
}
// append trailing dot (again)
if ($target != '.') {
$content .= '.';
}
}
$new_entry = array(
'record' => $record,
'type' => $type,
'prio' => $prio,
'content' => $content,
'ttl' => $ttl,
'domain_id' => $domain_id
);
ksort($new_entry);
// check for duplicate
foreach ($dom_entries as $existing_entry) {
// compare serialized string of array
$check_entry = $existing_entry;
// new entry has no ID yet
unset($check_entry['id']);
// sort by key
ksort($check_entry);
// format integer fields to real integer (as they are read as string from the DB)
$check_entry['prio'] = (int) $check_entry['prio'];
$check_entry['ttl'] = (int) $check_entry['ttl'];
$check_entry['domain_id'] = (int) $check_entry['domain_id'];
// serialize both
$check_entry = serialize($check_entry);
$new = serialize($new_entry);
// compare
if ($check_entry === $new) {
$errors[] = $lng['error']['dns_duplicate_entry'];
unset($check_entry);
break;
}
}
if (empty($errors)) {
$ins_stmt = Database::prepare("
INSERT INTO `" . TABLE_DOMAIN_DNS . "` SET
`record` = :record,
`type` = :type,
`prio` = :prio,
`content` = :content,
`ttl` = :ttl,
`domain_id` = :domain_id
");
Database::pexecute($ins_stmt, $new_entry);
$new_entry_id = Database::lastInsertId();
// add temporary to the entries-array (no reread of DB necessary)
$new_entry['id'] = $new_entry_id;
$dom_entries[] = $new_entry;
// success message (inline)
$success_message = $lng['success']['dns_record_added'];
$record = "";
$type = 'A';
$prio = "";
$content = "";
$ttl = "";
// re-generate bind configs
inserttask('4');
} else {
// show $errors
$errors = implode("<br>", $errors);
}
} elseif ($action == 'delete') {
// remove entry
$entry_id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
if ($entry_id > 0) {
$del_stmt = Database::prepare("DELETE FROM `" . TABLE_DOMAIN_DNS . "` WHERE `id` = :id");
Database::pexecute($del_stmt, array(
'id' => $entry_id
));
// remove deleted entry from internal data array (no reread of DB necessary)
$_t = $dom_entries;
foreach ($_t as $idx => $entry) {
if ($entry['id'] == $entry_id) {
unset($dom_entries[$idx]);
break;
}
}
unset($_t);
// success message (inline)
$success_message = $lng['success']['dns_record_deleted'];
// re-generate bind configs
inserttask('4');
}
}
// show editor
$record_list = "";
$existing_entries = "";
$type_select = "";
$entriescount = 0;
if (! empty($dom_entries)) {
$entriescount = count($dom_entries);
foreach ($dom_entries as $entry) {
$entry['content'] = wordwrap($entry['content'], 100, '<br>', true);
eval("\$existing_entries.=\"" . getTemplate("dns_editor/entry_bit", true) . "\";");
}
}
// available types
$type_select_values = array(
'A',
'AAAA',
'NS',
'MX',
'SRV',
'TXT',
'CNAME'
);
asort($type_select_values);
foreach ($type_select_values as $_type) {
$type_select .= makeoption($_type, $_type, $type);
}
eval("\$record_list=\"" . getTemplate("dns_editor/list", true) . "\";");
$zone = createDomainZone($domain_id);
$zonefile = (string) $zone;
eval("echo \"" . getTemplate("dns_editor/index", true) . "\";");

BIN
images/ball.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 B

BIN
images/changelanguage.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
images/default.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
images/endsection.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
images/error.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
images/error.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
images/footer.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
images/header.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
images/header_r.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
images/info.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
images/login.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
images/logininternal.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
images/order_asc.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 B

BIN
images/order_desc.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 B

BIN
images/section.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
images/shadow.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 B

BIN
images/subsection.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
images/title.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 B

BIN
images/traffic_blue.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 B

BIN
images/traffic_green.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 B

BIN
images/traffic_red.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

BIN
images/traffic_yellow.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 827 B

667
index.php
View File

@@ -14,543 +14,302 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'login'); define('AREA', 'login');
require './lib/init.php';
if ($action == '') { /**
* Include our init.php, which manages Sessions, Language etc.
*/
require ("./lib/init.php");
if($action == '')
{
$action = 'login'; $action = 'login';
} }
if ($action == 'login') { if($action == 'login')
if (isset($_POST['send']) && $_POST['send'] == 'send') { {
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$loginname = validate($_POST['loginname'], 'loginname'); $loginname = validate($_POST['loginname'], 'loginname');
$password = validate($_POST['password'], 'password'); $password = validate($_POST['password'], 'password');
$stmt = Database::prepare("SELECT `loginname` AS `customer` FROM `" . TABLE_PANEL_CUSTOMERS . "` $row = $db->query_first("SELECT `loginname` AS `customer` FROM `" . TABLE_PANEL_CUSTOMERS . "` WHERE `loginname`='" . $db->escape($loginname) . "'");
WHERE `loginname`= :loginname"
);
Database::pexecute($stmt, array("loginname" => $loginname));
$row = $stmt->fetch(PDO::FETCH_ASSOC);
if ($row['customer'] == $loginname) { if($row['customer'] == $loginname)
{
$table = "`" . TABLE_PANEL_CUSTOMERS . "`"; $table = "`" . TABLE_PANEL_CUSTOMERS . "`";
$uid = 'customerid'; $uid = 'customerid';
$adminsession = '0'; $adminsession = '0';
$is_admin = false; $is_admin = false;
} else { }
else
{
$is_admin = true; $is_admin = true;
if ((int)Settings::Get('login.domain_login') == 1) {
$domainname = $idna_convert->encode(preg_replace(array('/\:(\d)+$/', '/^https?\:\/\//'), '', $loginname));
$stmt = Database::prepare("SELECT `customerid` FROM `" . TABLE_PANEL_DOMAINS . "`
WHERE `domain` = :domain"
);
Database::pexecute($stmt, array("domain" => $domainname));
$row2 = $stmt->fetch(PDO::FETCH_ASSOC);
if (isset($row2['customerid']) && $row2['customerid'] > 0) {
$loginname = getCustomerDetail($row2['customerid'], 'loginname');
if ($loginname !== false) {
$stmt = Database::prepare("SELECT `loginname` AS `customer` FROM `" . TABLE_PANEL_CUSTOMERS . "`
WHERE `loginname`= :loginname"
);
Database::pexecute($stmt, array("loginname" => $loginname));
$row3 = $stmt->fetch(PDO::FETCH_ASSOC);
if ($row3['customer'] == $loginname) {
$table = "`" . TABLE_PANEL_CUSTOMERS . "`";
$uid = 'customerid';
$adminsession = '0';
$is_admin = false;
}
}
}
}
} }
if ((hasUpdates($version) || hasDbUpdates($dbversion)) && $is_admin == false) { if(hasUpdates($version) && $is_admin == false)
{
redirectTo('index.php'); redirectTo('index.php');
exit; exit;
} }
if ($is_admin) { if($is_admin)
if (hasUpdates($version) || hasDbUpdates($dbversion)) { {
$stmt = Database::prepare("SELECT `loginname` AS `admin` FROM `" . TABLE_PANEL_ADMINS . "` if(hasUpdates($version))
WHERE `loginname`= :loginname {
AND `change_serversettings` = '1'" $row = $db->query_first("SELECT `loginname` AS `admin` FROM `" . TABLE_PANEL_ADMINS . "` WHERE `loginname`='" . $db->escape($loginname) . "' AND `change_serversettings` = '1'");
); /*
Database::pexecute($stmt, array("loginname" => $loginname)); * not an admin who can see updates
$row = $stmt->fetch(PDO::FETCH_ASSOC); */
if (!isset($row['admin'])) { if(!isset($row['admin']))
// not an admin who can see updates {
redirectTo('index.php'); redirectTo('index.php');
exit; exit;
} }
} else { }
$stmt = Database::prepare("SELECT `loginname` AS `admin` FROM `" . TABLE_PANEL_ADMINS . "` else
WHERE `loginname`= :loginname" {
); $row = $db->query_first("SELECT `loginname` AS `admin` FROM `" . TABLE_PANEL_ADMINS . "` WHERE `loginname`='" . $db->escape($loginname) . "'");
Database::pexecute($stmt, array("loginname" => $loginname));
$row = $stmt->fetch(PDO::FETCH_ASSOC);
} }
if ($row['admin'] == $loginname) { if($row['admin'] == $loginname)
{
$table = "`" . TABLE_PANEL_ADMINS . "`"; $table = "`" . TABLE_PANEL_ADMINS . "`";
$uid = 'adminid'; $uid = 'adminid';
$adminsession = '1'; $adminsession = '1';
} else { }
// Log failed login else
$rstlog = FroxlorLogger::getInstanceOf(array('loginname' => $_SERVER['REMOTE_ADDR'])); {
$rstlog->logAction(LOGIN_ACTION, LOG_WARNING, "Unknown user '" . $loginname . "' tried to login."); redirectTo('index.php', Array('showmessage' => '2'), true);
redirectTo('index.php', array('showmessage' => '2'));
exit; exit;
} }
} }
$userinfo_stmt = Database::prepare("SELECT * FROM $table $userinfo = $db->query_first("SELECT * FROM $table WHERE `loginname`='" . $db->escape($loginname) . "'");
WHERE `loginname`= :loginname"
);
Database::pexecute($userinfo_stmt, array("loginname" => $loginname));
$userinfo = $userinfo_stmt->fetch(PDO::FETCH_ASSOC);
if ($userinfo['loginfail_count'] >= Settings::Get('login.maxloginattempts') && $userinfo['lastlogin_fail'] > (time() - Settings::Get('login.deactivatetime'))) { if($userinfo['loginfail_count'] >= $settings['login']['maxloginattempts']
redirectTo('index.php', array('showmessage' => '3')); && $userinfo['lastlogin_fail'] > (time() - $settings['login']['deactivatetime']))
{
redirectTo('index.php', Array('showmessage' => '3'), true);
exit; exit;
} elseif (validatePasswordLogin($userinfo, $password, $table, $uid)) { }
// only show "you're banned" if the login was successful elseif($userinfo['password'] == md5($password))
// because we don't want to publish that the user does exist {
if ($userinfo['deactivated']) { // login correct
unset($userinfo); // reset loginfail_counter, set lastlogin_succ
redirectTo('index.php', array('showmessage' => '5'));
exit; $db->query("UPDATE $table SET `lastlogin_succ`='" . time() . "', `loginfail_count`='0' WHERE `$uid`='" . (int)$userinfo[$uid] . "'");
} else { $userinfo['userid'] = $userinfo[$uid];
// login correct $userinfo['adminsession'] = $adminsession;
// reset loginfail_counter, set lastlogin_succ }
$stmt = Database::prepare("UPDATE $table else
SET `lastlogin_succ`= :lastlogin_succ, `loginfail_count`='0' {
WHERE `$uid`= :uid"
);
Database::pexecute($stmt, array("lastlogin_succ" => time(), "uid" => $userinfo[$uid]));
$userinfo['userid'] = $userinfo[$uid];
$userinfo['adminsession'] = $adminsession;
}
} else {
// login incorrect // login incorrect
$stmt = Database::prepare("UPDATE $table
SET `lastlogin_fail`= :lastlogin_fail, `loginfail_count`=`loginfail_count`+1
WHERE `$uid`= :uid"
);
Database::pexecute($stmt, array("lastlogin_fail" => time(), "uid" => $userinfo[$uid]));
// Log failed login
$rstlog = FroxlorLogger::getInstanceOf(array('loginname' => $_SERVER['REMOTE_ADDR']));
$rstlog->logAction(LOGIN_ACTION, LOG_WARNING, "User '" . $loginname . "' tried to login with wrong password.");
$db->query("UPDATE $table SET `lastlogin_fail`='" . time() . "', `loginfail_count`=`loginfail_count`+1 WHERE `$uid`='" . (int)$userinfo[$uid] . "'");
unset($userinfo); unset($userinfo);
redirectTo('index.php', array('showmessage' => '2')); redirectTo('index.php', Array('showmessage' => '2'), true);
exit; exit;
} }
if (isset($userinfo['userid']) && $userinfo['userid'] != '') { if(isset($userinfo['userid'])
&& $userinfo['userid'] != '')
{
$s = md5(uniqid(microtime(), 1)); $s = md5(uniqid(microtime(), 1));
if (isset($_POST['language'])) { if(isset($_POST['language']))
{
$language = validate($_POST['language'], 'language'); $language = validate($_POST['language'], 'language');
if ($language == 'profile') {
if($language == 'profile')
{
$language = $userinfo['def_language']; $language = $userinfo['def_language'];
} elseif (!isset($languages[$language])) {
$language = Settings::Get('panel.standardlanguage');
} }
} else { elseif(!isset($languages[$language]))
$language = Settings::Get('panel.standardlanguage'); {
} $language = $settings['panel']['standardlanguage'];
if (isset($userinfo['theme']) && $userinfo['theme'] != '') {
$theme = $userinfo['theme'];
} else {
$theme = Settings::Get('panel.default_theme');
}
if (Settings::Get('session.allow_multiple_login') != '1') {
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "`
WHERE `userid` = :uid
AND `adminsession` = :adminsession"
);
Database::pexecute($stmt, array("uid" => $userinfo['userid'], "adminsession" => $userinfo['adminsession']));
}
// check for field 'theme' in session-table, refs #607
// Changed with #1287 to new method
$theme_field = false;
$stmt = Database::query("SHOW COLUMNS FROM panel_sessions LIKE 'theme'");
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
if ($row['Field'] == "theme") {
$has_theme = true;
} }
} }
else
$params = array( {
"hash" => $s, $language = $settings['panel']['standardlanguage'];
"userid" => $userinfo['userid'],
"ipaddress" => $remote_addr,
"useragent" => $http_user_agent,
"lastactivity" => time(),
"language" => $language,
"adminsession" => $userinfo['adminsession']
);
if ($has_theme) {
$params["theme"] = $theme;
$stmt = Database::prepare("INSERT INTO `" . TABLE_PANEL_SESSIONS . "`
(`hash`, `userid`, `ipaddress`, `useragent`, `lastactivity`, `language`, `adminsession`, `theme`)
VALUES (:hash, :userid, :ipaddress, :useragent, :lastactivity, :language, :adminsession, :theme)"
);
} else {
$stmt = Database::prepare("INSERT INTO `" . TABLE_PANEL_SESSIONS . "`
(`hash`, `userid`, `ipaddress`, `useragent`, `lastactivity`, `language`, `adminsession`)
VALUES (:hash, :userid, :ipaddress, :useragent, :lastactivity, :language, :adminsession)"
);
} }
Database::pexecute($stmt, $params);
$qryparams = array(); if($settings['session']['allow_multiple_login'] != '1')
if (isset($_POST['qrystr']) && $_POST['qrystr'] != "") { {
parse_str(urldecode($_POST['qrystr']), $qryparams); $db->query("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid` = '" . (int)$userinfo['userid'] . "' AND `adminsession` = '" . $db->escape($userinfo['adminsession']) . "'");
} }
$qryparams['s'] = $s;
if ($userinfo['adminsession'] == '1') { $db->query("INSERT INTO `" . TABLE_PANEL_SESSIONS . "` (`hash`, `userid`, `ipaddress`, `useragent`, `lastactivity`, `language`, `adminsession`) VALUES ('" . $db->escape($s) . "', '" . (int)$userinfo['userid'] . "', '" . $db->escape($remote_addr) . "', '" . $db->escape($http_user_agent) . "', '" . time() . "', '" . $db->escape($language) . "', '" . $db->escape($userinfo['adminsession']) . "')");
if (hasUpdates($version) || hasDbUpdates($dbversion)) {
redirectTo('admin_updates.php', array('s' => $s)); if($userinfo['adminsession'] == '1')
} else { {
if (isset($_POST['script']) && $_POST['script'] != "") { if(hasUpdates($version))
if (preg_match("/customer\_/", $_POST['script']) === 1) { {
redirectTo('admin_customers.php', array("page" => "customers")); redirectTo('admin_updates.php', Array('s' => $s), true);
} else { exit;
redirectTo($_POST['script'], $qryparams);
}
} else {
redirectTo('admin_index.php', $qryparams);
}
} }
} else { else
if (isset($_POST['script']) && $_POST['script'] != "") { {
redirectTo($_POST['script'], $qryparams); redirectTo('admin_index.php', Array('s' => $s), true);
} else { exit;
redirectTo('customer_index.php', $qryparams);
} }
} }
} else { else
redirectTo('index.php', array('showmessage' => '2')); {
redirectTo('customer_index.php', Array('s' => $s), true);
exit;
}
} }
exit; else
} else { {
redirectTo('index.php', Array('showmessage' => '2'), true);
exit;
}
}
else
{
$language_options = ''; $language_options = '';
$language_options .= makeoption($lng['login']['profile_lng'], 'profile', 'profile', true, true); $language_options.= makeoption($lng['login']['profile_lng'], 'profile', 'profile', true, true);
while (list($language_file, $language_name) = each($languages)) { while(list($language_file, $language_name) = each($languages))
$language_options .= makeoption($language_name, $language_file, 'profile', true); {
$language_options.= makeoption($language_name, $language_file, 'profile', true);
} }
$smessage = isset($_GET['showmessage']) ? (int)$_GET['showmessage'] : 0; $smessage = isset($_GET['showmessage']) ? (int)$_GET['showmessage'] : 0;
$message = ''; $message = '';
$successmessage = '';
switch ($smessage) { switch($smessage)
case 1: {
$successmessage = $lng['pwdreminder']['success']; case 1:
break; $message = $lng['pwdreminder']['success'];
case 2: break;
$message = $lng['error']['login']; case 2:
break; $message = $lng['error']['login'];
case 3: break;
$message = sprintf($lng['error']['login_blocked'], Settings::Get('login.deactivatetime')); case 3:
break; $message = $lng['error']['login_blocked'];
case 4: break;
$cmail = isset($_GET['customermail']) ? $_GET['customermail'] : 'unknown'; case 4:
$message = str_replace('%s', $cmail, $lng['error']['errorsendingmail']); $message = $lng['error']['errorsendingmail'];
break; break;
case 5:
$message = $lng['error']['user_banned'];
break;
case 6:
$successmessage = $lng['pwdreminder']['changed'];
break;
case 7:
$message = $lng['pwdreminder']['wrongcode'];
break;
case 8:
$message = $lng['pwdreminder']['notallowed'];
break;
} }
$update_in_progress = ''; $update_in_progress = '';
if (hasUpdates($version) || hasDbUpdates($dbversion)) { if(hasUpdates($version))
{
$update_in_progress = $lng['update']['updateinprogress_onlyadmincanlogin']; $update_in_progress = $lng['update']['updateinprogress_onlyadmincanlogin'];
} }
// Pass the last used page if needed
$lastscript = "";
if (isset($_REQUEST['script']) && $_REQUEST['script'] != "") {
$lastscript = $_REQUEST['script'];
if (!file_exists(__DIR__."/".$lastscript)) { eval("echo \"" . getTemplate("login") . "\";");
$lastscript = "";
}
}
$lastqrystr = "";
if (isset($_REQUEST['qrystr']) && $_REQUEST['qrystr'] != "") {
$lastqrystr = htmlspecialchars($_REQUEST['qrystr'], ENT_QUOTES);
}
eval("echo \"" . getTemplate('login') . "\";");
} }
} }
if ($action == 'forgotpwd') { if($action == 'forgotpwd')
$adminchecked = false; {
$message = ''; if(isset($_POST['send'])
&& $_POST['send'] == 'send')
if (isset($_POST['send']) && $_POST['send'] == 'send') { {
$adminchecked = false;
$loginname = validate($_POST['loginname'], 'loginname'); $loginname = validate($_POST['loginname'], 'loginname');
$email = validateEmail($_POST['loginemail'], 'email'); $email = validateEmail($_POST['loginemail'], 'email');
$result_stmt = Database::prepare("SELECT `adminid`, `customerid`, `firstname`, `name`, `company`, `email`, `loginname`, `def_language`, `deactivated` FROM `" . TABLE_PANEL_CUSTOMERS . "` $sql = "SELECT `customerid`, `firstname`, `name`, `email`, `loginname` FROM `" . TABLE_PANEL_CUSTOMERS . "`
WHERE `loginname`= :loginname WHERE `loginname`='" . $db->escape($loginname) . "'
AND `email`= :email" AND `email`='" . $db->escape($email) . "'";
); $result = $db->query($sql);
Database::pexecute($result_stmt, array("loginname" => $loginname, "email" => $email));
if (Database::num_rows() == 0) { if($db->num_rows() == 0)
$result_stmt = Database::prepare("SELECT `adminid`, `name`, `email`, `loginname`, `def_language`, `deactivated` FROM `" . TABLE_PANEL_ADMINS . "` {
WHERE `loginname`= :loginname $sql = "SELECT `adminid`, `firstname`, `name`, `email`, `loginname` FROM `" . TABLE_PANEL_ADMINS . "`
AND `email`= :email" WHERE `loginname`='" . $db->escape($loginname) . "'
); AND `email`='" . $db->escape($email) . "'";
Database::pexecute($result_stmt, array("loginname" => $loginname, "email" => $email)); $result = $db->query($sql);
$adminchecked = true;
if (Database::num_rows() > 0) {
$adminchecked = true;
} else {
$result_stmt = null;
}
} }
if ($result_stmt !== null) { $user = $db->fetch_array($result);
$user = $result_stmt->fetch(PDO::FETCH_ASSOC);
/* Check whether user is banned */ if(($adminchecked && $settings['panel']['allow_preset_admin'] == '1')
if ($user['deactivated']) { || $adminchecked == false)
redirectTo('index.php', array('showmessage' => '8')); {
if($user !== false)
{
$password = substr(md5(uniqid(microtime(), 1)), 12, 6);
if($adminchecked)
{
$db->query("UPDATE `" . TABLE_PANEL_ADMINS . "` SET `password`='" . md5($password) . "'
WHERE `loginname`='" . $user['loginname'] . "'
AND `email`='" . $user['email'] . "'");
}
else
{
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `password`='" . md5($password) . "'
WHERE `loginname`='" . $user['loginname'] . "'
AND `email`='" . $user['email'] . "'");
}
$rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'password_reset'), $db, $settings);
$rstlog->logAction(USR_ACTION, LOG_WARNING, "Password for user '" . $user['loginname'] . "' has been reset!");
$body = strtr($lng['pwdreminder']['body'], array('%s' => $user['firstname'] . ' ' . $user['name'], '%p' => $password));
$mail->From = $settings['panel']['adminmail'];
$mail->FromName = 'Froxlor';
$mail->Subject = $lng['pwdreminder']['subject'];
$mail->Body = $body;
$mail->AddAddress($user['email'], $user['firstname'] . ' ' . $user['name']);
if(!$mail->Send())
{
if($mail->ErrorInfo != '')
{
$mailerr_msg = $mail->ErrorInfo;
}
else
{
$mailerr_msg = $email;
}
$rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'password_reset'), $db, $settings);
$rstlog->logAction(ADM_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
redirectTo('index.php', Array('showmessage' => '4'), true);
exit;
}
$mail->ClearAddresses();
redirectTo('index.php', Array('showmessage' => '1'), true);
exit; exit;
} }
else
if (($adminchecked && Settings::Get('panel.allow_preset_admin') == '1') || $adminchecked == false) { {
if ($user !== false) { $rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'password_reset'), $db, $settings);
// build a activation code $rstlog->logAction(USR_ACTION, LOG_WARNING, "User '" . $loginname . "' tried to reset pwd but wasn't found in database!");
$timestamp = time(); $message = $lng['login']['usernotfound'];
$first = substr(md5($user['loginname'] . $timestamp . randomStr(16)), 0, 15);
$third = substr(md5($user['email'] . $timestamp . randomStr(16)), -15);
$activationcode = $first . $timestamp . $third . substr(md5($third . $timestamp), 0, 10);
// Drop all existing activation codes for this user
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_ACTIVATION . "`
WHERE `userid` = :userid
AND `admin` = :admin"
);
$params = array(
"userid" => $adminchecked ? $user['adminid'] : $user['customerid'],
"admin" => $adminchecked ? 1 : 0
);
Database::pexecute($stmt, $params);
// Add new activation code to database
$stmt = Database::prepare("INSERT INTO `" . TABLE_PANEL_ACTIVATION . "`
(userid, admin, creation, activationcode)
VALUES (:userid, :admin, :creation, :activationcode)"
);
$params = array(
"userid" => $adminchecked ? $user['adminid'] : $user['customerid'],
"admin" => $adminchecked ? 1 : 0,
"creation" => $timestamp,
"activationcode" => $activationcode
);
Database::pexecute($stmt, $params);
$rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'password_reset'));
$rstlog->logAction(USR_ACTION, LOG_WARNING, "User '" . $user['loginname'] . "' requested a link for setting a new password.");
// Set together our activation link
$protocol = empty( $_SERVER['HTTPS'] ) ? 'http' : 'https';
// this can be a fixed value to avoid potential exploiting by modifying headers
$host = Settings::Get('system.hostname'); // $_SERVER['HTTP_HOST'];
$port = $_SERVER['SERVER_PORT'] != 80 ? ':' . $_SERVER['SERVER_PORT'] : '';
// don't add :443 when https is used, as it is default (and just looks weird!)
if ($protocol == 'https' && $_SERVER['SERVER_PORT'] == '443') {
$port = '';
}
// there can be only one script to handle this so we can use a fixed value here
$script = "/index.php"; // $_SERVER['SCRIPT_NAME'];
if (Settings::Get('system.froxlordirectlyviahostname') == 0) {
$script = makeCorrectFile("/".basename(__DIR__)."/".$script);
}
$activationlink = $protocol . '://' . $host . $port . $script . '?action=resetpwd&resetcode=' . $activationcode;
$replace_arr = array(
'SALUTATION' => getCorrectUserSalutation($user),
'USERNAME' => $loginname,
'LINK' => $activationlink
);
$def_language = ($user['def_language'] != '') ? $user['def_language'] : Settings::Get('panel.standardlanguage');
$result_stmt = Database::prepare('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '`
WHERE `adminid`= :adminid
AND `language`= :lang
AND `templategroup`=\'mails\'
AND `varname`=\'password_reset_subject\''
);
Database::pexecute($result_stmt, array("adminid" => $user['adminid'], "lang" => $def_language));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
$mail_subject = html_entity_decode(replace_variables((($result['value'] != '') ? $result['value'] : $lng['mails']['password_reset']['subject']), $replace_arr));
$result_stmt = Database::prepare('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '`
WHERE `adminid`= :adminid
AND `language`= :lang
AND `templategroup`=\'mails\'
AND `varname`=\'password_reset_mailbody\''
);
Database::pexecute($result_stmt, array("adminid" => $user['adminid'], "lang" => $def_language));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
$mail_body = html_entity_decode(replace_variables((($result['value'] != '') ? $result['value'] : $lng['mails']['password_reset']['mailbody']), $replace_arr));
$_mailerror = false;
try {
$mail->Subject = $mail_subject;
$mail->AltBody = $mail_body;
$mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
$mail->AddAddress($user['email'], getCorrectUserSalutation($user));
$mail->Send();
} catch(phpmailerException $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (Exception $e) {
$mailerr_msg = $e->getMessage();
$_mailerror = true;
}
if ($_mailerror) {
$rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'password_reset'));
$rstlog->logAction(ADM_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
redirectTo('index.php', array('showmessage' => '4', 'customermail' => $user['email']));
exit;
}
$mail->ClearAddresses();
redirectTo('index.php', array('showmessage' => '1'));
exit;
} else {
$rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'password_reset'));
$rstlog->logAction(USR_ACTION, LOG_WARNING, "User '" . $loginname . "' requested to set a new password, but was not found in database!");
$message = $lng['login']['combination_not_found'];
}
unset($user);
}
} else {
$message = $lng['login']['usernotfound'];
}
}
if ($adminchecked) {
if (Settings::Get('panel.allow_preset_admin') != '1') {
$message = $lng['pwdreminder']['notallowed'];
unset ($adminchecked);
}
} else {
if (Settings::Get('panel.allow_preset') != '1') {
$message = $lng['pwdreminder']['notallowed'];
}
}
eval("echo \"" . getTemplate('fpwd') . "\";");
}
if ($action == 'resetpwd') {
$message = '';
// Remove old activation codes
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_ACTIVATION . "`
WHERE creation < :oldest"
);
Database::pexecute($stmt, array("oldest" => time() - 86400));
if (isset($_GET['resetcode']) && strlen($_GET['resetcode']) == 50) {
// Check if activation code is valid
$activationcode = $_GET['resetcode'];
$timestamp = substr($activationcode, 15, 10);
$third = substr($activationcode, 25, 15);
$check = substr($activationcode, 40, 10);
if (substr(md5($third . $timestamp), 0, 10) == $check && $timestamp >= time() - 86400) {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$stmt = Database::prepare("SELECT `userid`, `admin` FROM `" . TABLE_PANEL_ACTIVATION . "`
WHERE `activationcode` = :activationcode"
);
$result = Database::pexecute_first($stmt, array("activationcode" => $activationcode));
if ($result !== false) {
if ($result['admin'] == 1) {
$new_password = validate($_POST['new_password'], 'new password');
$new_password_confirm = validate($_POST['new_password_confirm'], 'new password confirm');
} else {
$new_password = validatePassword($_POST['new_password'], 'new password');
$new_password_confirm = validatePassword($_POST['new_password_confirm'], 'new password confirm');
}
if ($new_password == '') {
$message = $new_password;
} elseif ($new_password_confirm == '') {
$message = $new_password_confirm;
} elseif ($new_password != $new_password_confirm) {
$message = $new_password . " != " . $new_password_confirm;
} else {
// Update user password
if ($result['admin'] == 1) {
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_ADMINS . "`
SET `password` = :newpassword
WHERE `adminid` = :userid"
);
} else {
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CUSTOMERS . "`
SET `password` = :newpassword
WHERE `customerid` = :userid"
);
}
Database::pexecute($stmt, array("newpassword" => makeCryptPassword($new_password), "userid" => $result['userid']));
$rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'password_reset'));
$rstlog->logAction(USR_ACTION, LOG_NOTICE, "changed password using password reset.");
// Remove activation code from DB
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_ACTIVATION . "`
WHERE `activationcode` = :activationcode
AND `userid` = :userid"
);
Database::pexecute($stmt, array("activationcode" => $activationcode, "userid" => $result['userid']));
redirectTo('index.php', array("showmessage" => '6'));
}
} else {
redirectTo('index.php', array("showmessage" => '7'));
}
} }
eval("echo \"" . getTemplate('rpwd') . "\";"); unset($user, $adminchecked);
}
} else { else
redirectTo('index.php', array("showmessage" => '7')); {
$message = '';
} }
} else {
redirectTo('index.php');
} }
else
{
$message = '';
}
if($settings['panel']['allow_preset'] != '1')
{
$message = $lng['pwdreminder']['notallowed'];
}
eval("echo \"" . getTemplate("fpwd") . "\";");
} }
?>

File diff suppressed because it is too large Load Diff

View File

@@ -2,6 +2,7 @@
/** /**
* This file is part of the Froxlor project. * This file is part of the Froxlor project.
* Copyright (c) 2003-2009 the SysCP Team (see authors).
* Copyright (c) 2010 the Froxlor Team (see authors). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * For the full copyright and license information, please view the COPYING
@@ -9,14 +10,821 @@
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * COPYING file online at http://files.froxlor.org/misc/COPYING.txt
* *
* @copyright (c) the authors * @copyright (c) the authors
* @author Michael Kaufmann <mkaufmann@nutime.de> * @author Florian Lippert <flo@syscp.org> (2003-2009)
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Install * @package Install
* * @version $Id$
*/ */
require 'lib/class.FroxlorInstall.php'; /**
* Most elements are taken from the phpBB (www.phpbb.com)
* installer, (c) 1999 - 2004 phpBB Group.
*/
$frxinstall = new FroxlorInstall(); if(file_exists('../lib/userdata.inc.php'))
$frxinstall->run(); {
/**
* Includes the Usersettings eg. MySQL-Username/Passwort etc. to test if Froxlor is already installed
*/
require ('../lib/userdata.inc.php');
if(isset($sql)
&& is_array($sql))
{
die('Sorry, Froxlor is already configured...');
}
}
/**
* Include the functions
*/
require ('../lib/functions.php');
/**
* Include the MySQL-Table-Definitions
*/
require ('../lib/tables.inc.php');
/**
* Language Managament
*/
$languages = Array(
'german' => 'Deutsch',
'english' => 'English',
'french' => 'Francais'
);
$standardlanguage = 'english';
if(isset($_GET['language'])
&& isset($languages[$_GET['language']]))
{
$language = $_GET['language'];
}
elseif(isset($_POST['language'])
&& isset($languages[$_POST['language']]))
{
$language = $_POST['language'];
}
else
{
$language = $standardlanguage;
}
if(file_exists('./lng/' . $language . '.lng.php'))
{
/**
* Includes file /lng/$language.lng.php if it exists
*/
require ('./lng/' . $language . '.lng.php');
}
/**
* BEGIN FUNCTIONS -----------------------------------------------
*/
function page_header()
{
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" />
<link rel="stylesheet" href="../templates/main.css" type="text/css" />
<title>Froxlor</title>
</head>
<body style="margin: 0; padding: 0;" onload="document.loginform.loginname.focus()">
<!--
We request you retain the full copyright notice below including the link to www.froxlor.org.
This not only gives respect to the large amount of time given freely by the developers
but also helps build interest, traffic and use of Froxlor. If you refuse
to include even this then support on our forums may be affected.
The Froxlor Team : 2009-2010
// -->
<!--
Templates based on work by Luca Piona (info@havanastudio.ch) and Luca Longinotti (chtekk@gentoo.org)
// -->
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td width="800"><img src="../images/header.gif" width="800" height="90" alt="" /></td>
<td class="header">&nbsp;</td>
</tr>
</table>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td valign="top" bgcolor="#FFFFFF">
<br />
<br />
<?php
}
function page_footer()
{
?>
</td>
</tr>
</table>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td width="100%" class="footer">
<br />Froxlor &copy; 2009-2010 by <a href="http://www.froxlor.org/" target="_blank">the Froxlor Team</a>
<br /><br/>
</td>
</tr>
</table>
</body>
</html>
<?php
}
function status_message($case, $text)
{
if($case == 'begin')
{
echo "\t\t<tr>\n\t\t\t<td class=\"main_field_name\">$text";
}
else
{
echo " <span style=\"color:$case;\">$text</span></td>\n\t\t</tr>\n";
}
}
/**
* END FUNCTIONS ---------------------------------------------------
*/
/**
* BEGIN VARIABLES ---------------------------------------------------
*/
//guess Servername
if(!empty($_POST['servername']))
{
$servername = $_POST['servername'];
}
else
{
if(!empty($_SERVER['SERVER_NAME']))
{
if(validate_ip($_SERVER['SERVER_NAME'], true) == false)
{
$servername = $_SERVER['SERVER_NAME'];
}
else
{
$servername = '';
}
}
else
{
$servername = '';
}
}
//guess serverip
if(!empty($_POST['serverip']))
{
$serverip = $_POST['serverip'];
}
else
{
if(!empty($_SERVER['SERVER_ADDR']))
{
$serverip = $_SERVER['SERVER_ADDR'];
}
else
{
$serverip = '';
}
}
if(!empty($_POST['mysql_host']))
{
$mysql_host = $_POST['mysql_host'];
}
else
{
$mysql_host = '127.0.0.1';
}
if(!empty($_POST['mysql_database']))
{
$mysql_database = $_POST['mysql_database'];
}
else
{
$mysql_database = 'froxlor';
}
if(!empty($_POST['mysql_unpriv_user']))
{
$mysql_unpriv_user = $_POST['mysql_unpriv_user'];
}
else
{
$mysql_unpriv_user = 'froxlor';
}
if(!empty($_POST['mysql_unpriv_pass']))
{
$mysql_unpriv_pass = $_POST['mysql_unpriv_pass'];
}
else
{
$mysql_unpriv_pass = '';
}
if(!empty($_POST['mysql_root_user']))
{
$mysql_root_user = $_POST['mysql_root_user'];
}
else
{
$mysql_root_user = 'root';
}
if(!empty($_POST['mysql_root_pass']))
{
$mysql_root_pass = $_POST['mysql_root_pass'];
}
else
{
$mysql_root_pass = '';
}
if(!empty($_POST['admin_user']))
{
$admin_user = $_POST['admin_user'];
}
else
{
$admin_user = 'admin';
}
if(!empty($_POST['admin_pass1']))
{
$admin_pass1 = $_POST['admin_pass1'];
}
else
{
$admin_pass1 = '';
}
if(!empty($_POST['admin_pass2']))
{
$admin_pass2 = $_POST['admin_pass2'];
}
else
{
$admin_pass2 = '';
}
if($mysql_host == 'localhost'
|| $mysql_host == '127.0.0.1')
{
$mysql_access_host = $mysql_host;
}
else
{
$mysql_access_host = $serverip;
}
// gues http software
if(!empty($_POST['webserver']))
{
$webserver = $_POST['webserver'];
}
else
{
if(strtoupper(@php_sapi_name()) == "APACHE2HANDLER"
|| stristr($_SERVER[SERVER_SOFTWARE], "apache/2"))
{
$webserver = 'apache2';
}
elseif(substr(strtoupper(@php_sapi_name()), 0, 8) == "LIGHTTPD"
|| stristr($_SERVER[SERVER_SOFTWARE], "lighttpd"))
{
$webserver = 'lighttpd';
}
else
{
// we don't need to bail out, since unknown does not affect any critical installation routines
$webserver = 'unknown';
}
}
if(!empty($_POST['httpuser']))
{
$httpuser = $_POST['httpuser'];
}
else
{
$httpuser = '';
}
if(!empty($_POST['httpgroup']))
{
$httpgroup = $_POST['httpgroup'];
}
else
{
$httpgroup = '';
}
/**
* END VARIABLES ---------------------------------------------------
*/
/**
* BEGIN INSTALL ---------------------------------------------------
*/
if(isset($_POST['installstep'])
&& $_POST['installstep'] == '1'
&& $admin_pass1 == $admin_pass2
&& $admin_pass1 != ''
&& $admin_pass2 != ''
&& $mysql_unpriv_pass != ''
&& $mysql_root_pass != ''
&& $servername != ''
&& $serverip != ''
&& $httpuser != ''
&& $httpgroup != ''
&& $mysql_unpriv_user != $mysql_root_user)
{
page_header();
?>
<table cellpadding="5" cellspacing="4" border="0" align="center" class="maintable">
<tr>
<td class="maintitle"><b><img src="../images/title.gif" alt="" />&nbsp;Froxlor Installation</b></td>
</tr>
<?php
$_die = false;
// check for correct php version
status_message('begin', $lng['install']['phpversion']);
if(version_compare("5.2.0", PHP_VERSION, ">="))
{
status_message('red', $lng['install']['notinstalled']);
$_die = true;
}
else
{
status_message('green', 'OK');
}
status_message('begin', $lng['install']['phpmysql']);
if(!extension_loaded('mysql'))
{
status_message('red', $lng['install']['notinstalled']);
$_die = true;
}
else
{
status_message('green', 'OK');
}
status_message('begin', $lng['install']['phpfilter']);
if(!extension_loaded('filter'))
{
status_message('red', $lng['install']['notinstalled']);
$_die = true;
}
else
{
status_message('green', 'OK');
}
status_message('begin', $lng['install']['phpposix']);
if(!extension_loaded('posix'))
{
status_message('red', $lng['install']['notinstalled']);
$_die = true;
}
else
{
status_message('green', 'OK');
}
status_message('begin', $lng['install']['phpbcmath']);
if(!extension_loaded('bcmath'))
{
status_message('orange', $lng['install']['notinstalled'] . '<br />' . $lng['install']['bcmathdescription']);
$_die = false;
}
else
{
status_message('green', 'OK');
}
status_message('begin', $lng['install']['openbasedir']);
$php_ob = @ini_get("open_basedir");
if(!empty($php_ob)
&& $php_ob != '')
{
status_message('orange', $lng['install']['openbasedirenabled']);
$_die = false;
}
else
{
status_message('green', 'OK');
}
if($_die)
{
status_message('begin', $lng['install']['diedbecauseofrequirements']);
die();
}
//first test if we can access the database server with the given root user and password
status_message('begin', $lng['install']['testing_mysql']);
$db_root = new db($mysql_host, $mysql_root_user, $mysql_root_pass, '');
//ok, if we are here, the database class is build up (otherwise it would have already die'd this script)
status_message('green', 'OK');
//first we make a backup of the old DB if it exists
status_message('begin', $lng['install']['backup_old_db']);
$result = mysql_list_tables($mysql_database);
if($result)
{
$filename = "/tmp/froxlor_backup_" . date(YmdHi) . ".sql";
if(is_file("/usr/bin/mysqldump"))
{
$command = "/usr/bin/mysqldump " . $mysql_database . " -u " . $mysql_root_user . " --password='" . $mysql_root_pass . "' --result-file=" . $filename;
$output = exec($command);
if(stristr($output, "error"))
{
status_message('red', $lng['install']['backing_up_failed']);
}
else
{
status_message('green', 'OK');
}
}
else
{
status_message('red', $lng['install']['backing_up_binary_missing']);
}
}
//so first we have to delete the database and the user given for the unpriv-user if they exit
status_message('begin', $lng['install']['erasing_old_db']);
$db_root->query("DELETE FROM `mysql`.`user` WHERE `User` = '" . $db_root->escape($mysql_unpriv_user) . "' AND `Host` = '" . $db_root->escape($mysql_access_host) . "'");
$db_root->query("DELETE FROM `mysql`.`db` WHERE `User` = '" . $db_root->escape($mysql_unpriv_user) . "' AND `Host` = '" . $db_root->escape($mysql_access_host) . "'");
$db_root->query("DELETE FROM `mysql`.`tables_priv` WHERE `User` = '" . $db_root->escape($mysql_unpriv_user) . "' AND `Host` = '" . $db_root->escape($mysql_access_host) . "'");
$db_root->query("DELETE FROM `mysql`.`columns_priv` WHERE `User` = '" . $db_root->escape($mysql_unpriv_user) . "' AND `Host` = '" . $db_root->escape($mysql_access_host) . "'");
$db_root->query("DROP DATABASE IF EXISTS `" . $db_root->escape(str_replace('`', '', $mysql_database)) . "` ;");
$db_root->query("FLUSH PRIVILEGES;");
status_message('green', 'OK');
//then we have to create a new user and database for the froxlor unprivileged mysql access
status_message('begin', $lng['install']['create_mysqluser_and_db']);
$db_root->query("CREATE DATABASE `" . $db_root->escape(str_replace('`', '', $mysql_database)) . "`");
$mysql_access_host_array = array_map('trim', explode(',', $mysql_access_host));
if(in_array('127.0.0.1', $mysql_access_host_array)
&& !in_array('localhost', $mysql_access_host_array))
{
$mysql_access_host_array[] = 'localhost';
}
if(!in_array('127.0.0.1', $mysql_access_host_array)
&& in_array('localhost', $mysql_access_host_array))
{
$mysql_access_host_array[] = '127.0.0.1';
}
$mysql_access_host_array[] = $serverip;
foreach($mysql_access_host_array as $mysql_access_host)
{
$db_root->query("GRANT ALL PRIVILEGES ON `" . $db_root->escape(str_replace('`', '', $mysql_database)) . "`.* TO '" . $db_root->escape($mysql_unpriv_user) . "'@'" . $db_root->escape($mysql_access_host) . "' IDENTIFIED BY 'password'");
$db_root->query("SET PASSWORD FOR '" . $db_root->escape($mysql_unpriv_user) . "'@'" . $db_root->escape($mysql_access_host) . "' = PASSWORD('" . $db_root->escape($mysql_unpriv_pass) . "')");
}
$db_root->query("FLUSH PRIVILEGES;");
$mysql_access_host = implode(',', $mysql_access_host_array);
status_message('green', 'OK');
//now a new database and the new froxlor-unprivileged-mysql-account have been created and we can fill it now with the data.
status_message('begin', $lng['install']['testing_new_db']);
$db = new db($mysql_host, $mysql_unpriv_user, $mysql_unpriv_pass, $mysql_database);
status_message('green', 'OK');
status_message('begin', $lng['install']['importing_data']);
$db_schema = './froxlor.sql';
$sql_query = @file_get_contents($db_schema, 'r');
$sql_query = remove_remarks($sql_query);
$sql_query = split_sql_file($sql_query, ';');
for ($i = 0;$i < sizeof($sql_query);$i++)
{
if(trim($sql_query[$i]) != '')
{
$result = $db->query($sql_query[$i]);
}
}
status_message('green', 'OK');
status_message('begin', 'System Servername...');
if(validate_ip($_SERVER['SERVER_NAME'], true) !== false)
{
status_message('red', $lng['install']['servername_should_be_fqdn']);
}
else
{
status_message('green', 'OK');
}
//now let's change the settings in our settings-table
status_message('begin', $lng['install']['changing_data']);
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = 'admin@" . $db->escape($servername) . "' WHERE `settinggroup` = 'panel' AND `varname` = 'adminmail'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($serverip) . "' WHERE `settinggroup` = 'system' AND `varname` = 'ipaddress'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($servername) . "' WHERE `settinggroup` = 'system' AND `varname` = 'hostname'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($version) . "' WHERE `settinggroup` = 'panel' AND `varname` = 'version'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($languages[$language]) . "' WHERE `settinggroup` = 'panel' AND `varname` = 'standardlanguage'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($mysql_access_host) . "' WHERE `settinggroup` = 'system' AND `varname` = 'mysql_access_host'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($webserver) . "' WHERE `settinggroup` = 'system' AND `varname` = 'webserver'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($webserver) . "' WHERE `settinggroup` = 'system' AND `varname` = 'webserver'");
//FIXME
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($httpuser) . "' WHERE `settinggroup` = 'system' AND `varname` = 'httpuser'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($httpgroup) . "' WHERE `settinggroup` = 'system' AND `varname` = 'httpgroup'");
if($webserver == "apache2")
{
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/apache2/sites-enabled/' WHERE `settinggroup` = 'system' AND `varname` = 'apacheconf_vhost'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/apache2/sites-enabled/' WHERE `settinggroup` = 'system' AND `varname` = 'apacheconf_diroptions'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/apache2/froxlor-htpasswd/' WHERE `settinggroup` = 'system' AND `varname` = 'apacheconf_htpasswddir'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/init.d/apache2 reload' WHERE `settinggroup` = 'system' AND `varname` = 'apachereload_command'");
}
elseif($webserver == "lighttpd")
{
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/lighttpd/conf-enabled/' WHERE `settinggroup` = 'system' AND `varname` = 'apacheconf_vhost'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/lighttpd/froxlor-diroptions/' WHERE `settinggroup` = 'system' AND `varname` = 'apacheconf_diroptions'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/lighttpd/froxlor-htpasswd/' WHERE `settinggroup` = 'system' AND `varname` = 'apacheconf_htpasswddir'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/init.d/lighttpd reload' WHERE `settinggroup` = 'system' AND `varname` = 'apachereload_command'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/lighttpd/lighttpd.pem' WHERE `settinggroup` = 'system' AND `varname` = 'ssl_cert_file'");
}
// insert the lastcronrun to be the installation date
$query = 'UPDATE `%s` SET `value` = UNIX_TIMESTAMP() WHERE `settinggroup` = \'system\' AND `varname` = \'lastcronrun\'';
$query = sprintf($query, TABLE_PANEL_SETTINGS);
$db->query($query);
// and lets insert the default ip and port
$query = 'INSERT INTO `%s` SET `ip` = \'%s\', `port` = \'80\' ';
$query = sprintf($query, TABLE_PANEL_IPSANDPORTS, $db->escape($serverip));
$db->query($query);
$defaultip = $db->insert_id();
// insert the defaultip
$query = 'UPDATE `%s` SET `value` = \'%s\' WHERE `settinggroup` = \'system\' AND `varname` = \'defaultip\'';
$query = sprintf($query, TABLE_PANEL_SETTINGS, $db->escape($defaultip));
$db->query($query);
status_message('green', 'OK');
//last but not least create the main admin
status_message('begin', $lng['install']['adding_admin_user']);
$db->query("INSERT INTO `" . TABLE_PANEL_ADMINS . "` SET
`loginname` = '" . $db->escape($admin_user) . "',
`password` = '" . md5($admin_pass1) . "',
`name` = 'Siteadmin',
`email` = 'admin@" . $db->escape($servername) . "',
`customers` = -1,
`customers_used` = 0,
`customers_see_all` = 1,
`caneditphpsettings` = 1,
`domains` = -1,
`domains_used` = 0,
`domains_see_all` = 1,
`change_serversettings` = 1,
`diskspace` = -1024,
`diskspace_used` = 0,
`mysqls` = -1,
`mysqls_used` = 0,
`emails` = -1,
`emails_used` = 0,
`email_accounts` = -1,
`email_accounts_used` = 0,
`email_forwarders` = -1,
`email_forwarders_used` = 0,
`email_quota` = -1,
`email_quota_used` = 0,
`ftps` = -1,
`ftps_used` = 0,
`tickets` = -1,
`tickets_used` = 0,
`subdomains` = -1,
`subdomains_used` = 0,
`traffic` = -1048576,
`traffic_used` = 0,
`deactivated` = 0,
`aps_packages` = -1");
status_message('green', 'OK');
//now we create the userdata.inc.php with the mysql-accounts
status_message('begin', $lng['install']['creating_configfile']);
$userdata = "<?php\n";
$userdata.= "//automatically generated userdata.inc.php for Froxlor\n";
$userdata.= "\$sql['host']='" . addcslashes($mysql_host, "'\\") . "';\n";
$userdata.= "\$sql['user']='" . addcslashes($mysql_unpriv_user, "'\\") . "';\n";
$userdata.= "\$sql['password']='" . addcslashes($mysql_unpriv_pass, "'\\") . "';\n";
$userdata.= "\$sql['db']='" . addcslashes($mysql_database, "'\\") . "';\n";
$userdata.= "\$sql_root[0]['caption']='Default';\n";
$userdata.= "\$sql_root[0]['host']='" . addcslashes($mysql_host, "'\\") . "';\n";
$userdata.= "\$sql_root[0]['user']='" . addcslashes($mysql_root_user, "'\\") . "';\n";
$userdata.= "\$sql_root[0]['password']='" . addcslashes($mysql_root_pass, "'\\") . "';\n";
$userdata.= "?>";
//we test now if we can store the userdata.inc.php in ../lib
if($fp = @fopen('../lib/userdata.inc.php', 'w'))
{
$result = @fputs($fp, $userdata, strlen($userdata));
@fclose($fp);
status_message('green', $lng['install']['creating_configfile_succ']);
chmod('../lib/userdata.inc.php', 0440);
}
elseif($fp = @fopen('/tmp/userdata.inc.php', 'w'))
{
$result = @fputs($fp, $userdata, strlen($userdata));
@fclose($fp);
status_message('orange', $lng['install']['creating_configfile_temp']);
chmod('/tmp/userdata.inc.php', 0440);
}
else
{
status_message('red', $lng['install']['creating_configfile_failed']);
echo "\t\t<tr>\n\t\t\t<td class=\"main_field_name\"><p>" . nl2br(htmlspecialchars($userdata)) . "</p></td>\n\t\t</tr>\n";
}
?>
<tr>
<td class="main_field_display" align="center">
<?php echo $lng['install']['froxlor_succ_installed']; ?><br />
<a href="../index.php"><?php echo $lng['install']['click_here_to_login']; ?></a>
</td>
</tr>
</table>
<br />
<br />
<?php
page_footer();
}
else
{
page_header();
?>
<form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="get">
<table cellpadding="5" cellspacing="4" border="0" align="center" class="maintable_40">
<tr>
<td class="maintitle" colspan="2"><b><img src="../images/title.gif" alt="" />&nbsp;<?php echo $lng['install']['welcome']; ?></b></td>
</tr>
<tr>
<td class="main_field_name" colspan="2"><?php echo $lng['install']['welcometext']; ?></td>
</tr>
<tr>
<td class="main_field_name"><?php echo $lng['install']['language']; ?>: </td>
<td class="main_field_display" nowrap="nowrap">
<select name="language" class="dropdown_noborder"><?php
$language_options = '';
while(list($language_file, $language_name) = each($languages))
{
$language_options.= "\n\t\t\t\t\t\t" . makeoption($language_name, $language_file, $language, true, true);
}
echo $language_options;
?>
</select>
</td>
</tr>
<tr>
<td class="main_field_confirm" colspan="2">
<input class="bottom" type="submit" name="chooselang" value="Go" />
</td>
</tr>
</table>
</form>
<br />
<form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="post">
<table cellpadding="5" cellspacing="4" border="0" align="center" class="maintable_40">
<tr>
<td class="maintitle" colspan="2"><b><img src="../images/title.gif" alt="" />&nbsp;<?php echo $lng['install']['database']; ?></b></td>
</tr>
<tr>
<td class="main_field_name"><?php echo $lng['install']['mysql_hostname']; ?>:</td>
<td class="main_field_display"><input type="text" name="mysql_host" value="<?php echo htmlspecialchars($mysql_host); ?>"/></td>
</tr>
<tr>
<td class="main_field_name"><?php echo $lng['install']['mysql_database']; ?>:</td>
<td class="main_field_display"><input type="text" name="mysql_database" value="<?php echo htmlspecialchars($mysql_database); ?>"/></td>
</tr>
<tr>
<td class="main_field_name"<?php echo (($mysql_unpriv_user == $mysql_root_user) ? ' style="color:blue;"' : ''); ?>><?php echo $lng['install']['mysql_unpriv_user']; ?>:</td>
<td class="main_field_display"><input type="text" name="mysql_unpriv_user" value="<?php echo htmlspecialchars($mysql_unpriv_user); ?>"/></td>
</tr>
<tr>
<td class="main_field_name"<?php echo ((!empty($_POST['installstep']) && $mysql_unpriv_pass == '') ? ' style="color:red;"' : ''); ?>><?php echo $lng['install']['mysql_unpriv_pass']; ?>:</td>
<td class="main_field_display"><input type="password" name="mysql_unpriv_pass" value="<?php echo htmlspecialchars($mysql_unpriv_pass); ?>"/></td>
</tr>
<tr>
<td class="main_field_name"<?php echo (($mysql_unpriv_user == $mysql_root_user) ? ' style="color:blue;"' : ''); ?>><?php echo $lng['install']['mysql_root_user']; ?>:</td>
<td class="main_field_display"><input type="text" name="mysql_root_user" value="<?php echo htmlspecialchars($mysql_root_user); ?>"/></td>
</tr>
<tr>
<td class="main_field_name"<?php echo ((!empty($_POST['installstep']) && $mysql_root_pass == '') ? ' style="color:red;"' : ''); ?>><?php echo $lng['install']['mysql_root_pass']; ?>:</td>
<td class="main_field_display"><input type="password" name="mysql_root_pass" value="<?php echo htmlspecialchars($mysql_root_pass); ?>"/></td>
</tr>
<tr>
<td class="maintitle" colspan="2"><b><img src="../images/title.gif" alt="" />&nbsp;<?php echo $lng['install']['admin_account']; ?></b></td>
</tr>
<tr>
<td class="main_field_name"><?php echo $lng['install']['admin_user']; ?>:</td>
<td class="main_field_display"><input type="text" name="admin_user" value="<?php echo htmlspecialchars($admin_user); ?>"/></td>
</tr>
<tr>
<td class="main_field_name"<?php echo ((!empty($_POST['installstep']) && ($admin_pass1 == '' || $admin_pass1 != $admin_pass2)) ? ' style="color:red;"' : ''); ?>><?php echo $lng['install']['admin_pass']; ?>:</td>
<td class="main_field_display"><input type="password" name="admin_pass1" value="<?php echo htmlspecialchars($admin_pass1); ?>"/></td>
</tr>
<tr>
<td class="main_field_name"<?php echo ((!empty($_POST['installstep']) && ($admin_pass2 == '' || $admin_pass1 != $admin_pass2)) ? ' style="color:red;"' : ''); ?>><?php echo $lng['install']['admin_pass_confirm']; ?>:</td>
<td class="main_field_display"><input type="password" name="admin_pass2" value="<?php echo htmlspecialchars($admin_pass2); ?>"/></td>
</tr>
<tr>
<td class="maintitle" colspan="2"><b><img src="../images/title.gif" alt="" />&nbsp;<?php echo $lng['install']['serversettings']; ?></b></td>
</tr>
<tr>
<td class="main_field_name"<?php echo ((!empty($_POST['installstep']) && $servername == '') ? ' style="color:red;"' : ''); ?>><?php echo $lng['install']['servername']; ?>:</td>
<td class="main_field_display"><input type="text" name="servername" value="<?php echo htmlspecialchars($servername); ?>"/></td>
</tr>
<tr>
<td class="main_field_name"<?php echo ((!empty($_POST['installstep']) && $serverip == '') ? ' style="color:red;"' : ''); ?>><?php echo $lng['install']['serverip']; ?>:</td>
<td class="main_field_display"><input type="text" name="serverip" value="<?php echo htmlspecialchars($serverip); ?>"/></td>
</tr>
<tr>
<td class="main_field_name"<?php echo ((!empty($_POST['installstep']) && $webserver == '') ? ' style="color:red;"' : ''); ?>><?php echo $lng['install']['webserver']; ?>:</td>
<td class="main_field_display"><input type="radio" name="webserver" value="apache2" <?php echo $webserver == "apache2" ? 'checked="checked"' : "" ?>/>Apache2&nbsp;<br /><input type="radio" name="webserver" value="lighttpd" <?php echo $webserver == "lighttpd" ? 'checked="checked"' : "" ?>/>Lighttpd</td>
</tr>
<tr>
<td class="main_field_name"<?php echo ((!empty($_POST['installstep']) && $serverip == '') ? ' style="color:red;"' : ''); ?>><?php echo $lng['install']['httpuser']; ?>:</td>
<td class="main_field_display"><input type="text" name="httpuser" value="<?php $posixusername = posix_getpwuid(posix_getuid()); echo $posixusername['name']; ?>"/></td>
</tr>
<tr>
<td class="main_field_name"<?php echo ((!empty($_POST['installstep']) && $serverip == '') ? ' style="color:red;"' : ''); ?>><?php echo $lng['install']['httpgroup']; ?>:</td>
<td class="main_field_display"><input type="text" name="httpgroup" value="<?php $posixgroup = posix_getgrgid(posix_getgid()); echo $posixgroup['name']; ?>"/></td>
</tr>
<tr>
<td class="main_field_confirm" colspan="2"><input type="hidden" name="language" value="<?php echo htmlspecialchars($language); ?>"/><input type="hidden" name="installstep" value="1"/><input class="bottom" type="submit" name="submitbutton" value="<?php echo $lng['install']['next']; ?>"/></td>
</tr>
</table>
</form>
<br />
<br />
<?php
page_footer();
}
/**
* END INSTALL ---------------------------------------------------
*/
?>

File diff suppressed because it is too large Load Diff

View File

@@ -14,80 +14,74 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Language * @package Language
* * @version $Id$
*/ */
$lng['requirements']['title'] = 'Checking system requirements...'; /**
$lng['requirements']['installed'] = 'installed'; * Begin
$lng['requirements']['not_true'] = 'no'; */
$lng['requirements']['notfound'] = 'not found';
$lng['requirements']['notinstalled'] = 'not installed';
$lng['requirements']['activated'] = 'enabled';
$lng['requirements']['phpversion'] = 'PHP version >= 5.3';
$lng['requirements']['newerphpprefered'] = 'Good, but php-5.6 is prefered.';
$lng['requirements']['phpmagic_quotes_runtime'] = 'magic_quotes_runtime...';
$lng['requirements']['phpmagic_quotes_runtime_description'] = 'PHP setting "magic_quotes_runtime" must be set to "Off". We have disabled it temporary for now please fix the coresponding php.ini.';
$lng['requirements']['phppdo'] = 'PHP PDO extension and PDO-MySQL driver...';
$lng['requirements']['phpxml'] = 'PHP XML-extension...';
$lng['requirements']['phpfilter'] = 'PHP filter-extension...';
$lng['requirements']['phpposix'] = 'PHP posix-extension...';
$lng['requirements']['phpbcmath'] = 'PHP bcmath-extension...';
$lng['requirements']['phpcurl'] = 'PHP curl-extension...';
$lng['requirements']['phpmbstring'] = 'PHP mbstring-extension...';
$lng['requirements']['phpzip'] = 'PHP zip-extension...';
$lng['requirements']['bcmathdescription'] = 'Traffic-calculation related functions will not work correctly!';
$lng['requirements']['zipdescription'] = 'The auto-update feature requires the zip extension.';
$lng['requirements']['openbasedir'] = 'open_basedir...';
$lng['requirements']['openbasedirenabled'] = 'Froxlor will not work properly with open_basedir enabled. Please disable open_basedir for Froxlor in the coresponding php.ini';
$lng['requirements']['diedbecauseofrequirements'] = 'Cannot install Froxlor without these requirements! Try to fix them and retry.';
$lng['requirements']['froxlor_succ_checks'] = 'All requirements are satisfied';
$lng['install']['lngtitle'] = 'Froxlor install - choose language'; $lng['install']['language'] = 'Installation - Language';
$lng['install']['language'] = 'Installation language'; $lng['install']['welcome'] = 'Welcome to Froxlor Installation';
$lng['install']['lngbtn_go'] = 'Change language';
$lng['install']['title'] = 'Froxlor install - setup';
$lng['install']['welcometext'] = 'Thank you for choosing Froxlor. Please fill out the following fields with the required information to start the installation.<br /><b>Attention:</b> If the database you chose for Froxlor already exists on your System, it will be erased with all containing data!'; $lng['install']['welcometext'] = 'Thank you for choosing Froxlor. Please fill out the following fields with the required information to start the installation.<br /><b>Attention:</b> If the database you chose for Froxlor already exists on your System, it will be erased with all containing data!';
$lng['install']['database'] = 'Database connection'; $lng['install']['database'] = 'Database';
$lng['install']['mysql_host'] = 'MySQL-Hostname'; $lng['install']['mysql_hostname'] = 'MySQL-Hostname';
$lng['install']['mysql_database'] = 'Database name'; $lng['install']['mysql_database'] = 'MySQL-Database';
$lng['install']['mysql_unpriv_user'] = 'Username for the unprivileged MySQL-account'; $lng['install']['mysql_unpriv_user'] = 'Username for the unprivileged MySQL-account';
$lng['install']['mysql_unpriv_pass'] = 'Password for the unprivileged MySQL-account'; $lng['install']['mysql_unpriv_pass'] = 'Password for the unprivileged MySQL-account';
$lng['install']['mysql_root_user'] = 'Username for the MySQL-root-account'; $lng['install']['mysql_root_user'] = 'Username for the MySQL-root-account';
$lng['install']['mysql_root_pass'] = 'Password for the MySQL-root-account'; $lng['install']['mysql_root_pass'] = 'Password for the MySQL-root-account';
$lng['install']['admin_account'] = 'Administrator Account'; $lng['install']['admin_account'] = 'Administrator Account';
$lng['install']['admin_user'] = 'Administrator Username'; $lng['install']['admin_user'] = 'Administrator Username';
$lng['install']['admin_pass1'] = 'Administrator Password'; $lng['install']['admin_pass'] = 'Administrator Password';
$lng['install']['admin_pass2'] = 'Administrator-Password (confirm)'; $lng['install']['admin_pass_confirm'] = 'Administrator-Password (confirm)';
$lng['install']['activate_newsfeed'] = 'Enable the official newsfeed<br><small>(https://inside.froxlor.org/news/)</small>';
$lng['install']['serversettings'] = 'Server settings'; $lng['install']['serversettings'] = 'Server settings';
$lng['install']['servername'] = 'Server name (FQDN, no ip-address)'; $lng['install']['servername'] = 'Server name (FQDN)';
$lng['install']['serverip'] = 'Server IP'; $lng['install']['serverip'] = 'Server IP';
$lng['install']['webserver'] = 'Webserver';
$lng['install']['apache2'] = 'Apache 2';
$lng['install']['apache24'] = 'Apache 2.4';
$lng['install']['lighttpd'] = 'LigHTTPd';
$lng['install']['nginx'] = 'NGINX';
$lng['install']['httpuser'] = 'HTTP username'; $lng['install']['httpuser'] = 'HTTP username';
$lng['install']['httpgroup'] = 'HTTP groupname'; $lng['install']['httpgroup'] = 'HTTP groupname';
$lng['install']['apacheversion'] = 'Apacheversion';
$lng['install']['next'] = 'Next';
$lng['install']['testing_mysql'] = 'Checking MySQL-root access...'; /**
$lng['install']['testing_mysql_fail'] = 'There seems to be a problem with the database-connection. Cannot continue. Please go back and check your credentials.'; * Progress
$lng['install']['backup_old_db'] = 'Creating backup of old database...'; */
$lng['install']['backup_binary_missing'] = 'Could not find mysqldump';
$lng['install']['backup_failed'] = 'Could not backup database'; $lng['install']['testing_mysql'] = 'Testing if MySQL-root-username and password are correct...';
$lng['install']['prepare_db'] = 'Preparing database...'; $lng['install']['erasing_old_db'] = 'Erasing old Database...';
$lng['install']['create_mysqluser_and_db'] = 'Creating database and username...'; $lng['install']['backup_old_db'] = 'Create backup of the old Database...';
$lng['install']['testing_new_db'] = 'Testing if database and user have been created correctly...'; $lng['install']['backing_up'] = 'Backing up';
$lng['install']['importing_data'] = 'Importing data...'; $lng['install']['backing_up_binary_missing'] = '/usr/bin/mysqldump is missing';
$lng['install']['changing_data'] = 'Adjusting settings...'; $lng['install']['create_mysqluser_and_db'] = 'Creating MySQL-database and username...';
$lng['install']['creating_entries'] = 'Inserting new values...'; $lng['install']['testing_new_db'] = 'Testing if MySQL-database and username have been created correctly...';
$lng['install']['adding_admin_user'] = 'Creating admin-account...'; $lng['install']['importing_data'] = 'Importing data into MySQL-database...';
$lng['install']['changing_data'] = 'Changing imported data...';
$lng['install']['adding_admin_user'] = 'Adding Administrator Account...';
$lng['install']['creating_configfile'] = 'Creating configfile...'; $lng['install']['creating_configfile'] = 'Creating configfile...';
$lng['install']['creating_configfile_succ'] = 'OK, userdata.inc.php was saved in lib/.';
$lng['install']['creating_configfile_temp'] = 'File was saved in /tmp/userdata.inc.php, please move to lib/.'; $lng['install']['creating_configfile_temp'] = 'File was saved in /tmp/userdata.inc.php, please move to lib/.';
$lng['install']['creating_configfile_failed'] = 'Could not create lib/userdata.inc.php, please create it manually with the following content:'; $lng['install']['creating_configfile_failed'] = 'Cannot create lib/userdata.inc.php, please create it manually with the following data:';
$lng['install']['froxlor_succ_installed'] = 'Froxlor was installed successfully.'; $lng['install']['froxlor_succ_installed'] = 'Froxlor was installed successfully.';
$lng['install']['click_here_to_login'] = 'Click here to login.';
$lng['install']['phpmysql'] = 'Testing if PHP MySQL-extension is installed...';
$lng['install']['phpfilter'] = 'Testing if PHP filter-extension is installed...';
$lng['install']['diedbecauseofrequirements'] = 'Cannot install Froxlor without these requirements! Aborting...';
$lng['install']['notinstalled'] = 'not installed!';
$lng['install']['phpbcmath'] = 'Testing if PHP bcmath-extension is installed...';
$lng['install']['bcmathdescription'] = 'Traffic-calculation related functions will not work correctly!';
$lng['install']['openbasedir'] = 'Testing if open_basedir is enabled...';
$lng['install']['openbasedirenabled'] = 'enabled. Froxlor will not work properly with open_basedir enabled. Please disable open_basedir for Froxlor';
$lng['click_here_to_refresh'] = 'Click here to check again'; /**
$lng['click_here_to_goback'] = 'Click here to go back'; * Renamed in 1.2.19-svn40
$lng['click_here_to_continue'] = 'Click here to continue'; */
$lng['click_here_to_login'] = 'Click here to login.';
$lng['install']['webserver'] = 'Webserver';
/*
* Added in Froxlor 0.9
*/
$lng['install']['phpversion'] = 'Checking for PHP version >= 5.2';
$lng['install']['phpposix'] = 'Testing if PHP posix-extension is installed...';
?>

View File

@@ -10,80 +10,62 @@
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * COPYING file online at http://files.froxlor.org/misc/COPYING.txt
* *
* @copyright (c) the authors * @copyright (c) the authors
* @author Florian Lippert <flo@syscp.org> (2003-2009) * @author Tim Zielosko <mail@zielosko.net>
* @author Froxlor team <team@froxlor.org> (2010-) * @author Romain MARIADASSOU <roms2000@free.fr>
* @author Froxlor Team <team@froxlor.org>
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Language * @package Language
* * @version $Id$
*/ */
$lng['requirements']['title'] = 'Vérification des prérequis système...'; /**
$lng['requirements']['installed'] = 'installé'; * Begin
$lng['requirements']['not_true'] = 'non'; */
$lng['requirements']['notfound'] = 'introuvable';
$lng['requirements']['notinstalled'] = 'non installé';
$lng['requirements']['activated'] = 'activé';
$lng['requirements']['phpversion'] = 'PHP version >= 5.3';
$lng['requirements']['phpmagic_quotes_runtime'] = 'magic_quotes_runtime...';
$lng['requirements']['phpmagic_quotes_runtime_description'] = 'Le réglage PHP "magic_quotes_runtime" doit être positionné à "Off". Nous l\'avons désactivé temporairement pour l\'instant; merci de corriger le php.ini correspondant.';
$lng['requirements']['phppdo'] = 'extension PHP PDO et pilote PDO-MySQL ...';
$lng['requirements']['phpxml'] = 'extension PHP XML...';
$lng['requirements']['phpfilter'] = 'extension PHP filter ...';
$lng['requirements']['phpposix'] = 'extension PHP posix ...';
$lng['requirements']['phpbcmath'] = 'extension PHP bcmath ...';
$lng['requirements']['phpcurl'] = 'extension PHP curl...';
$lng['requirements']['phpmbstring'] = 'extension PHP mbstring...';
$lng['requirements']['bcmathdescription'] = 'Les fonctions de calcul de traffic ne fonctionneront pas correctement!';
$lng['requirements']['openbasedir'] = 'open_basedir...';
$lng['requirements']['openbasedirenabled'] = 'Froxlor ne fonctionnera pas correctement avec open_basedir activé. Merci de désactiver open_basedir pour Froxlor dans le php.ini correspondant';
$lng['requirements']['diedbecauseofrequirements'] = 'Impossible d\'installer Froxlor sans ces prérequis! Essayez de les corriger et essayez à nouveau.';
$lng['requirements']['froxlor_succ_checks'] = 'Tous les prérequis sont vérifiés';
$lng['install']['lngtitle'] = 'Installation de Froxlor - choisisez la langue';
$lng['install']['language'] = 'Langue d\'installation'; $lng['install']['language'] = 'Langue d\'installation';
$lng['install']['lngbtn_go'] = 'Changer la langue'; $lng['install']['welcome'] = 'Bienvenue <20> l\'installation de Froxlor';
$lng['install']['title'] = 'Installation de Froxlor - paramètrage'; $lng['install']['welcometext'] = 'Merci beaucoup d\'avoir choisi Froxlor. Pour installer Froxlor remplissez les cases ci-dessous avec les informations demand<6E>es.<br /><b>Attention :</b> Si vous entrez le nom d\'une base de donn<6E>es existante, celle-ci sera effac<61>e !';
$lng['install']['welcometext'] = 'Merci d\'avoir choisi Froxlor. Merci de remplir les champs suivant avec les informations nécessaires pour démarrer l\'installation.<br /><b>Attention:</b> Si la base de données que vous choisissez existe déjà sur votre système, elle sera écrasée ainsi que les données contenues!'; $lng['install']['database'] = 'Base de donn<6E>es';
$lng['install']['database'] = 'Connexion à la base de données'; $lng['install']['mysql_hostname'] = 'Nom d\'h<>te du serveur MySQL';
$lng['install']['mysql_host'] = 'Nom d\'hôte MySQL'; $lng['install']['mysql_database'] = 'Base de donn<6E>es MySQL';
$lng['install']['mysql_database'] = 'Nom de la base de données'; $lng['install']['mysql_unpriv_user'] = 'Utilisateur pour l\'acc<63>s non privil<69>gi<67> <20> MySQL';
$lng['install']['mysql_unpriv_user'] = 'Nom d\'utilisateur pour le compte non priviligié MySQL'; $lng['install']['mysql_unpriv_pass'] = 'Mot de passe pour l\'acc<63>s non privil<EFBFBD>gi<EFBFBD> <20> MySQL';
$lng['install']['mysql_unpriv_pass'] = 'Mot de passe pour le compte non priviligié MySQL'; $lng['install']['mysql_root_user'] = 'Utilisateur pour l\'acc<63>s root <20> MySQL';
$lng['install']['mysql_root_user'] = 'Nom d\'utilisateur pour le compte MySQL root'; $lng['install']['mysql_root_pass'] = 'Mot de passe pour l\'acc<63>s root <20> MySQL';
$lng['install']['mysql_root_pass'] = 'Mot de passe pour le compte MySQL root'; $lng['install']['admin_account'] = 'Acc<63>s administratif';
$lng['install']['admin_account'] = 'Compte administrateur'; $lng['install']['admin_user'] = 'Login de l\'administrateur';
$lng['install']['admin_user'] = 'Nom d\'utilisateur administrateur'; $lng['install']['admin_pass'] = 'Mot de passe de l\'administrateur';
$lng['install']['admin_pass1'] = 'Mot de passe administrateur'; $lng['install']['admin_pass_confirm'] = 'Mot de passe de l\'administrateur (confirmation)';
$lng['install']['admin_pass2'] = 'Mot de passe administrateur (confirmez)'; $lng['install']['serversettings'] = 'Configuration du serveur';
$lng['install']['serversettings'] = 'Réglages serveur'; $lng['install']['servername'] = 'Nom du serveur (FQDN)';
$lng['install']['servername'] = 'Nom du serveur (FQDN, pas d\'adresse IP)';
$lng['install']['serverip'] = 'Adresse IP du serveur'; $lng['install']['serverip'] = 'Adresse IP du serveur';
$lng['install']['webserver'] = 'Serveur Web'; $lng['install']['apacheversion'] = 'Version du serveur Apache';
$lng['install']['apache2'] = 'Apache 2'; $lng['install']['next'] = 'Continuer';
$lng['install']['apache24'] = 'Apache 2.4';
$lng['install']['lighttpd'] = 'LigHTTPd';
$lng['install']['nginx'] = 'NGINX';
$lng['install']['httpuser'] = 'Nom d\'utilisateur HTTP';
$lng['install']['httpgroup'] = 'Nom de groupe HTTP';
$lng['install']['testing_mysql'] = 'Vérification de l\'accès root MySQL...'; /**
$lng['install']['testing_mysql_fail'] = 'Il semble y avoir un problème avec la connexion à la base de données. Impossible de continuer. Merci de revenir en arrière et de vérifier les informations d\'identification.'; * Progress
$lng['install']['backup_old_db'] = 'Création des sauvegardes de l\'ancienne base de données...'; */
$lng['install']['backup_binary_missing'] = 'Impossible de trouver mysqldump';
$lng['install']['backup_failed'] = 'Impossible de sauvegarde la base de données';
$lng['install']['prepare_db'] = 'Préparation de la base de données...';
$lng['install']['create_mysqluser_and_db'] = 'Création de la base de données et l\'utilisateur...';
$lng['install']['testing_new_db'] = 'Teste si la base de données et l\'utilisateur ont été créés correctement...';
$lng['install']['importing_data'] = 'Import des données...';
$lng['install']['changing_data'] = 'Ajustement des paramètres...';
$lng['install']['creating_entries'] = 'Insertion des nouvelles valeurs...';
$lng['install']['adding_admin_user'] = 'Création du compte administrateur...';
$lng['install']['creating_configfile'] = 'Création du fichier de configuration...';
$lng['install']['creating_configfile_temp'] = 'Le fichier a été enregistré dans /tmp/userdata.inc.php, merci de le déplacer dans lib/.';
$lng['install']['creating_configfile_failed'] = 'Impossible de créer lib/userdata.inc.php, merci de le créer manuellement avec le contenu suivant:';
$lng['install']['froxlor_succ_installed'] = 'Froxlor a été installé avec succès.';
$lng['click_here_to_refresh'] = 'Cliquez ici pour vérifier à nouveau'; $lng['install']['testing_mysql'] = 'V<>rification du login root de MySQL ...';
$lng['click_here_to_goback'] = 'Cliquez ici pour revenir'; $lng['install']['erasing_old_db'] = 'Effacement de l\'ancienne base de donn<6E>es ...';
$lng['click_here_to_continue'] = 'Cliquez ici pour continuer'; $lng['install']['create_mysqluser_and_db'] = 'Cr<43>ation de la base de donn<6E>es puis des utilisateurs ...';
$lng['click_here_to_login'] = 'Cliquez ici pour vous connecter.'; $lng['install']['testing_new_db'] = 'V<>rification de la base de donn<6E>es et des utilisateurs ...';
$lng['install']['importing_data'] = 'Importation des informations dans la base de donn<6E>es ...';
$lng['install']['changing_data'] = 'Modification des donn<6E>es import<72>s ...';
$lng['install']['adding_admin_user'] = 'Ajout de l\'utilisateur administrateur ...';
$lng['install']['creating_configfile'] = 'Cr<43>ation du fichier de configuration ...';
$lng['install']['creating_configfile_succ'] = 'OK, userdata.inc.php a <20>t<EFBFBD> sauvegard<72> dans le dossier lib/ de Froxlor.';
$lng['install']['creating_configfile_temp'] = 'Le fichier a <20>t<EFBFBD> sauvegard<72> dans /tmp/userdata.inc.php, veuillez le d<>placer / copier dans le dossier lib/ de Froxlor.';
$lng['install']['creating_configfile_failed'] = 'Erreur en cr<63>ant le fichier lib/userdata.inc.php, veuillez le cr<63>er avec le contenu ci-dessous :';
$lng['install']['froxlor_succ_installed'] = 'Froxlor a <20>t<EFBFBD> install<6C> correctement.';
$lng['install']['click_here_to_login'] = 'Cliquez ici pour vous rendre <20> l\'invite de connexion.';
$lng['install']['httpuser'] = 'Nom du utilisateur du HTTP';
$lng['install']['httpgroup'] = 'Nom du la group du HTTP';
/**
* Renamed in 1.2.19-svn40
*/
$lng['install']['webserver'] = 'Version du serveur';
?>

View File

@@ -2,92 +2,86 @@
/** /**
* This file is part of the Froxlor project. * This file is part of the Froxlor project.
* Copyright (c) 2003-2009 the SysCP Team (see authors). * Copyright (c) 2003-2007 the SysCP Team (see authors).
* Copyright (c) 2010 the Froxlor Team (see authors). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the * file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * COPYING file online at http://files.syscp.org/misc/COPYING.txt
* *
* @copyright (c) the authors * @copyright (c) the authors
* @author Florian Lippert <flo@syscp.org> (2003-2009) * @author Florian Lippert <flo@syscp.org> (2003-2007)
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor Team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Language * @package Language
* * @version $Id$
*/ */
$lng['requirements']['title'] = 'Prüfe Systemvoraussetzungen...'; /**
$lng['requirements']['installed'] = 'installiert'; * Begin
$lng['requirements']['not_true'] = 'nein'; */
$lng['requirements']['notfound'] = 'nicht gefunden';
$lng['requirements']['notinstalled'] = 'nicht installiert';
$lng['requirements']['activated'] = 'ist aktiviert.';
$lng['requirements']['phpversion'] = 'PHP Version >= 5.3';
$lng['requirements']['newerphpprefered'] = 'Passt, aber php-5.6 wird bevorzugt.';
$lng['requirements']['phpmagic_quotes_runtime'] = 'magic_quotes_runtime';
$lng['requirements']['phpmagic_quotes_runtime_description'] = 'Die PHP Einstellung "magic_quotes_runtime" muss deaktiviert sein ("Off"). Die Einstellung wurde temporär deaktiviert, bitte ändern Sie diese in der entsprechenden php.ini.';
$lng['requirements']['phppdo'] = 'PHP PDO Erweiterung und PDO-MySQL Treiber...';
$lng['requirements']['phpxml'] = 'PHP XML-Erweiterung...';
$lng['requirements']['phpfilter'] = 'PHP filter-Erweiterung...';
$lng['requirements']['phpposix'] = 'PHP posix-Erweiterung...';
$lng['requirements']['phpbcmath'] = 'PHP bcmath-Erweiterung...';
$lng['requirements']['phpcurl'] = 'PHP curl-Erweiterung...';
$lng['requirements']['phpmbstring'] = 'PHP mbstring-Erweiterung...';
$lng['requirements']['phpzip'] = 'PHP zip-Erweiterung...';
$lng['requirements']['bcmathdescription'] = 'Traffic-Berechnungs bezogene Funktionen stehen nicht vollständig zur Verfügung!';
$lng['requirements']['zipdescription'] = 'Die Auto-Update Funktion benötigt die zip Erweiterung.';
$lng['requirements']['openbasedir'] = 'open_basedir genutzt wird...';
$lng['requirements']['openbasedirenabled'] = 'Froxlor wird mit aktiviertem open_basedir nicht vollständig funktionieren. Bitte deaktivieren Sie open_basedir für Froxlor in der entsprechenden php.ini';
$lng['requirements']['diedbecauseofrequirements'] = 'Kann Froxlor ohne diese Voraussetzungen nicht installieren! Beheben Sie die angezeigten Probleme und versuchen Sie es erneut.';
$lng['requirements']['froxlor_succ_checks'] = 'Alle Vorraussetzungen sind erfüllt';
$lng['install']['lngtitle'] = 'Froxlor Installation - Sprache auswählen'; $lng['install']['language'] = 'Installations - Sprache';
$lng['install']['language'] = 'Sprache für die Installation'; $lng['install']['welcome'] = 'Willkommen zur Froxlor Installation';
$lng['install']['lngbtn_go'] = 'Sprache ändern'; $lng['install']['welcometext'] = 'Vielen Dank dass Sie sich f&uuml;r Froxlor entschieden haben. Um Ihre Installation von Froxlor zu starten, f&uuml;llen Sie bitte alle Felder unten mit den geforderten Angaben.<br /><b>Achtung:</b> Eine eventuell bereits existierende Datenbank, die den selben Namen hat wie den, den Sie unten eingeben werden, wird mit allen enthaltenen Daten gel&ouml;scht!';
$lng['install']['title'] = 'Froxlor Installation - Einrichtung'; $lng['install']['database'] = 'Datenbank';
$lng['install']['welcometext'] = 'Vielen Dank dass Sie sich für Froxlor entschieden haben. Um die Installation von Froxlor zu starten, füllen Sie bitte alle Felder mit den geforderten Angaben aus.<br /><b>Achtung:</b> Eine eventuell existierende Datenbank, die den selben Namen hat wie den Gewählten, wird mit allen enthaltenen Daten gelöscht!'; $lng['install']['mysql_hostname'] = 'MySQL-Hostname';
$lng['install']['database'] = 'Datenbankverbindung'; $lng['install']['mysql_database'] = 'MySQL-Datenbank';
$lng['install']['mysql_host'] = 'MySQL-Hostname'; $lng['install']['mysql_unpriv_user'] = 'Benutzername f&uuml;r den unprivilegierten MySQL-Account';
$lng['install']['mysql_database'] = 'Datenbank Name'; $lng['install']['mysql_unpriv_pass'] = 'Passwort f&uuml;r den unprivilegierten MySQL-Account';
$lng['install']['mysql_unpriv_user'] = 'Benutzername für den unprivilegierten MySQL-Account'; $lng['install']['mysql_root_user'] = 'Benutzername f&uuml;r den MySQL-Root-Account';
$lng['install']['mysql_unpriv_pass'] = 'Passwort für den unprivilegierten MySQL-Account'; $lng['install']['mysql_root_pass'] = 'Passwort f&uuml;r den MySQL-Root-Account';
$lng['install']['mysql_root_user'] = 'Benutzername für den MySQL-Root-Account';
$lng['install']['mysql_root_pass'] = 'Passwort für den MySQL-Root-Account';
$lng['install']['admin_account'] = 'Admin-Zugang'; $lng['install']['admin_account'] = 'Admin-Zugang';
$lng['install']['admin_user'] = 'Administrator-Benutzername'; $lng['install']['admin_user'] = 'Administrator-Benutzername';
$lng['install']['admin_pass1'] = 'Administrator-Passwort'; $lng['install']['admin_pass'] = 'Administrator-Passwort';
$lng['install']['admin_pass2'] = 'Administrator-Passwort (Bestätigung)'; $lng['install']['admin_pass_confirm'] = 'Administrator-Passwort (Best&auml;tigung)';
$lng['install']['activate_newsfeed'] = 'Aktiviere das offizielle Newsfeed<br><small>(https://inside.froxlor.org/news/)</small>';
$lng['install']['serversettings'] = 'Servereinstellungen'; $lng['install']['serversettings'] = 'Servereinstellungen';
$lng['install']['servername'] = 'Servername (FQDN, keine IP-Adresse)'; $lng['install']['servername'] = 'Servername (FQDN)';
$lng['install']['serverip'] = 'Server-IP'; $lng['install']['serverip'] = 'Server-IP';
$lng['install']['webserver'] = 'Webserver'; $lng['install']['apacheversion'] = 'Apacheversion';
$lng['install']['apache2'] = 'Apache 2'; $lng['install']['next'] = 'Fortfahren';
$lng['install']['apache24'] = 'Apache 2.4';
$lng['install']['lighttpd'] = 'LigHTTPd';
$lng['install']['nginx'] = 'NGINX';
$lng['install']['httpuser'] = 'HTTP Username';
$lng['install']['httpgroup'] = 'HTTP Gruppenname';
$lng['install']['testing_mysql'] = 'Teste MySQL-Root Zugang...'; /**
$lng['install']['testing_mysql_fail'] = 'Bei der Verwendung der Datenbank gibt es scheinbar Probleme. Installation kann nicht fortgesetzt werden. Bitte Zugangsdaten prüfen und erneut versuchen.'; * Progress
$lng['install']['backup_old_db'] = 'Sicherung vorheriger Datenbank...'; */
$lng['install']['backup_binary_missing'] = 'Konnte mysqldump nicht finden';
$lng['install']['backup_failed'] = 'Sicherung fehlgeschlagen'; $lng['install']['testing_mysql'] = 'Teste, ob die MySQL-Root-Benutzerdaten richtig sind...';
$lng['install']['prepare_db'] = 'Datenbank wird vorbereitet...'; $lng['install']['erasing_old_db'] = 'Entferne alte Datenbank...';
$lng['install']['backup_old_db'] = 'Sichere bisherige Datenbank...';
$lng['install']['backing_up'] = 'Sicherung l&auml;ft';
$lng['install']['backing_up_binary_missing'] = '/usr/bin/mysqldump nicht vorhanden';
$lng['install']['create_mysqluser_and_db'] = 'Erstelle Datenbank und Benutzer...'; $lng['install']['create_mysqluser_and_db'] = 'Erstelle Datenbank und Benutzer...';
$lng['install']['testing_new_db'] = 'Teste, ob Datenbank und Benutzer korrekt angelegt wurden...'; $lng['install']['testing_new_db'] = 'Teste, ob die Datenbank und Passwort korrekt angelegt wurden...';
$lng['install']['importing_data'] = 'Importiere Daten...'; $lng['install']['importing_data'] = 'Importiere Daten in die MySQL-Datenbank...';
$lng['install']['changing_data'] = 'Einstellungen anpassen...'; $lng['install']['changing_data'] = 'Passe die importierten Daten an...';
$lng['install']['creating_entries'] = 'Trage neue Werte ein...'; $lng['install']['adding_admin_user'] = 'F&uuml;ge den Admin-Benutzer hinzu...';
$lng['install']['adding_admin_user'] = 'Erstelle Admin-Benutzer...';
$lng['install']['creating_configfile'] = 'Erstelle Konfigurationsdatei...'; $lng['install']['creating_configfile'] = 'Erstelle Konfigurationsdatei...';
$lng['install']['creating_configfile_succ'] = 'OK, userdata.inc.php wurde in lib/ gespeichert.';
$lng['install']['creating_configfile_temp'] = 'Datei wurde in /tmp/userdata.inc.php gespeichert, bitte nach lib/ verschieben.'; $lng['install']['creating_configfile_temp'] = 'Datei wurde in /tmp/userdata.inc.php gespeichert, bitte nach lib/ verschieben.';
$lng['install']['creating_configfile_failed'] = 'Konnte lib/userdata.inc.php nicht erstellen, bitte manuell mit folgendem Inhalt anlegen:'; $lng['install']['creating_configfile_failed'] = 'Konnte lib/userdata.inc.php nicht erstellen, bitte manuell mit folgendem Inhalt anlegen:';
$lng['install']['froxlor_succ_installed'] = 'Froxlor wurde erfolgreich installiert.'; $lng['install']['froxlor_succ_installed'] = 'Froxlor wurde erfolgreich installiert.';
$lng['install']['click_here_to_login'] = 'Hier geht es weiter zum Login-Fenster.';
$lng['install']['phpmysql'] = 'Teste, ob die PHP MySQL-Erweiterung installiert ist...';
$lng['install']['phpfilter'] = 'Teste, ob die PHP Filter-Erweiterung installiert ist...';
$lng['install']['diedbecauseofrequirements'] = 'Kann Froxlor ohne diese Voraussetzungen nicht installieren! Breche ab...';
$lng['install']['notinstalled'] = 'nicht installiert!';
$lng['install']['phpbcmath'] = 'Teste, ob die PHP bcmath-Erweiterung installiert ist...';
$lng['install']['bcmathdescription'] = 'Traffic-Berechnungs bezogene Funktionen stehen nicht vollst&auml;ndig zur Verf&uuml;gung!';
$lng['install']['openbasedir'] = 'Teste, ob open_basedir genutzt wird...';
$lng['install']['openbasedirenabled'] = 'aktiviert. Froxlor wird mit aktiviertem open_basedir nicht vollst&auml;ndig funktionieren. Bitte deaktivieren Sie open_basedir f&uuml;r Froxlor';
$lng['install']['httpuser'] = 'HTTP Username';
$lng['install']['httpgroup'] = 'HTTP Gruppenname';
$lng['click_here_to_refresh'] = 'Hier klicken, um erneut zu prüfen'; /**
$lng['click_here_to_goback'] = 'Einen Schritt zurück'; * Renamed in 1.2.19-svn40
$lng['click_here_to_continue'] = 'Installation fortführen'; */
$lng['click_here_to_login'] = 'Hier geht es weiter zum Login-Fenster.';
$lng['install']['webserver'] = 'Webserver';
/*
* Added in Froxlor 0.9
*/
$lng['install']['phpversion'] = 'Pr&uuml;fe PHP Version >= 5.2';
$lng['install']['phpposix'] = 'Teste, ob die PHP Posix-Erweiterung installiert ist...';
?>

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