ininitial froxlor commit;
'reverted' old-style update-process; removed billing-classes, -functions and -templates; some sql-fixes;
281
COPYING
Normal file
@@ -0,0 +1,281 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
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
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
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
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
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.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
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
|
||||
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
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
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
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
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.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
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"
|
||||
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,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
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
|
||||
along with the Program.
|
||||
|
||||
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.
|
||||
|
||||
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
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
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
|
||||
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
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
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
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
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
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works 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
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
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
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
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
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
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
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
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
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
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
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
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
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
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
|
||||
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
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
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 promoting the sharing and reuse of software generally.
|
||||
|
||||
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
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
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
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
64
actions/admin/settings/000.version.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
* @version $Id: 000.version.php 2733 2009-11-06 09:32:00Z flo $
|
||||
*/
|
||||
|
||||
return array(
|
||||
'groups' => array(
|
||||
'version' => array(
|
||||
'fields' => array(
|
||||
'system_dbversion' => array(
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'dbversion',
|
||||
'type' => 'hidden',
|
||||
'default' => '',
|
||||
),
|
||||
'system_last_tasks_run' => array(
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'last_tasks_run',
|
||||
'type' => 'hidden',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_last_traffic_run' => array(
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'last_traffic_run',
|
||||
'type' => 'hidden',
|
||||
'default' => '',
|
||||
),
|
||||
'system_lastcronrun' => array(
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'lastcronrun',
|
||||
'type' => 'hidden',
|
||||
'default' => '',
|
||||
),
|
||||
'system_lastguid' => array(
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'lastguid',
|
||||
'type' => 'hidden',
|
||||
'default' => 9999,
|
||||
),
|
||||
'system_lastaccountnumber' => array(
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'lastaccountnumber',
|
||||
'type' => 'hidden',
|
||||
'default' => 0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
?>
|
||||
163
actions/admin/settings/100.panel.php
Normal file
@@ -0,0 +1,163 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
* @version $Id: 100.panel.php 2724 2009-06-07 14:18:02Z flo $
|
||||
*/
|
||||
|
||||
return array(
|
||||
'groups' => array(
|
||||
'panel' => array(
|
||||
'title' => $lng['admin']['panelsettings'],
|
||||
'fields' => array(
|
||||
'panel_standardlanguage' => array(
|
||||
'label' => array('title' => $lng['login']['language'], 'description' => $lng['serversettings']['language']['description']),
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'standardlanguage',
|
||||
'type' => 'option',
|
||||
'default' => 'English',
|
||||
'option_mode' => 'one',
|
||||
'option_options_method' => 'getLanguages',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'panel_natsorting' => array(
|
||||
'label' => $lng['serversettings']['natsorting'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'natsorting',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'panel_no_robots' => array(
|
||||
'label' => $lng['serversettings']['no_robots'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'no_robots',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'panel_paging' => array(
|
||||
'label' => $lng['serversettings']['paging'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'paging',
|
||||
'type' => 'int',
|
||||
'int_min' => 0,
|
||||
'default' => 0,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'panel_pathedit' => array(
|
||||
'label' => $lng['serversettings']['pathedit'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'pathedit',
|
||||
'type' => 'option',
|
||||
'default' => 'Manual',
|
||||
'option_mode' => 'one',
|
||||
'option_options' => array('Manual' => 'Manual', 'Dropdown' => 'Dropdown'),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'panel_adminmail' => array(
|
||||
'label' => $lng['serversettings']['adminmail'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'adminmail',
|
||||
'type' => 'string',
|
||||
'string_type' => 'mail',
|
||||
'string_emptyallowed' => false,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'panel_decimal_places' => array(
|
||||
'label' => $lng['serversettings']['decimal_places'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'decimal_places',
|
||||
'type' => 'int',
|
||||
'int_min' => 0,
|
||||
'int_max' => 15,
|
||||
'default' => 4,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'panel_phpmyadmin_url' => array(
|
||||
'label' => $lng['serversettings']['phpmyadmin_url'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'phpmyadmin_url',
|
||||
'type' => 'string',
|
||||
'string_type' => 'url',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'panel_webmail_url' => array(
|
||||
'label' => $lng['serversettings']['webmail_url'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'webmail_url',
|
||||
'type' => 'string',
|
||||
'string_type' => 'url',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'panel_webftp_url' => array(
|
||||
'label' => $lng['serversettings']['webftp_url'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'webftp_url',
|
||||
'type' => 'string',
|
||||
'string_type' => 'url',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'admin_show_version_login' => array(
|
||||
'label' => $lng['admin']['show_version_login'],
|
||||
'settinggroup' => 'admin',
|
||||
'varname' => 'show_version_login',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'admin_show_version_footer' => array(
|
||||
'label' => $lng['admin']['show_version_footer'],
|
||||
'settinggroup' => 'admin',
|
||||
'varname' => 'show_version_footer',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'admin_syscp_graphic' => array(
|
||||
'label' => $lng['admin']['syscp_graphic'],
|
||||
'settinggroup' => 'admin',
|
||||
'varname' => 'syscp_graphic',
|
||||
'type' => 'string',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'panel_allow_domain_change_admin' => array(
|
||||
'label' => $lng['serversettings']['panel_allow_domain_change_admin'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'allow_domain_change_admin',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'panel_allow_domain_change_customer' => array(
|
||||
'label' => $lng['serversettings']['panel_allow_domain_change_customer'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'allow_domain_change_customer',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
?>
|
||||
110
actions/admin/settings/110.accounts.php
Normal file
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
* @version $Id: 110.accounts.php 2724 2009-06-07 14:18:02Z flo $
|
||||
*/
|
||||
|
||||
return array(
|
||||
'groups' => array(
|
||||
'accounts' => array(
|
||||
'title' => $lng['admin']['accountsettings'],
|
||||
'fields' => array(
|
||||
'session_sessiontimeout' => array(
|
||||
'label' => $lng['serversettings']['session_timeout'],
|
||||
'settinggroup' => 'session',
|
||||
'varname' => 'sessiontimeout',
|
||||
'type' => 'int',
|
||||
'default' => 600,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'session_allow_multiple_login' => array(
|
||||
'label' => $lng['serversettings']['session_allow_multiple_login'],
|
||||
'settinggroup' => 'session',
|
||||
'varname' => 'allow_multiple_login',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'login_maxloginattempts' => array(
|
||||
'label' => $lng['serversettings']['maxloginattempts'],
|
||||
'settinggroup' => 'login',
|
||||
'varname' => 'maxloginattempts',
|
||||
'type' => 'int',
|
||||
'default' => 3,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'login_deactivatetime' => array(
|
||||
'label' => $lng['serversettings']['deactivatetime'],
|
||||
'settinggroup' => 'login',
|
||||
'varname' => 'deactivatetime',
|
||||
'type' => 'int',
|
||||
'default' => 900,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'customer_accountprefix' => array(
|
||||
'label' => $lng['serversettings']['accountprefix'],
|
||||
'settinggroup' => 'customer',
|
||||
'varname' => 'accountprefix',
|
||||
'type' => 'string',
|
||||
'default' => '',
|
||||
'plausibility_check_method' => 'checkUsername',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'customer_mysqlprefix' => array(
|
||||
'label' => $lng['serversettings']['mysqlprefix'],
|
||||
'settinggroup' => 'customer',
|
||||
'varname' => 'mysqlprefix',
|
||||
'type' => 'string',
|
||||
'default' => '',
|
||||
'plausibility_check_method' => 'checkUsername',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'customer_ftpprefix' => array(
|
||||
'label' => $lng['serversettings']['ftpprefix'],
|
||||
'settinggroup' => 'customer',
|
||||
'varname' => 'ftpprefix',
|
||||
'type' => 'string',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'customer_ftpatdomain' => array(
|
||||
'label' => $lng['serversettings']['ftpdomain'],
|
||||
'settinggroup' => 'customer',
|
||||
'varname' => 'ftpatdomain',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'panel_allow_preset' => array(
|
||||
'label' => $lng['serversettings']['allow_password_reset'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'allow_preset',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'panel_allow_preset_admin' => array(
|
||||
'label' => $lng['serversettings']['allow_password_reset_admin'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'allow_preset_admin',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
?>
|
||||
103
actions/admin/settings/120.system.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
* @version $Id: 120.system.php 2729 2009-09-20 10:33:50Z flo $
|
||||
*/
|
||||
|
||||
return array(
|
||||
'groups' => array(
|
||||
'system' => array(
|
||||
'title' => $lng['admin']['systemsettings'],
|
||||
'fields' => array(
|
||||
'system_documentroot_prefix' => array(
|
||||
'label' => $lng['serversettings']['documentroot_prefix'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'documentroot_prefix',
|
||||
'type' => 'string',
|
||||
'default' => '/var/customers/webs/',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_ipaddress' => array(
|
||||
'label' => $lng['serversettings']['ipaddress'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'ipaddress',
|
||||
'type' => 'option',
|
||||
'option_mode' => 'one',
|
||||
'option_options_method' => 'getIpAddresses',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingIpAddress',
|
||||
),
|
||||
'system_defaultip' => array(
|
||||
'label' => $lng['serversettings']['defaultip'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'defaultip',
|
||||
'type' => 'option',
|
||||
'option_mode' => 'one',
|
||||
'option_options_method' => 'getIpPortCombinations',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingDefaultIp',
|
||||
),
|
||||
'system_hostname' => array(
|
||||
'label' => $lng['serversettings']['hostname'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'hostname',
|
||||
'type' => 'string',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingHostname',
|
||||
),
|
||||
'system_mysql_access_host' => array(
|
||||
'label' => $lng['serversettings']['mysql_access_host'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mysql_access_host',
|
||||
'type' => 'string',
|
||||
'default' => '127.0.0.1,localhost',
|
||||
'plausibility_check_method' => 'checkMysqlAccessHost',
|
||||
'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(
|
||||
'label' => $lng['serversettings']['index_file_extension'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'index_file_extension',
|
||||
'type' => 'string',
|
||||
'string_regexp' => '/^[a-zA-Z0-9]{1,6}$/',
|
||||
'default' => 'html',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_httpuser' => array(
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'httpuser',
|
||||
'type' => 'hidden',
|
||||
'default' => 'www-data',
|
||||
),
|
||||
'system_httpgroup' => array(
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'httpgroup',
|
||||
'type' => 'hidden',
|
||||
'default' => 'www-data',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
?>
|
||||
168
actions/admin/settings/130.webserver.php
Normal file
@@ -0,0 +1,168 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
* @version $Id: 130.webserver.php 2724 2009-06-07 14:18:02Z flo $
|
||||
*/
|
||||
|
||||
return array(
|
||||
'groups' => array(
|
||||
'webserver' => array(
|
||||
'title' => $lng['admin']['webserversettings'],
|
||||
'fields' => array(
|
||||
'system_webserver' => array(
|
||||
'label' => $lng['admin']['webserver'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'webserver',
|
||||
'type' => 'option',
|
||||
'default' => 'Apache2',
|
||||
'option_mode' => 'one',
|
||||
'option_options' => array('apache2' => 'Apache 2', 'lighttpd' => 'ligHTTPd'),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_apacheconf_vhost' => array(
|
||||
'label' => $lng['serversettings']['apacheconf_vhost'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'apacheconf_vhost',
|
||||
'type' => 'string',
|
||||
'string_type' => 'filedir',
|
||||
'default' => '/etc/apache2/sites-enabled/',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_apacheconf_diroptions' => array(
|
||||
'label' => $lng['serversettings']['apacheconf_diroptions'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'apacheconf_diroptions',
|
||||
'type' => 'string',
|
||||
'string_type' => 'filedir',
|
||||
'default' => '/etc/apache2/sites-enabled/',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_apacheconf_htpasswddir' => array(
|
||||
'label' => $lng['serversettings']['apacheconf_htpasswddir'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'apacheconf_htpasswddir',
|
||||
'type' => 'string',
|
||||
'string_type' => 'dir',
|
||||
'default' => '/etc/apache2/htpasswd/',
|
||||
'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(
|
||||
'label' => $lng['serversettings']['logfiles_directory'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'logfiles_directory',
|
||||
'type' => 'string',
|
||||
'string_type' => 'dir',
|
||||
'default' => '/var/customers/logs/',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_phpappendopenbasedir' => array(
|
||||
'label' => $lng['serversettings']['phpappendopenbasedir'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'phpappendopenbasedir',
|
||||
'type' => 'string',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_deactivateddocroot' => array(
|
||||
'label' => $lng['serversettings']['deactivateddocroot'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'deactivateddocroot',
|
||||
'type' => 'string',
|
||||
'string_type' => 'dir',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_default_vhostconf' => array(
|
||||
'label' => $lng['serversettings']['default_vhostconf'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'default_vhostconf',
|
||||
'type' => 'text',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
),
|
||||
),
|
||||
'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',
|
||||
),
|
||||
'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',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
?>
|
||||
82
actions/admin/settings/140.statistics.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
* @version $Id: 140.statistics.php 2724 2009-06-07 14:18:02Z flo $
|
||||
*/
|
||||
|
||||
return array(
|
||||
'groups' => array(
|
||||
'statistics' => array(
|
||||
'title' => $lng['admin']['statisticsettings'],
|
||||
'fields' => array(
|
||||
'system_webalizer_quiet' => array(
|
||||
'label' => $lng['serversettings']['webalizer_quiet'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'webalizer_quiet',
|
||||
'type' => 'option',
|
||||
'default' => 2,
|
||||
'option_mode' => 'one',
|
||||
'option_options' => array(0 => $lng['admin']['webalizer']['normal'], 1 => $lng['admin']['webalizer']['quiet'], 2 => $lng['admin']['webalizer']['veryquiet']),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_awstats_enabled' => array(
|
||||
'label' => $lng['serversettings']['awstats_enabled'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'awstats_enabled',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'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(
|
||||
'label' => $lng['serversettings']['awstats_path'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'awstats_path',
|
||||
'type' => 'string',
|
||||
'string_type' => 'dir',
|
||||
'default' => '/usr/share/awstats/VERSION/webroot/cgi-bin/',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_awstats_updateall_command' => array(
|
||||
'label' => $lng['serversettings']['awstats_updateall_command'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'awstats_updateall_command',
|
||||
'type' => 'string',
|
||||
'string_type' => 'file',
|
||||
'default' => '/usr/bin/awstats_updateall.pl',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
?>
|
||||
95
actions/admin/settings/150.mail.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
* @version $Id: 150.mail.php 2729 2009-09-20 10:33:50Z flo $
|
||||
*/
|
||||
|
||||
return array(
|
||||
'groups' => array(
|
||||
'mail' => array(
|
||||
'title' => $lng['admin']['mailserversettings'],
|
||||
'fields' => array(
|
||||
'system_vmail_uid' => array(
|
||||
'label' => $lng['serversettings']['vmail_uid'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'vmail_uid',
|
||||
'type' => 'int',
|
||||
'default' => 2000,
|
||||
'int_min' => 1,
|
||||
'int_max' => 65535,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_vmail_gid' => array(
|
||||
'label' => $lng['serversettings']['vmail_gid'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'vmail_gid',
|
||||
'type' => 'int',
|
||||
'default' => 2000,
|
||||
'int_min' => 1,
|
||||
'int_max' => 65535,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_vmail_homedir' => array(
|
||||
'label' => $lng['serversettings']['vmail_homedir'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'vmail_homedir',
|
||||
'type' => 'string',
|
||||
'string_type' => 'dir',
|
||||
'default' => '/var/customers/mail/',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'panel_sendalternativemail' => array(
|
||||
'label' => $lng['serversettings']['sendalternativemail'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'sendalternativemail',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_mail_quota_enabled' => array(
|
||||
'label' => $lng['serversettings']['mail_quota_enabled'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mail_quota_enabled',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_mail_quota' => array(
|
||||
'label' => $lng['serversettings']['mail_quota'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mail_quota',
|
||||
'type' => 'int',
|
||||
'default' => 100,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'systen_autoresponder_enabled' => array(
|
||||
'label' => $lng['serversettings']['autoresponder_active'],
|
||||
'settinggroup' => 'autoresponder',
|
||||
'varname' => 'autoresponder_active',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'systen_last_autoresponder_run' => array(
|
||||
'settinggroup' => 'autoresponder',
|
||||
'varname' => 'last_autoresponder_run',
|
||||
'type' => 'hidden',
|
||||
'default' => 0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
?>
|
||||
65
actions/admin/settings/160.nameserver.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
* @version $Id: 160.nameserver.php 2724 2009-06-07 14:18:02Z flo $
|
||||
*/
|
||||
|
||||
return array(
|
||||
'groups' => array(
|
||||
'nameserver' => array(
|
||||
'title' => $lng['admin']['nameserversettings'],
|
||||
'fields' => array(
|
||||
'system_bindconf_directory' => array(
|
||||
'label' => $lng['serversettings']['bindconf_directory'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'bindconf_directory',
|
||||
'type' => 'string',
|
||||
'string_type' => 'dir',
|
||||
'default' => '/etc/bind/',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_bindreload_command' => array(
|
||||
'label' => $lng['serversettings']['bindreload_command'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'bindreload_command',
|
||||
'type' => 'string',
|
||||
'default' => '/etc/init.d/bind9 reload',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_nameservers' => array(
|
||||
'label' => $lng['serversettings']['nameservers'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'nameservers',
|
||||
'type' => 'string',
|
||||
'string_regexp' => '/^(([a-z0-9\-\._]+, ?)*[a-z0-9\-\._]+)?$/i',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_mxservers' => array(
|
||||
'label' => $lng['serversettings']['mxservers'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mxservers',
|
||||
'type' => 'string',
|
||||
'string_regexp' => '/^(([0-9]+ [a-z0-9\-\._]+, ?)*[0-9]+ [a-z0-9\-\._]+)?$/i',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
?>
|
||||
74
actions/admin/settings/170.logger.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
* @version $Id: 170.logger.php 2724 2009-06-07 14:18:02Z flo $
|
||||
*/
|
||||
|
||||
return array(
|
||||
'groups' => array(
|
||||
'logging' => array(
|
||||
'title' => $lng['admin']['loggersettings'],
|
||||
'fields' => array(
|
||||
'logger_enabled' => array(
|
||||
'label' => $lng['serversettings']['logger']['enable'],
|
||||
'settinggroup' => 'logger',
|
||||
'varname' => 'enabled',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'logger_severity' => array(
|
||||
'label' => $lng['serversettings']['logger']['severity'],
|
||||
'settinggroup' => 'logger',
|
||||
'varname' => 'severity',
|
||||
'type' => 'option',
|
||||
'default' => 1,
|
||||
'option_mode' => 'one',
|
||||
'option_options' => array(1 => $lng['admin']['logger']['normal'], 2 => $lng['admin']['logger']['paranoid']),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'logger_logtypes' => array(
|
||||
'label' => $lng['serversettings']['logger']['types'],
|
||||
'settinggroup' => 'logger',
|
||||
'varname' => 'logtypes',
|
||||
'type' => 'option',
|
||||
'default' => 'syslog,mysql',
|
||||
'option_mode' => 'multiple',
|
||||
'option_options' => array('syslog' => 'syslog', 'file' => 'file', 'mysql' => 'mysql'),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'logger_logfile' => array(
|
||||
'label' => $lng['serversettings']['logger']['logfile'],
|
||||
'settinggroup' => 'logger',
|
||||
'varname' => 'logfile',
|
||||
'type' => 'string',
|
||||
'string_type' => 'file',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'logger_log_cron' => array(
|
||||
'label' => $lng['serversettings']['logger']['logcron'],
|
||||
'settinggroup' => 'logger',
|
||||
'varname' => 'log_cron',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
70
actions/admin/settings/180.dkim.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
* @version $Id: 180.dkim.php 2724 2009-06-07 14:18:02Z flo $
|
||||
*/
|
||||
|
||||
return array(
|
||||
'groups' => array(
|
||||
'dkim' => array(
|
||||
'title' => $lng['admin']['dkimsettings'],
|
||||
'fields' => array(
|
||||
'dkim_enabled' => array(
|
||||
'label' => $lng['dkim']['use_dkim'],
|
||||
'settinggroup' => 'dkim',
|
||||
'varname' => 'use_dkim',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'dkim_prefix' => array(
|
||||
'label' => $lng['dkim']['dkim_prefix'],
|
||||
'settinggroup' => 'dkim',
|
||||
'varname' => 'dkim_prefix',
|
||||
'type' => 'string',
|
||||
'default' => '/etc/postfix/dkim/',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'dkim_domains' => array(
|
||||
'label' => $lng['dkim']['dkim_domains'],
|
||||
'settinggroup' => 'dkim',
|
||||
'varname' => 'dkim_domains',
|
||||
'type' => 'string',
|
||||
'string_regexp' => '/^[a-z0-9\._]+$/i',
|
||||
'default' => 'domains',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'dkim_dkimkeys' => array(
|
||||
'label' => $lng['dkim']['dkim_dkimkeys'],
|
||||
'settinggroup' => 'dkim',
|
||||
'varname' => 'dkim_dkimkeys',
|
||||
'type' => 'string',
|
||||
'string_regexp' => '/^[a-z0-9\._]+$/i',
|
||||
'default' => 'dkim-keys.conf',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'dkimrestart_command' => array(
|
||||
'label' => $lng['dkim']['dkimrestart_command'],
|
||||
'settinggroup' => 'dkim',
|
||||
'varname' => 'dkimrestart_command',
|
||||
'type' => 'string',
|
||||
'default' => '/etc/init.d/dkim-filter restart',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
?>
|
||||
129
actions/admin/settings/190.ticket.php
Normal file
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
* @version $Id: 190.ticket.php 2724 2009-06-07 14:18:02Z flo $
|
||||
*/
|
||||
|
||||
return array(
|
||||
'groups' => array(
|
||||
'ticket' => array(
|
||||
'title' => $lng['admin']['ticketsettings'],
|
||||
'fields' => array(
|
||||
'ticket_enabled' => array(
|
||||
'label' => $lng['serversettings']['ticket']['enable'],
|
||||
'settinggroup' => 'ticket',
|
||||
'varname' => 'enabled',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'ticket_noreply_email' => array(
|
||||
'label' => $lng['serversettings']['ticket']['noreply_email'],
|
||||
'settinggroup' => 'ticket',
|
||||
'varname' => 'noreply_email',
|
||||
'type' => 'string',
|
||||
'string_type' => 'mail',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'ticket_noreply_name' => array(
|
||||
'label' => $lng['serversettings']['ticket']['noreply_name'],
|
||||
'settinggroup' => 'ticket',
|
||||
'varname' => 'noreply_name',
|
||||
'type' => 'string',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'ticket_reset_cycle' => array(
|
||||
'label' => $lng['serversettings']['ticket']['reset_cycle'],
|
||||
'settinggroup' => 'ticket',
|
||||
'varname' => 'reset_cycle',
|
||||
'type' => 'option',
|
||||
'default' => 1,
|
||||
'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'])),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'ticket_concurrently_open' => array(
|
||||
'label' => $lng['serversettings']['ticket']['concurrentlyopen'],
|
||||
'settinggroup' => 'ticket',
|
||||
'varname' => 'concurrently_open',
|
||||
'type' => 'int',
|
||||
'default' => 5,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'ticket_archiving_days' => array(
|
||||
'label' => $lng['serversettings']['ticket']['archiving_days'],
|
||||
'settinggroup' => 'ticket',
|
||||
'varname' => 'archiving_days',
|
||||
'type' => 'int',
|
||||
'int_min' => 1,
|
||||
'int_max' => 99,
|
||||
'default' => 5,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'ticket_worktime_all' => array(
|
||||
'label' => $lng['serversettings']['ticket']['worktime_all'],
|
||||
'settinggroup' => 'ticket',
|
||||
'varname' => 'worktime_all',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'ticket_worktime_begin' => array(
|
||||
'label' => $lng['serversettings']['ticket']['worktime_begin'],
|
||||
'settinggroup' => 'ticket',
|
||||
'varname' => 'worktime_begin',
|
||||
'type' => 'string',
|
||||
'string_regexp' => '/^[012][0-9]:[0-6][0-9]$/',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'ticket_worktime_end' => array(
|
||||
'label' => $lng['serversettings']['ticket']['worktime_end'],
|
||||
'settinggroup' => 'ticket',
|
||||
'varname' => 'worktime_end',
|
||||
'type' => 'string',
|
||||
'string_regexp' => '/^[012][0-9]:[0-6][0-9]$/',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'ticket_worktime_sat' => array(
|
||||
'label' => $lng['serversettings']['ticket']['worktime_sat'],
|
||||
'settinggroup' => 'ticket',
|
||||
'varname' => 'worktime_sat',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'ticket_worktime_sun' => array(
|
||||
'label' => $lng['serversettings']['ticket']['worktime_sun'],
|
||||
'settinggroup' => 'ticket',
|
||||
'varname' => 'worktime_sun',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_last_archive_run' => array(
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'last_archive_run',
|
||||
'type' => 'hidden',
|
||||
'default' => '',
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
98
actions/admin/settings/200.aps.php
Normal file
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
* @version $Id: 210.aps.php 2724 2009-06-07 14:18:02Z flo $
|
||||
*/
|
||||
|
||||
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,
|
||||
'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' => '',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
?>
|
||||
106
actions/admin/settings/210.security.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
* @version $Id: 220.security.php 2724 2009-06-07 14:18:02Z flo $
|
||||
*/
|
||||
|
||||
return array(
|
||||
'groups' => array(
|
||||
'security' => array(
|
||||
'title' => $lng['admin']['security_settings'],
|
||||
'fields' => array(
|
||||
'panel_unix_names' => array(
|
||||
'label' => $lng['serversettings']['unix_names'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'unix_names',
|
||||
'type' => 'bool',
|
||||
'default' => true,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_mailpwcleartext' => array(
|
||||
'label' => $lng['serversettings']['mailpwcleartext'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mailpwcleartext',
|
||||
'type' => 'bool',
|
||||
'default' => true,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_mod_fcgid_enabled' => array(
|
||||
'label' => $lng['serversettings']['mod_fcgid'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mod_fcgid',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_mod_fcgid_configdir' => array(
|
||||
'label' => $lng['serversettings']['mod_fcgid']['configdir'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mod_fcgid_configdir',
|
||||
'type' => 'string',
|
||||
'string_type' => 'dir',
|
||||
'default' => '/var/www/php-fcgi-scripts/',
|
||||
'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',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
?>
|
||||
739
admin_admins.php
Normal file
@@ -0,0 +1,739 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
* @version $Id: admin_admins.php 2692 2009-03-27 18:04:47Z flo $
|
||||
*/
|
||||
|
||||
define('AREA', 'admin');
|
||||
|
||||
/**
|
||||
* Include our init.php, which manages Sessions, Language etc.
|
||||
*/
|
||||
|
||||
require ("./lib/init.php");
|
||||
|
||||
if(isset($_POST['id']))
|
||||
{
|
||||
$id = intval($_POST['id']);
|
||||
}
|
||||
elseif(isset($_GET['id']))
|
||||
{
|
||||
$id = intval($_GET['id']);
|
||||
}
|
||||
|
||||
if($page == 'admins'
|
||||
&& $userinfo['change_serversettings'] == '1')
|
||||
{
|
||||
if($action == '')
|
||||
{
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_admins");
|
||||
$fields = array(
|
||||
'loginname' => $lng['login']['username'],
|
||||
'name' => $lng['customer']['name'],
|
||||
'diskspace' => $lng['customer']['diskspace'],
|
||||
'diskspace_used' => $lng['customer']['diskspace'] . ' (' . $lng['panel']['used'] . ')',
|
||||
'traffic' => $lng['customer']['traffic'],
|
||||
'traffic_used' => $lng['customer']['traffic'] . ' (' . $lng['panel']['used'] . ')',
|
||||
'mysqls' => $lng['customer']['mysqls'],
|
||||
'mysqls_used' => $lng['customer']['mysqls'] . ' (' . $lng['panel']['used'] . ')',
|
||||
'ftps' => $lng['customer']['ftps'],
|
||||
'ftps_used' => $lng['customer']['ftps'] . ' (' . $lng['panel']['used'] . ')',
|
||||
'tickets' => $lng['customer']['tickets'],
|
||||
'tickets_used' => $lng['customer']['tickets'] . ' (' . $lng['panel']['used'] . ')',
|
||||
'subdomains' => $lng['customer']['subdomains'],
|
||||
'subdomains_used' => $lng['customer']['subdomains'] . ' (' . $lng['panel']['used'] . ')',
|
||||
'emails' => $lng['customer']['emails'],
|
||||
'emails_used' => $lng['customer']['emails'] . ' (' . $lng['panel']['used'] . ')',
|
||||
'email_accounts' => $lng['customer']['accounts'],
|
||||
'email_accounts_used' => $lng['customer']['accounts'] . ' (' . $lng['panel']['used'] . ')',
|
||||
'email_forwarders' => $lng['customer']['forwarders'],
|
||||
'email_forwarders_used' => $lng['customer']['forwarders'] . ' (' . $lng['panel']['used'] . ')',
|
||||
'email_quota' => $lng['customer']['email_quota'],
|
||||
'email_quota_used' => $lng['customer']['email_quota'] . ' (' . $lng['panel']['used'] . ')',
|
||||
'deactivated' => $lng['admin']['deactivated']
|
||||
);
|
||||
$paging = new paging($userinfo, $db, TABLE_PANEL_ADMINS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
|
||||
$admins = '';
|
||||
$result = $db->query("SELECT * FROM `" . TABLE_PANEL_ADMINS . "` " . $paging->getSqlWhere(false) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
|
||||
$paging->setEntries($db->num_rows($result));
|
||||
$sortcode = $paging->getHtmlSortCode($lng, true);
|
||||
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$searchcode = $paging->getHtmlSearchCode($lng);
|
||||
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$i = 0;
|
||||
$count = 0;
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
if($paging->checkDisplay($i))
|
||||
{
|
||||
$highlight_row = ($row['service_active'] != '1' && $settings['billing']['activate_billing'] == '1' && $settings['billing']['highlight_inactive'] == '1');
|
||||
$row['traffic_used'] = round($row['traffic_used'] / (1024 * 1024), $settings['panel']['decimal_places']);
|
||||
$row['traffic'] = round($row['traffic'] / (1024 * 1024), $settings['panel']['decimal_places']);
|
||||
$row['diskspace_used'] = round($row['diskspace_used'] / 1024, $settings['panel']['decimal_places']);
|
||||
$row['diskspace'] = round($row['diskspace'] / 1024, $settings['panel']['decimal_places']);
|
||||
$row = str_replace_array('-1', 'UL', $row, 'customers domains diskspace traffic mysqls emails email_accounts email_forwarders email_quota ftps subdomains tickets');
|
||||
$row = htmlentities_array($row);
|
||||
eval("\$admins.=\"" . getTemplate("admins/admins_admin") . "\";");
|
||||
$count++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("admins/admins") . "\";");
|
||||
}
|
||||
elseif($action == 'su')
|
||||
{
|
||||
$result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_ADMINS . "` WHERE `adminid` = '" . (int)$id . "'");
|
||||
$destination_admin = $result['loginname'];
|
||||
|
||||
if($destination_admin != ''
|
||||
&& $result['adminid'] != $userinfo['userid'])
|
||||
{
|
||||
$result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid`='" . (int)$userinfo['userid'] . "'");
|
||||
$s = md5(uniqid(microtime(), 1));
|
||||
$db->query("INSERT INTO `" . TABLE_PANEL_SESSIONS . "` (`hash`, `userid`, `ipaddress`, `useragent`, `lastactivity`, `language`, `adminsession`) VALUES ('" . $db->escape($s) . "', '" . (int)$id . "', '" . $db->escape($result['ipaddress']) . "', '" . $db->escape($result['useragent']) . "', '" . time() . "', '" . $db->escape($result['language']) . "', '1')");
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "switched adminuser and is now '" . $destination_admin . "'");
|
||||
redirectTo('admin_index.php', Array('s' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
redirectTo('index.php', Array('action' => 'login'));
|
||||
}
|
||||
}
|
||||
elseif($action == 'delete'
|
||||
&& $id != 0)
|
||||
{
|
||||
$result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_ADMINS . "` WHERE `adminid`='" . (int)$id . "'");
|
||||
|
||||
if($result['loginname'] != '')
|
||||
{
|
||||
if($result['adminid'] == $userinfo['userid'])
|
||||
{
|
||||
standard_error('youcantdeleteyourself');
|
||||
exit;
|
||||
}
|
||||
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$db->query("DELETE FROM `" . TABLE_PANEL_ADMINS . "` WHERE `adminid`='" . (int)$id . "'");
|
||||
$db->query("DELETE FROM `" . TABLE_PANEL_TRAFFIC_ADMINS . "` WHERE `adminid`='" . (int)$id . "'");
|
||||
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `adminid` = '" . (int)$userinfo['userid'] . "' WHERE `adminid` = '" . (int)$id . "'");
|
||||
$db->query("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET `adminid` = '" . (int)$userinfo['userid'] . "' WHERE `adminid` = '" . (int)$id . "'");
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "deleted admin '" . $result['loginname'] . "'");
|
||||
updateCounters();
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
ask_yesno('admin_admin_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['loginname']);
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif($action == 'add')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$name = validate($_POST['name'], 'name');
|
||||
$email = $idna_convert->encode(validate($_POST['email'], 'email'));
|
||||
|
||||
$loginname = validate($_POST['loginname'], 'loginname');
|
||||
$password = validate($_POST['admin_password'], 'password');
|
||||
$def_language = validate($_POST['def_language'], 'default language');
|
||||
$customers = intval_ressource($_POST['customers']);
|
||||
|
||||
if(isset($_POST['customers_ul']))
|
||||
{
|
||||
$customers = - 1;
|
||||
}
|
||||
|
||||
$domains = intval_ressource($_POST['domains']);
|
||||
|
||||
if(isset($_POST['domains_ul']))
|
||||
{
|
||||
$domains = - 1;
|
||||
}
|
||||
|
||||
$subdomains = intval_ressource($_POST['subdomains']);
|
||||
|
||||
if(isset($_POST['subdomains_ul']))
|
||||
{
|
||||
$subdomains = - 1;
|
||||
}
|
||||
|
||||
$emails = intval_ressource($_POST['emails']);
|
||||
|
||||
if(isset($_POST['emails_ul']))
|
||||
{
|
||||
$emails = - 1;
|
||||
}
|
||||
|
||||
$email_accounts = intval_ressource($_POST['email_accounts']);
|
||||
|
||||
if(isset($_POST['email_accounts_ul']))
|
||||
{
|
||||
$email_accounts = - 1;
|
||||
}
|
||||
|
||||
$email_forwarders = intval_ressource($_POST['email_forwarders']);
|
||||
|
||||
if(isset($_POST['email_forwarders_ul']))
|
||||
{
|
||||
$email_forwarders = - 1;
|
||||
}
|
||||
|
||||
if($settings['system']['mail_quota_enabled'] == '1')
|
||||
{
|
||||
$email_quota = validate($_POST['email_quota'], 'email_quota', '/^\d+$/', 'vmailquotawrong', array('0', ''));
|
||||
|
||||
if(isset($_POST['email_quota_ul']))
|
||||
{
|
||||
$email_quota = - 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$email_quota = - 1;
|
||||
}
|
||||
|
||||
$ftps = intval_ressource($_POST['ftps']);
|
||||
|
||||
if(isset($_POST['ftps_ul']))
|
||||
{
|
||||
$ftps = - 1;
|
||||
}
|
||||
|
||||
$tickets = intval_ressource($_POST['tickets']);
|
||||
|
||||
if(isset($_POST['tickets_ul'])
|
||||
&& $settings['ticket']['enabled'] == '1')
|
||||
{
|
||||
$tickets = - 1;
|
||||
}
|
||||
|
||||
$mysqls = intval_ressource($_POST['mysqls']);
|
||||
|
||||
if(isset($_POST['mysqls_ul']))
|
||||
{
|
||||
$mysqls = - 1;
|
||||
}
|
||||
|
||||
if($settings['aps']['aps_active'] == '1')
|
||||
{
|
||||
$number_of_aps_packages = intval_ressource($_POST['number_of_aps_packages']);
|
||||
|
||||
if(isset($_POST['number_of_aps_packages_ul']))
|
||||
{
|
||||
$number_of_aps_packages = - 1;
|
||||
}
|
||||
|
||||
$can_manage_aps_packages = intval($_POST['can_manage_aps_packages']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$number_of_aps_packages = 0;
|
||||
$can_manage_aps_packages = 0;
|
||||
}
|
||||
|
||||
$customers_see_all = intval($_POST['customers_see_all']);
|
||||
$domains_see_all = intval($_POST['domains_see_all']);
|
||||
$caneditphpsettings = intval($_POST['caneditphpsettings']);
|
||||
$change_serversettings = intval($_POST['change_serversettings']);
|
||||
|
||||
$diskspace = intval_ressource($_POST['diskspace']);
|
||||
|
||||
if(isset($_POST['diskspace_ul']))
|
||||
{
|
||||
$diskspace = - 1;
|
||||
}
|
||||
|
||||
$traffic = doubleval_ressource($_POST['traffic']);
|
||||
|
||||
if(isset($_POST['traffic_ul']))
|
||||
{
|
||||
$traffic = - 1;
|
||||
}
|
||||
|
||||
$diskspace = $diskspace * 1024;
|
||||
$traffic = $traffic * 1024 * 1024;
|
||||
$ipaddress = intval_ressource($_POST['ipaddress']);
|
||||
|
||||
// Check if the account already exists
|
||||
|
||||
$loginname_check = $db->query_first("SELECT `loginname` FROM `" . TABLE_PANEL_CUSTOMERS . "` WHERE `loginname` = '" . $db->escape($loginname) . "'");
|
||||
$loginname_check_admin = $db->query_first("SELECT `loginname` FROM `" . TABLE_PANEL_ADMINS . "` WHERE `loginname` = '" . $db->escape($loginname) . "'");
|
||||
|
||||
if($loginname == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'myloginname'));
|
||||
}
|
||||
elseif(strtolower($loginname_check['loginname']) == strtolower($loginname)
|
||||
|| strtolower($loginname_check_admin['loginname']) == strtolower($loginname))
|
||||
{
|
||||
standard_error('loginnameexists', $loginname);
|
||||
}
|
||||
|
||||
// Accounts which match systemaccounts are not allowed, filtering them
|
||||
|
||||
elseif (preg_match('/^' . preg_quote($settings['customer']['accountprefix'], '/') . '([0-9]+)/', $loginname))
|
||||
{
|
||||
standard_error('loginnameissystemaccount', $settings['customer']['accountprefix']);
|
||||
}
|
||||
elseif(!validateUsername($loginname))
|
||||
{
|
||||
standard_error('loginnameiswrong', $loginname);
|
||||
}
|
||||
elseif($name == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'myname'));
|
||||
}
|
||||
elseif($email == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'emailadd'));
|
||||
}
|
||||
elseif($password == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'mypassword'));
|
||||
}
|
||||
elseif(!validateEmail($email))
|
||||
{
|
||||
standard_error('emailiswrong', $email);
|
||||
}
|
||||
else
|
||||
{
|
||||
if($customers_see_all != '1')
|
||||
{
|
||||
$customers_see_all = '0';
|
||||
}
|
||||
|
||||
if($domains_see_all != '1')
|
||||
{
|
||||
$domains_see_all = '0';
|
||||
}
|
||||
|
||||
if($caneditphpsettings != '1')
|
||||
{
|
||||
$caneditphpsettings = '0';
|
||||
}
|
||||
|
||||
if($change_serversettings != '1')
|
||||
{
|
||||
$change_serversettings = '0';
|
||||
}
|
||||
|
||||
$result = $db->query("INSERT INTO `" . TABLE_PANEL_ADMINS . "` (`loginname`, `password`, `name`, `email`, `def_language`, `change_serversettings`, `customers`, `customers_see_all`, `domains`, `domains_see_all`, `caneditphpsettings`, `diskspace`, `traffic`, `subdomains`, `emails`, `email_accounts`, `email_forwarders`, `email_quota`, `ftps`, `tickets`, `mysqls`, `ip`, `can_manage_aps_packages`, `aps_packages`)
|
||||
VALUES ('" . $db->escape($loginname) . "', '" . md5($password) . "', '" . $db->escape($name) . "', '" . $db->escape($email) . "','" . $db->escape($def_language) . "', '" . $db->escape($change_serversettings) . "', '" . $db->escape($customers) . "', '" . $db->escape($customers_see_all) . "', '" . $db->escape($domains) . "', '" . $db->escape($domains_see_all) . "', '" . (int)$caneditphpsettings . "', '" . $db->escape($diskspace) . "', '" . $db->escape($traffic) . "', '" . $db->escape($subdomains) . "', '" . $db->escape($emails) . "', '" . $db->escape($email_accounts) . "', '" . $db->escape($email_forwarders) . "', '" . $db->escape($email_quota) . "', '" . $db->escape($ftps) . "', '" . $db->escape($tickets) . "', '" . $db->escape($mysqls) . "', '" . (int)$ipaddress . "', " . (int)$can_manage_aps_packages . ", " . (int)$number_of_aps_packages . ")");
|
||||
$adminid = $db->insert_id();
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "added admin '" . $loginname . "'");
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$language_options = '';
|
||||
|
||||
while(list($language_file, $language_name) = each($languages))
|
||||
{
|
||||
$language_options.= makeoption($language_name, $language_file, $userinfo['language'], true);
|
||||
}
|
||||
|
||||
$ipaddress = makeoption($lng['admin']['allips'], "-1");
|
||||
$ips = array();
|
||||
$ipsandports = $db->query('SELECT `id`, `ip` FROM `' . TABLE_PANEL_IPSANDPORTS . '` ORDER BY `ip`, `port` ASC');
|
||||
|
||||
while($row = $db->fetch_array($ipsandports))
|
||||
{
|
||||
if(filter_var($row['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6))
|
||||
{
|
||||
$row['ip'] = '[' . $row['ip'] . ']';
|
||||
}
|
||||
|
||||
if(!in_array($row['ip'], $ips))
|
||||
{
|
||||
$ipaddress.= makeoption($row['ip'], $row['id']);
|
||||
$ips[] = $row['ip'];
|
||||
}
|
||||
}
|
||||
|
||||
$customers_ul = makecheckbox('customers_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$diskspace_ul = makecheckbox('diskspace_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$traffic_ul = makecheckbox('traffic_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$domains_ul = makecheckbox('domains_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$subdomains_ul = makecheckbox('subdomains_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$emails_ul = makecheckbox('emails_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$email_accounts_ul = makecheckbox('email_accounts_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$email_forwarders_ul = makecheckbox('email_forwarders_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$email_quota_ul = makecheckbox('email_quota_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$ftps_ul = makecheckbox('ftps_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$tickets_ul = makecheckbox('tickets_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$mysqls_ul = makecheckbox('mysqls_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$change_serversettings = makeyesno('change_serversettings', '1', '0', '0');
|
||||
$customers_see_all = makeyesno('customers_see_all', '1', '0', '0');
|
||||
$domains_see_all = makeyesno('domains_see_all', '1', '0', '0');
|
||||
$caneditphpsettings = makeyesno('caneditphpsettings', '1', '0', '0');
|
||||
$can_manage_aps_packages = makeyesno('can_manage_aps_packages', '1', '0', '0');
|
||||
$number_of_aps_packages_ul = makecheckbox('number_of_aps_packages_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
|
||||
eval("echo \"" . getTemplate("admins/admins_add") . "\";");
|
||||
}
|
||||
}
|
||||
elseif($action == 'edit'
|
||||
&& $id != 0)
|
||||
{
|
||||
$result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_ADMINS . "` WHERE `adminid`='" . (int)$id . "'");
|
||||
|
||||
if($result['loginname'] != '')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$name = validate($_POST['name'], 'name');
|
||||
$email = $idna_convert->encode(validate($_POST['email'], 'email'));
|
||||
|
||||
if($result['adminid'] == $userinfo['userid'])
|
||||
{
|
||||
$password = '';
|
||||
$def_language = $result['def_language'];
|
||||
$deactivated = $result['deactivated'];
|
||||
$customers = $result['customers'];
|
||||
$domains = $result['domains'];
|
||||
$subdomains = $result['subdomains'];
|
||||
$emails = $result['emails'];
|
||||
$email_accounts = $result['email_accounts'];
|
||||
$email_forwarders = $result['email_forwarders'];
|
||||
$email_quota = $result['email_quota'];
|
||||
$ftps = $result['ftps'];
|
||||
$tickets = $result['tickets'];
|
||||
$mysqls = $result['mysqls'];
|
||||
$customers_see_all = $result['customers_see_all'];
|
||||
$domains_see_all = $result['domains_see_all'];
|
||||
$caneditphpsettings = $result['caneditphpsettings'];
|
||||
$change_serversettings = $result['change_serversettings'];
|
||||
$diskspace = $result['diskspace'];
|
||||
$traffic = $result['traffic'];
|
||||
$ipaddress = $result['ip'];
|
||||
$can_manage_aps_packages = $result['can_manage_aps_packages'];
|
||||
$number_of_aps_packages = $result['aps_packages'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$password = validate($_POST['admin_password'], 'new password');
|
||||
$def_language = validate($_POST['def_language'], 'default language');
|
||||
$deactivated = intval($_POST['deactivated']);
|
||||
$customers = intval_ressource($_POST['customers']);
|
||||
|
||||
if(isset($_POST['customers_ul']))
|
||||
{
|
||||
$customers = - 1;
|
||||
}
|
||||
|
||||
$domains = intval_ressource($_POST['domains']);
|
||||
|
||||
if(isset($_POST['domains_ul']))
|
||||
{
|
||||
$domains = - 1;
|
||||
}
|
||||
|
||||
$subdomains = intval_ressource($_POST['subdomains']);
|
||||
|
||||
if(isset($_POST['subdomains_ul']))
|
||||
{
|
||||
$subdomains = - 1;
|
||||
}
|
||||
|
||||
$emails = intval_ressource($_POST['emails']);
|
||||
|
||||
if(isset($_POST['emails_ul']))
|
||||
{
|
||||
$emails = - 1;
|
||||
}
|
||||
|
||||
$email_accounts = intval_ressource($_POST['email_accounts']);
|
||||
|
||||
if(isset($_POST['email_accounts_ul']))
|
||||
{
|
||||
$email_accounts = - 1;
|
||||
}
|
||||
|
||||
$email_forwarders = intval_ressource($_POST['email_forwarders']);
|
||||
|
||||
if(isset($_POST['email_forwarders_ul']))
|
||||
{
|
||||
$email_forwarders = - 1;
|
||||
}
|
||||
|
||||
if($settings['system']['mail_quota_enabled'] == '1')
|
||||
{
|
||||
$email_quota = validate($_POST['email_quota'], 'email_quota', '/^\d+$/', 'vmailquotawrong', array('0', ''));
|
||||
|
||||
if(isset($_POST['email_quota_ul']))
|
||||
{
|
||||
$email_quota = - 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$email_quota = - 1;
|
||||
}
|
||||
|
||||
$ftps = intval_ressource($_POST['ftps']);
|
||||
|
||||
if(isset($_POST['ftps_ul']))
|
||||
{
|
||||
$ftps = - 1;
|
||||
}
|
||||
|
||||
$tickets = intval_ressource($_POST['tickets']);
|
||||
|
||||
if(isset($_POST['tickets_ul']))
|
||||
{
|
||||
$tickets = - 1;
|
||||
}
|
||||
|
||||
$mysqls = intval_ressource($_POST['mysqls']);
|
||||
|
||||
if(isset($_POST['mysqls_ul']))
|
||||
{
|
||||
$mysqls = - 1;
|
||||
}
|
||||
|
||||
$number_of_aps_packages = intval_ressource($_POST['number_of_aps_packages']);
|
||||
|
||||
if(isset($_POST['number_of_aps_packages_ul']))
|
||||
{
|
||||
$number_of_aps_packages = - 1;
|
||||
}
|
||||
|
||||
$customers_see_all = intval($_POST['customers_see_all']);
|
||||
$domains_see_all = intval($_POST['domains_see_all']);
|
||||
$caneditphpsettings = intval($_POST['caneditphpsettings']);
|
||||
$change_serversettings = intval($_POST['change_serversettings']);
|
||||
$can_manage_aps_packages = intval($_POST['can_manage_aps_packages']);
|
||||
|
||||
$diskspace = intval($_POST['diskspace']);
|
||||
|
||||
if(isset($_POST['diskspace_ul']))
|
||||
{
|
||||
$diskspace = - 1;
|
||||
}
|
||||
|
||||
$traffic = doubleval_ressource($_POST['traffic']);
|
||||
|
||||
if(isset($_POST['traffic_ul']))
|
||||
{
|
||||
$traffic = - 1;
|
||||
}
|
||||
|
||||
$diskspace = $diskspace * 1024;
|
||||
$traffic = $traffic * 1024 * 1024;
|
||||
$ipaddress = intval_ressource($_POST['ipaddress']);
|
||||
}
|
||||
|
||||
if($name == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'myname'));
|
||||
}
|
||||
elseif($email == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'emailadd'));
|
||||
}
|
||||
elseif(!validateEmail($email))
|
||||
{
|
||||
standard_error('emailiswrong', $email);
|
||||
}
|
||||
else
|
||||
{
|
||||
if($password != '')
|
||||
{
|
||||
$password = md5($password);
|
||||
}
|
||||
else
|
||||
{
|
||||
$password = $result['password'];
|
||||
}
|
||||
|
||||
if($deactivated != '1')
|
||||
{
|
||||
$deactivated = '0';
|
||||
}
|
||||
|
||||
if($customers_see_all != '1')
|
||||
{
|
||||
$customers_see_all = '0';
|
||||
}
|
||||
|
||||
if($domains_see_all != '1')
|
||||
{
|
||||
$domains_see_all = '0';
|
||||
}
|
||||
|
||||
if($caneditphpsettings != '1')
|
||||
{
|
||||
$caneditphpsettings = '0';
|
||||
}
|
||||
|
||||
if($change_serversettings != '1')
|
||||
{
|
||||
$change_serversettings = '0';
|
||||
}
|
||||
|
||||
$db->query("UPDATE `" . TABLE_PANEL_ADMINS . "` SET `name`='" . $db->escape($name) . "', `email`='" . $db->escape($email) . "', `def_language`='" . $db->escape($def_language) . "', `change_serversettings` = '" . $db->escape($change_serversettings) . "', `customers` = '" . $db->escape($customers) . "', `customers_see_all` = '" . $db->escape($customers_see_all) . "', `domains` = '" . $db->escape($domains) . "', `domains_see_all` = '" . $db->escape($domains_see_all) . "', `caneditphpsettings` = '" . (int)$caneditphpsettings . "', `password` = '" . $password . "', `diskspace`='" . $db->escape($diskspace) . "', `traffic`='" . $db->escape($traffic) . "', `subdomains`='" . $db->escape($subdomains) . "', `emails`='" . $db->escape($emails) . "', `email_accounts` = '" . $db->escape($email_accounts) . "', `email_forwarders`='" . $db->escape($email_forwarders) . "', `email_quota`='" . $db->escape($email_quota) . "', `ftps`='" . $db->escape($ftps) . "', `tickets`='" . $db->escape($tickets) . "', `mysqls`='" . $db->escape($mysqls) . "', `ip`='" . (int)$ipaddress . "', `deactivated`='" . $db->escape($deactivated) . "', `can_manage_aps_packages`=" . (int)$can_manage_aps_packages . ", `aps_packages`=" . (int)$number_of_aps_packages . " WHERE `adminid`='" . $db->escape($id) . "'");
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "edited admin '#" . $id . "'");
|
||||
$redirect_props = Array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
);
|
||||
|
||||
redirectTo($filename, $redirect_props);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$result['traffic'] = round($result['traffic'] / (1024 * 1024), $settings['panel']['decimal_places']);
|
||||
$result['diskspace'] = round($result['diskspace'] / 1024, $settings['panel']['decimal_places']);
|
||||
$result['email'] = $idna_convert->decode($result['email']);
|
||||
$customers_ul = makecheckbox('customers_ul', $lng['customer']['unlimited'], '-1', false, $result['customers'], true, true);
|
||||
|
||||
if($result['customers'] == '-1')
|
||||
{
|
||||
$result['customers'] = '';
|
||||
}
|
||||
|
||||
$diskspace_ul = makecheckbox('diskspace_ul', $lng['customer']['unlimited'], '-1', false, $result['diskspace'], true, true);
|
||||
|
||||
if($result['diskspace'] == '-1')
|
||||
{
|
||||
$result['diskspace'] = '';
|
||||
}
|
||||
|
||||
$traffic_ul = makecheckbox('traffic_ul', $lng['customer']['unlimited'], '-1', false, $result['traffic'], true, true);
|
||||
|
||||
if($result['traffic'] == '-1')
|
||||
{
|
||||
$result['traffic'] = '';
|
||||
}
|
||||
|
||||
$domains_ul = makecheckbox('domains_ul', $lng['customer']['unlimited'], '-1', false, $result['domains'], true, true);
|
||||
|
||||
if($result['domains'] == '-1')
|
||||
{
|
||||
$result['domains'] = '';
|
||||
}
|
||||
|
||||
$subdomains_ul = makecheckbox('subdomains_ul', $lng['customer']['unlimited'], '-1', false, $result['subdomains'], true, true);
|
||||
|
||||
if($result['subdomains'] == '-1')
|
||||
{
|
||||
$result['subdomains'] = '';
|
||||
}
|
||||
|
||||
$emails_ul = makecheckbox('emails_ul', $lng['customer']['unlimited'], '-1', false, $result['emails'], true, true);
|
||||
|
||||
if($result['emails'] == '-1')
|
||||
{
|
||||
$result['emails'] = '';
|
||||
}
|
||||
|
||||
$email_accounts_ul = makecheckbox('email_accounts_ul', $lng['customer']['unlimited'], '-1', false, $result['email_accounts'], true, true);
|
||||
|
||||
if($result['email_accounts'] == '-1')
|
||||
{
|
||||
$result['email_accounts'] = '';
|
||||
}
|
||||
|
||||
$email_forwarders_ul = makecheckbox('email_forwarders_ul', $lng['customer']['unlimited'], '-1', false, $result['email_forwarders'], true, true);
|
||||
|
||||
if($result['email_forwarders'] == '-1')
|
||||
{
|
||||
$result['email_forwarders'] = '';
|
||||
}
|
||||
|
||||
$email_quota_ul = makecheckbox('email_quota_ul', $lng['customer']['unlimited'], '-1', false, $result['email_quota'], true, true);
|
||||
|
||||
if($result['email_quota'] == '-1')
|
||||
{
|
||||
$result['email_quota'] = '';
|
||||
}
|
||||
|
||||
$ftps_ul = makecheckbox('ftps_ul', $lng['customer']['unlimited'], '-1', false, $result['ftps'], true, true);
|
||||
|
||||
if($result['ftps'] == '-1')
|
||||
{
|
||||
$result['ftps'] = '';
|
||||
}
|
||||
|
||||
$tickets_ul = makecheckbox('tickets_ul', $lng['customer']['unlimited'], '-1', false, $result['tickets'], true, true);
|
||||
|
||||
if($result['tickets'] == '-1')
|
||||
{
|
||||
$result['tickets'] = '';
|
||||
}
|
||||
|
||||
$mysqls_ul = makecheckbox('mysqls_ul', $lng['customer']['unlimited'], '-1', false, $result['mysqls'], true, true);
|
||||
|
||||
if($result['mysqls'] == '-1')
|
||||
{
|
||||
$result['mysqls'] = '';
|
||||
}
|
||||
|
||||
$number_of_aps_packages_ul = makecheckbox('number_of_aps_packages_ul', $lng['customer']['unlimited'], '-1', false, $result['aps_packages'], true, true);
|
||||
|
||||
if($result['aps_packages'] == '-1')
|
||||
{
|
||||
$result['aps_packages'] = '';
|
||||
}
|
||||
|
||||
$language_options = '';
|
||||
|
||||
while(list($language_file, $language_name) = each($languages))
|
||||
{
|
||||
$language_options.= makeoption($language_name, $language_file, $result['def_language'], true);
|
||||
}
|
||||
|
||||
$ipaddress = makeoption($lng['admin']['allips'], "-1", $result['ip']);
|
||||
$ips = array();
|
||||
$ipsandports = $db->query('SELECT `id`, `ip` FROM `' . TABLE_PANEL_IPSANDPORTS . '` ORDER BY `ip`, `port` ASC');
|
||||
|
||||
while($row = $db->fetch_array($ipsandports))
|
||||
{
|
||||
if(filter_var($row['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6))
|
||||
{
|
||||
$row['ip'] = '[' . $row['ip'] . ']';
|
||||
}
|
||||
|
||||
if(!in_array($row['ip'], $ips))
|
||||
{
|
||||
$ipaddress.= makeoption($row['ip'], $row['id'], $result['ip']);
|
||||
$ips[] = $row['ip'];
|
||||
}
|
||||
}
|
||||
|
||||
$change_serversettings = makeyesno('change_serversettings', '1', '0', $result['change_serversettings']);
|
||||
$customers_see_all = makeyesno('customers_see_all', '1', '0', $result['customers_see_all']);
|
||||
$domains_see_all = makeyesno('domains_see_all', '1', '0', $result['domains_see_all']);
|
||||
$caneditphpsettings = makeyesno('caneditphpsettings', '1', '0', $result['caneditphpsettings']);
|
||||
$deactivated = makeyesno('deactivated', '1', '0', $result['deactivated']);
|
||||
$can_manage_aps_packages = makeyesno('can_manage_aps_packages', '1', '0', $result['can_manage_aps_packages']);
|
||||
|
||||
$result = htmlentities_array($result);
|
||||
eval("echo \"" . getTemplate("admins/admins_edit") . "\";");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
34
admin_aps.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Sven Skrabal <info@nexpa.de>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
* @version $Id: admin_aps.php 2692 2009-03-27 18:04:47Z flo $
|
||||
* @todo
|
||||
*/
|
||||
|
||||
// Required code
|
||||
|
||||
define('AREA', 'admin');
|
||||
require ("./lib/init.php");
|
||||
require ("./lib/class_apsparser.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") . "\";");
|
||||
|
||||
?>
|
||||
178
admin_configfiles.php
Normal file
@@ -0,0 +1,178 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
* @version $Id: admin_configfiles.php 2732 2009-10-30 16:24:48Z flo $
|
||||
*/
|
||||
|
||||
define('AREA', 'admin');
|
||||
|
||||
/**
|
||||
* Include our init.php, which manages Sessions, Language etc.
|
||||
*/
|
||||
|
||||
$need_db_sql_data = true;
|
||||
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']]))
|
||||
{
|
||||
$distribution = $_GET['distribution'];
|
||||
|
||||
if(isset($_GET['service'])
|
||||
&& $_GET['service'] != ''
|
||||
&& isset($configfiles[$distribution]['services'][$_GET['service']])
|
||||
&& is_array($configfiles[$distribution]['services'][$_GET['service']]))
|
||||
{
|
||||
$service = $_GET['service'];
|
||||
|
||||
if(isset($_GET['daemon'])
|
||||
&& $_GET['daemon'] != ''
|
||||
&& isset($configfiles[$distribution]['services'][$service]['daemons'][$_GET['daemon']])
|
||||
&& is_array($configfiles[$distribution]['services'][$service]['daemons'][$_GET['daemon']]))
|
||||
{
|
||||
$daemon = $_GET['daemon'];
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($configfiles[$distribution]['services'][$service]['daemons'] as $daemon_name => $daemon_details)
|
||||
{
|
||||
$daemons_select.= makeoption($daemon_details['label'], $daemon_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($configfiles[$distribution]['services'] as $service_name => $service_details)
|
||||
{
|
||||
$services_select.= makeoption($service_details['label'], $service_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($configfiles as $distribution_name => $distribution_details)
|
||||
{
|
||||
$distributions_select.= makeoption($distribution_details['label'], $distribution_name);
|
||||
}
|
||||
}
|
||||
|
||||
if($distribution != ''
|
||||
&& $service != ''
|
||||
&& $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' : ''
|
||||
);
|
||||
$files = '';
|
||||
$configpage = '';
|
||||
foreach($configfiles[$distribution]['services'][$service]['daemons'][$daemon] as $action => $value)
|
||||
{
|
||||
if(substr($action, 0, 8) == 'commands')
|
||||
{
|
||||
$commands = '';
|
||||
|
||||
if(is_array($value))
|
||||
{
|
||||
$commands = implode("\n", $value);
|
||||
|
||||
if($commands != '')
|
||||
{
|
||||
eval("\$configpage.=\"" . getTemplate("configfiles/configfiles_commands") . "\";");
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif(substr($action, 0, 5) == 'files')
|
||||
{
|
||||
$files = '';
|
||||
|
||||
if(is_array($value))
|
||||
{
|
||||
while(list($filename, $realname) = each($value))
|
||||
{
|
||||
$file_content = file_get_contents('./templates/misc/configfiles/' . $distribution . '/' . $daemon . '/' . $filename);
|
||||
$file_content = strtr($file_content, $replace_arr);
|
||||
$file_content = htmlspecialchars($file_content);
|
||||
$numbrows = count(explode("\n", $file_content));
|
||||
eval("\$files.=\"" . getTemplate("configfiles/configfiles_file") . "\";");
|
||||
}
|
||||
|
||||
eval("\$configpage.=\"" . getTemplate("configfiles/configfiles_files") . "\";");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($configfiles[$distribution]['services'][$service]['daemons'][$daemon]['restart'])
|
||||
&& is_array($configfiles[$distribution]['services'][$service]['daemons'][$daemon]['restart']))
|
||||
{
|
||||
$restart = implode("\n", $configfiles[$distribution]['services'][$service]['daemons'][$daemon]['restart']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$restart = '';
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("configfiles/configfiles") . "\";");
|
||||
}
|
||||
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") . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
1185
admin_customers.php
Normal file
1122
admin_domains.php
Normal file
294
admin_index.php
Normal file
@@ -0,0 +1,294 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
* @version $Id: admin_index.php 2696 2009-04-10 13:03:32Z flo $
|
||||
*/
|
||||
|
||||
define('AREA', 'admin');
|
||||
|
||||
/**
|
||||
* Include our init.php, which manages Sessions, Language etc.
|
||||
*/
|
||||
|
||||
require ("./lib/init.php");
|
||||
|
||||
if($action == 'logout')
|
||||
{
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "logged out");
|
||||
|
||||
if($settings['session']['allow_multiple_login'] == '1')
|
||||
{
|
||||
$db->query("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid` = '" . (int)$userinfo['adminid'] . "' AND `adminsession` = '1' AND `hash` = '" . $s . "'");
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->query("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid` = '" . (int)$userinfo['adminid'] . "' AND `adminsession` = '1'");
|
||||
}
|
||||
|
||||
redirectTo('index.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
if(isset($_POST['id']))
|
||||
{
|
||||
$id = intval($_POST['id']);
|
||||
}
|
||||
elseif(isset($_GET['id']))
|
||||
{
|
||||
$id = intval($_GET['id']);
|
||||
}
|
||||
|
||||
if($page == 'overview')
|
||||
{
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_index");
|
||||
$overview = $db->query_first("SELECT COUNT(*) AS `number_customers`,
|
||||
SUM(`diskspace_used`) AS `diskspace_used`,
|
||||
SUM(`mysqls_used`) AS `mysqls_used`,
|
||||
SUM(`emails_used`) AS `emails_used`,
|
||||
SUM(`email_accounts_used`) AS `email_accounts_used`,
|
||||
SUM(`email_forwarders_used`) AS `email_forwarders_used`,
|
||||
SUM(`email_quota_used`) AS `email_quota_used`,
|
||||
SUM(`ftps_used`) AS `ftps_used`,
|
||||
SUM(`tickets_used`) AS `tickets_used`,
|
||||
SUM(`subdomains_used`) AS `subdomains_used`,
|
||||
SUM(`traffic_used`) AS `traffic_used`,
|
||||
SUM(`aps_packages_used`) AS `aps_packages_used`
|
||||
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']);
|
||||
$overview['diskspace_used'] = round($overview['diskspace_used'] / 1024, $settings['panel']['decimal_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['number_domains'] = $number_domains['number_domains'];
|
||||
$phpversion = phpversion();
|
||||
$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());
|
||||
|
||||
if((isset($_GET['lookfornewversion']) && $_GET['lookfornewversion'] == 'yes')
|
||||
|| (isset($lookfornewversion) && $lookfornewversion == 'yes'))
|
||||
{
|
||||
$latestversion = @file('http://version.syscp.org/SysCP/legacy/' . $version . '-' . $dbversion );
|
||||
|
||||
if(is_array($latestversion)
|
||||
&& count($latestversion) >= 2)
|
||||
{
|
||||
$lookfornewversion_lable = $latestversion[0];
|
||||
$lookfornewversion_link = $latestversion[1];
|
||||
$lookfornewversion_addinfo = '';
|
||||
|
||||
if(count($latestversion) >= 3)
|
||||
{
|
||||
$addinfo = $latestversion;
|
||||
unset($addinfo[0]);
|
||||
unset($addinfo[1]);
|
||||
$lookfornewversion_addinfo = implode("\n", $addinfo);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
redirectTo('http://version.syscp.org/SysCP/legacy/' . $version . '-' . $dbversion . '/pretty', NULL);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$lookfornewversion_lable = $lng['admin']['lookfornewversion']['clickhere'];
|
||||
$lookfornewversion_link = htmlspecialchars($filename . '?s=' . urlencode($s) . '&page=' . urlencode($page) . '&lookfornewversion=yes');
|
||||
$lookfornewversion_addinfo = '';
|
||||
}
|
||||
|
||||
$userinfo['diskspace'] = round($userinfo['diskspace'] / 1024, $settings['panel']['decimal_places']);
|
||||
$userinfo['diskspace_used'] = round($userinfo['diskspace_used'] / 1024, $settings['panel']['decimal_places']);
|
||||
$userinfo['traffic'] = round($userinfo['traffic'] / (1024 * 1024), $settings['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, 'customers domains diskspace traffic mysqls emails email_accounts email_forwarders email_quota ftps tickets subdomains aps_packages');
|
||||
|
||||
if($settings['system']['last_tasks_run'] == 0)
|
||||
{
|
||||
$cronlastrun = $lng['cronjobs']['notyetrun'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$cronlastrun = date("d.m.Y H:i:s", $settings['system']['last_tasks_run']);
|
||||
}
|
||||
|
||||
if($settings['system']['last_traffic_run'] == 0)
|
||||
{
|
||||
$trafficlastrun = $lng['cronjobs']['notyetrun'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$trafficlastrun = date("d.m.Y H:i:s", $settings['system']['last_traffic_run']);
|
||||
}
|
||||
|
||||
if($settings['system']['last_archive_run'] == 0)
|
||||
{
|
||||
$archivelastrun = $lng['cronjobs']['notyetrun'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$archivelastrun = date("d.m.Y H:i:s", $settings['system']['last_archive_run']);
|
||||
}
|
||||
|
||||
$opentickets = 0;
|
||||
$opentickets = $db->query_first('SELECT COUNT(`id`) as `count` FROM `' . TABLE_PANEL_TICKETS . '`
|
||||
WHERE `answerto` = "0" AND (`status` = "0" OR `status` = "1")
|
||||
AND `lastreplier`="0" AND `adminid` = "' . $userinfo['adminid'] . '"');
|
||||
$awaitingtickets = $opentickets['count'];
|
||||
$awaitingtickets_text = '';
|
||||
|
||||
if($opentickets > 0)
|
||||
{
|
||||
$awaitingtickets_text = strtr($lng['ticket']['awaitingticketreply'], array('%s' => '<a href="admin_tickets.php?page=tickets&s=' . $s . '">' . $opentickets['count'] . '</a>'));
|
||||
}
|
||||
|
||||
if(function_exists('sys_getloadavg'))
|
||||
{
|
||||
$loadArray = sys_getloadavg();
|
||||
$load = number_format($loadArray[0], 2, '.', '') . " / " . number_format($loadArray[1], 2, '.', '') . " / " . number_format($loadArray[2], 2, '.', '');
|
||||
}
|
||||
else
|
||||
{
|
||||
$load = @file_get_contents('/proc/loadavg');
|
||||
|
||||
if(!$load)
|
||||
{
|
||||
$load = $lng['admin']['noloadavailable'];
|
||||
}
|
||||
}
|
||||
|
||||
if(function_exists('posix_uname'))
|
||||
{
|
||||
$showkernel = 1;
|
||||
$kernel_nfo = posix_uname();
|
||||
$kernel = $kernel_nfo['release'] . ' (' . $kernel_nfo['machine'] . ')';
|
||||
}
|
||||
else
|
||||
{
|
||||
$showkernel = 0;
|
||||
$kernel = '';
|
||||
}
|
||||
|
||||
// Try to get the uptime
|
||||
// First: With exec (let's hope it's enabled for the SysCP - vHost)
|
||||
|
||||
$uptime_array = explode(" ", @file_get_contents("/proc/uptime"));
|
||||
|
||||
if(is_array($uptime_array)
|
||||
&& isset($uptime_array[0])
|
||||
&& is_numeric($uptime_array[0]))
|
||||
{
|
||||
// Some calculatioon to get a nicly formatted display
|
||||
|
||||
$seconds = round($uptime_array[0], 0);
|
||||
$minutes = $seconds / 60;
|
||||
$hours = $minutes / 60;
|
||||
$days = floor($hours / 24);
|
||||
$hours = floor($hours - ($days * 24));
|
||||
$minutes = floor($minutes - ($days * 24 * 60) - ($hours * 60));
|
||||
$seconds = floor($seconds - ($days * 24 * 60 * 60) - ($hours * 60 * 60) - ($minutes * 60));
|
||||
$uptime = "{$days}d, {$hours}h, {$minutes}m, {$seconds}s";
|
||||
|
||||
// Just cleanup
|
||||
|
||||
unset($uptime_array, $seconds, $minutes, $hours, $days);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Nothing of the above worked, show an error :/
|
||||
|
||||
$uptime = '';
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("index/index") . "\";");
|
||||
}
|
||||
elseif($page == 'change_password')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$old_password = validate($_POST['old_password'], 'old password');
|
||||
|
||||
if(md5($old_password) != $userinfo['password'])
|
||||
{
|
||||
standard_error('oldpasswordnotcorrect');
|
||||
exit;
|
||||
}
|
||||
|
||||
$new_password = validate($_POST['new_password'], 'new password');
|
||||
$new_password_confirm = validate($_POST['new_password_confirm'], 'new password confirm');
|
||||
|
||||
if($old_password == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'oldpassword'));
|
||||
}
|
||||
elseif($new_password == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'newpassword'));
|
||||
}
|
||||
elseif($new_password_confirm == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'newpasswordconfirm'));
|
||||
}
|
||||
elseif($new_password != $new_password_confirm)
|
||||
{
|
||||
standard_error('newpasswordconfirmerror');
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->query("UPDATE `" . TABLE_PANEL_ADMINS . "` SET `password`='" . md5($new_password) . "' WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `password`='" . md5($old_password) . "'");
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, 'changed password');
|
||||
redirectTo($filename, Array('s' => $s));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
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');
|
||||
|
||||
if(isset($languages[$def_language]))
|
||||
{
|
||||
$db->query("UPDATE `" . TABLE_PANEL_ADMINS . "` SET `def_language`='" . $db->escape($def_language) . "' WHERE `adminid`='" . (int)$userinfo['adminid'] . "'");
|
||||
$db->query("UPDATE `" . TABLE_PANEL_SESSIONS . "` SET `language`='" . $db->escape($def_language) . "' WHERE `hash`='" . $db->escape($s) . "'");
|
||||
}
|
||||
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "changed his/her default language to '" . $def_language . "'");
|
||||
redirectTo($filename, Array('s' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
$language_options = '';
|
||||
|
||||
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") . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
320
admin_ipsandports.php
Normal file
@@ -0,0 +1,320 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @author Michael Duergner <michael@duergner.com>
|
||||
* @author Luca Longinotti <chtekk@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
* @version $Id: admin_ipsandports.php 2699 2009-04-14 11:21:26Z flo $
|
||||
*/
|
||||
|
||||
define('AREA', 'admin');
|
||||
|
||||
/**
|
||||
* Include our init.php, which manages Sessions, Language etc.
|
||||
*/
|
||||
|
||||
require ("./lib/init.php");
|
||||
|
||||
if(isset($_POST['id']))
|
||||
{
|
||||
$id = intval($_POST['id']);
|
||||
}
|
||||
elseif(isset($_GET['id']))
|
||||
{
|
||||
$id = intval($_GET['id']);
|
||||
}
|
||||
|
||||
if($page == 'ipsandports'
|
||||
|| $page == 'overview')
|
||||
{
|
||||
if($action == '')
|
||||
{
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_ipsandports");
|
||||
$fields = array(
|
||||
'ip' => $lng['admin']['ipsandports']['ip'],
|
||||
'port' => $lng['admin']['ipsandports']['port']
|
||||
);
|
||||
$paging = new paging($userinfo, $db, TABLE_PANEL_IPSANDPORTS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
|
||||
$ipsandports = '';
|
||||
$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());
|
||||
$paging->setEntries($db->num_rows($result));
|
||||
$sortcode = $paging->getHtmlSortCode($lng);
|
||||
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$searchcode = $paging->getHtmlSearchCode($lng);
|
||||
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$i = 0;
|
||||
$count = 0;
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
if($paging->checkDisplay($i))
|
||||
{
|
||||
$row = htmlentities_array($row);
|
||||
|
||||
if(filter_var($row['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6))
|
||||
{
|
||||
$row['ip'] = '[' . $row['ip'] . ']';
|
||||
}
|
||||
|
||||
eval("\$ipsandports.=\"" . getTemplate("ipsandports/ipsandports_ipandport") . "\";");
|
||||
$count++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
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 . "'");
|
||||
|
||||
if(isset($result['id'])
|
||||
&& $result['id'] == $id)
|
||||
{
|
||||
$result_checkdomain = $db->query_first("SELECT `id` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `ipandport`='" . (int)$id . "'");
|
||||
|
||||
if($result_checkdomain['id'] == '')
|
||||
{
|
||||
if($result['id'] != $settings['system']['defaultip'])
|
||||
{
|
||||
$result_sameipotherport = $db->query_first("SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ip`='" . $db->escape($result['ip']) . "' AND `id`!='" . (int)$id . "'");
|
||||
|
||||
if(($result['ip'] != $settings['system']['ipaddress'])
|
||||
|| ($result['ip'] == $settings['system']['ipaddress'] && $result_sameipotherport['id'] != ''))
|
||||
{
|
||||
$result = $db->query_first("SELECT `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id`='" . (int)$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'] . "'");
|
||||
inserttask('1');
|
||||
inserttask('4');
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
ask_yesno('admin_ip_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['ip'] . ':' . $result['port']);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('cantdeletesystemip');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('cantdeletedefaultip');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('ipstillhasdomains');
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif($action == 'add')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$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'));
|
||||
$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]*$/');
|
||||
$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]*$/');
|
||||
|
||||
if($listen_statement != '1')
|
||||
{
|
||||
$listen_statement = '0';
|
||||
}
|
||||
|
||||
if($namevirtualhost_statement != '1')
|
||||
{
|
||||
$namevirtualhost_statement = '0';
|
||||
}
|
||||
|
||||
if($vhostcontainer != '1')
|
||||
{
|
||||
$vhostcontainer = '0';
|
||||
}
|
||||
|
||||
if($vhostcontainer_servername_statement != '1')
|
||||
{
|
||||
$vhostcontainer_servername_statement = '0';
|
||||
}
|
||||
|
||||
if($ssl != '1')
|
||||
{
|
||||
$ssl = '0';
|
||||
}
|
||||
|
||||
if($ssl_cert_file != '')
|
||||
{
|
||||
$ssl_cert_file = makeCorrectFile($ssl_cert_file);
|
||||
}
|
||||
|
||||
if($ssl_key_file != '')
|
||||
{
|
||||
$ssl_key_file = makeCorrectFile($ssl_key_file);
|
||||
}
|
||||
|
||||
if($ssl_ca_file != '')
|
||||
{
|
||||
$ssl_ca_file = makeCorrectFile($ssl_ca_file);
|
||||
}
|
||||
|
||||
$result_checkfordouble = $db->query_first("SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ip`='" . $db->escape($ip) . "' AND `port`='" . (int)$port . "'");
|
||||
|
||||
if($result_checkfordouble['id'] != '')
|
||||
{
|
||||
standard_error('myipnotdouble');
|
||||
}
|
||||
else
|
||||
{
|
||||
$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) . "')");
|
||||
|
||||
if(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6))
|
||||
{
|
||||
$ip = '[' . $ip . ']';
|
||||
}
|
||||
|
||||
$log->logAction(ADM_ACTION, LOG_WARNING, "added IP/port '" . $ip . ":" . $port . "'");
|
||||
inserttask('1');
|
||||
inserttask('4');
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$enable_ssl = makeyesno('ssl', '1', '0', '0');
|
||||
$listen_statement = makeyesno('listen_statement', '1', '0', '1');
|
||||
$namevirtualhost_statement = makeyesno('namevirtualhost_statement', '1', '0', '1');
|
||||
$vhostcontainer = makeyesno('vhostcontainer', '1', '0', '1');
|
||||
$vhostcontainer_servername_statement = makeyesno('vhostcontainer_servername_statement', '1', '0', '1');
|
||||
eval("echo \"" . getTemplate("ipsandports/ipsandports_add") . "\";");
|
||||
}
|
||||
}
|
||||
elseif($action == 'edit'
|
||||
&& $id != 0)
|
||||
{
|
||||
$result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id`='" . (int)$id . "'");
|
||||
|
||||
if($result['ip'] != '')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$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'));
|
||||
$result_checkfordouble = $db->query_first("SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ip`='" . $db->escape($ip) . "' AND `port`='" . (int)$port . "'");
|
||||
$result_sameipotherport = $db->query_first("SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ip`='" . $db->escape($result['ip']) . "' AND `id`!='" . (int)$id . "'");
|
||||
$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]*$/');
|
||||
$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]*$/');
|
||||
|
||||
if($listen_statement != '1')
|
||||
{
|
||||
$listen_statement = '0';
|
||||
}
|
||||
|
||||
if($namevirtualhost_statement != '1')
|
||||
{
|
||||
$namevirtualhost_statement = '0';
|
||||
}
|
||||
|
||||
if($vhostcontainer != '1')
|
||||
{
|
||||
$vhostcontainer = '0';
|
||||
}
|
||||
|
||||
if($vhostcontainer_servername_statement != '1')
|
||||
{
|
||||
$vhostcontainer_servername_statement = '0';
|
||||
}
|
||||
|
||||
if($ssl != '1')
|
||||
{
|
||||
$ssl = '0';
|
||||
}
|
||||
|
||||
if($ssl_cert_file != '')
|
||||
{
|
||||
$ssl_cert_file = makeCorrectFile($ssl_cert_file);
|
||||
}
|
||||
|
||||
if($ssl_key_file != '')
|
||||
{
|
||||
$ssl_key_file = makeCorrectFile($ssl_key_file);
|
||||
}
|
||||
|
||||
if($ssl_ca_file != '')
|
||||
{
|
||||
$ssl_ca_file = makeCorrectFile($ssl_ca_file);
|
||||
}
|
||||
|
||||
if($result['ip'] != $ip
|
||||
&& $result['ip'] == $settings['system']['ipaddress']
|
||||
&& $result_sameipotherport['id'] == '')
|
||||
{
|
||||
standard_error('cantchangesystemip');
|
||||
}
|
||||
elseif($result_checkfordouble['id'] != ''
|
||||
&& $result_checkfordouble['id'] != $id)
|
||||
{
|
||||
standard_error('myipnotdouble');
|
||||
}
|
||||
else
|
||||
{
|
||||
$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 . "'");
|
||||
$log->logAction(ADM_ACTION, LOG_WARNING, "changed IP/port from '" . $result['ip'] . ":" . $result['port'] . "' to '" . $ip . ":" . $port . "'");
|
||||
inserttask('1');
|
||||
inserttask('4');
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$enable_ssl = makeyesno('ssl', '1', '0', $result['ssl']);
|
||||
$result = htmlentities_array($result);
|
||||
$listen_statement = makeyesno('listen_statement', '1', '0', $result['listen_statement']);
|
||||
$namevirtualhost_statement = makeyesno('namevirtualhost_statement', '1', '0', $result['namevirtualhost_statement']);
|
||||
$vhostcontainer = makeyesno('vhostcontainer', '1', '0', $result['vhostcontainer']);
|
||||
$vhostcontainer_servername_statement = makeyesno('vhostcontainer_servername_statement', '1', '0', $result['vhostcontainer_servername_statement']);
|
||||
eval("echo \"" . getTemplate("ipsandports/ipsandports_edit") . "\";");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
175
admin_logger.php
Normal file
@@ -0,0 +1,175 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* System-Logger - Admin
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version. This program is distributed in the
|
||||
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
|
||||
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Michael Kaufmann <mkaufmann@nutime.de>
|
||||
* @license http://www.gnu.org/licenses/gpl.txt
|
||||
* @package Panel
|
||||
* @version CVS: $Id: admin_logger.php 2452 2008-11-30 13:12:36Z flo $
|
||||
* @link http://www.nutime.de/
|
||||
* @since File available since Release 1.2.20
|
||||
*/
|
||||
|
||||
define('AREA', 'admin');
|
||||
|
||||
/**
|
||||
* Include our init.php, which manages Sessions, Language etc.
|
||||
*/
|
||||
|
||||
require ("./lib/init.php");
|
||||
|
||||
if($page == 'log'
|
||||
&& $userinfo['change_serversettings'] == '1')
|
||||
{
|
||||
if($action == '')
|
||||
{
|
||||
$fields = array(
|
||||
'action' => $lng['logger']['action'],
|
||||
'date' => $lng['logger']['date'],
|
||||
'type' => $lng['logger']['type'],
|
||||
'user' => $lng['logger']['user']
|
||||
);
|
||||
$paging = new paging($userinfo, $db, TABLE_PANEL_LOG, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
|
||||
$paging->sortfield = 'date';
|
||||
$paging->sortorder = 'desc';
|
||||
$result = $db->query('SELECT * FROM `' . TABLE_PANEL_LOG . '` ' . $paging->getSqlWhere(false) . ' ' . $paging->getSqlOrderBy() . ' ' . $paging->getSqlLimit());
|
||||
$paging->setEntries($db->num_rows($result));
|
||||
$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 = $db->fetch_array($result))
|
||||
{
|
||||
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 = 'Reseller';
|
||||
break;
|
||||
case ADM_ACTION:
|
||||
$_action = 'Administrator';
|
||||
break;
|
||||
case CRON_ACTION:
|
||||
$_action = 'Cronjob';
|
||||
break;
|
||||
case LOG_ERROR:
|
||||
$_action = 'Internal';
|
||||
break;
|
||||
default:
|
||||
$_action = 'Unknown';
|
||||
break;
|
||||
}
|
||||
|
||||
$row['action'] = $_action;
|
||||
eval("\$log.=\"" . getTemplate("logger/logger_action") . "\";");
|
||||
}
|
||||
|
||||
$log_count++;
|
||||
$type = $row['type'];
|
||||
$_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++;
|
||||
$_action = $action;
|
||||
}
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("logger/logger") . "\";");
|
||||
}
|
||||
elseif($action == 'truncate')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$yesterday = time() - (60 * 10);
|
||||
|
||||
/* (60*60*24); */
|
||||
|
||||
$db->query("DELETE FROM `" . TABLE_PANEL_LOG . "` WHERE `date` < '" . $yesterday . "'");
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
146
admin_message.php
Normal file
@@ -0,0 +1,146 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
* @version $Id: admin_message.php 2692 2009-03-27 18:04:47Z flo $
|
||||
*/
|
||||
|
||||
define('AREA', 'admin');
|
||||
|
||||
/**
|
||||
* Include our init.php, which manages Sessions, Language etc.
|
||||
*/
|
||||
|
||||
require ("./lib/init.php");
|
||||
|
||||
if(isset($_POST['id']))
|
||||
{
|
||||
$id = intval($_POST['id']);
|
||||
}
|
||||
elseif(isset($_GET['id']))
|
||||
{
|
||||
$id = intval($_GET['id']);
|
||||
}
|
||||
|
||||
if($page == 'message')
|
||||
{
|
||||
if($action == '')
|
||||
{
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed panel_message");
|
||||
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
if($_POST['receipient'] == 0
|
||||
&& $userinfo['customers_see_all'] == '1')
|
||||
{
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "sending messages to admins");
|
||||
$result = $db->query('SELECT `firstname`, `name`, `email` FROM `' . TABLE_PANEL_ADMINS . "`");
|
||||
}
|
||||
elseif($_POST['receipient'] == 1)
|
||||
{
|
||||
if($userinfo['customers_see_all'] == "1")
|
||||
{
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "sending messages to ALL customers");
|
||||
$result = $db->query('SELECT `firstname`, `name`, `email` FROM `' . TABLE_PANEL_CUSTOMERS . "`");
|
||||
}
|
||||
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');
|
||||
}
|
||||
|
||||
$subject = $_POST['subject'];
|
||||
$message = wordwrap($_POST['message'], 70);
|
||||
|
||||
if(!empty($message))
|
||||
{
|
||||
$mailcounter = 0;
|
||||
$mail->Body = $message;
|
||||
$mail->Subject = $subject;
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
$mail->AddAddress($row['email'], $row['firstname'] . ' ' . $row['name']);
|
||||
$mail->From = $userinfo['email'];
|
||||
$mail->FromName = $userinfo['firstname'] . ' ' . $userinfo['name'];
|
||||
|
||||
if(!$mail->Send())
|
||||
{
|
||||
if($mail->ErrorInfo != '')
|
||||
{
|
||||
$mailerr_msg = $mail->ErrorInfo;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mailerr_msg = $row["email"];
|
||||
}
|
||||
|
||||
$log->logAction(ADM_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
|
||||
standard_error('errorsendingmail', $row["email"]);
|
||||
}
|
||||
|
||||
$mailcounter++;
|
||||
$mail->ClearAddresses();
|
||||
}
|
||||
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s, 'action' => 'showsuccess', 'sentitems' => $mailcounter));
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('nomessagetosend');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($action == 'showsuccess')
|
||||
{
|
||||
$success = 1;
|
||||
$sentitems = isset($_GET['sentitems']) ? (int)$_GET['sentitems'] : 0;
|
||||
|
||||
if($sentitems == 0)
|
||||
{
|
||||
$successmessage = $lng['message']['noreceipients'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$successmessage = str_replace('%s', $sentitems, $lng['message']['success']);
|
||||
}
|
||||
|
||||
$action = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$success = 0;
|
||||
$sentitems = 0;
|
||||
$successmessage = '';
|
||||
$action = '';
|
||||
}
|
||||
|
||||
$receipients = '';
|
||||
|
||||
if($userinfo['customers_see_all'] == "1")
|
||||
{
|
||||
$receipients.= makeoption($lng['panel']['reseller'], 0);
|
||||
}
|
||||
|
||||
$receipients.= makeoption($lng['panel']['customer'], 1);
|
||||
eval("echo \"" . getTemplate("message/message") . "\";");
|
||||
}
|
||||
|
||||
?>
|
||||
185
admin_phpsettings.php
Normal file
@@ -0,0 +1,185 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Sven Skrabal <info@nexpa.de>
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
* @version $Id: admin_phpsettings.php 2692 2009-03-27 18:04:47Z flo $
|
||||
* @todo
|
||||
*/
|
||||
|
||||
define('AREA', 'admin');
|
||||
|
||||
/**
|
||||
* Include our init.php, which manages Sessions, Language etc.
|
||||
*/
|
||||
|
||||
require ("./lib/init.php");
|
||||
|
||||
if(isset($_POST['id']))
|
||||
{
|
||||
$id = intval($_POST['id']);
|
||||
}
|
||||
elseif(isset($_GET['id']))
|
||||
{
|
||||
$id = intval($_GET['id']);
|
||||
}
|
||||
|
||||
if($page == 'overview')
|
||||
{
|
||||
if($action == '')
|
||||
{
|
||||
$tablecontent = '';
|
||||
$result = $db->query("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "`");
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
$domainresult = false;
|
||||
|
||||
if((int)$userinfo['domains_see_all'] == 0)
|
||||
{
|
||||
$domainresult = $db->query("SELECT * FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `adminid` = " . (int)$userinfo['userid'] . " AND `phpsettingid` = " . (int)$row['id']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$domainresult = $db->query("SELECT * FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `phpsettingid` = " . (int)$row['id']);
|
||||
}
|
||||
|
||||
$domains = '';
|
||||
|
||||
if($db->num_rows($domainresult) > 0)
|
||||
{
|
||||
while($row2 = $db->fetch_array($domainresult))
|
||||
{
|
||||
$domains.= $row2['domain'] . '<br/>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$domains = $lng['admin']['phpsettings']['notused'];
|
||||
}
|
||||
|
||||
eval("\$tablecontent.=\"" . getTemplate("phpconfig/overview_overview") . "\";");
|
||||
}
|
||||
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "php.ini setting overview has been viewed by '" . $userinfo['loginname'] . "'");
|
||||
eval("echo \"" . getTemplate("phpconfig/overview") . "\";");
|
||||
}
|
||||
|
||||
if($action == 'add')
|
||||
{
|
||||
if((int)$userinfo['change_serversettings'] == 1)
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$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]*$/');
|
||||
$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(strlen($description) == 0
|
||||
|| strlen($description) > 50)
|
||||
{
|
||||
standard_error('descriptioninvalid');
|
||||
}
|
||||
|
||||
$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) . "'");
|
||||
inserttask('1');
|
||||
$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));
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = 1");
|
||||
eval("echo \"" . getTemplate("phpconfig/overview_add") . "\";");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('nopermissionsorinvalidid');
|
||||
}
|
||||
}
|
||||
|
||||
if($action == 'delete')
|
||||
{
|
||||
$result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = " . (int)$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');
|
||||
$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));
|
||||
}
|
||||
else
|
||||
{
|
||||
ask_yesno('phpsetting_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['description']);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('nopermissionsorinvalidid');
|
||||
}
|
||||
}
|
||||
|
||||
if($action == 'edit')
|
||||
{
|
||||
$result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = " . (int)$id);
|
||||
|
||||
if($result['id'] != 0
|
||||
&& $result['id'] == $id
|
||||
&& (int)$userinfo['change_serversettings'] == 1)
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$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]*$/');
|
||||
$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(strlen($description) == 0
|
||||
|| strlen($description) > 50)
|
||||
{
|
||||
standard_error('descriptioninvalid');
|
||||
}
|
||||
|
||||
$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);
|
||||
inserttask('1');
|
||||
$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));
|
||||
}
|
||||
else
|
||||
{
|
||||
eval("echo \"" . getTemplate("phpconfig/overview_edit") . "\";");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('nopermissionsorinvalidid');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
159
admin_settings.php
Normal file
@@ -0,0 +1,159 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
* @version $Id: admin_settings.php 2733 2009-11-06 09:32:00Z flo $
|
||||
*/
|
||||
|
||||
define('AREA', 'admin');
|
||||
|
||||
/**
|
||||
* Include our init.php, which manages Sessions, Language etc.
|
||||
*/
|
||||
|
||||
$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 = loadSettings(&$settings_data, &$db);
|
||||
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
if(processForm(&$settings_data, &$_POST, array('filename' => $filename, 'action' => $action, 'page' => $page)))
|
||||
{
|
||||
standard_success('settingssaved', '', array('filename' => $filename, 'action' => $action, 'page' => $page));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$fields = buildForm(&$settings_data);
|
||||
eval("echo \"" . getTemplate("settings/settings") . "\";");
|
||||
}
|
||||
}
|
||||
elseif($page == 'rebuildconfigs'
|
||||
&& $userinfo['change_serversettings'] == '1')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "rebuild configfiles");
|
||||
inserttask('1');
|
||||
inserttask('4');
|
||||
inserttask('5');
|
||||
redirectTo('admin_index.php', array('s' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
ask_yesno('admin_configs_reallyrebuild', $filename, array('page' => $page));
|
||||
}
|
||||
}
|
||||
elseif($page == 'updatecounters'
|
||||
&& $userinfo['change_serversettings'] == '1')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "updated resource-counters");
|
||||
$updatecounters = updateCounters(true);
|
||||
$customers = '';
|
||||
foreach($updatecounters['customers'] as $customerid => $customer)
|
||||
{
|
||||
eval("\$customers.=\"" . getTemplate("settings/updatecounters_row_customer") . "\";");
|
||||
}
|
||||
|
||||
$admins = '';
|
||||
foreach($updatecounters['admins'] as $adminid => $admin)
|
||||
{
|
||||
eval("\$admins.=\"" . getTemplate("settings/updatecounters_row_admin") . "\";");
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("settings/updatecounters") . "\";");
|
||||
}
|
||||
else
|
||||
{
|
||||
ask_yesno('admin_counters_reallyupdate', $filename, array('page' => $page));
|
||||
}
|
||||
}
|
||||
elseif($page == 'wipecleartextmailpws'
|
||||
&& $userinfo['change_serversettings'] == '1')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$log->logAction(ADM_ACTION, LOG_WARNING, "wiped all cleartext mail passwords");
|
||||
$db->query("UPDATE `" . TABLE_MAIL_USERS . "` SET `password`='' ");
|
||||
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value`='0' WHERE `settinggroup`='system' AND `varname`='mailpwcleartext'");
|
||||
redirectTo('admin_settings.php', array('s' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
ask_yesno('admin_cleartextmailpws_reallywipe', $filename, array('page' => $page));
|
||||
}
|
||||
}
|
||||
elseif($page == 'wipequotas'
|
||||
&& $userinfo['change_serversettings'] == '1')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$log->logAction(ADM_ACTION, LOG_WARNING, "wiped all mailquotas");
|
||||
|
||||
// Set the quota to 0 which means unlimited
|
||||
|
||||
$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));
|
||||
}
|
||||
}
|
||||
elseif($page == 'enforcequotas'
|
||||
&& $userinfo['change_serversettings'] == '1')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
// Fetch all accounts
|
||||
|
||||
$result = $db->query("SELECT `quota`, `customerid` FROM " . TABLE_MAIL_USERS);
|
||||
|
||||
while($array = $db->fetch_array($result))
|
||||
{
|
||||
$difference = $settings['system']['mail_quota'] - $array['quota'];
|
||||
$db->query("UPDATE " . TABLE_PANEL_CUSTOMERS . " SET `email_quota_used` = `email_quota_used` + " . (int)$difference . " WHERE `customerid` = '" . $array['customerid'] . "'");
|
||||
}
|
||||
|
||||
// Set the new quota
|
||||
|
||||
$db->query("UPDATE `" . TABLE_MAIL_USERS . "` SET `quota`='" . $settings['system']['mail_quota'] . "'");
|
||||
|
||||
// Update the Customer, if the used quota is bigger than the allowed quota
|
||||
|
||||
$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));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
379
admin_templates.php
Normal file
@@ -0,0 +1,379 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Michael Duergner <michael@duergner.com>
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
* @version $Id: admin_templates.php 2692 2009-03-27 18:04:47Z flo $
|
||||
*/
|
||||
|
||||
define('AREA', 'admin');
|
||||
|
||||
/**
|
||||
* Include our init.php, which manages Sessions, Language etc.
|
||||
*/
|
||||
|
||||
require ("./lib/init.php");
|
||||
|
||||
if(isset($_POST['subjectid']))
|
||||
{
|
||||
$subjectid = intval($_POST['subjectid']);
|
||||
$mailbodyid = intval($_POST['mailbodyid']);
|
||||
}
|
||||
elseif(isset($_GET['subjectid']))
|
||||
{
|
||||
$subjectid = intval($_GET['subjectid']);
|
||||
$mailbodyid = intval($_GET['mailbodyid']);
|
||||
}
|
||||
|
||||
if(isset($_POST['id']))
|
||||
{
|
||||
$id = intval($_POST['id']);
|
||||
}
|
||||
elseif(isset($_GET['id']))
|
||||
{
|
||||
$id = intval($_GET['id']);
|
||||
}
|
||||
|
||||
$available_templates = array(
|
||||
'createcustomer',
|
||||
'pop_success',
|
||||
'trafficninetypercent',
|
||||
'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(
|
||||
'index_html'
|
||||
);
|
||||
|
||||
if($action == '')
|
||||
{
|
||||
//email templates
|
||||
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_templates");
|
||||
|
||||
if($settings['panel']['sendalternativemail'] == 1)
|
||||
{
|
||||
$available_templates[] = 'pop_success_alternative';
|
||||
}
|
||||
|
||||
$templates_array = array();
|
||||
$result = $db->query("SELECT `id`, `language`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `templategroup`='mails' ORDER BY `language`, `varname`");
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
$parts = array();
|
||||
preg_match('/^([a-z]([a-z_]+[a-z])*)_(mailbody|subject)$/', $row['varname'], $parts);
|
||||
$templates_array[$row['language']][$parts[1]][$parts[3]] = $row['id'];
|
||||
}
|
||||
|
||||
$templates = '';
|
||||
foreach($templates_array as $language => $template_defs)
|
||||
{
|
||||
foreach($template_defs as $action => $email)
|
||||
{
|
||||
$subjectid = $email['subject'];
|
||||
$mailbodyid = $email['mailbody'];
|
||||
$template = $lng['admin']['templates'][$action];
|
||||
eval("\$templates.=\"" . getTemplate("templates/templates_template") . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
$add = false;
|
||||
|
||||
while(list($language_file, $language_name) = each($languages))
|
||||
{
|
||||
$templates_done = array();
|
||||
$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\'');
|
||||
|
||||
while(($row = $db->fetch_array($result)) != false)
|
||||
{
|
||||
$templates_done[] = str_replace('_subject', '', $row['varname']);
|
||||
}
|
||||
|
||||
if(count(array_diff($available_templates, $templates_done)) > 0)
|
||||
{
|
||||
$add = true;
|
||||
}
|
||||
}
|
||||
|
||||
//filetemplates
|
||||
|
||||
$filetemplates = '';
|
||||
$filetemplateadd = false;
|
||||
$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))$filetemplateadd = true;
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
eval("\$filetemplates.=\"" . getTemplate("templates/templates_filetemplate") . "\";");
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("templates/templates") . "\";");
|
||||
}
|
||||
elseif($action == 'delete'
|
||||
&& $subjectid != 0
|
||||
&& $mailbodyid != 0)
|
||||
{
|
||||
//email templates
|
||||
|
||||
$result = $db->query_first("SELECT `language`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `id`='" . (int)$subjectid . "'");
|
||||
|
||||
if($result['varname'] != '')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$db->query("DELETE FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND (`id`='" . (int)$subjectid . "' OR `id`='" . (int)$mailbodyid . "')");
|
||||
$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));
|
||||
}
|
||||
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'])]);
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif($action == 'delete'
|
||||
&& $id != 0)
|
||||
{
|
||||
//file templates
|
||||
|
||||
$result = $db->query("SELECT * FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `id`='" . (int)$id . "'");
|
||||
|
||||
if($db->num_rows($result) > 0)
|
||||
{
|
||||
$row = $db->fetch_array($result);
|
||||
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$db->query("DELETE FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `adminid`=" . (int)$userinfo['adminid'] . " AND `id`=" . (int)$id . "");
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "deleted template '" . $lng['admin']['templates'][$row['varname']] . "'");
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
ask_yesno('admin_template_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $lng['admin']['templates'][$row['varname']]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('templatenotfound');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
elseif($action == 'add')
|
||||
{
|
||||
if($settings['panel']['sendalternativemail'] == 1)
|
||||
{
|
||||
$available_templates[] = 'pop_success_alternative';
|
||||
}
|
||||
|
||||
if(isset($_POST['prepare'])
|
||||
&& $_POST['prepare'] == 'prepare')
|
||||
{
|
||||
//email templates
|
||||
|
||||
$language = validate($_POST['language'], 'language');
|
||||
$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);
|
||||
$template_options = '';
|
||||
foreach($templates as $template)
|
||||
{
|
||||
$template_options.= makeoption($lng['admin']['templates'][$template], $template, NULL, true);
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("templates/templates_add_2") . "\";");
|
||||
}
|
||||
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
|
||||
|
||||
$template = validate($_POST['template'], 'template');
|
||||
$filecontent = validate($_POST['filecontent'], 'filecontent', '/^[^\0]+$/', 'filecontentnotset');
|
||||
$db->query("INSERT INTO `" . TABLE_PANEL_TEMPLATES . "` (`adminid`, `language`, `templategroup`, `varname`, `value`)
|
||||
VALUES ('" . (int)$userinfo['adminid'] . "', '', 'files', '" . $db->escape($template) . "','" . $db->escape($filecontent) . "')");
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "added template '" . $template . "'");
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
elseif(!isset($_GET['files']))
|
||||
{
|
||||
//email templates
|
||||
|
||||
$add = false;
|
||||
$language_options = '';
|
||||
|
||||
while(list($language_file, $language_name) = each($languages))
|
||||
{
|
||||
$templates = array();
|
||||
$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\'');
|
||||
|
||||
while(($row = $db->fetch_array($result)) != false)
|
||||
{
|
||||
$templates[] = str_replace('_subject', '', $row['varname']);
|
||||
}
|
||||
|
||||
if(count(array_diff($available_templates, $templates)) > 0)
|
||||
{
|
||||
$add = true;
|
||||
$language_options.= makeoption($language_name, $language_file, $userinfo['language'], true);
|
||||
}
|
||||
}
|
||||
|
||||
if($add)
|
||||
{
|
||||
eval("echo \"" . getTemplate("templates/templates_add_1") . "\";");
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('alltemplatesdefined');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//filetemplates
|
||||
|
||||
$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();
|
||||
$free_templates = '';
|
||||
|
||||
while($row = $db->fetch_array($result))$templatesdefined[] = $row['varname'];
|
||||
foreach(array_diff($file_templates, $templatesdefined) as $template)
|
||||
{
|
||||
$free_templates.= makeoption($lng['admin']['templates'][$template], $template, '', true);
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("templates/filetemplates_add") . "\";");
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif($action == 'edit'
|
||||
&& $subjectid != 0
|
||||
&& $mailbodyid != 0)
|
||||
{
|
||||
//email templates
|
||||
|
||||
$result = $db->query_first("SELECT `language`, `varname`, `value` FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `id`='" . (int)$subjectid . "'");
|
||||
|
||||
if($result['varname'] != '')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$subject = validate($_POST['subject'], 'subject', '/^[^\r\n\0]+$/', 'nosubjectcreate');
|
||||
$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 . "'");
|
||||
$db->query("UPDATE `" . TABLE_PANEL_TEMPLATES . "` SET `value`='" . $db->escape($mailbody) . "' WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `id`='" . (int)$mailbodyid . "'");
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "edited template '" . $result['varname'] . "'");
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = htmlentities_array($result);
|
||||
$template = $lng['admin']['templates'][str_replace('_subject', '', $result['varname'])];
|
||||
$subject = $result['value'];
|
||||
$result = $db->query_first("SELECT `language`, `varname`, `value` FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `id`='$mailbodyid'");
|
||||
$result = htmlentities_array($result);
|
||||
$mailbody = $result['value'];
|
||||
eval("echo \"" . getTemplate("templates/templates_edit") . "\";");
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif($action == 'edit'
|
||||
&& $id != 0)
|
||||
{
|
||||
//file templates
|
||||
|
||||
$result = $db->query("SELECT * FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `id`='" . (int)$id . "'");
|
||||
|
||||
if($db->num_rows($result) > 0)
|
||||
{
|
||||
$row = $db->fetch_array($result);
|
||||
|
||||
//filetemplates
|
||||
|
||||
if(isset($_POST['filesend'])
|
||||
&& $_POST['filesend'] == 'filesend')
|
||||
{
|
||||
$filecontent = validate($_POST['filecontent'], 'filecontent', '/^[^\0]+$/', 'filecontentnotset');
|
||||
$db->query("UPDATE `" . TABLE_PANEL_TEMPLATES . "` SET `value`='" . $db->escape($filecontent) . "' WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `id`='" . (int)$id . "'");
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "edited template '" . $row['varname'] . "'");
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
eval("echo \"" . getTemplate("templates/filetemplates_edit") . "\";");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('templatenotfound');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
802
admin_tickets.php
Normal file
@@ -0,0 +1,802 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Support-Tickets - Admin
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version. This program is distributed in the
|
||||
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
|
||||
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Michael Kaufmann <mkaufmann@nutime.de>
|
||||
* @license http://www.gnu.org/licenses/gpl.txt
|
||||
* @package Panel
|
||||
* @version CVS: $Id: admin_tickets.php 2537 2008-12-12 15:30:38Z flo $
|
||||
* @link http://www.nutime.de/
|
||||
* @since File available since Release 1.2.18
|
||||
*/
|
||||
|
||||
define('AREA', 'admin');
|
||||
|
||||
/**
|
||||
* Include our init.php, which manages Sessions, Language etc.
|
||||
*/
|
||||
|
||||
require ("./lib/init.php");
|
||||
|
||||
if(isset($_POST['id']))
|
||||
{
|
||||
$id = intval($_POST['id']);
|
||||
}
|
||||
elseif(isset($_GET['id']))
|
||||
{
|
||||
$id = intval($_GET['id']);
|
||||
}
|
||||
|
||||
if($page == 'tickets'
|
||||
&& $userinfo['customers'] != '0')
|
||||
{
|
||||
if($action == '')
|
||||
{
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_tickets");
|
||||
$fields = array(
|
||||
'status' => $lng['ticket']['status'],
|
||||
'priority' => $lng['ticket']['priority'],
|
||||
'lastchange' => $lng['ticket']['lastchange'],
|
||||
'ticket_answers' => $lng['ticket']['ticket_answers'],
|
||||
'subject' => $lng['ticket']['subject'],
|
||||
'lastreplier' => $lng['ticket']['lastreplier']
|
||||
);
|
||||
$paging = new paging($userinfo, $db, TABLE_PANEL_TICKETS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
|
||||
$paging->sortfield = 'lastchange';
|
||||
$paging->sortorder = 'desc';
|
||||
$result = $db->query('SELECT `main`.`id`, `main`.`customerid`, (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 `adminid` = "' . (int)$userinfo['adminid'] . '" ' . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
|
||||
$paging->setEntries($db->num_rows($result));
|
||||
$sortcode = $paging->getHtmlSortCode($lng);
|
||||
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$searchcode = $paging->getHtmlSearchCode($lng);
|
||||
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$ctickets = array();
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
if(!isset($ctickets[$row['customerid']])
|
||||
|| !is_array($ctickets[$row['customerid']]))
|
||||
{
|
||||
$ctickets[$row['customerid']] = array();
|
||||
}
|
||||
|
||||
$ctickets[$row['customerid']][$row['id']] = $row;
|
||||
}
|
||||
|
||||
if($paging->sortfield == 'customerid'
|
||||
&& $paging->sortorder == 'desc')
|
||||
{
|
||||
krsort($ctickets);
|
||||
}
|
||||
else
|
||||
{
|
||||
ksort($ctickets);
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
$count = 0;
|
||||
$tickets_count = 0;
|
||||
$tickets = '';
|
||||
foreach($ctickets as $cid => $ticketrows)
|
||||
{
|
||||
$_cid = 0;
|
||||
foreach($ticketrows as $row)
|
||||
{
|
||||
if($paging->checkDisplay($i))
|
||||
{
|
||||
$row = htmlentities_array($row);
|
||||
$row['lastchange'] = date("d.m.y H:i", $row['lastchange']);
|
||||
|
||||
if($_cid != $row['customerid'])
|
||||
{
|
||||
$cid = $row['customerid'];
|
||||
$usr = $db->query_first('SELECT `firstname`, `name`, `loginname` FROM `' . TABLE_PANEL_CUSTOMERS . '`
|
||||
WHERE `customerid` = "' . (int)$cid . '"');
|
||||
$customer = $usr['firstname'] . " " . $usr['name'] . " (" . $usr['loginname'] . ")";
|
||||
eval("\$tickets.=\"" . getTemplate("ticket/tickets_customer") . "\";");
|
||||
}
|
||||
|
||||
$tickets_count++;
|
||||
|
||||
if($row['status'] >= 0
|
||||
&& $row['status'] <= 2)
|
||||
{
|
||||
$reopen = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$reopen = 1;
|
||||
}
|
||||
|
||||
$row['status'] = ticket::getStatusText($lng, $row['status']);
|
||||
$row['priority'] = ticket::getPriorityText($lng, $row['priority']);
|
||||
|
||||
if($row['lastreplier'] == '1')
|
||||
{
|
||||
$row['lastreplier'] = $lng['ticket']['staff'];
|
||||
$cananswer = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$row['lastreplier'] = $lng['ticket']['customer'];
|
||||
$cananswer = 1;
|
||||
}
|
||||
|
||||
if(strlen($row['subject']) > 20)
|
||||
{
|
||||
$row['subject'] = substr($row['subject'], 0, 17) . '...';
|
||||
}
|
||||
|
||||
eval("\$tickets.=\"" . getTemplate("ticket/tickets_tickets") . "\";");
|
||||
$count++;
|
||||
$_cid = $row['customerid'];
|
||||
}
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("ticket/tickets") . "\";");
|
||||
}
|
||||
elseif($action == 'new')
|
||||
{
|
||||
if($userinfo['tickets_used'] < $userinfo['tickets']
|
||||
|| $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('priority', validate($_POST['priority'], 'priority'), true, false);
|
||||
$newticket->Set('category', validate($_POST['category'], 'category'), true, false);
|
||||
$newticket->Set('customer', validate($_POST['customer'], 'customer'), true, false);
|
||||
$newticket->Set('message', validate(str_replace("\r\n", "\n", $_POST['message']), 'message', '/^[^\0]*$/'), true, false);
|
||||
|
||||
if($newticket->Get('subject') == null)
|
||||
{
|
||||
standard_error(array('stringisempty', 'mysubject'));
|
||||
}
|
||||
elseif($newticket->Get('message') == null)
|
||||
{
|
||||
standard_error(array('stringisempty', 'mymessage'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$now = time();
|
||||
$newticket->Set('admin', $userinfo['adminid'], true, true);
|
||||
$newticket->Set('dt', $now, true, true);
|
||||
$newticket->Set('lastchange', $now, true, true);
|
||||
$newticket->Set('ip', $_SERVER['REMOTE_ADDR'], true, true);
|
||||
$newticket->Set('status', '0', true, true);
|
||||
$newticket->Set('lastreplier', '1', true, true);
|
||||
$newticket->Set('by', '1', true, true);
|
||||
$newticket->Insert();
|
||||
$newticket->sendMail((int)$newticket->Get('customer'), 'new_ticket_by_staff_subject', $lng['mails']['new_ticket_by_staff']['subject'], 'new_ticket_by_staff_mailbody', $lng['mails']['new_ticket_by_staff']['mailbody']);
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "opened a new ticket for customer #" . $newticket->Get('customer') . " - '" . $newticket->Get('subject') . "'");
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$categories = '';
|
||||
$result = $db->query_first('SELECT `id`, `name` FROM `' . TABLE_PANEL_TICKET_CATS . '` WHERE `adminid` = "' . $userinfo['adminid'] . '" ORDER BY `name` ASC');
|
||||
|
||||
if(isset($result['name'])
|
||||
&& $result['name'] != '')
|
||||
{
|
||||
$result2 = $db->query('SELECT `id`, `name` FROM `' . TABLE_PANEL_TICKET_CATS . '` WHERE `adminid` = "' . $userinfo['adminid'] . '" ORDER BY `name` ASC');
|
||||
|
||||
while($row = $db->fetch_array($result2))
|
||||
{
|
||||
$categories.= makeoption($row['name'], $row['id']);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$categories = makeoption($lng['ticket']['no_cat'], '0');
|
||||
}
|
||||
|
||||
$customers = '';
|
||||
$result_customers = $db->query("SELECT `customerid`, `loginname`, `name`, `firstname`, `company` FROM `" . TABLE_PANEL_CUSTOMERS . "` " . ($userinfo['customers_see_all'] ? '' : " WHERE `adminid` = '" . (int)$userinfo['adminid'] . "' ") . " ORDER BY `name` ASC");
|
||||
|
||||
while($row_customer = $db->fetch_array($result_customers))
|
||||
{
|
||||
if($row_customer['company'] == '')
|
||||
{
|
||||
$customers.= makeoption($row_customer['name'] . ', ' . $row_customer['firstname'] . ' (' . $row_customer['loginname'] . ')', $row_customer['customerid']);
|
||||
}
|
||||
else
|
||||
{
|
||||
if($row_customer['name'] != ''
|
||||
&& $row_customer['firstname'] != '')
|
||||
{
|
||||
$customers.= makeoption($row_customer['name'] . ', ' . $row_customer['firstname'] . ' | ' . $row_customer['company'] . ' (' . $row_customer['loginname'] . ')', $row_customer['customerid']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$customers.= makeoption($row_customer['company'] . ' (' . $row_customer['loginname'] . ')', $row_customer['customerid']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$priorities = makeoption($lng['ticket']['unf_high'], '1');
|
||||
$priorities.= makeoption($lng['ticket']['unf_normal'], '2');
|
||||
$priorities.= makeoption($lng['ticket']['unf_low'], '3');
|
||||
eval("echo \"" . getTemplate("ticket/tickets_new") . "\";");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('nomoreticketsavailable');
|
||||
}
|
||||
}
|
||||
elseif($action == 'answer'
|
||||
&& $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('priority', validate($_POST['priority'], 'priority'), true, false);
|
||||
$replyticket->Set('message', validate(str_replace("\r\n", "\n", $_POST['message']), 'message', '/^[^\0]*$/'), true, false);
|
||||
|
||||
if($replyticket->Get('message') == null)
|
||||
{
|
||||
standard_error(array('stringisempty', 'mymessage'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$now = time();
|
||||
$mainticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$id);
|
||||
$replyticket->Set('customerid', $mainticket->Get('customer'), true, true);
|
||||
$replyticket->Set('lastchange', $now, true, true);
|
||||
$replyticket->Set('ip', $_SERVER['REMOTE_ADDR'], true, true);
|
||||
$replyticket->Set('status', '1', true, true);
|
||||
$replyticket->Set('answerto', (int)$id, true, false);
|
||||
$replyticket->Set('by', '1', true, true);
|
||||
$replyticket->Insert();
|
||||
|
||||
// Update priority if changed
|
||||
|
||||
if($replyticket->Get('priority') != $mainticket->Get('priority'))
|
||||
{
|
||||
$mainticket->Set('priority', $replyticket->Get('priority'), true);
|
||||
}
|
||||
|
||||
$mainticket->Set('lastchange', $now);
|
||||
$mainticket->Set('lastreplier', '1');
|
||||
$mainticket->Set('status', '2');
|
||||
$mainticket->Update();
|
||||
$mainticket->sendMail((int)$mainticket->Get('customer'), 'new_reply_ticket_by_staff_subject', $lng['mails']['new_reply_ticket_by_staff']['subject'], 'new_reply_ticket_by_staff_mailbody', $lng['mails']['new_reply_ticket_by_staff']['mailbody']);
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "answered ticket '" . $mainticket->Get('subject') . "'");
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$ticket_replies = '';
|
||||
$mainticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$id);
|
||||
$lastchange = date("d.m.Y H:i\h", $mainticket->Get('lastchange'));
|
||||
$status = ticket::getStatusText($lng, $mainticket->Get('status'));
|
||||
|
||||
if($mainticket->Get('status') >= 0
|
||||
&& $mainticket->Get('status') <= 2)
|
||||
{
|
||||
$isclosed = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$isclosed = 1;
|
||||
}
|
||||
|
||||
if($mainticket->Get('by') == '1')
|
||||
{
|
||||
$by = $lng['ticket']['staff'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$by = $lng['ticket']['customer'];
|
||||
}
|
||||
|
||||
$subject = $mainticket->Get('subject');
|
||||
$message = $mainticket->Get('message');
|
||||
eval("\$ticket_replies.=\"" . getTemplate("ticket/tickets_tickets_main") . "\";");
|
||||
$result = $db->query('SELECT `name` FROM `' . TABLE_PANEL_TICKET_CATS . '`
|
||||
WHERE `id`="' . (int)$mainticket->Get('category') . '"');
|
||||
$row = $db->fetch_array($result);
|
||||
$andere = $db->query('SELECT * FROM `' . TABLE_PANEL_TICKETS . '` WHERE `answerto`="' . (int)$id . '" ORDER BY `lastchange` DESC');
|
||||
|
||||
while($row2 = $db->fetch_array($andere))
|
||||
{
|
||||
$subticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$row2['id']);
|
||||
$lastchange = date("d.m.Y H:i\h", $subticket->Get('lastchange'));
|
||||
|
||||
if($subticket->Get('by') == '1')
|
||||
{
|
||||
$by = $lng['ticket']['staff'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$by = $lng['ticket']['customer'];
|
||||
}
|
||||
|
||||
$subject = $subticket->Get('subject');
|
||||
$message = $subticket->Get('message');
|
||||
eval("\$ticket_replies.=\"" . getTemplate("ticket/tickets_tickets_list") . "\";");
|
||||
}
|
||||
|
||||
$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']['low'], '3', $mainticket->Get('priority'), true, true);
|
||||
$subject = $mainticket->Get('subject');
|
||||
$ticket_replies_count = $db->num_rows($andere) + 1;
|
||||
|
||||
// don't forget the main-ticket!
|
||||
|
||||
eval("echo \"" . getTemplate("ticket/tickets_reply") . "\";");
|
||||
}
|
||||
}
|
||||
elseif($action == 'close'
|
||||
&& $id != 0)
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$now = time();
|
||||
$mainticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$id);
|
||||
$mainticket->Set('lastchange', $now, true, true);
|
||||
$mainticket->Set('lastreplier', '1', true, true);
|
||||
$mainticket->Set('status', '3', true, true);
|
||||
$mainticket->Update();
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "closed ticket '" . $mainticket->Get('subject') . "'");
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
$mainticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$id);
|
||||
ask_yesno('ticket_reallyclose', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $mainticket->Get('subject'));
|
||||
}
|
||||
}
|
||||
elseif($action == 'reopen'
|
||||
&& $id != 0)
|
||||
{
|
||||
$now = time();
|
||||
$mainticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$id);
|
||||
$mainticket->Set('lastchange', $now, true, true);
|
||||
$mainticket->Set('lastreplier', '1', true, true);
|
||||
$mainticket->Set('status', '0', true, true);
|
||||
$mainticket->Update();
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "reopened ticket '" . $mainticket->Get('subject') . "'");
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
elseif($action == 'archive'
|
||||
&& $id != 0)
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$now = time();
|
||||
$mainticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$id);
|
||||
$mainticket->Set('lastchange', $now, true, true);
|
||||
$mainticket->Set('lastreplier', '1', true, true);
|
||||
$mainticket->Set('status', '3', true, true);
|
||||
$mainticket->Update();
|
||||
$mainticket->Archive();
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "archived ticket '" . $mainticket->Get('subject') . "'");
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
$mainticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$id);
|
||||
ask_yesno('ticket_reallyarchive', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $mainticket->Get('subject'));
|
||||
}
|
||||
}
|
||||
elseif($action == 'delete'
|
||||
&& $id != 0)
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$mainticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$id);
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "deleted ticket '" . $mainticket->Get('subject') . "'");
|
||||
$mainticket->Delete();
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
$mainticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$id);
|
||||
ask_yesno('ticket_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $mainticket->Get('subject'));
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif($page == 'categories'
|
||||
&& $userinfo['customers'] != '0')
|
||||
{
|
||||
if($action == '')
|
||||
{
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_tickets::categories");
|
||||
$fields = array(
|
||||
'name' => $lng['ticket']['category']
|
||||
);
|
||||
$paging = new paging($userinfo, $db, TABLE_PANEL_TICKET_CATS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
|
||||
$result = $db->query("SELECT `main`.`id`, `main`.`name`, (
|
||||
SELECT COUNT(`sub`.`id`) FROM `" . TABLE_PANEL_TICKETS . "` `sub`
|
||||
WHERE `sub`.`category` = `main`.`id`
|
||||
AND `sub`.`answerto` = '0' AND `sub`.`adminid` = '" . $userinfo['adminid'] . "')
|
||||
as `ticketcount`, (
|
||||
SELECT COUNT(`sub2`.`id`) FROM `" . TABLE_PANEL_TICKETS . "` `sub2`
|
||||
WHERE `sub2`.`category` = `main`.`id`
|
||||
AND `sub2`.`answerto` = '0'
|
||||
AND (`sub2`.`status` = '0' OR `sub2`.`status` = '1' OR `sub2`.`status` = '2')
|
||||
AND `sub2`.`adminid` = '" . $userinfo['adminid'] . "'
|
||||
) as `ticketcountnotclosed`
|
||||
FROM `" . TABLE_PANEL_TICKET_CATS . "` `main` WHERE `main`.`adminid` = '" . (int)$userinfo['adminid'] . "' " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
|
||||
$paging->setEntries($db->num_rows($result));
|
||||
$sortcode = $paging->getHtmlSortCode($lng);
|
||||
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$searchcode = $paging->getHtmlSearchCode($lng);
|
||||
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$i = 0;
|
||||
$count = 0;
|
||||
$ticketcategories = '';
|
||||
$categories_count = $db->num_rows($result);
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
if($paging->checkDisplay($i))
|
||||
{
|
||||
$row = htmlentities_array($row);
|
||||
$closedtickets_count = ($row['ticketcount'] - $row['ticketcountnotclosed']);
|
||||
eval("\$ticketcategories.=\"" . getTemplate("ticket/tickets_categories") . "\";");
|
||||
$count++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("ticket/categories") . "\";");
|
||||
}
|
||||
elseif($action == 'addcategory')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$category = validate($_POST['category'], 'category');
|
||||
|
||||
if($category == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'mycategory'));
|
||||
}
|
||||
else
|
||||
{
|
||||
ticket::addCategory($db, $category, $userinfo['adminid']);
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "added ticket-category '" . $category . "'");
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
eval("echo \"" . getTemplate("ticket/tickets_newcategory") . "\";");
|
||||
}
|
||||
}
|
||||
elseif($action == 'editcategory'
|
||||
&& $id != 0)
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$category = validate($_POST['category'], 'category');
|
||||
|
||||
if($category == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'mycategory'));
|
||||
}
|
||||
else
|
||||
{
|
||||
ticket::editCategory($db, $category, $id);
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "edited ticket-category '" . $category . "'");
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$row = $db->query_first('SELECT * FROM `' . TABLE_PANEL_TICKET_CATS . '` WHERE `id` = "' . (int)$id . '"');
|
||||
eval("echo \"" . getTemplate("ticket/tickets_editcategory") . "\";");
|
||||
}
|
||||
}
|
||||
elseif($action == 'deletecategory'
|
||||
&& $id != 0)
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
if(ticket::deleteCategory($db, $id) == false)
|
||||
{
|
||||
standard_error('categoryhastickets');
|
||||
}
|
||||
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "deleted ticket-category #" . $id);
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
$name = ticket::getCategoryName($db, $id);
|
||||
ask_yesno('ticket_reallydeletecat', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $name);
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif($page == 'archive'
|
||||
&& $userinfo['customers'] != '0')
|
||||
{
|
||||
if($action == '')
|
||||
{
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_tickets::archive");
|
||||
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$priority = array();
|
||||
$categories = array();
|
||||
$subject = validate($_POST['subject'], 'subject');
|
||||
$priority[0] = isset($_POST['priority1']) ? $_POST['priority1'] : '';
|
||||
$priority[1] = isset($_POST['priority2']) ? $_POST['priority2'] : '';
|
||||
$priority[2] = isset($_POST['priority3']) ? $_POST['priority3'] : '';
|
||||
$fromdate = validate($_POST['fromdate'], 'fromdate');
|
||||
$todate = validate($_POST['todate'], 'todate');
|
||||
$message = validate($_POST['message'], 'message');
|
||||
$customer = validate($_POST['customer'], 'customer');
|
||||
$cat = $db->query_first('SELECT COUNT(`id`) as `ccount` FROM `' . TABLE_PANEL_TICKET_CATS . '`');
|
||||
for ($x = 0;$x < $cat['ccount'];$x++)
|
||||
{
|
||||
$categories[$x] = isset($_POST['category' . $x]) ? $_POST['category' . $x] : '';
|
||||
}
|
||||
|
||||
$query = ticket::getArchiveSearchStatement($subject, $priority, $fromdate, $todate, $message, $customer, $userinfo['adminid'], $categories);
|
||||
$fields = array(
|
||||
'lastchange' => $lng['ticket']['lastchange'],
|
||||
'ticket_answers' => $lng['ticket']['ticket_answers'],
|
||||
'subject' => $lng['ticket']['subject'],
|
||||
'lastreplier' => $lng['ticket']['lastreplier'],
|
||||
'priority' => $lng['ticket']['priority']
|
||||
);
|
||||
$paging = new paging($userinfo, $db, TABLE_PANEL_TICKETS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
|
||||
$result = $db->query($query . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
|
||||
$sortcode = $paging->getHtmlSortCode($lng);
|
||||
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$searchcode = $paging->getHtmlSearchCode($lng);
|
||||
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$ctickets = array();
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
if(!isset($ctickets[$row['customerid']])
|
||||
|| !is_array($ctickets[$row['customerid']]))
|
||||
{
|
||||
$ctickets[$row['customerid']] = array();
|
||||
}
|
||||
|
||||
$ctickets[$row['customerid']][$row['id']] = $row;
|
||||
}
|
||||
|
||||
if($paging->sortfield == 'customerid'
|
||||
&& $paging->sortorder == 'desc')
|
||||
{
|
||||
krsort($ctickets);
|
||||
}
|
||||
else
|
||||
{
|
||||
ksort($ctickets);
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
$count = 0;
|
||||
$tickets_count = 0;
|
||||
$tickets = '';
|
||||
foreach($ctickets as $cid => $ticketrows)
|
||||
{
|
||||
if($paging->sortfield == 'lastchange'
|
||||
&& $paging->sortorder == 'desc')
|
||||
{
|
||||
krsort($ticketrows);
|
||||
}
|
||||
else
|
||||
{
|
||||
ksort($ticketrows);
|
||||
}
|
||||
|
||||
$_cid = 0;
|
||||
foreach($ticketrows as $ticket)
|
||||
{
|
||||
if($paging->checkDisplay($i))
|
||||
{
|
||||
$ticket = htmlentities_array($ticket);
|
||||
$ticket['lastchange'] = date("d.m.y H:i", $ticket['lastchange']);
|
||||
|
||||
if($_cid != $ticket['customerid'])
|
||||
{
|
||||
$cid = $ticket['customerid'];
|
||||
$usr = $db->query_first('SELECT `firstname`, `name`, `loginname` FROM `' . TABLE_PANEL_CUSTOMERS . '`
|
||||
WHERE `customerid` = "' . (int)$cid . '"');
|
||||
$customer = $usr['firstname'] . " " . $usr['name'] . " (" . $usr['loginname'] . ")";
|
||||
eval("\$tickets.=\"" . getTemplate("ticket/tickets_customer") . "\";");
|
||||
}
|
||||
|
||||
$tickets_count++;
|
||||
$ticket['priority'] = ticket::getPriorityText($lng, $ticket['priority']);
|
||||
|
||||
if($ticket['lastreplier'] == '1')
|
||||
{
|
||||
$ticket['lastreplier'] = $lng['ticket']['staff'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$ticket['lastreplier'] = $lng['ticket']['customer'];
|
||||
}
|
||||
|
||||
if(strlen($ticket['subject']) > 20)
|
||||
{
|
||||
$ticket['subject'] = substr($ticket['subject'], 0, 17) . '...';
|
||||
}
|
||||
|
||||
eval("\$tickets.=\"" . getTemplate("ticket/archived_tickets") . "\";");
|
||||
$count++;
|
||||
$_cid = $ticket['customerid'];
|
||||
}
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("ticket/archivesearch") . "\";");
|
||||
}
|
||||
else
|
||||
{
|
||||
$archived = array();
|
||||
$archived = ticket::getLastArchived($db, 6, $userinfo['adminid']);
|
||||
$tickets = '';
|
||||
|
||||
if($archived !== false)
|
||||
{
|
||||
foreach($archived as $id => $ticket)
|
||||
{
|
||||
$ticket['lastchange'] = date("d.m.y H:i", $ticket['lastchange']);
|
||||
$ticket['priority'] = ticket::getPriorityText($lng, $ticket['priority']);
|
||||
|
||||
if($ticket['lastreplier'] == '1')
|
||||
{
|
||||
$ticket['lastreplier'] = $lng['ticket']['staff'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$ticket['lastreplier'] = $lng['ticket']['customer'];
|
||||
}
|
||||
|
||||
if(strlen($ticket['subject']) > 20)
|
||||
{
|
||||
$ticket['subject'] = substr($ticket['subject'], 0, 17) . '...';
|
||||
}
|
||||
|
||||
eval("\$tickets.=\"" . getTemplate("ticket/archived_tickets") . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
$priorities_options = makecheckbox('priority1', $lng['ticket']['unf_high'], '1');
|
||||
$priorities_options.= makecheckbox('priority2', $lng['ticket']['unf_normal'], '2');
|
||||
$priorities_options.= makecheckbox('priority3', $lng['ticket']['unf_low'], '3');
|
||||
$category_options = '';
|
||||
$ccount = 0;
|
||||
$result = $db->query('SELECT * FROM `' . TABLE_PANEL_TICKET_CATS . '` ORDER BY `name` ASC');
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
$category_options.= makecheckbox('category' . $ccount, $row['name'], $row['id'], true);
|
||||
$ccount++;
|
||||
}
|
||||
|
||||
$customers = makeoption($lng['ticket']['nocustomer'], '-1', '-1');
|
||||
$result = $db->query_first('SELECT `customerid` FROM `' . TABLE_PANEL_CUSTOMERS . '` ' . ($userinfo['customers_see_all'] ? '' : ' WHERE `adminid` = "' . (int)$userinfo['adminid'] . '" ') . 'ORDER BY `name` ASC');
|
||||
|
||||
if(isset($result['customerid'])
|
||||
&& $result['customerid'] != '')
|
||||
{
|
||||
$result2 = $db->query('SELECT `customerid`, `loginname`, `firstname`, `name`
|
||||
FROM `' . TABLE_PANEL_CUSTOMERS . '` ' . ($userinfo['customers_see_all'] ? '' : ' WHERE `adminid` = "' . (int)$userinfo['adminid'] . '" ') . ' ORDER BY `name` ASC');
|
||||
|
||||
while($row = $db->fetch_array($result2))
|
||||
{
|
||||
$customers.= makeoption($row['name'] . ', ' . $row['firstname'] . ' (' . $row['loginname'] . ')', $row['customerid']);
|
||||
}
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("ticket/archive") . "\";");
|
||||
}
|
||||
}
|
||||
elseif($action == 'view'
|
||||
&& $id != 0)
|
||||
{
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed archived-ticket #" . $id);
|
||||
$ticket_replies = '';
|
||||
$mainticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$id);
|
||||
$lastchange = date("d.m.Y H:i\h", $mainticket->Get('lastchange'));
|
||||
$status = ticket::getStatusText($lng, $mainticket->Get('status'));
|
||||
$isclosed = 1;
|
||||
|
||||
if($mainticket->Get('by') == '1')
|
||||
{
|
||||
$by = $lng['ticket']['staff'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$by = $lng['ticket']['customer'];
|
||||
}
|
||||
|
||||
$subject = $mainticket->Get('subject');
|
||||
$message = $mainticket->Get('message');
|
||||
eval("\$ticket_replies.=\"" . getTemplate("ticket/tickets_tickets_main") . "\";");
|
||||
$result = $db->query('SELECT `name` FROM `' . TABLE_PANEL_TICKET_CATS . '`
|
||||
WHERE `id`="' . (int)$mainticket->Get('category') . '"');
|
||||
$row = $db->fetch_array($result);
|
||||
$andere = $db->query('SELECT * FROM `' . TABLE_PANEL_TICKETS . '` WHERE `answerto`="' . (int)$id . '"');
|
||||
|
||||
while($row2 = $db->fetch_array($andere))
|
||||
{
|
||||
$subticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$row2['id']);
|
||||
$lastchange = date("d.m.Y H:i\h", $subticket->Get('lastchange'));
|
||||
|
||||
if($subticket->Get('by') == '1')
|
||||
{
|
||||
$by = $lng['ticket']['staff'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$by = $lng['ticket']['customer'];
|
||||
}
|
||||
|
||||
$subject = $subticket->Get('subject');
|
||||
$message = $subticket->Get('message');
|
||||
eval("\$ticket_replies.=\"" . getTemplate("ticket/tickets_tickets_list") . "\";");
|
||||
}
|
||||
|
||||
$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']['low'], '3', $mainticket->Get('priority'), true, true);
|
||||
$subject = $mainticket->Get('subject');
|
||||
$ticket_replies_count = $db->num_rows($andere) + 1;
|
||||
|
||||
// don't forget the main-ticket!
|
||||
|
||||
eval("echo \"" . getTemplate("ticket/tickets_view") . "\";");
|
||||
}
|
||||
elseif($action == 'delete'
|
||||
&& $id != 0)
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$mainticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$id);
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "deleted archived ticket '" . $mainticket->Get('subject') . "'");
|
||||
$mainticket->Delete();
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
$mainticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$id);
|
||||
ask_yesno('ticket_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $mainticket->Get('subject'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
34
customer_aps.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Sven Skrabal <info@nexpa.de>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
* @version $Id: customer_aps.php 2692 2009-03-27 18:04:47Z flo $
|
||||
* @todo
|
||||
*/
|
||||
|
||||
// Required code
|
||||
|
||||
define('AREA', 'customer');
|
||||
require ("./lib/init.php");
|
||||
require ("./lib/class_apsparser.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") . "\";");
|
||||
|
||||
?>
|
||||
216
customer_autoresponder.php
Normal file
@@ -0,0 +1,216 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Michael Schlechtinger
|
||||
* @author Sven Skrabal <info@nexpa.de>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
* @version $Id: customer_autoresponder.php 2692 2009-03-27 18:04:47Z flo $
|
||||
* @todo - add function to select periods when responders are active
|
||||
*/
|
||||
|
||||
// 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']);
|
||||
|
||||
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'] . "',
|
||||
`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>";
|
||||
}
|
||||
|
||||
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']);
|
||||
|
||||
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 . "',
|
||||
`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']);
|
||||
$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))
|
||||
{
|
||||
eval("\$autoresponder.=\"" . getTemplate("email/autoresponder_autoresponder") . "\";");
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("email/autoresponder") . "\";");
|
||||
}
|
||||
|
||||
?>
|
||||
492
customer_domains.php
Normal file
@@ -0,0 +1,492 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
* @version $Id: customer_domains.php 2713 2009-04-17 08:55:53Z flo $
|
||||
*/
|
||||
|
||||
define('AREA', 'customer');
|
||||
|
||||
/**
|
||||
* Include our init.php, which manages Sessions, Language etc.
|
||||
*/
|
||||
|
||||
require ("./lib/init.php");
|
||||
|
||||
if(isset($_POST['id']))
|
||||
{
|
||||
$id = intval($_POST['id']);
|
||||
}
|
||||
elseif(isset($_GET['id']))
|
||||
{
|
||||
$id = intval($_GET['id']);
|
||||
}
|
||||
|
||||
if($page == 'overview')
|
||||
{
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_domains");
|
||||
eval("echo \"" . getTemplate("domains/domains") . "\";");
|
||||
}
|
||||
elseif($page == 'domains')
|
||||
{
|
||||
if($action == '')
|
||||
{
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_domains::domains");
|
||||
$fields = array(
|
||||
'd.domain' => $lng['domains']['domainname'],
|
||||
'd.documentroot' => $lng['panel']['path'],
|
||||
'd.aliasdomain' => $lng['domains']['aliasdomain']
|
||||
);
|
||||
$paging = new paging($userinfo, $db, TABLE_PANEL_DOMAINS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
|
||||
$result = $db->query("SELECT `d`.`id`, " . " `d`.`customerid`, " . " `d`.`domain`, " . " `d`.`documentroot`, " . " `d`.`isemaildomain`, " . " `d`.`caneditdomain`, " . " `d`.`iswildcarddomain`, " . " `d`.`parentdomainid`, " . " `ad`.`id` AS `aliasdomainid`, " . " `ad`.`domain` AS `aliasdomain`, " . " `da`.`id` AS `domainaliasid`, " . " `da`.`domain` AS `domainalias` " . "FROM `" . TABLE_PANEL_DOMAINS . "` `d` " . "LEFT JOIN `" . TABLE_PANEL_DOMAINS . "` `ad` ON `d`.`aliasdomain`=`ad`.`id` " . "LEFT JOIN `" . TABLE_PANEL_DOMAINS . "` `da` ON `da`.`aliasdomain`=`d`.`id` " . "WHERE `d`.`customerid`='" . (int)$userinfo['customerid'] . "' " . " AND `d`.`email_only`='0' AND `d`.`id` <> " . (int)$userinfo['standardsubdomain'] . " " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
|
||||
$paging->setEntries($db->num_rows($result));
|
||||
$sortcode = $paging->getHtmlSortCode($lng);
|
||||
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$searchcode = $paging->getHtmlSearchCode($lng);
|
||||
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$domains = '';
|
||||
$parentdomains_count = 0;
|
||||
$domains_count = 0;
|
||||
$domain_array = array();
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
$row['domain'] = $idna_convert->decode($row['domain']);
|
||||
$row['aliasdomain'] = $idna_convert->decode($row['aliasdomain']);
|
||||
$row['domainalias'] = $idna_convert->decode($row['domainalias']);
|
||||
|
||||
if($row['parentdomainid'] == '0'
|
||||
&& $row['iswildcarddomain'] != '1'
|
||||
&& $row['caneditdomain'] == '1')
|
||||
{
|
||||
$parentdomains_count++;
|
||||
}
|
||||
|
||||
$domains_count++;
|
||||
$domainparts = explode('.', $row['domain']);
|
||||
$domainparts = array_reverse($domainparts);
|
||||
$sortkey = '';
|
||||
foreach($domainparts as $key => $part)
|
||||
{
|
||||
$sortkey.= $part . '.';
|
||||
}
|
||||
|
||||
$domain_array[$sortkey] = $row;
|
||||
}
|
||||
|
||||
ksort($domain_array);
|
||||
$domain_id_array = array();
|
||||
foreach($domain_array as $sortkey => $row)
|
||||
{
|
||||
$domain_id_array[$row['id']] = $sortkey;
|
||||
}
|
||||
|
||||
$domain_sort_array = array();
|
||||
foreach($domain_array as $sortkey => $row)
|
||||
{
|
||||
if($row['parentdomainid'] == 0)
|
||||
{
|
||||
$domain_sort_array[$sortkey][$sortkey] = $row;
|
||||
}
|
||||
else
|
||||
{
|
||||
$domain_sort_array[$domain_id_array[$row['parentdomainid']]][$sortkey] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
$domain_array = array();
|
||||
|
||||
if($paging->sortfield == 'd.domain'
|
||||
&& $paging->sortorder == 'asc')
|
||||
{
|
||||
ksort($domain_sort_array);
|
||||
}
|
||||
elseif($paging->sortfield == 'd.domain'
|
||||
&& $paging->sortorder == 'desc')
|
||||
{
|
||||
krsort($domain_sort_array);
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
foreach($domain_sort_array as $sortkey => $domain_array)
|
||||
{
|
||||
if($paging->checkDisplay($i))
|
||||
{
|
||||
$row = htmlentities_array($domain_array[$sortkey]);
|
||||
eval("\$domains.=\"" . getTemplate("domains/domains_delimiter") . "\";");
|
||||
|
||||
if($paging->sortfield == 'd.domain'
|
||||
&& $paging->sortorder == 'asc')
|
||||
{
|
||||
ksort($domain_array);
|
||||
}
|
||||
elseif($paging->sortfield == 'd.domain'
|
||||
&& $paging->sortorder == 'desc')
|
||||
{
|
||||
krsort($domain_array);
|
||||
}
|
||||
|
||||
foreach($domain_array as $row)
|
||||
{
|
||||
if(strpos($row['documentroot'], $userinfo['documentroot']) === 0)
|
||||
{
|
||||
$row['documentroot'] = makeCorrectDir(substr($row['documentroot'], strlen($userinfo['documentroot'])));
|
||||
}
|
||||
|
||||
$row = htmlentities_array($row);
|
||||
eval("\$domains.=\"" . getTemplate("domains/domains_domain") . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
$i+= count($domain_array);
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("domains/domainlist") . "\";");
|
||||
}
|
||||
elseif($action == 'delete'
|
||||
&& $id != 0)
|
||||
{
|
||||
$result = $db->query_first("SELECT `id`, `customerid`, `domain`, `documentroot`, `isemaildomain`, `parentdomainid` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
|
||||
$alias_check = $db->query_first('SELECT COUNT(`id`) AS `count` FROM `' . TABLE_PANEL_DOMAINS . '` WHERE `aliasdomain`=\'' . (int)$id . '\'');
|
||||
|
||||
if(isset($result['parentdomainid'])
|
||||
&& $result['parentdomainid'] != '0'
|
||||
&& $alias_check['count'] == 0)
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
if($result['isemaildomain'] == '1')
|
||||
{
|
||||
$emails = $db->query_first('SELECT COUNT(`id`) AS `count` FROM `' . TABLE_MAIL_VIRTUAL . '` WHERE `customerid`=\'' . (int)$userinfo['customerid'] . '\' AND `domainid`=\'' . (int)$id . '\'');
|
||||
|
||||
if($emails['count'] != '0')
|
||||
{
|
||||
standard_error('domains_cantdeletedomainwithemail');
|
||||
}
|
||||
}
|
||||
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "deleted subdomain '" . $idna_convert->decode($result['domain']) . "'");
|
||||
$result = $db->query("DELETE FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
|
||||
$result = $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `subdomains_used`=`subdomains_used`-1 WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
|
||||
inserttask('1');
|
||||
inserttask('4');
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
ask_yesno('domains_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $idna_convert->decode($result['domain']));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('domains_cantdeletemaindomain');
|
||||
}
|
||||
}
|
||||
elseif($action == 'add')
|
||||
{
|
||||
if($userinfo['subdomains_used'] < $userinfo['subdomains']
|
||||
|| $userinfo['subdomains'] == '-1')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$subdomain = $idna_convert->encode(preg_replace(Array('/\:(\d)+$/', '/^https?\:\/\//'), '', validate($_POST['subdomain'], 'subdomain', '', 'subdomainiswrong')));
|
||||
$domain = $idna_convert->encode($_POST['domain']);
|
||||
$domain_check = $db->query_first("SELECT * FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `domain`='" . $db->escape($domain) . "' AND `customerid`='" . (int)$userinfo['customerid'] . "' AND `parentdomainid`='0' AND `email_only`='0' AND `iswildcarddomain`='0' AND `caneditdomain`='1' ");
|
||||
$completedomain = $subdomain . '.' . $domain;
|
||||
$completedomain_check = $db->query_first("SELECT * FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `domain`='" . $db->escape($completedomain) . "' AND `customerid`='" . (int)$userinfo['customerid'] . "' AND `email_only`='0' AND `caneditdomain` = '1'");
|
||||
$aliasdomain = intval($_POST['alias']);
|
||||
$aliasdomain_check = array(
|
||||
'id' => 0
|
||||
);
|
||||
|
||||
if($aliasdomain != 0)
|
||||
{
|
||||
$aliasdomain_check = $db->query_first('SELECT `id` FROM `' . TABLE_PANEL_DOMAINS . '` `d`,`' . TABLE_PANEL_CUSTOMERS . '` `c` WHERE `d`.`customerid`=\'' . (int)$userinfo['customerid'] . '\' AND `d`.`aliasdomain` IS NULL AND `d`.`id`<>`c`.`standardsubdomain` AND `c`.`customerid`=\'' . (int)$userinfo['customerid'] . '\' AND `d`.`id`=\'' . (int)$aliasdomain . '\'');
|
||||
}
|
||||
|
||||
if(isset($_POST['url'])
|
||||
&& $_POST['url'] != ''
|
||||
&& validateUrl($idna_convert->encode($_POST['url'])))
|
||||
{
|
||||
$path = $_POST['url'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$path = validate($_POST['path'], 'path');
|
||||
}
|
||||
|
||||
if(!preg_match('/^https?\:\/\//', $path)
|
||||
|| !validateUrl($idna_convert->encode($path)))
|
||||
{
|
||||
$path = $userinfo['documentroot'] . '/' . $path;
|
||||
$path = makeCorrectDir($path);
|
||||
}
|
||||
|
||||
if(isset($_POST['openbasedir_path'])
|
||||
&& $_POST['openbasedir_path'] == '1')
|
||||
{
|
||||
$openbasedir_path = '1';
|
||||
}
|
||||
else
|
||||
{
|
||||
$openbasedir_path = '0';
|
||||
}
|
||||
|
||||
if(isset($_POST['ssl_redirect'])
|
||||
&& $_POST['ssl_redirect'] == '1')
|
||||
{
|
||||
$ssl_redirect = '1';
|
||||
}
|
||||
else
|
||||
{
|
||||
$ssl_redirect = '0';
|
||||
}
|
||||
|
||||
if($path == '')
|
||||
{
|
||||
standard_error('patherror');
|
||||
}
|
||||
elseif($subdomain == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'domainname'));
|
||||
}
|
||||
elseif($subdomain == 'www' && $domain_check['wwwserveralias'] == '1')
|
||||
{
|
||||
standard_error('wwwnotallowed');
|
||||
}
|
||||
elseif($domain == '')
|
||||
{
|
||||
standard_error('domaincantbeempty');
|
||||
}
|
||||
elseif(strtolower($completedomain_check['domain']) == strtolower($completedomain))
|
||||
{
|
||||
standard_error('domainexistalready', $completedomain);
|
||||
}
|
||||
elseif(strtolower($domain_check['domain']) != strtolower($domain))
|
||||
{
|
||||
standard_error('maindomainnonexist', $domain);
|
||||
}
|
||||
elseif($aliasdomain_check['id'] != $aliasdomain)
|
||||
{
|
||||
standard_error('domainisaliasorothercustomer');
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $db->query("INSERT INTO `" . TABLE_PANEL_DOMAINS . "` (`customerid`, `domain`, `documentroot`, `ipandport`, `aliasdomain`, `parentdomainid`, `isemaildomain`, `openbasedir`, `openbasedir_path`, `safemode`, `speciallogfile`, `specialsettings`, `ssl_redirect`) VALUES ('" . (int)$userinfo['customerid'] . "', '" . $db->escape($completedomain) . "', '" . $db->escape($path) . "', '" . $db->escape($domain_check['ipandport']) . "', " . (($aliasdomain != 0) ? "'" . $db->escape($aliasdomain) . "'" : "NULL") . ", '" . (int)$domain_check['id'] . "', '" . ($domain_check['subcanemaildomain'] == '3' ? '1' : '0') . "', '" . $db->escape($domain_check['openbasedir']) . "', '" . $db->escape($openbasedir_path) . "', '" . $db->escape($domain_check['safemode']) . "', '" . $db->escape($domain_check['speciallogfile']) . "', '" . $db->escape($domain_check['specialsettings']) . "', '" . $ssl_redirect . "')");
|
||||
$result = $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `subdomains_used`=`subdomains_used`+1 WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "added subdomain '" . $completedomain . "'");
|
||||
inserttask('1');
|
||||
inserttask('4');
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $db->query("SELECT `id`, `domain`, `documentroot`, `ssl_redirect`,`isemaildomain` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `parentdomainid`='0' AND `email_only`='0' AND `iswildcarddomain`='0' AND `caneditdomain`='1' ORDER BY `domain` ASC");
|
||||
$domains = '';
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
$domains.= makeoption($idna_convert->decode($row['domain']), $row['domain']);
|
||||
}
|
||||
|
||||
$aliasdomains = makeoption($lng['domains']['noaliasdomain'], 0, NULL, true);
|
||||
$result_domains = $db->query("SELECT `d`.`id`, `d`.`domain` FROM `" . TABLE_PANEL_DOMAINS . "` `d`, `" . TABLE_PANEL_CUSTOMERS . "` `c` WHERE `d`.`aliasdomain` IS NULL AND `d`.`id` <> `c`.`standardsubdomain` AND `d`.`customerid`=`c`.`customerid` AND `d`.`email_only`='0' AND `d`.`customerid`=" . (int)$userinfo['customerid'] . " ORDER BY `d`.`domain` ASC");
|
||||
|
||||
while($row_domain = $db->fetch_array($result_domains))
|
||||
{
|
||||
$aliasdomains.= makeoption($idna_convert->decode($row_domain['domain']), $row_domain['id']);
|
||||
}
|
||||
|
||||
$ssl_redirect = makeyesno('ssl_redirect', '1', '0', $result['ssl_redirect']);
|
||||
$openbasedir = makeoption($lng['domain']['docroot'], 0, NULL, true) . makeoption($lng['domain']['homedir'], 1, NULL, true);
|
||||
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit']);
|
||||
eval("echo \"" . getTemplate("domains/domains_add") . "\";");
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif($action == 'edit'
|
||||
&& $id != 0)
|
||||
{
|
||||
$result = $db->query_first("SELECT `d`.`id`, `d`.`customerid`, `d`.`domain`, `d`.`documentroot`, `d`.`isemaildomain`, `d`.`iswildcarddomain`, `d`.`parentdomainid`, `d`.`ssl_redirect`, `d`.`aliasdomain`, `d`.`openbasedir_path` ,`pd`.`subcanemaildomain` FROM `" . TABLE_PANEL_DOMAINS . "` `d`, `" . TABLE_PANEL_DOMAINS . "` `pd` WHERE `d`.`customerid`='" . (int)$userinfo['customerid'] . "' AND `d`.`id`='" . (int)$id . "' AND ((`d`.`parentdomainid`!='0' AND `pd`.`id`=`d`.`parentdomainid`) OR (`d`.`parentdomainid`='0' AND `pd`.`id`=`d`.`id`)) AND `d`.`caneditdomain`='1'");
|
||||
$alias_check = $db->query_first('SELECT COUNT(`id`) AS count FROM `' . TABLE_PANEL_DOMAINS . '` WHERE `aliasdomain`=\'' . (int)$result['id'] . '\'');
|
||||
$alias_check = $alias_check['count'];
|
||||
|
||||
if(isset($result['customerid'])
|
||||
&& $result['customerid'] == $userinfo['customerid'])
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
if(isset($_POST['url'])
|
||||
&& $_POST['url'] != ''
|
||||
&& validateUrl($idna_convert->encode($_POST['url'])))
|
||||
{
|
||||
$path = $_POST['url'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$path = validate($_POST['path'], 'path');
|
||||
}
|
||||
|
||||
if(!preg_match('/^https?\:\/\//', $path)
|
||||
|| !validateUrl($idna_convert->encode($path)))
|
||||
{
|
||||
$path = $userinfo['documentroot'] . '/' . $path;
|
||||
$path = makeCorrectDir($path);
|
||||
}
|
||||
|
||||
$aliasdomain = intval($_POST['alias']);
|
||||
|
||||
if(isset($_POST['iswildcarddomain'])
|
||||
&& $_POST['iswildcarddomain'] == '1'
|
||||
&& $result['parentdomainid'] == '0'
|
||||
&& $userinfo['subdomains'] != '0')
|
||||
{
|
||||
$wildcarddomaincheck = $db->query("SELECT `id` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `parentdomainid` = '" . (int)$result['id'] . "'");
|
||||
|
||||
if($db->num_rows($wildcarddomaincheck) != '0')
|
||||
{
|
||||
standard_error('firstdeleteallsubdomains');
|
||||
exit;
|
||||
}
|
||||
|
||||
$iswildcarddomain = '1';
|
||||
}
|
||||
else
|
||||
{
|
||||
$iswildcarddomain = '0';
|
||||
}
|
||||
|
||||
if($result['parentdomainid'] != '0'
|
||||
&& ($result['subcanemaildomain'] == '1' || $result['subcanemaildomain'] == '2')
|
||||
&& isset($_POST['isemaildomain']))
|
||||
{
|
||||
$isemaildomain = intval($_POST['isemaildomain']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$isemaildomain = $result['isemaildomain'];
|
||||
}
|
||||
|
||||
$aliasdomain_check = array(
|
||||
'id' => 0
|
||||
);
|
||||
|
||||
if($aliasdomain != 0)
|
||||
{
|
||||
$aliasdomain_check = $db->query_first('SELECT `id` FROM `' . TABLE_PANEL_DOMAINS . '` `d`,`' . TABLE_PANEL_CUSTOMERS . '` `c` WHERE `d`.`customerid`=\'' . (int)$result['customerid'] . '\' AND `d`.`aliasdomain` IS NULL AND `d`.`id`<>`c`.`standardsubdomain` AND `c`.`customerid`=\'' . (int)$result['customerid'] . '\' AND `d`.`id`=\'' . (int)$aliasdomain . '\'');
|
||||
}
|
||||
|
||||
if($aliasdomain_check['id'] != $aliasdomain)
|
||||
{
|
||||
standard_error('domainisaliasorothercustomer');
|
||||
}
|
||||
|
||||
if(isset($_POST['openbasedir_path'])
|
||||
&& $_POST['openbasedir_path'] == '1')
|
||||
{
|
||||
$openbasedir_path = '1';
|
||||
}
|
||||
else
|
||||
{
|
||||
$openbasedir_path = '0';
|
||||
}
|
||||
|
||||
if(isset($_POST['ssl_redirect'])
|
||||
&& $_POST['ssl_redirect'] == '1')
|
||||
{
|
||||
$ssl_redirect = '1';
|
||||
}
|
||||
else
|
||||
{
|
||||
$ssl_redirect = '0';
|
||||
}
|
||||
|
||||
if($path == '')
|
||||
{
|
||||
standard_error('patherror');
|
||||
}
|
||||
else
|
||||
{
|
||||
if(($result['isemaildomain'] == '1')
|
||||
&& ($isemaildomain == '0'))
|
||||
{
|
||||
$db->query("DELETE FROM `" . TABLE_MAIL_USERS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `domainid`='" . (int)$id . "'");
|
||||
$db->query("DELETE FROM `" . TABLE_MAIL_VIRTUAL . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `domainid`='" . (int)$id . "'");
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "automatically deleted mail-table entries for '" . $idna_convert->decode($result['domain']) . "'");
|
||||
}
|
||||
|
||||
if($path != $result['documentroot']
|
||||
|| $isemaildomain != $result['isemaildomain']
|
||||
|| $iswildcarddomain != $result['iswildcarddomain']
|
||||
|| $aliasdomain != $result['aliasdomain']
|
||||
|| $openbasedir_path != $result['openbasedir_path']
|
||||
|| $ssl_redirect != $result['ssl_redirect'])
|
||||
{
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "edited domain '" . $idna_convert->decode($result['domain']) . "'");
|
||||
inserttask('1');
|
||||
inserttask('4');
|
||||
$result = $db->query("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET `documentroot`='" . $db->escape($path) . "', `isemaildomain`='" . (int)$isemaildomain . "', `iswildcarddomain`='" . (int)$iswildcarddomain . "', `aliasdomain`=" . (($aliasdomain != 0 && $alias_check == 0) ? '\'' . $db->escape($aliasdomain) . '\'' : 'NULL') . ",`openbasedir_path`='" . $db->escape($openbasedir_path) . "', `ssl_redirect`='" . $ssl_redirect . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
|
||||
}
|
||||
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$result['domain'] = $idna_convert->decode($result['domain']);
|
||||
$domains = makeoption($lng['domains']['noaliasdomain'], 0, $result['aliasdomain'], true);
|
||||
$result_domains = $db->query("SELECT `d`.`id`, `d`.`domain` FROM `" . TABLE_PANEL_DOMAINS . "` `d`, `" . TABLE_PANEL_CUSTOMERS . "` `c` WHERE `d`.`aliasdomain` IS NULL AND `d`.`id`<>'" . (int)$result['id'] . "' AND `c`.`standardsubdomain`<>`d`.`id` AND `d`.`customerid`='" . (int)$userinfo['customerid'] . "' AND `c`.`customerid`=`d`.`customerid` ORDER BY `d`.`domain` ASC");
|
||||
|
||||
while($row_domain = $db->fetch_array($result_domains))
|
||||
{
|
||||
$domains.= makeoption($idna_convert->decode($row_domain['domain']), $row_domain['id'], $result['aliasdomain']);
|
||||
}
|
||||
|
||||
if(preg_match('/^https?\:\/\//', $result['documentroot'])
|
||||
&& validateUrl($idna_convert->encode($result['documentroot']))
|
||||
&& $settings['panel']['pathedit'] == 'Dropdown')
|
||||
{
|
||||
$urlvalue = $result['documentroot'];
|
||||
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$urlvalue = '';
|
||||
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit'], $result['documentroot']);
|
||||
}
|
||||
|
||||
$ssl_redirect = makeyesno('ssl_redirect', '1', '0', $result['ssl_redirect']);
|
||||
$iswildcarddomain = makeyesno('iswildcarddomain', '1', '0', $result['iswildcarddomain']);
|
||||
$isemaildomain = makeyesno('isemaildomain', '1', '0', $result['isemaildomain']);
|
||||
$openbasedir = makeoption($lng['domain']['docroot'], 0, $result['openbasedir_path'], true) . makeoption($lng['domain']['homedir'], 1, $result['openbasedir_path'], true);
|
||||
$result = htmlentities_array($result);
|
||||
|
||||
if($settings['system']['use_ssl'] == "1")
|
||||
{
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("domains/domains_edit") . "\";");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('domains_canteditdomain');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
712
customer_email.php
Normal file
@@ -0,0 +1,712 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
* @version $Id: customer_email.php 2718 2009-04-30 18:36:58Z flo $
|
||||
*/
|
||||
|
||||
define('AREA', 'customer');
|
||||
|
||||
/**
|
||||
* Include our init.php, which manages Sessions, Language etc.
|
||||
*/
|
||||
|
||||
require ("./lib/init.php");
|
||||
|
||||
if(isset($_POST['id']))
|
||||
{
|
||||
$id = intval($_POST['id']);
|
||||
}
|
||||
elseif(isset($_GET['id']))
|
||||
{
|
||||
$id = intval($_GET['id']);
|
||||
}
|
||||
|
||||
if($page == 'overview')
|
||||
{
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_email");
|
||||
eval("echo \"" . getTemplate("email/email") . "\";");
|
||||
}
|
||||
elseif($page == 'emails')
|
||||
{
|
||||
if($action == '')
|
||||
{
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_email::emails");
|
||||
$fields = array(
|
||||
'd.domain' => $lng['domains']['domainname'],
|
||||
'm.email_full' => $lng['emails']['emailaddress'],
|
||||
'm.destination' => $lng['emails']['forwarders']
|
||||
);
|
||||
$paging = new paging($userinfo, $db, TABLE_MAIL_VIRTUAL, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
|
||||
$result = $db->query('SELECT `m`.`id`, `m`.`domainid`, `m`.`email`, `m`.`email_full`, `m`.`iscatchall`, `u`.`quota`, `m`.`destination`, `m`.`popaccountid`, `d`.`domain` FROM `' . TABLE_MAIL_VIRTUAL . '` `m` LEFT JOIN `' . TABLE_PANEL_DOMAINS . '` `d` ON (`m`.`domainid` = `d`.`id`) LEFT JOIN `' . TABLE_MAIL_USERS . '` `u` ON (`m`.`popaccountid` = `u`.`id`) WHERE `m`.`customerid`="' . $db->escape($userinfo['customerid']) . '" ' . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
|
||||
$paging->setEntries($db->num_rows($result));
|
||||
$sortcode = $paging->getHtmlSortCode($lng);
|
||||
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$searchcode = $paging->getHtmlSearchCode($lng);
|
||||
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$emails = array();
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
if(!isset($emails[$row['domain']])
|
||||
|| !is_array($emails[$row['domain']]))
|
||||
{
|
||||
$emails[$row['domain']] = array();
|
||||
}
|
||||
|
||||
$emails[$row['domain']][$row['email_full']] = $row;
|
||||
}
|
||||
|
||||
if($paging->sortfield == 'd.domain'
|
||||
&& $paging->sortorder == 'desc')
|
||||
{
|
||||
krsort($emails);
|
||||
}
|
||||
else
|
||||
{
|
||||
ksort($emails);
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
$count = 0;
|
||||
$accounts = '';
|
||||
$emails_count = 0;
|
||||
$domainname = '';
|
||||
foreach($emails as $domainid => $emailaddresses)
|
||||
{
|
||||
if($paging->sortfield == 'm.email_full'
|
||||
&& $paging->sortorder == 'desc')
|
||||
{
|
||||
krsort($emailaddresses);
|
||||
}
|
||||
else
|
||||
{
|
||||
ksort($emailaddresses);
|
||||
}
|
||||
|
||||
foreach($emailaddresses as $row)
|
||||
{
|
||||
if($paging->checkDisplay($i))
|
||||
{
|
||||
if($domainname != $idna_convert->decode($row['domain']))
|
||||
{
|
||||
$domainname = $idna_convert->decode($row['domain']);
|
||||
eval("\$accounts.=\"" . getTemplate("email/emails_domain") . "\";");
|
||||
}
|
||||
|
||||
$emails_count++;
|
||||
$row['email'] = $idna_convert->decode($row['email']);
|
||||
$row['email_full'] = $idna_convert->decode($row['email_full']);
|
||||
$row['destination'] = explode(' ', $row['destination']);
|
||||
uasort($row['destination'], 'strcasecmp');
|
||||
|
||||
while(list($dest_id, $destination) = each($row['destination']))
|
||||
{
|
||||
$row['destination'][$dest_id] = $idna_convert->decode($row['destination'][$dest_id]);
|
||||
|
||||
if($row['destination'][$dest_id] == $row['email_full'])
|
||||
{
|
||||
unset($row['destination'][$dest_id]);
|
||||
}
|
||||
}
|
||||
|
||||
$destinations_count = count($row['destination']);
|
||||
$row['destination'] = implode(', ', $row['destination']);
|
||||
|
||||
if(strlen($row['destination']) > 35)
|
||||
{
|
||||
$row['destination'] = substr($row['destination'], 0, 32) . '... (' . $destinations_count . ')';
|
||||
}
|
||||
|
||||
$row = htmlentities_array($row);
|
||||
eval("\$accounts.=\"" . getTemplate("email/emails_email") . "\";");
|
||||
$count++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$emaildomains_count = $db->query_first("SELECT COUNT(`id`) AS `count` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `customerid`='" . $userinfo['customerid'] . "' AND `isemaildomain`='1' ORDER BY `domain` ASC");
|
||||
$emaildomains_count = $emaildomains_count['count'];
|
||||
eval("echo \"" . getTemplate("email/emails") . "\";");
|
||||
}
|
||||
elseif($action == 'delete'
|
||||
&& $id != 0)
|
||||
{
|
||||
$result = $db->query_first("SELECT `id`, `email`, `email_full`, `iscatchall`, `destination`, `customerid`, `popaccountid` FROM `" . TABLE_MAIL_VIRTUAL . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
|
||||
|
||||
if(isset($result['email'])
|
||||
&& $result['email'] != '')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$update_users_query_addon = '';
|
||||
|
||||
if($result['destination'] != '')
|
||||
{
|
||||
$result['destination'] = explode(' ', $result['destination']);
|
||||
$number_forwarders = count($result['destination']);
|
||||
|
||||
if($result['popaccountid'] != 0)
|
||||
{
|
||||
// Free the Quota used by the email account
|
||||
|
||||
if($settings['system']['mail_quota_enabled'] == 1)
|
||||
{
|
||||
$res_quota = $db->query_first("SELECT `quota` FROM `" . TABLE_MAIL_USERS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$result['popaccountid'] . "'");
|
||||
$update_users_query_addon.= " , `email_quota_used` = `email_quota_used` - " . (int)$res_quota['quota'] . " ";
|
||||
}
|
||||
|
||||
$db->query("DELETE FROM `" . TABLE_MAIL_USERS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$result['popaccountid'] . "'");
|
||||
$update_users_query_addon .= " , `email_accounts_used` = `email_accounts_used` - 1 ";
|
||||
$number_forwarders-= 1;
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "deleted forwarder for email address '" . $result['email'] . "'");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$number_forwarders = 0;
|
||||
}
|
||||
|
||||
$db->query("DELETE FROM `" . TABLE_MAIL_VIRTUAL . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
|
||||
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `emails_used`=`emails_used` - 1 , `email_forwarders_used` = `email_forwarders_used` - " . (int)$number_forwarders . " $update_users_query_addon WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "deleted email address '" . $result['email'] . "'");
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
ask_yesno('email_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $idna_convert->decode($result['email_full']));
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif($action == 'add')
|
||||
{
|
||||
if($userinfo['emails_used'] < $userinfo['emails']
|
||||
|| $userinfo['emails'] == '-1')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$email_part = $_POST['email_part'];
|
||||
$domain = $idna_convert->encode(validate($_POST['domain'], 'domain'));
|
||||
$domain_check = $db->query_first("SELECT `id`, `domain`, `customerid` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `domain`='" . $db->escape($domain) . "' AND `customerid`='" . (int)$userinfo['customerid'] . "' AND `isemaildomain`='1' ");
|
||||
|
||||
if(isset($_POST['iscatchall'])
|
||||
&& $_POST['iscatchall'] == '1')
|
||||
{
|
||||
$iscatchall = '1';
|
||||
$email = '@' . $domain;
|
||||
}
|
||||
else
|
||||
{
|
||||
$iscatchall = '0';
|
||||
$email = $email_part . '@' . $domain;
|
||||
}
|
||||
|
||||
$email_full = $email_part . '@' . $domain;
|
||||
|
||||
if(!validateEmail($email_full))
|
||||
{
|
||||
standard_error('emailiswrong', $email_full);
|
||||
}
|
||||
|
||||
$email_check = $db->query_first("SELECT `id`, `email`, `email_full`, `iscatchall`, `destination`, `customerid` FROM `" . TABLE_MAIL_VIRTUAL . "` WHERE ( `email`='" . $db->escape($email) . "' OR `email_full` = '" . $db->escape($email_full) . "' ) AND `customerid`='" . (int)$userinfo['customerid'] . "'");
|
||||
|
||||
if($email == ''
|
||||
|| $email_full == ''
|
||||
|| $email_part == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'emailadd'));
|
||||
}
|
||||
elseif($domain == '')
|
||||
{
|
||||
standard_error('domaincantbeempty');
|
||||
}
|
||||
elseif($domain_check['domain'] != $domain)
|
||||
{
|
||||
standard_error('maindomainnonexist', $domain);
|
||||
}
|
||||
elseif($email_check['email_full'] == $email_full)
|
||||
{
|
||||
standard_error('emailexistalready', $email_full);
|
||||
}
|
||||
elseif($email_check['email'] == $email)
|
||||
{
|
||||
standard_error('youhavealreadyacatchallforthisdomain');
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->query("INSERT INTO `" . TABLE_MAIL_VIRTUAL . "` (`customerid`, `email`, `email_full`, `iscatchall`, `domainid`) VALUES ('" . (int)$userinfo['customerid'] . "', '" . $db->escape($email) . "', '" . $db->escape($email_full) . "', '" . $db->escape($iscatchall) . "', '" . (int)$domain_check['id'] . "')");
|
||||
$address_id = $db->insert_id();
|
||||
$db->query("UPDATE " . TABLE_PANEL_CUSTOMERS . " SET `emails_used` = `emails_used` + 1 WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "added email address '" . $email_full . "'");
|
||||
redirectTo($filename, Array('page' => $page, 'action' => 'edit', 'id' => $address_id, 's' => $s));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $db->query("SELECT `id`, `domain`, `customerid` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `isemaildomain`='1' ORDER BY `domain` ASC");
|
||||
$domains = '';
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
$domains.= makeoption($idna_convert->decode($row['domain']), $row['domain']);
|
||||
}
|
||||
|
||||
$iscatchall = makeyesno('iscatchall', '1', '0', '0');
|
||||
eval("echo \"" . getTemplate("email/emails_add") . "\";");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('allresourcesused');
|
||||
}
|
||||
}
|
||||
elseif($action == 'edit'
|
||||
&& $id != 0)
|
||||
{
|
||||
$result = $db->query_first("SELECT `v`.`id`, `v`.`email`, `v`.`email_full`, `v`.`iscatchall`, `v`.`destination`, `v`.`customerid`, `v`.`popaccountid`, `u`.`quota` FROM `" . TABLE_MAIL_VIRTUAL . "` `v` LEFT JOIN `" . TABLE_MAIL_USERS . "` `u` ON(`v`.`popaccountid` = `u`.`id`)WHERE `v`.`customerid`='" . (int)$userinfo['customerid'] . "' AND `v`.`id`='" . (int)$id . "'");
|
||||
|
||||
if(isset($result['email'])
|
||||
&& $result['email'] != '')
|
||||
{
|
||||
$result['email'] = $idna_convert->decode($result['email']);
|
||||
$result['email_full'] = $idna_convert->decode($result['email_full']);
|
||||
$result['destination'] = explode(' ', $result['destination']);
|
||||
uasort($result['destination'], 'strcasecmp');
|
||||
$forwarders = '';
|
||||
$forwarders_count = 0;
|
||||
|
||||
while(list($dest_id, $destination) = each($result['destination']))
|
||||
{
|
||||
$destination = $idna_convert->decode($destination);
|
||||
|
||||
if($destination != $result['email_full']
|
||||
&& $destination != '')
|
||||
{
|
||||
eval("\$forwarders.=\"" . getTemplate("email/emails_edit_forwarder") . "\";");
|
||||
$forwarders_count++;
|
||||
}
|
||||
|
||||
$result['destination'][$dest_id] = $destination;
|
||||
}
|
||||
|
||||
$destinations_count = count($result['destination']);
|
||||
$result = htmlentities_array($result);
|
||||
eval("echo \"" . getTemplate("email/emails_edit") . "\";");
|
||||
}
|
||||
}
|
||||
elseif($action == 'togglecatchall'
|
||||
&& $id != 0)
|
||||
{
|
||||
$result = $db->query_first("SELECT `id`, `email`, `email_full`, `iscatchall`, `destination`, `customerid`, `popaccountid` FROM `" . TABLE_MAIL_VIRTUAL . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
|
||||
|
||||
if(isset($result['email'])
|
||||
&& $result['email'] != '')
|
||||
{
|
||||
if($result['iscatchall'] == '1')
|
||||
{
|
||||
$db->query("UPDATE `" . TABLE_MAIL_VIRTUAL . "` SET `email` = '" . $db->escape($result['email_full']) . "', `iscatchall` = '0' WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$result['id'] . "'");
|
||||
}
|
||||
else
|
||||
{
|
||||
$email_parts = explode('@', $result['email_full']);
|
||||
$email = '@' . $email_parts[1];
|
||||
$email_check = $db->query_first("SELECT `id`, `email`, `email_full`, `iscatchall`, `destination`, `customerid` FROM `" . TABLE_MAIL_VIRTUAL . "` WHERE `email`='" . $db->escape($email) . "' AND `customerid`='" . (int)$userinfo['customerid'] . "'");
|
||||
|
||||
if($email_check['email'] == $email)
|
||||
{
|
||||
standard_error('youhavealreadyacatchallforthisdomain');
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->query("UPDATE `" . TABLE_MAIL_VIRTUAL . "` SET `email` = '$email' , `iscatchall` = '1' WHERE `customerid`='" . $userinfo['customerid'] . "' AND `id`='" . $result['id'] . "'");
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "edited email address '" . $email . "'");
|
||||
}
|
||||
}
|
||||
|
||||
redirectTo($filename, Array('page' => $page, 'action' => 'edit', 'id' => $id, 's' => $s));
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif($page == 'accounts')
|
||||
{
|
||||
if($action == 'add'
|
||||
&& $id != 0)
|
||||
{
|
||||
// ensure the int is a positive one
|
||||
|
||||
if(isset($_POST['email_quota']))
|
||||
{
|
||||
$quota = validate($_POST['email_quota'], 'email_quota', '/^\d+$/', 'vmailquotawrong');
|
||||
}
|
||||
|
||||
if($userinfo['email_accounts'] == '-1'
|
||||
|| ($userinfo['email_accounts_used'] < $userinfo['email_accounts']))
|
||||
{
|
||||
$result = $db->query_first("SELECT `id`, `email`, `email_full`, `iscatchall`, `destination`, `customerid`, `popaccountid`, `domainid` FROM `" . TABLE_MAIL_VIRTUAL . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
|
||||
|
||||
if(isset($result['email'])
|
||||
&& $result['email'] != ''
|
||||
&& $result['popaccountid'] == '0')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$email_full = $result['email_full'];
|
||||
$username = $idna_convert->decode($email_full);
|
||||
$password = validate($_POST['email_password'], 'password');
|
||||
|
||||
if($settings['panel']['sendalternativemail'] == 1)
|
||||
{
|
||||
$alternative_email = $idna_convert->encode(validate($_POST['alternative_email'], 'alternative_email'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$alternative_email = '';
|
||||
}
|
||||
|
||||
if($settings['system']['mail_quota_enabled'] == 1)
|
||||
{
|
||||
if($userinfo['email_quota'] != '-1'
|
||||
&& ($quota == 0 || ($quota + $userinfo['email_quota_used']) > $userinfo['email_quota']))
|
||||
{
|
||||
standard_error('allocatetoomuchquota', $quota);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$quota = 0;
|
||||
}
|
||||
|
||||
if($email_full == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'emailadd'));
|
||||
}
|
||||
elseif($password == ''
|
||||
&& !($settings['panel']['sendalternativemail'] == 1 && validateEmail($alternative_email)))
|
||||
{
|
||||
standard_error(array('stringisempty', 'mypassword'));
|
||||
}
|
||||
else
|
||||
{
|
||||
if($password == '')
|
||||
{
|
||||
$password = substr(md5(uniqid(microtime(), 1)), 12, 6);
|
||||
}
|
||||
|
||||
$db->query("INSERT INTO `" . TABLE_MAIL_USERS . "` (`customerid`, `email`, `username`, " . ($settings['system']['mailpwcleartext'] == '1' ? '`password`, ' : '') . " `password_enc`, `homedir`, `maildir`, `uid`, `gid`, `domainid`, `postfix`, `quota`, `imap`, `pop3`) VALUES ('" . (int)$userinfo['customerid'] . "', '" . $db->escape($email_full) . "', '" . $db->escape($username) . "', " . ($settings['system']['mailpwcleartext'] == '1' ? "'" . $db->escape($password) . "'," : '') . " ENCRYPT('" . $db->escape($password) . "'), '" . $db->escape($settings['system']['vmail_homedir']) . "', '" . $db->escape($userinfo['loginname'] . '/' . $email_full . '/') . "', '" . (int)$settings['system']['vmail_uid'] . "', '" . (int)$settings['system']['vmail_gid'] . "', '" . (int)$result['domainid'] . "', 'y', '" . (int)$quota . "', '" . (int)$userinfo['imap'] . "', '" . (int)$userinfo['pop3'] . "')");
|
||||
$popaccountid = $db->insert_id();
|
||||
$result['destination'].= ' ' . $email_full;
|
||||
$db->query("UPDATE `" . TABLE_MAIL_VIRTUAL . "` SET `destination` = '" . $db->escape(makeCorrectDestination($result['destination'])) . "', `popaccountid` = '" . (int)$popaccountid . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
|
||||
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `email_accounts_used`=`email_accounts_used`+1, `email_quota_used`=`email_quota_used`+" . (int)$quota . " WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "added email account for '" . $email_full . "'");
|
||||
$replace_arr = array(
|
||||
'EMAIL' => $email_full,
|
||||
'USERNAME' => $username,
|
||||
'PASSWORD' => $password
|
||||
);
|
||||
$admin = $db->query_first('SELECT `firstname`, `name`, `company`, `email` FROM `' . TABLE_PANEL_ADMINS . '` WHERE `adminid`=\'' . (int)$userinfo['adminid'] . '\'');
|
||||
$result = $db->query_first('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '` WHERE `adminid`=\'' . (int)$userinfo['adminid'] . '\' AND `language`=\'' . $db->escape($userinfo['def_language']) . '\' AND `templategroup`=\'mails\' AND `varname`=\'pop_success_subject\'');
|
||||
$mail_subject = html_entity_decode(replace_variables((($result['value'] != '') ? $result['value'] : $lng['mails']['pop_success']['subject']), $replace_arr));
|
||||
$result = $db->query_first('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '` WHERE `adminid`=\'' . (int)$userinfo['adminid'] . '\' AND `language`=\'' . $db->escape($userinfo['def_language']) . '\' AND `templategroup`=\'mails\' AND `varname`=\'pop_success_mailbody\'');
|
||||
$mail_body = html_entity_decode(replace_variables((($result['value'] != '') ? $result['value'] : $lng['mails']['pop_success']['mailbody']), $replace_arr));
|
||||
$mail->From = $admin['email'];
|
||||
$mail->FromName = getCorrectUserSalutation($admin);
|
||||
$mail->Subject = $mail_subject;
|
||||
$mail->Body = $mail_body;
|
||||
$mail->AddAddress($email_full, getCorrectUserSalutation($userinfo));
|
||||
|
||||
if(!$mail->Send())
|
||||
{
|
||||
if($mail->ErrorInfo != '')
|
||||
{
|
||||
$mailerr_msg = $mail->ErrorInfo;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mailerr_msg = $email;
|
||||
}
|
||||
|
||||
$log->logAction(USR_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
|
||||
standard_error('errorsendingmail', $email);
|
||||
}
|
||||
|
||||
$mail->ClearAddresses();
|
||||
|
||||
if(validateEmail($alternative_email)
|
||||
&& $settings['panel']['sendalternativemail'] == 1)
|
||||
{
|
||||
$result = $db->query_first('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '` WHERE `adminid`=\'' . (int)$userinfo['adminid'] . '\' AND `language`=\'' . $db->escape($userinfo['def_language']) . '\' AND `templategroup`=\'mails\' AND `varname`=\'pop_success_alternative_subject\'');
|
||||
$mail_subject = replace_variables((($result['value'] != '') ? $result['value'] : $lng['mails']['pop_success_alternative']['subject']), $replace_arr);
|
||||
$result = $db->query_first('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '` WHERE `adminid`=\'' . (int)$userinfo['adminid'] . '\' AND `language`=\'' . $db->escape($userinfo['def_language']) . '\' AND `templategroup`=\'mails\' AND `varname`=\'pop_success_alternative_mailbody\'');
|
||||
$mail_body = replace_variables((($result['value'] != '') ? $result['value'] : $lng['mails']['pop_success_alternative']['mailbody']), $replace_arr);
|
||||
$mail->From = $admin['email'];
|
||||
$mail->FromName = getCorrectUserSalutation($admin);
|
||||
$mail->Subject = $mail_subject;
|
||||
$mail->Body = $mail_body;
|
||||
$mail->AddAddress($idna_convert->encode($alternative_email), getCorrectUserSalutation($userinfo));
|
||||
|
||||
if(!$mail->Send())
|
||||
{
|
||||
if($mail->ErrorInfo != '')
|
||||
{
|
||||
$mailerr_msg = $mail->ErrorInfo;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mailerr_msg = $alternative_email;
|
||||
}
|
||||
|
||||
$log->logAction(USR_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
|
||||
standard_error(array('errorsendingmail', $alternative_email));
|
||||
}
|
||||
|
||||
$mail->ClearAddresses();
|
||||
}
|
||||
|
||||
redirectTo($filename, Array('page' => 'emails', 'action' => 'edit', 'id' => $id, 's' => $s));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$result['email_full'] = $idna_convert->decode($result['email_full']);
|
||||
$result = htmlentities_array($result);
|
||||
$quota = $settings['system']['mail_quota'];
|
||||
eval("echo \"" . getTemplate("email/account_add") . "\";");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error(array('allresourcesused', 'allocatetoomuchquota'), $quota);
|
||||
}
|
||||
}
|
||||
elseif($action == 'changepw'
|
||||
&& $id != 0)
|
||||
{
|
||||
$result = $db->query_first("SELECT `id`, `email`, `email_full`, `iscatchall`, `destination`, `customerid`, `popaccountid` FROM `" . TABLE_MAIL_VIRTUAL . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
|
||||
|
||||
if(isset($result['popaccountid'])
|
||||
&& $result['popaccountid'] != '')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$password = validate($_POST['email_password'], 'password');
|
||||
|
||||
if($password == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'mypassword'));
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "changed email password for '" . $result['email_full'] . "'");
|
||||
$result = $db->query("UPDATE `" . TABLE_MAIL_USERS . "` SET " . ($settings['system']['mailpwcleartext'] == '1' ? "`password` = '" . $db->escape($password) . "', " : '') . " `password_enc`=ENCRYPT('" . $db->escape($password) . "') WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$result['popaccountid'] . "'");
|
||||
redirectTo($filename, Array('page' => 'emails', 'action' => 'edit', 'id' => $id, 's' => $s));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$result['email_full'] = $idna_convert->decode($result['email_full']);
|
||||
$result = htmlentities_array($result);
|
||||
eval("echo \"" . getTemplate("email/account_changepw") . "\";");
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif($action == 'changequota'
|
||||
&& $settings['system']['mail_quota_enabled'] == '1'
|
||||
&& $id != 0)
|
||||
{
|
||||
$result = $db->query_first("SELECT `v`.`id`, `v`.`email`, `v`.`email_full`, `v`.`iscatchall`, `v`.`destination`, `v`.`customerid`, `v`.`popaccountid`, `u`.`quota` FROM `" . TABLE_MAIL_VIRTUAL . "` `v` LEFT JOIN `" . TABLE_MAIL_USERS . "` `u` ON(`v`.`popaccountid` = `u`.`id`)WHERE `v`.`customerid`='" . (int)$userinfo['customerid'] . "' AND `v`.`id`='" . (int)$id . "'");
|
||||
|
||||
if(isset($result['popaccountid'])
|
||||
&& $result['popaccountid'] != '')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$quota = (int)validate($_POST['email_quota'], 'email_quota', '/^\d+$/', 'vmailquotawrong');
|
||||
|
||||
if($userinfo['email_quota'] != '-1'
|
||||
&& ($quota == 0 || ($quota + $userinfo['email_quota_used'] - $result['quota']) > $userinfo['email_quota']))
|
||||
{
|
||||
standard_error('allocatetoomuchquota', $quota);
|
||||
}
|
||||
else
|
||||
{
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "updated quota for email address '" . $result['email'] . "' to " . $quota . " MB");
|
||||
$db->query("UPDATE `" . TABLE_MAIL_USERS . "` SET `quota` = '" . (int)$quota . "' WHERE `id` = " . $result['popaccountid'] . " AND `customerid`='" . $userinfo['customerid'] . "'");
|
||||
|
||||
if($userinfo['email_quota'] != '-1')
|
||||
{
|
||||
$new_used_quota = $userinfo['email_quota_used'] + ($quota - $result['quota']);
|
||||
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `email_quota_used` = " . $new_used_quota . " WHERE `customerid` = '" . $userinfo['customerid'] . "'");
|
||||
}
|
||||
|
||||
redirectTo($filename, Array('page' => 'emails', 'action' => 'edit', 'id' => $id, 's' => $s));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$result['email_full'] = $idna_convert->decode($result['email_full']);
|
||||
$result = htmlentities_array($result);
|
||||
eval("echo \"" . getTemplate("email/account_changequota") . "\";");
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif($action == 'delete'
|
||||
&& $id != 0)
|
||||
{
|
||||
$result = $db->query_first("SELECT `v`.`id`, `v`.`email`, `v`.`email_full`, `v`.`iscatchall`, `v`.`destination`, `v`.`customerid`, `v`.`popaccountid`, `u`.`quota` FROM `" . TABLE_MAIL_VIRTUAL . "` `v` LEFT JOIN `" . TABLE_MAIL_USERS . "` `u` ON(`v`.`popaccountid` = `u`.`id`)WHERE `v`.`customerid`='" . (int)$userinfo['customerid'] . "' AND `v`.`id`='" . (int)$id . "'");
|
||||
|
||||
if(isset($result['popaccountid'])
|
||||
&& $result['popaccountid'] != '')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$db->query("DELETE FROM `" . TABLE_MAIL_USERS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$result['popaccountid'] . "'");
|
||||
$result['destination'] = str_replace($result['email_full'], '', $result['destination']);
|
||||
$db->query("UPDATE `" . TABLE_MAIL_VIRTUAL . "` SET `destination` = '" . $db->escape(makeCorrectDestination($result['destination'])) . "', `popaccountid` = '0' WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
|
||||
|
||||
if($settings['system']['mail_quota_enabled'] == '1'
|
||||
&& $userinfo['email_quota'] != '-1')
|
||||
{
|
||||
$quota = (int)$result['quota'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$quota = 0;
|
||||
}
|
||||
|
||||
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `email_accounts_used` = `email_accounts_used` - 1, `email_quota_used` = `email_quota_used` - " . (int)$quota . " WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "deleted email account for '" . $result['email_full'] . "'");
|
||||
redirectTo($filename, Array('page' => 'emails', 'action' => 'edit', 'id' => $id, 's' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
ask_yesno('email_reallydelete_account', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $idna_convert->decode($result['email_full']));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif($page == 'forwarders')
|
||||
{
|
||||
if($action == 'add'
|
||||
&& $id != 0)
|
||||
{
|
||||
if($userinfo['email_forwarders_used'] < $userinfo['email_forwarders']
|
||||
|| $userinfo['email_forwarders'] == '-1')
|
||||
{
|
||||
$result = $db->query_first("SELECT `id`, `email`, `email_full`, `iscatchall`, `destination`, `customerid`, `popaccountid`, `domainid` FROM `" . TABLE_MAIL_VIRTUAL . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
|
||||
|
||||
if(isset($result['email'])
|
||||
&& $result['email'] != '')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$destination = $idna_convert->encode($_POST['destination']);
|
||||
$result['destination_array'] = explode(' ', $result['destination']);
|
||||
|
||||
if($destination == '')
|
||||
{
|
||||
standard_error('destinationnonexist');
|
||||
}
|
||||
elseif(!validateEmail($destination))
|
||||
{
|
||||
standard_error('destinationiswrong', $destination);
|
||||
}
|
||||
elseif($destination == $result['email'])
|
||||
{
|
||||
standard_error('destinationalreadyexistasmail', $destination);
|
||||
}
|
||||
elseif(in_array($destination, $result['destination_array']))
|
||||
{
|
||||
standard_error('destinationalreadyexist', $destination);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result['destination'].= ' ' . $destination;
|
||||
$db->query("UPDATE `" . TABLE_MAIL_VIRTUAL . "` SET `destination` = '" . $db->escape(makeCorrectDestination($result['destination'])) . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
|
||||
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `email_forwarders_used` = `email_forwarders_used` + 1 WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "added email forwarder for '" . $result['email_full'] . "'");
|
||||
redirectTo($filename, Array('page' => 'emails', 'action' => 'edit', 'id' => $id, 's' => $s));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$result['email_full'] = $idna_convert->decode($result['email_full']);
|
||||
$result = htmlentities_array($result);
|
||||
eval("echo \"" . getTemplate("email/forwarder_add") . "\";");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('allresourcesused');
|
||||
}
|
||||
}
|
||||
elseif($action == 'delete'
|
||||
&& $id != 0)
|
||||
{
|
||||
$result = $db->query_first("SELECT `id`, `email`, `email_full`, `iscatchall`, `destination`, `customerid`, `popaccountid` FROM `" . TABLE_MAIL_VIRTUAL . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
|
||||
|
||||
if(isset($result['destination'])
|
||||
&& $result['destination'] != '')
|
||||
{
|
||||
if(isset($_POST['forwarderid']))
|
||||
{
|
||||
$forwarderid = intval($_POST['forwarderid']);
|
||||
}
|
||||
elseif(isset($_GET['forwarderid']))
|
||||
{
|
||||
$forwarderid = intval($_GET['forwarderid']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$forwarderid = 0;
|
||||
}
|
||||
|
||||
$result['destination'] = explode(' ', $result['destination']);
|
||||
|
||||
if(isset($result['destination'][$forwarderid]) && $result['email'] != $result['destination'][$forwarderid])
|
||||
{
|
||||
$forwarder = $result['destination'][$forwarderid];
|
||||
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
unset($result['destination'][$forwarderid]);
|
||||
$result['destination'] = implode(' ', $result['destination']);
|
||||
$db->query("UPDATE `" . TABLE_MAIL_VIRTUAL . "` SET `destination` = '" . $db->escape(makeCorrectDestination($result['destination'])) . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
|
||||
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `email_forwarders_used` = `email_forwarders_used` - 1 WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "deleted email forwarder for '" . $result['email_full'] . "'");
|
||||
redirectTo($filename, Array('page' => 'emails', 'action' => 'edit', 'id' => $id, 's' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
ask_yesno('email_reallydelete_forwarder', $filename, array('id' => $id, 'forwarderid' => $forwarderid, 'page' => $page, 'action' => $action), $idna_convert->decode($result['email_full']) . ' -> ' . $idna_convert->decode($forwarder));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
426
customer_extras.php
Normal file
@@ -0,0 +1,426 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
* @version $Id: customer_extras.php 2692 2009-03-27 18:04:47Z flo $
|
||||
*/
|
||||
|
||||
define('AREA', 'customer');
|
||||
|
||||
/**
|
||||
* Include our init.php, which manages Sessions, Language etc.
|
||||
*/
|
||||
|
||||
require ("./lib/init.php");
|
||||
|
||||
if(isset($_POST['id']))
|
||||
{
|
||||
$id = intval($_POST['id']);
|
||||
}
|
||||
elseif(isset($_GET['id']))
|
||||
{
|
||||
$id = intval($_GET['id']);
|
||||
}
|
||||
|
||||
if($page == 'overview')
|
||||
{
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_extras");
|
||||
eval("echo \"" . getTemplate("extras/extras") . "\";");
|
||||
}
|
||||
elseif($page == 'htpasswds')
|
||||
{
|
||||
if($action == '')
|
||||
{
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_extras::htpasswds");
|
||||
$fields = array(
|
||||
'username' => $lng['login']['username'],
|
||||
'path' => $lng['panel']['path']
|
||||
);
|
||||
$paging = new paging($userinfo, $db, TABLE_PANEL_HTPASSWDS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
|
||||
$result = $db->query("SELECT `id`, `username`, `path` FROM `" . TABLE_PANEL_HTPASSWDS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
|
||||
$paging->setEntries($db->num_rows($result));
|
||||
$sortcode = $paging->getHtmlSortCode($lng);
|
||||
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$searchcode = $paging->getHtmlSearchCode($lng);
|
||||
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$i = 0;
|
||||
$count = 0;
|
||||
$htpasswds = '';
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
if($paging->checkDisplay($i))
|
||||
{
|
||||
if(strpos($row['path'], $userinfo['documentroot']) === 0)
|
||||
{
|
||||
$row['path'] = substr($row['path'], strlen($userinfo['documentroot']));
|
||||
}
|
||||
|
||||
$row = htmlentities_array($row);
|
||||
eval("\$htpasswds.=\"" . getTemplate("extras/htpasswds_htpasswd") . "\";");
|
||||
$count++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("extras/htpasswds") . "\";");
|
||||
}
|
||||
elseif($action == 'delete'
|
||||
&& $id != 0)
|
||||
{
|
||||
$result = $db->query_first("SELECT `id`, `customerid`, `username`, `path` FROM `" . TABLE_PANEL_HTPASSWDS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$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'] . ")'");
|
||||
inserttask('1');
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
if(strpos($result['path'], $userinfo['documentroot']) === 0)
|
||||
{
|
||||
$result['path'] = substr($result['path'], strlen($userinfo['documentroot']));
|
||||
}
|
||||
|
||||
ask_yesno('extras_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['username'] . ' (' . $result['path'] . ')');
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif($action == 'add')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$path = makeCorrectDir(validate($_POST['path'], 'path'));
|
||||
$userpath = $path;
|
||||
$path = makeCorrectDir($userinfo['documentroot'] . '/' . $path);
|
||||
$username = validate($_POST['username'], 'username', '/^[a-zA-Z0-9][a-zA-Z0-9\-_]+\$?$/');
|
||||
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'] . "'");
|
||||
|
||||
if(CRYPT_STD_DES == 1)
|
||||
{
|
||||
$saltfordescrypt = substr(md5(uniqid(microtime(), 1)), 4, 2);
|
||||
$password = crypt($_POST['directory_password'], $saltfordescrypt);
|
||||
}
|
||||
else
|
||||
{
|
||||
$password = crypt($_POST['directory_password']);
|
||||
}
|
||||
|
||||
if(!$_POST['path'])
|
||||
{
|
||||
standard_error('invalidpath');
|
||||
}
|
||||
|
||||
if($username == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'myloginname'));
|
||||
}
|
||||
elseif($username_path_check['username'] == $username
|
||||
&& $username_path_check['path'] == $path)
|
||||
{
|
||||
standard_error('userpathcombinationdupe');
|
||||
}
|
||||
elseif($_POST['directory_password'] == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'mypassword'));
|
||||
}
|
||||
elseif($path == '')
|
||||
{
|
||||
standard_error('patherror');
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->query("INSERT INTO `" . TABLE_PANEL_HTPASSWDS . "` (`customerid`, `username`, `password`, `path`) VALUES ('" . (int)$userinfo['customerid'] . "', '" . $db->escape($username) . "', '" . $db->escape($password) . "', '" . $db->escape($path) . "')");
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "added htpasswd for '" . $username . " (" . $path . ")'");
|
||||
inserttask('1');
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit']);
|
||||
eval("echo \"" . getTemplate("extras/htpasswds_add") . "\";");
|
||||
}
|
||||
}
|
||||
elseif($action == 'edit'
|
||||
&& $id != 0)
|
||||
{
|
||||
$result = $db->query_first("SELECT `id`, `username`, `path` FROM `" . TABLE_PANEL_HTPASSWDS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
|
||||
|
||||
if(isset($result['username'])
|
||||
&& $result['username'] != '')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
validate($_POST['directory_password'], 'password');
|
||||
|
||||
if(CRYPT_STD_DES == 1)
|
||||
{
|
||||
$saltfordescrypt = substr(md5(uniqid(microtime(), 1)), 4, 2);
|
||||
$password = crypt($_POST['directory_password'], $saltfordescrypt);
|
||||
}
|
||||
else
|
||||
{
|
||||
$password = crypt($_POST['directory_password']);
|
||||
}
|
||||
|
||||
if($_POST['directory_password'] == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'mypassword'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->query("UPDATE `" . TABLE_PANEL_HTPASSWDS . "` SET `password`='" . $db->escape($password) . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "edited htpasswd for '" . $result['username'] . " (" . $result['path'] . ")'");
|
||||
inserttask('1');
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(strpos($result['path'], $userinfo['documentroot']) === 0)
|
||||
{
|
||||
$result['path'] = substr($result['path'], strlen($userinfo['documentroot']));
|
||||
}
|
||||
|
||||
$result = htmlentities_array($result);
|
||||
eval("echo \"" . getTemplate("extras/htpasswds_edit") . "\";");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif($page == 'htaccess')
|
||||
{
|
||||
if($action == '')
|
||||
{
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_extras::htaccess");
|
||||
$fields = array(
|
||||
'path' => $lng['panel']['path'],
|
||||
'options_indexes' => $lng['extras']['view_directory'],
|
||||
'error404path' => $lng['extras']['error404path'],
|
||||
'error403path' => $lng['extras']['error403path'],
|
||||
'error500path' => $lng['extras']['error500path']
|
||||
);
|
||||
$paging = new paging($userinfo, $db, TABLE_PANEL_HTACCESS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
|
||||
$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());
|
||||
$paging->setEntries($db->num_rows($result));
|
||||
$sortcode = $paging->getHtmlSortCode($lng);
|
||||
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$searchcode = $paging->getHtmlSearchCode($lng);
|
||||
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$i = 0;
|
||||
$count = 0;
|
||||
$htaccess = '';
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
if($paging->checkDisplay($i))
|
||||
{
|
||||
if(strpos($row['path'], $userinfo['documentroot']) === 0)
|
||||
{
|
||||
$row['path'] = substr($row['path'], strlen($userinfo['documentroot']));
|
||||
}
|
||||
|
||||
$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 = htmlentities_array($row);
|
||||
eval("\$htaccess.=\"" . getTemplate("extras/htaccess_htaccess") . "\";");
|
||||
$count++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("extras/htaccess") . "\";");
|
||||
}
|
||||
elseif($action == 'delete'
|
||||
&& $id != 0)
|
||||
{
|
||||
$result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_HTACCESS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
|
||||
|
||||
if(isset($result['customerid'])
|
||||
&& $result['customerid'] != ''
|
||||
&& $result['customerid'] == $userinfo['customerid'])
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$db->query("DELETE FROM `" . TABLE_PANEL_HTACCESS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "deleted htaccess for '" . str_replace($userinfo['documentroot'], '', $result['path']) . "'");
|
||||
inserttask('1');
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
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')
|
||||
{
|
||||
$path = makeCorrectDir(validate($_POST['path'], 'path'));
|
||||
$userpath = $path;
|
||||
$path = makeCorrectDir($userinfo['documentroot'] . '/' . $path);
|
||||
$path_dupe_check = $db->query_first("SELECT `id`, `path` FROM `" . TABLE_PANEL_HTACCESS . "` WHERE `path`='" . $db->escape($path) . "' AND `customerid`='" . (int)$userinfo['customerid'] . "'");
|
||||
|
||||
if(!$_POST['path'])
|
||||
{
|
||||
standard_error('invalidpath');
|
||||
}
|
||||
|
||||
if(($_POST['error404path'] === '')
|
||||
|| (validateUrl($idna_convert->encode($_POST['error404path']))))
|
||||
{
|
||||
$error404path = $_POST['error404path'];
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('mustbeurl');
|
||||
}
|
||||
|
||||
if(($_POST['error403path'] === '')
|
||||
|| (validateUrl($idna_convert->encode($_POST['error403path']))))
|
||||
{
|
||||
$error403path = $_POST['error403path'];
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('mustbeurl');
|
||||
}
|
||||
|
||||
if(($_POST['error500path'] === '')
|
||||
|| (validateUrl($idna_convert->encode($_POST['error500path']))))
|
||||
{
|
||||
$error500path = $_POST['error500path'];
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('mustbeurl');
|
||||
}
|
||||
|
||||
if($path_dupe_check['path'] == $path)
|
||||
{
|
||||
standard_error('errordocpathdupe', $userpath);
|
||||
}
|
||||
elseif($path == '')
|
||||
{
|
||||
standard_error('patherror');
|
||||
}
|
||||
else
|
||||
{
|
||||
$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) . '" )');
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "added htaccess for '" . $path . "'");
|
||||
inserttask('1');
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit']);
|
||||
$options_indexes = makeyesno('options_indexes', '1', '0', '1');
|
||||
eval("echo \"" . getTemplate("extras/htaccess_add") . "\";");
|
||||
}
|
||||
}
|
||||
elseif(($action == 'edit')
|
||||
&& ($id != 0))
|
||||
{
|
||||
$result = $db->query_first('SELECT * FROM `' . TABLE_PANEL_HTACCESS . '` WHERE `customerid` = "' . (int)$userinfo['customerid'] . '" AND `id` = "' . (int)$id . '"');
|
||||
|
||||
if((isset($result['customerid']))
|
||||
&& ($result['customerid'] != '')
|
||||
&& ($result['customerid'] == $userinfo['customerid']))
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$option_indexes = intval($_POST['options_indexes']);
|
||||
|
||||
if($option_indexes != '1')
|
||||
{
|
||||
$option_indexes = '0';
|
||||
}
|
||||
|
||||
if(($_POST['error404path'] === '')
|
||||
|| (validateUrl($idna_convert->encode($_POST['error404path']))))
|
||||
{
|
||||
$error404path = $_POST['error404path'];
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('mustbeurl');
|
||||
}
|
||||
|
||||
if(($_POST['error403path'] === '')
|
||||
|| (validateUrl($idna_convert->encode($_POST['error403path']))))
|
||||
{
|
||||
$error403path = $_POST['error403path'];
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('mustbeurl');
|
||||
}
|
||||
|
||||
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');
|
||||
$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 . '"');
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "edited htaccess for '" . str_replace($userinfo['documentroot'], '', $result['path']) . "'");
|
||||
}
|
||||
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
if(strpos($result['path'], $userinfo['documentroot']) === 0)
|
||||
{
|
||||
$result['path'] = substr($result['path'], strlen($userinfo['documentroot']));
|
||||
}
|
||||
|
||||
$result['error404path'] = $result['error404path'];
|
||||
$result['error403path'] = $result['error403path'];
|
||||
$result['error500path'] = $result['error500path'];
|
||||
$options_indexes = makeyesno('options_indexes', '1', '0', $result['options_indexes']);
|
||||
$result = htmlentities_array($result);
|
||||
eval("echo \"" . getTemplate("extras/htaccess_edit") . "\";");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
243
customer_ftp.php
Normal file
@@ -0,0 +1,243 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
* @version $Id: customer_ftp.php 2707 2009-04-17 07:47:29Z flo $
|
||||
*/
|
||||
|
||||
define('AREA', 'customer');
|
||||
|
||||
/**
|
||||
* Include our init.php, which manages Sessions, Language etc.
|
||||
*/
|
||||
|
||||
require ("./lib/init.php");
|
||||
|
||||
if(isset($_POST['id']))
|
||||
{
|
||||
$id = intval($_POST['id']);
|
||||
}
|
||||
elseif(isset($_GET['id']))
|
||||
{
|
||||
$id = intval($_GET['id']);
|
||||
}
|
||||
|
||||
if($page == 'overview')
|
||||
{
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_ftp");
|
||||
eval("echo \"" . getTemplate("ftp/ftp") . "\";");
|
||||
}
|
||||
elseif($page == 'accounts')
|
||||
{
|
||||
if($action == '')
|
||||
{
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_ftp::accounts");
|
||||
$fields = array(
|
||||
'username' => $lng['login']['username'],
|
||||
'homedir' => $lng['panel']['path']
|
||||
);
|
||||
$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());
|
||||
$paging->setEntries($db->num_rows($result));
|
||||
$sortcode = $paging->getHtmlSortCode($lng);
|
||||
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$searchcode = $paging->getHtmlSearchCode($lng);
|
||||
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$i = 0;
|
||||
$count = 0;
|
||||
$accounts = '';
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
if($paging->checkDisplay($i))
|
||||
{
|
||||
if(strpos($row['homedir'], $userinfo['documentroot']) === 0)
|
||||
{
|
||||
$row['documentroot'] = substr($row['homedir'], strlen($userinfo['documentroot']));
|
||||
}
|
||||
else
|
||||
{
|
||||
$row['documentroot'] = $row['homedir'];
|
||||
}
|
||||
|
||||
$row['documentroot'] = makeCorrectDir($row['documentroot']);
|
||||
|
||||
$row = htmlentities_array($row);
|
||||
eval("\$accounts.=\"" . getTemplate("ftp/accounts_account") . "\";");
|
||||
$count++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$ftps_count = $db->num_rows($result);
|
||||
eval("echo \"" . getTemplate("ftp/accounts") . "\";");
|
||||
}
|
||||
elseif($action == 'delete'
|
||||
&& $id != 0)
|
||||
{
|
||||
$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 . "'");
|
||||
|
||||
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'] . "'");
|
||||
$db->query("UPDATE `" . TABLE_FTP_GROUPS . "` SET `members`=REPLACE(`members`,'," . $db->escape($result['username']) . "','') WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
|
||||
|
||||
// $db->query("DELETE FROM `".TABLE_FTP_GROUPS."` WHERE `customerid`='".$userinfo['customerid']."' AND `id`='$id'");
|
||||
|
||||
if($userinfo['ftps_used'] == '1')
|
||||
{
|
||||
$resetaccnumber = " , `ftp_lastaccountnumber`='0'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$resetaccnumber = '';
|
||||
}
|
||||
|
||||
$result = $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `ftps_used`=`ftps_used`-1 $resetaccnumber WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
ask_yesno('ftp_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['username']);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('ftp_cantdeletemainaccount');
|
||||
}
|
||||
}
|
||||
elseif($action == 'add')
|
||||
{
|
||||
if($userinfo['ftps_used'] < $userinfo['ftps']
|
||||
|| $userinfo['ftps'] == '-1')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$path = validate($_POST['path'], 'path');
|
||||
$password = validate($_POST['ftp_password'], 'password');
|
||||
|
||||
if($settings['customer']['ftpatdomain'] == '1')
|
||||
{
|
||||
$ftpusername = validate($_POST['ftp_username'], 'username', '/^[a-zA-Z0-9][a-zA-Z0-9\-_]+\$?$/');
|
||||
if($ftpusername == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'username'));
|
||||
}
|
||||
$ftpdomain = $idna_convert->encode(validate($_POST['ftp_domain'], 'domain'));
|
||||
$ftpdomain_check = $db->query_first("SELECT `id`, `domain`, `customerid` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `domain`='" . $db->escape($ftpdomain) . "' AND `customerid`='" . (int)$userinfo['customerid'] . "'");
|
||||
if($ftpdomain_check['domain'] != $ftpdomain)
|
||||
{
|
||||
standard_error('maindomainnonexist', $domain);
|
||||
}
|
||||
$username = $ftpusername . "@" . $ftpdomain;
|
||||
}
|
||||
else
|
||||
{
|
||||
$username = $userinfo['loginname'] . $settings['customer']['ftpprefix'] . (intval($userinfo['ftp_lastaccountnumber']) + 1);
|
||||
}
|
||||
|
||||
$username_check = $db->query_first('SELECT * FROM `' . TABLE_FTP_USERS .'` WHERE `username` = \'' . $db->escape($username) . '\'');
|
||||
|
||||
if(!empty($username_check) && $username_check['username'] = $username)
|
||||
{
|
||||
standard_error('usernamealreadyexists', $username);
|
||||
}
|
||||
elseif($password == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'mypassword'));
|
||||
}
|
||||
elseif($path == '')
|
||||
{
|
||||
standard_error('patherror');
|
||||
}
|
||||
else
|
||||
{
|
||||
$userpath = makeCorrectDir($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'] . "'");
|
||||
|
||||
// $db->query("INSERT INTO `".TABLE_FTP_GROUPS."` (`customerid`, `groupname`, `gid`, `members`) VALUES ('".$userinfo['customerid']."', '$username', '$uid', '$username')");
|
||||
|
||||
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `ftps_used`=`ftps_used`+1, `ftp_lastaccountnumber`=`ftp_lastaccountnumber`+1 WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
|
||||
|
||||
// $db->query("UPDATE `".TABLE_PANEL_SETTINGS."` SET `value`='$uid' WHERE settinggroup='ftp' AND varname='lastguid'");
|
||||
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "added ftp-account '" . $username . " (" . $path . ")'");
|
||||
inserttask(5);
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit']);
|
||||
|
||||
if($settings['customer']['ftpatdomain'] == '1')
|
||||
{
|
||||
$domains = '';
|
||||
|
||||
$result_domains = $db->query("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
|
||||
|
||||
while($row_domain = $db->fetch_array($result_domains))
|
||||
{
|
||||
$domains.= makeoption($idna_convert->decode($row_domain['domain']), $row_domain['domain']);
|
||||
}
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("ftp/accounts_add") . "\";");
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif($action == 'edit'
|
||||
&& $id != 0)
|
||||
{
|
||||
$result = $db->query_first("SELECT `id`, `username`, `homedir` FROM `" . TABLE_FTP_USERS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
|
||||
|
||||
if(isset($result['username'])
|
||||
&& $result['username'] != '')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$password = validate($_POST['ftp_password'], 'password');
|
||||
|
||||
if($password == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'mypassword'));
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->query("UPDATE `" . TABLE_FTP_USERS . "` SET `password`=ENCRYPT('" . $db->escape($password) . "') WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "edited ftp-account '" . $result['username'] . "'");
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
eval("echo \"" . getTemplate("ftp/accounts_edit") . "\";");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
182
customer_index.php
Normal file
@@ -0,0 +1,182 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
* @version $Id: customer_index.php 2692 2009-03-27 18:04:47Z flo $
|
||||
*/
|
||||
|
||||
define('AREA', 'customer');
|
||||
|
||||
/**
|
||||
* Include our init.php, which manages Sessions, Language etc.
|
||||
*/
|
||||
|
||||
require ("./lib/init.php");
|
||||
|
||||
if($action == 'logout')
|
||||
{
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "logged out");
|
||||
|
||||
if($settings['session']['allow_multiple_login'] == '1')
|
||||
{
|
||||
$db->query("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid` = '" . (int)$userinfo['customerid'] . "' AND `adminsession` = '0' AND `hash` = '" . $s . "'");
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->query("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid` = '" . (int)$userinfo['customerid'] . "' AND `adminsession` = '0'");
|
||||
}
|
||||
|
||||
redirectTo('index.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
if($page == 'overview')
|
||||
{
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_index");
|
||||
$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();
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
$domainArray[] = $idna_convert->decode($row['domain']);
|
||||
}
|
||||
|
||||
natsort($domainArray);
|
||||
$domains = implode(', ', $domainArray);
|
||||
$userinfo['email'] = $idna_convert->decode($userinfo['email']);
|
||||
$yesterday = time() - (60 * 60 * 24);
|
||||
$month = date('M Y', $yesterday);
|
||||
|
||||
/* $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']."'");
|
||||
$userinfo['traffic_used']=$traffic['http_sum']+$traffic['ftp_up_sum']+$traffic['ftp_down_sum']+$traffic['mail_sum'];*/
|
||||
|
||||
$userinfo['diskspace'] = round($userinfo['diskspace'] / 1024, $settings['panel']['decimal_places']);
|
||||
$userinfo['diskspace_used'] = round($userinfo['diskspace_used'] / 1024, $settings['panel']['decimal_places']);
|
||||
$userinfo['traffic'] = round($userinfo['traffic'] / (1024 * 1024), $settings['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 = '';
|
||||
|
||||
if($opentickets > 0)
|
||||
{
|
||||
$awaitingtickets_text = strtr($lng['ticket']['awaitingticketreply'], array('%s' => '<a href="customer_tickets.php?page=tickets&s=' . $s . '">' . $opentickets['count'] . '</a>'));
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("index/index") . "\";");
|
||||
}
|
||||
elseif($page == 'change_password')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$old_password = validate($_POST['old_password'], 'old password');
|
||||
|
||||
if(md5($old_password) != $userinfo['password'])
|
||||
{
|
||||
standard_error('oldpasswordnotcorrect');
|
||||
exit;
|
||||
}
|
||||
|
||||
$new_password = validate($_POST['new_password'], 'new password');
|
||||
$new_password_confirm = validate($_POST['new_password_confirm'], 'new password confirm');
|
||||
|
||||
if($old_password == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'oldpassword'));
|
||||
}
|
||||
elseif($new_password == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'newpassword'));
|
||||
}
|
||||
elseif($new_password_confirm == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'newpasswordconfirm'));
|
||||
}
|
||||
elseif($new_password != $new_password_confirm)
|
||||
{
|
||||
standard_error('newpasswordconfirmerror');
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `password`='" . md5($new_password) . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `password`='" . md5($old_password) . "'");
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, 'changed password');
|
||||
|
||||
if(isset($_POST['change_main_ftp'])
|
||||
&& $_POST['change_main_ftp'] == 'true')
|
||||
{
|
||||
$db->query("UPDATE `" . TABLE_FTP_USERS . "` SET `password`=ENCRYPT('" . $db->escape($new_password) . "') WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `username`='" . $db->escape($userinfo['loginname']) . "'");
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, 'changed main ftp password');
|
||||
}
|
||||
|
||||
if(isset($_POST['change_webalizer'])
|
||||
&& $_POST['change_webalizer'] == 'true')
|
||||
{
|
||||
if(CRYPT_STD_DES == 1)
|
||||
{
|
||||
$saltfordescrypt = substr(md5(uniqid(microtime(), 1)), 4, 2);
|
||||
$new_webalizer_password = crypt($new_password, $saltfordescrypt);
|
||||
}
|
||||
else
|
||||
{
|
||||
$new_webalizer_password = crypt($new_password);
|
||||
}
|
||||
|
||||
$db->query("UPDATE `" . TABLE_PANEL_HTPASSWDS . "` SET `password`='" . $db->escape($new_webalizer_password) . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `username`='" . $db->escape($userinfo['loginname']) . "'");
|
||||
}
|
||||
|
||||
redirectTo($filename, Array('s' => $s));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
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');
|
||||
|
||||
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 . "'");
|
||||
}
|
||||
|
||||
redirectTo($filename, Array('s' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
$language_options = '';
|
||||
|
||||
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") . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
252
customer_mysql.php
Normal file
@@ -0,0 +1,252 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
* @version $Id: customer_mysql.php 2732 2009-10-30 16:24:48Z flo $
|
||||
*/
|
||||
|
||||
define('AREA', 'customer');
|
||||
|
||||
/**
|
||||
* Include our init.php, which manages Sessions, Language etc.
|
||||
*/
|
||||
|
||||
$need_root_db_sql_data = true;
|
||||
require ("./lib/init.php");
|
||||
|
||||
if(isset($_POST['id']))
|
||||
{
|
||||
$id = intval($_POST['id']);
|
||||
}
|
||||
elseif(isset($_GET['id']))
|
||||
{
|
||||
$id = intval($_GET['id']);
|
||||
}
|
||||
|
||||
if($page == 'overview')
|
||||
{
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_mysql");
|
||||
$lng['mysql']['description'] = str_replace('<SQL_HOST>', $sql['host'], $lng['mysql']['description']);
|
||||
eval("echo \"" . getTemplate("mysql/mysql") . "\";");
|
||||
}
|
||||
elseif($page == 'mysqls')
|
||||
{
|
||||
if($action == '')
|
||||
{
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_mysql::mysqls");
|
||||
$fields = array(
|
||||
'databasename' => $lng['mysql']['databasename'],
|
||||
'description' => $lng['mysql']['databasedescription']
|
||||
);
|
||||
$paging = new paging($userinfo, $db, TABLE_PANEL_DATABASES, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
|
||||
$result = $db->query("SELECT `id`, `databasename`, `description`, `dbserver` FROM `" . TABLE_PANEL_DATABASES . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
|
||||
$paging->setEntries($db->num_rows($result));
|
||||
$sortcode = $paging->getHtmlSortCode($lng);
|
||||
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$searchcode = $paging->getHtmlSearchCode($lng);
|
||||
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$i = 0;
|
||||
$count = 0;
|
||||
$mysqls = '';
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
if($paging->checkDisplay($i))
|
||||
{
|
||||
$row = htmlentities_array($row);
|
||||
eval("\$mysqls.=\"" . getTemplate("mysql/mysqls_database") . "\";");
|
||||
$count++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$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 . '"');
|
||||
|
||||
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')
|
||||
{
|
||||
// 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', array_unique(explode(',', $settings['system']['mysql_access_host']))) as $mysql_access_host)
|
||||
{
|
||||
$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
|
||||
|
||||
$db->query('DELETE FROM `' . TABLE_PANEL_DATABASES . '` WHERE `customerid`="' . (int)$userinfo['customerid'] . '" AND `id`="' . (int)$id . '"');
|
||||
|
||||
if($userinfo['mysqls_used'] == '1')
|
||||
{
|
||||
$resetaccnumber = " , `mysql_lastaccountnumber`='0' ";
|
||||
}
|
||||
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')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$password = validate($_POST['mysql_password'], 'password');
|
||||
|
||||
if($password == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'mypassword'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$username = $userinfo['loginname'] . $settings['customer']['mysqlprefix'] . (intval($userinfo['mysql_lastaccountnumber']) + 1);
|
||||
|
||||
if(count($sql_root) > 1)
|
||||
{
|
||||
$dbserver = validate($_POST['mysql_server'], html_entity_decode($lng['mysql']['mysql_server']), '', '', 0);
|
||||
|
||||
if(!isset($sql_root[$dbserver]) || !is_array($sql_root[$dbserver]))
|
||||
{
|
||||
$dbserver = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$dbserver = 0;
|
||||
}
|
||||
|
||||
// Begin root-session
|
||||
|
||||
$db_root = new db($sql_root[$dbserver]['host'], $sql_root[$dbserver]['user'], $sql_root[$dbserver]['password'], '');
|
||||
unset($db_root->password);
|
||||
$db_root->query('CREATE DATABASE `' . $db_root->escape($username) . '`');
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "created database '" . $username . "'");
|
||||
foreach(array_map('trim', explode(',', $settings['system']['mysql_access_host'])) as $mysql_access_host)
|
||||
{
|
||||
$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\'');
|
||||
$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 . "'");
|
||||
}
|
||||
|
||||
$db_root->query('FLUSH PRIVILEGES');
|
||||
$db_root->close();
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// Update the Database description -- PH 2004-11-29
|
||||
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "edited database '" . $result['databasename'] . "'");
|
||||
$databasedescription = validate($_POST['description'], 'description');
|
||||
$result = $db->query('UPDATE `' . TABLE_PANEL_DATABASES . '` SET `description`="' . $db->escape($databasedescription) . '" WHERE `customerid`="' . (int)$userinfo['customerid'] . '" AND `id`="' . (int)$id . '"');
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
eval("echo \"" . getTemplate("mysql/mysqls_edit") . "\";");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
418
customer_tickets.php
Normal file
@@ -0,0 +1,418 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Support-Tickets - Customer
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version. This program is distributed in the
|
||||
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
|
||||
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Michael Kaufmann <mkaufmann@nutime.de>
|
||||
* @license http://www.gnu.org/licenses/gpl.txt
|
||||
* @package Panel
|
||||
* @version CVS: $Id: customer_tickets.php 2452 2008-11-30 13:12:36Z flo $
|
||||
* @link http://www.nutime.de/
|
||||
* @since File available since Release 1.2.18
|
||||
*/
|
||||
|
||||
define('AREA', 'customer');
|
||||
|
||||
/**
|
||||
* Include our init.php, which manages Sessions, Language etc.
|
||||
*/
|
||||
|
||||
require ("./lib/init.php");
|
||||
|
||||
if(isset($_POST['id']))
|
||||
{
|
||||
$id = intval($_POST['id']);
|
||||
}
|
||||
elseif(isset($_GET['id']))
|
||||
{
|
||||
$id = intval($_GET['id']);
|
||||
}
|
||||
|
||||
if($page == 'overview')
|
||||
{
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_tickets");
|
||||
eval("echo \"" . getTemplate("ticket/ticket") . "\";");
|
||||
}
|
||||
elseif($page == 'tickets')
|
||||
{
|
||||
if($action == '')
|
||||
{
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_tickets::tickets");
|
||||
$fields = array(
|
||||
'status' => $lng['ticket']['status'],
|
||||
'priority' => $lng['ticket']['priority'],
|
||||
'lastchange' => $lng['ticket']['lastchange'],
|
||||
'ticket_answers' => $lng['ticket']['ticket_answers'],
|
||||
'subject' => $lng['ticket']['subject'],
|
||||
'lastreplier' => $lng['ticket']['lastreplier']
|
||||
);
|
||||
$paging = new paging($userinfo, $db, TABLE_PANEL_TICKETS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
|
||||
$paging->sortfield = 'lastchange';
|
||||
$paging->sortorder = 'desc';
|
||||
$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());
|
||||
$paging->setEntries($db->num_rows($result));
|
||||
$sortcode = $paging->getHtmlSortCode($lng);
|
||||
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$searchcode = $paging->getHtmlSearchCode($lng);
|
||||
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$i = 0;
|
||||
$count = 0;
|
||||
$tickets = '';
|
||||
$tickets_count = 0;
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
if($paging->checkDisplay($i))
|
||||
{
|
||||
$tickets_count++;
|
||||
$row = htmlentities_array($row);
|
||||
$row['lastchange'] = date("d.m.y H:i", $row['lastchange']);
|
||||
|
||||
if($row['status'] >= 0
|
||||
&& $row['status'] <= 2)
|
||||
{
|
||||
$reopen = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$reopen = 1;
|
||||
}
|
||||
|
||||
$row['status'] = ticket::getStatusText($lng, $row['status']);
|
||||
$row['priority'] = ticket::getPriorityText($lng, $row['priority']);
|
||||
|
||||
if($row['lastreplier'] == '1')
|
||||
{
|
||||
$row['lastreplier'] = $lng['ticket']['staff'];
|
||||
$cananswer = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$row['lastreplier'] = $lng['ticket']['customer'];
|
||||
$cananswer = 0;
|
||||
}
|
||||
|
||||
if(strlen($row['subject']) > 20)
|
||||
{
|
||||
$row['subject'] = substr($row['subject'], 0, 17) . '...';
|
||||
}
|
||||
|
||||
eval("\$tickets.=\"" . getTemplate("ticket/tickets_tickets") . "\";");
|
||||
$count++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$supportavailable = 0;
|
||||
$time = date("Hi", time());
|
||||
$day = date("w", time());
|
||||
$start = substr($settings['ticket']['worktime_begin'], 0, 2) . substr($settings['ticket']['worktime_begin'], 3, 2);
|
||||
$end = substr($settings['ticket']['worktime_end'], 0, 2) . substr($settings['ticket']['worktime_end'], 3, 2);
|
||||
|
||||
if($time >= $start
|
||||
&& $time <= $end)
|
||||
{
|
||||
$supportavailable = 1;
|
||||
}
|
||||
|
||||
if($settings['ticket']['worktime_sat'] == "0"
|
||||
&& $day == "6")
|
||||
{
|
||||
$supportavailable = 0;
|
||||
}
|
||||
|
||||
if($settings['ticket']['worktime_sun'] == "0"
|
||||
&& $day == "0")
|
||||
{
|
||||
$supportavailable = 0;
|
||||
}
|
||||
|
||||
if($settings['ticket']['worktime_all'] == "1")
|
||||
{
|
||||
$supportavailable = 1;
|
||||
}
|
||||
|
||||
$ticketsopen = 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` = "1" OR `status` = "2")');
|
||||
|
||||
if($settings['ticket']['concurrently_open'] != - 1
|
||||
&& $settings['ticket']['concurrently_open'] != '')
|
||||
{
|
||||
$notmorethanxopentickets = strtr($lng['ticket']['notmorethanxopentickets'], array('%s' => $settings['ticket']['concurrently_open']));
|
||||
}
|
||||
else
|
||||
{
|
||||
$notmorethanxopentickets = '';
|
||||
}
|
||||
|
||||
$ticketsopen = (int)$opentickets['count'];
|
||||
eval("echo \"" . getTemplate("ticket/tickets") . "\";");
|
||||
}
|
||||
elseif($action == 'new')
|
||||
{
|
||||
if($userinfo['tickets_used'] < $userinfo['tickets']
|
||||
|| $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('priority', validate($_POST['priority'], 'priority'), true, false);
|
||||
$newticket->Set('category', validate($_POST['category'], 'category'), true, false);
|
||||
$newticket->Set('customer', (int)$userinfo['customerid'], 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);
|
||||
|
||||
if($newticket->Get('subject') == null)
|
||||
{
|
||||
standard_error(array('stringisempty', 'mysubject'));
|
||||
}
|
||||
elseif($newticket->Get('message') == null)
|
||||
{
|
||||
standard_error(array('stringisempty', 'mymessage'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$now = time();
|
||||
$newticket->Set('dt', $now, true, true);
|
||||
$newticket->Set('lastchange', $now, true, true);
|
||||
$newticket->Set('ip', $_SERVER['REMOTE_ADDR'], true, true);
|
||||
$newticket->Set('status', '0', true, true);
|
||||
$newticket->Set('lastreplier', '0', true, true);
|
||||
$newticket->Set('by', '0', true, true);
|
||||
$newticket->Insert();
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "opened support-ticket '" . $newticket->Get('subject') . "'");
|
||||
$db->query('UPDATE `' . TABLE_PANEL_CUSTOMERS . '`
|
||||
SET `tickets_used`=`tickets_used`+1 WHERE `customerid`="' . (int)$userinfo['customerid'] . '"');
|
||||
|
||||
// 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']);
|
||||
|
||||
// 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']);
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$categories = '';
|
||||
$result = $db->query_first('SELECT `id`, `name` FROM `' . TABLE_PANEL_TICKET_CATS . '` ORDER BY `name` ASC');
|
||||
|
||||
if(isset($result['name'])
|
||||
&& $result['name'] != '')
|
||||
{
|
||||
$result2 = $db->query('SELECT `id`, `name` FROM `' . TABLE_PANEL_TICKET_CATS . '` ORDER BY `name` ASC');
|
||||
|
||||
while($row = $db->fetch_array($result2))
|
||||
{
|
||||
$categories.= makeoption($row['name'], $row['id']);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$categories = makeoption($lng['ticket']['no_cat'], '0');
|
||||
}
|
||||
|
||||
$priorities = makeoption($lng['ticket']['unf_high'], '1');
|
||||
$priorities.= makeoption($lng['ticket']['unf_normal'], '2');
|
||||
$priorities.= makeoption($lng['ticket']['unf_low'], '3');
|
||||
$ticketsopen = 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` = "1" OR `status` = "2")');
|
||||
|
||||
if($settings['ticket']['concurrently_open'] != - 1
|
||||
&& $settings['ticket']['concurrently_open'] != '')
|
||||
{
|
||||
$notmorethanxopentickets = strtr($lng['ticket']['notmorethanxopentickets'], array('%s' => $settings['ticket']['concurrently_open']));
|
||||
}
|
||||
else
|
||||
{
|
||||
$notmorethanxopentickets = '';
|
||||
}
|
||||
|
||||
$ticketsopen = (int)$opentickets['count'];
|
||||
eval("echo \"" . getTemplate("ticket/tickets_new") . "\";");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('nomoreticketsavailable');
|
||||
}
|
||||
}
|
||||
elseif($action == 'answer'
|
||||
&& $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('priority', validate($_POST['priority'], 'priority'), true, false);
|
||||
$replyticket->Set('message', validate(str_replace("\r\n", "\n", $_POST['message']), 'message', '/^[^\0]*$/'), true, false);
|
||||
|
||||
if($replyticket->Get('message') == null)
|
||||
{
|
||||
standard_error(array('stringisempty', 'mymessage'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$now = time();
|
||||
$replyticket->Set('customerid', (int)$userinfo['customerid'], true, true);
|
||||
$replyticket->Set('lastchange', $now, true, true);
|
||||
$replyticket->Set('ip', $_SERVER['REMOTE_ADDR'], true, true);
|
||||
$replyticket->Set('status', '1', true, true);
|
||||
$replyticket->Set('answerto', (int)$id, true, false);
|
||||
$replyticket->Set('by', '0', true, true);
|
||||
$replyticket->Insert();
|
||||
|
||||
// Update priority if changed
|
||||
|
||||
$mainticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$id);
|
||||
|
||||
if($replyticket->Get('priority') != $mainticket->Get('priority'))
|
||||
{
|
||||
$mainticket->Set('priority', $replyticket->Get('priority'), true);
|
||||
}
|
||||
|
||||
$mainticket->Set('lastchange', $now);
|
||||
$mainticket->Set('lastreplier', '0');
|
||||
$mainticket->Set('status', '1');
|
||||
$mainticket->Update();
|
||||
$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']);
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$ticket_replies = '';
|
||||
$mainticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$id);
|
||||
$lastchange = date("d.m.Y H:i\h", $mainticket->Get('lastchange'));
|
||||
$status = ticket::getStatusText($lng, $mainticket->Get('status'));
|
||||
|
||||
if($mainticket->Get('status') >= 0
|
||||
&& $mainticket->Get('status') <= 2)
|
||||
{
|
||||
$isclosed = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$isclosed = 1;
|
||||
}
|
||||
|
||||
if($mainticket->Get('by') == '1')
|
||||
{
|
||||
$by = $lng['ticket']['staff'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$by = $lng['ticket']['customer'];
|
||||
}
|
||||
|
||||
$subject = $mainticket->Get('subject');
|
||||
$message = $mainticket->Get('message');
|
||||
eval("\$ticket_replies.=\"" . getTemplate("ticket/tickets_tickets_main") . "\";");
|
||||
$result = $db->query('SELECT `name` FROM `' . TABLE_PANEL_TICKET_CATS . '`
|
||||
WHERE `id`="' . (int)$mainticket->Get('category') . '"');
|
||||
$row = $db->fetch_array($result);
|
||||
$andere = $db->query('SELECT * FROM `' . TABLE_PANEL_TICKETS . '` WHERE `answerto`="' . (int)$id . '" ORDER BY `lastchange` DESC');
|
||||
|
||||
while($row2 = $db->fetch_array($andere))
|
||||
{
|
||||
$subticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$row2['id']);
|
||||
$lastchange = date("d.m.Y H:i\h", $subticket->Get('lastchange'));
|
||||
|
||||
if($subticket->Get('by') == '1')
|
||||
{
|
||||
$by = $lng['ticket']['staff'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$by = $lng['ticket']['customer'];
|
||||
}
|
||||
|
||||
$subject = $subticket->Get('subject');
|
||||
$message = $subticket->Get('message');
|
||||
eval("\$ticket_replies.=\"" . getTemplate("ticket/tickets_tickets_list") . "\";");
|
||||
}
|
||||
|
||||
$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']['low'], '3', $mainticket->Get('priority'), true, true);
|
||||
$subject = $mainticket->Get('subject');
|
||||
$ticket_replies_count = $db->num_rows($andere) + 1;
|
||||
|
||||
// don't forget the main-ticket!
|
||||
|
||||
eval("echo \"" . getTemplate("ticket/tickets_reply") . "\";");
|
||||
}
|
||||
}
|
||||
elseif($action == 'close'
|
||||
&& $id != 0)
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$now = time();
|
||||
$mainticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$id);
|
||||
$mainticket->Set('lastchange', $now, true, true);
|
||||
$mainticket->Set('lastreplier', '0', true, true);
|
||||
$mainticket->Set('status', '3', true, true);
|
||||
$mainticket->Update();
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "closed support-ticket '" . $mainticket->Get('subject') . "'");
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
$mainticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$id);
|
||||
ask_yesno('ticket_reallyclose', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $mainticket->Get('subject'));
|
||||
}
|
||||
}
|
||||
elseif($action == 'reopen'
|
||||
&& $id != 0)
|
||||
{
|
||||
$ticketsopen = 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` = "1" OR `status` = "2")');
|
||||
$ticketsopen = (int)$opentickets['count'];
|
||||
|
||||
if($ticketsopen > $settings['ticket']['concurrently_open']
|
||||
&& $settings['ticket']['concurrently_open'] != - 1
|
||||
&& $settings['ticket']['concurrently_open'] != '')
|
||||
{
|
||||
standard_error('notmorethanxopentickets', $settings['ticket']['concurrently_open']);
|
||||
}
|
||||
|
||||
$now = time();
|
||||
$mainticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$id);
|
||||
$mainticket->Set('lastchange', $now, true, true);
|
||||
$mainticket->Set('lastreplier', '0', true, true);
|
||||
$mainticket->Set('status', '0', true, true);
|
||||
$mainticket->Update();
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "reopened support-ticket '" . $mainticket->Get('subject') . "'");
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
280
customer_traffic.php
Normal file
@@ -0,0 +1,280 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Tobias Friebel <TobyF@web.de>
|
||||
* @author microft <microft@chimera.ch>
|
||||
* @author falzo <falzo@despammed.com>
|
||||
* @author Florian Aders <florian.aders@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
* @version $Id: customer_traffic.php 2692 2009-03-27 18:04:47Z flo $
|
||||
* @since File available since Release 1.2.20
|
||||
*/
|
||||
|
||||
define('AREA', 'customer');
|
||||
|
||||
/**
|
||||
* Include our init.php, which manages Sessions, Language etc.
|
||||
*/
|
||||
|
||||
require ("./lib/init.php");
|
||||
$traffic = '';
|
||||
$month = null;
|
||||
$year = null;
|
||||
|
||||
if(isset($_POST['month'])
|
||||
&& isset($_POST['year']))
|
||||
{
|
||||
$month = intval($_POST['month']);
|
||||
$year = intval($_POST['year']);
|
||||
}
|
||||
elseif(isset($_GET['month'])
|
||||
&& isset($_GET['year']))
|
||||
{
|
||||
$month = intval($_GET['month']);
|
||||
$year = intval($_GET['year']);
|
||||
}
|
||||
|
||||
//BAM! $_GET???
|
||||
|
||||
elseif (isset($_GET['page'])
|
||||
&& $_GET['page'] == "current")
|
||||
{
|
||||
if(date('d') != '01')
|
||||
{
|
||||
$month = date('m');
|
||||
$year = date('Y');
|
||||
}
|
||||
else
|
||||
{
|
||||
if(date('m') == '01')
|
||||
{
|
||||
$month = 12;
|
||||
$year = date('Y') - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$month = date('m') - 1;
|
||||
$year = date('Y');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!is_null($month)
|
||||
&& !is_null($year))
|
||||
{
|
||||
$traf['byte'] = 0;
|
||||
$result = $db->query("SELECT MAX(`http`), MAX(`ftp_up`+`ftp_down`), MAX(`mail`)
|
||||
FROM `" . TABLE_PANEL_TRAFFIC . "`
|
||||
WHERE `customerid`='" . $userinfo['customerid'] . "'
|
||||
AND `month` = '" . $month . "'
|
||||
AND `year` = '" . $year . "'");
|
||||
rsort($row = mysql_fetch_row($result));
|
||||
$traf['max'] = $row[0];
|
||||
$result = $db->query("SELECT
|
||||
SUM(`http`) as 'http', SUM(`ftp_up`) AS 'ftp_up', SUM(`ftp_down`) as 'ftp_down', SUM(`mail`) as 'mail',
|
||||
`day`, `month`, `year`
|
||||
FROM `" . TABLE_PANEL_TRAFFIC . "`
|
||||
WHERE `customerid`='" . $userinfo['customerid'] . "'
|
||||
AND `month` = '" . $month . "' AND `year` = '" . $year . "'
|
||||
GROUP BY `day` ORDER BY `day` ASC");
|
||||
$traffic_complete['http'] = 0;
|
||||
$traffic_complete['ftp'] = 0;
|
||||
$traffic_complete['mail'] = 0;
|
||||
$show = '';
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
$http = $row['http'];
|
||||
$ftp = $row['ftp_up'] + $row['ftp_down'];
|
||||
$mail = $row['mail'];
|
||||
$traf['byte'] = $http + $ftp + $mail;
|
||||
$traffic_complete['http']+= $http;
|
||||
$traffic_complete['ftp']+= $ftp;
|
||||
$traffic_complete['mail']+= $mail;
|
||||
$traf['day'] = $row['day'];
|
||||
|
||||
if(extension_loaded('bcmath'))
|
||||
{
|
||||
$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['httptext'] = bcdiv($http, 1024, $settings['panel']['decimal_places']) . " MB (HTTP)";
|
||||
$traf['mailtext'] = bcdiv($mail, 1024, $settings['panel']['decimal_places']) . " MB (Mail)";
|
||||
}
|
||||
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['httptext'] = round($http / 1024, $settings['panel']['decimal_places']) . " MB (HTTP)";
|
||||
$traf['mailtext'] = round($mail / 1024, $settings['panel']['decimal_places']) . " MB (Mail)";
|
||||
}
|
||||
|
||||
if($traf['byte'] != 0
|
||||
&& $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'];
|
||||
}
|
||||
|
||||
if(extension_loaded('bcmath'))
|
||||
{
|
||||
$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") . "\";");
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $db->query("(SELECT SUM(`http`) as sum FROM `" . TABLE_PANEL_TRAFFIC . "`
|
||||
WHERE `customerid` = '" . $userinfo['customerid'] . "'
|
||||
GROUP BY CONCAT(`year`,`month`) ORDER BY CONCAT(`year`,`month`) DESC LIMIT 12) UNION
|
||||
(SELECT SUM(`ftp_up`+`ftp_down`) FROM `" . TABLE_PANEL_TRAFFIC . "`
|
||||
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['sum'];
|
||||
$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['ftp'] = 0;
|
||||
$traffic_complete['mail'] = 0;
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
$http = $row['http'];
|
||||
$ftp_up = $row['ftp_up'];
|
||||
$ftp_down = $row['ftp_down'];
|
||||
$mail = $row['mail'];
|
||||
$traffic_complete['http']+= $http;
|
||||
$traffic_complete['ftp']+= $ftp_up + $ftp_down;
|
||||
$traffic_complete['mail']+= $mail;
|
||||
$traf['month'] = $row['month'];
|
||||
$traf['year'] = $row['year'];
|
||||
$traf['monthname'] = $lng['traffic']['months'][intval($row['month'])] . " " . $row['year'];
|
||||
$traf['byte'] = $http + $ftp_up + $ftp_down + $mail;
|
||||
|
||||
if(extension_loaded('bcmath'))
|
||||
{
|
||||
$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['httptext'] = bcdiv($http, 1024 * 1024, $settings['panel']['decimal_places']) . " GB (HTTP)";
|
||||
$traf['mailtext'] = bcdiv($mail, 1024 * 1024, $settings['panel']['decimal_places']) . " GB (Mail)";
|
||||
}
|
||||
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['httptext'] = round($http / 1024 * 1024, $settings['panel']['decimal_places']) . " GB (HTTP)";
|
||||
$traf['mailtext'] = round($mail / 1024 * 1024, $settings['panel']['decimal_places']) . " GB (Mail)";
|
||||
}
|
||||
|
||||
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") . "\";");
|
||||
}
|
||||
|
||||
if(extension_loaded('bcmath'))
|
||||
{
|
||||
$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") . "\";");
|
||||
}
|
||||
|
||||
?>
|
||||
BIN
images/ball.gif
Normal file
|
After Width: | Height: | Size: 51 B |
BIN
images/changelanguage.gif
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
images/default.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
images/endsection.gif
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
images/error.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
images/error.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
images/footer.gif
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
images/header.gif
Normal file
|
After Width: | Height: | Size: 27 KiB |
BIN
images/header_r.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
images/info.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
images/login.gif
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
images/logininternal.gif
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
images/order_asc.gif
Normal file
|
After Width: | Height: | Size: 62 B |
BIN
images/order_desc.gif
Normal file
|
After Width: | Height: | Size: 60 B |
BIN
images/section.gif
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
images/shadow.gif
Normal file
|
After Width: | Height: | Size: 86 B |
BIN
images/subsection.gif
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
images/title.gif
Normal file
|
After Width: | Height: | Size: 69 B |
BIN
images/traffic_blue.gif
Normal file
|
After Width: | Height: | Size: 66 B |
BIN
images/traffic_green.gif
Normal file
|
After Width: | Height: | Size: 82 B |
BIN
images/traffic_red.gif
Normal file
|
After Width: | Height: | Size: 105 B |
BIN
images/traffic_yellow.gif
Normal file
|
After Width: | Height: | Size: 827 B |
271
index.php
Normal file
@@ -0,0 +1,271 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
* @version $Id: index.php 2693 2009-03-27 19:31:48Z flo $
|
||||
*/
|
||||
|
||||
define('AREA', 'login');
|
||||
|
||||
/**
|
||||
* Include our init.php, which manages Sessions, Language etc.
|
||||
*/
|
||||
|
||||
require ("./lib/init.php");
|
||||
|
||||
if($action == '')
|
||||
{
|
||||
$action = 'login';
|
||||
}
|
||||
|
||||
if($action == 'login')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$loginname = validate($_POST['loginname'], 'loginname');
|
||||
$password = validate($_POST['password'], 'password');
|
||||
$row = $db->query_first("SELECT `loginname` AS `customer` FROM `" . TABLE_PANEL_CUSTOMERS . "` WHERE `loginname`='" . $db->escape($loginname) . "'");
|
||||
|
||||
if($row['customer'] == $loginname)
|
||||
{
|
||||
$table = "`" . TABLE_PANEL_CUSTOMERS . "`";
|
||||
$uid = 'customerid';
|
||||
$adminsession = '0';
|
||||
}
|
||||
else
|
||||
{
|
||||
$row = $db->query_first("SELECT `loginname` AS `admin` FROM `" . TABLE_PANEL_ADMINS . "` WHERE `loginname`='" . $db->escape($loginname) . "'");
|
||||
|
||||
if($row['admin'] == $loginname)
|
||||
{
|
||||
$table = "`" . TABLE_PANEL_ADMINS . "`";
|
||||
$uid = 'adminid';
|
||||
$adminsession = '1';
|
||||
}
|
||||
else
|
||||
{
|
||||
redirectTo('index.php', Array('showmessage' => '2'), true);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$userinfo = $db->query_first("SELECT * FROM $table WHERE `loginname`='" . $db->escape($loginname) . "'");
|
||||
|
||||
if($userinfo['loginfail_count'] >= $settings['login']['maxloginattempts']
|
||||
&& $userinfo['lastlogin_fail'] > (time() - $settings['login']['deactivatetime']))
|
||||
{
|
||||
redirectTo('index.php', Array('showmessage' => '3'), true);
|
||||
exit;
|
||||
}
|
||||
elseif($userinfo['password'] == md5($password))
|
||||
{
|
||||
// login correct
|
||||
// reset loginfail_counter, set lastlogin_succ
|
||||
|
||||
$db->query("UPDATE $table SET `lastlogin_succ`='" . time() . "', `loginfail_count`='0' WHERE `$uid`='" . (int)$userinfo[$uid] . "'");
|
||||
$userinfo['userid'] = $userinfo[$uid];
|
||||
$userinfo['adminsession'] = $adminsession;
|
||||
}
|
||||
else
|
||||
{
|
||||
// login incorrect
|
||||
|
||||
$db->query("UPDATE $table SET `lastlogin_fail`='" . time() . "', `loginfail_count`=`loginfail_count`+1 WHERE `$uid`='" . (int)$userinfo[$uid] . "'");
|
||||
unset($userinfo);
|
||||
redirectTo('index.php', Array('showmessage' => '2'), true);
|
||||
exit;
|
||||
}
|
||||
|
||||
if(isset($userinfo['userid'])
|
||||
&& $userinfo['userid'] != '')
|
||||
{
|
||||
$s = md5(uniqid(microtime(), 1));
|
||||
|
||||
if(isset($_POST['language']))
|
||||
{
|
||||
$language = validate($_POST['language'], 'language');
|
||||
|
||||
if($language == 'profile')
|
||||
{
|
||||
$language = $userinfo['def_language'];
|
||||
}
|
||||
elseif(!isset($languages[$language]))
|
||||
{
|
||||
$language = $settings['panel']['standardlanguage'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$language = $settings['panel']['standardlanguage'];
|
||||
}
|
||||
|
||||
if($settings['session']['allow_multiple_login'] != '1')
|
||||
{
|
||||
$db->query("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid` = '" . (int)$userinfo['userid'] . "' AND `adminsession` = '" . $db->escape($userinfo['adminsession']) . "'");
|
||||
}
|
||||
|
||||
$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($userinfo['adminsession'] == '1')
|
||||
{
|
||||
redirectTo('admin_index.php', Array('s' => $s), true);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
redirectTo('customer_index.php', Array('s' => $s), true);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
redirectTo('index.php', Array('showmessage' => '2'), true);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$language_options = '';
|
||||
$language_options.= makeoption($lng['login']['profile_lng'], 'profile', 'profile', true, true);
|
||||
|
||||
while(list($language_file, $language_name) = each($languages))
|
||||
{
|
||||
$language_options.= makeoption($language_name, $language_file, 'profile', true);
|
||||
}
|
||||
|
||||
$smessage = isset($_GET['showmessage']) ? (int)$_GET['showmessage'] : 0;
|
||||
$message = '';
|
||||
|
||||
switch($smessage)
|
||||
{
|
||||
case 1:
|
||||
$message = $lng['pwdreminder']['success'];
|
||||
break;
|
||||
case 2:
|
||||
$message = $lng['error']['login'];
|
||||
break;
|
||||
case 3:
|
||||
$message = $lng['error']['login_blocked'];
|
||||
break;
|
||||
case 4:
|
||||
$message = $lng['error']['errorsendingmail'];
|
||||
break;
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("login") . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
if($action == 'forgotpwd')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$adminchecked = false;
|
||||
$loginname = validate($_POST['loginname'], 'loginname');
|
||||
$email = validateEmail($_POST['loginemail'], 'email');
|
||||
$sql = "SELECT `customerid`, `firstname`, `name`, `email`, `loginname` FROM `" . TABLE_PANEL_CUSTOMERS . "`
|
||||
WHERE `loginname`='" . $db->escape($loginname) . "'
|
||||
AND `email`='" . $db->escape($email) . "'";
|
||||
$result = $db->query($sql);
|
||||
|
||||
if($db->num_rows() == 0)
|
||||
{
|
||||
$sql = "SELECT `adminid`, `firstname`, `name`, `email`, `loginname` FROM `" . TABLE_PANEL_ADMINS . "`
|
||||
WHERE `loginname`='" . $db->escape($loginname) . "'
|
||||
AND `email`='" . $db->escape($email) . "'";
|
||||
$result = $db->query($sql);
|
||||
$adminchecked = true;
|
||||
}
|
||||
|
||||
$user = $db->fetch_array($result);
|
||||
|
||||
if(($adminchecked && $settings['panel']['allow_preset_admin'] == '1')
|
||||
|| $adminchecked == false)
|
||||
{
|
||||
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 = SysCPLogger::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 = 'SysCP';
|
||||
$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 = SysCPLogger::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;
|
||||
}
|
||||
else
|
||||
{
|
||||
$rstlog = SysCPLogger::getInstanceOf(array('loginname' => 'password_reset'), $db, $settings);
|
||||
$rstlog->logAction(USR_ACTION, LOG_WARNING, "User '" . $loginname . "' tried to reset pwd but wasn't found in database!");
|
||||
$message = $lng['login']['usernotfound'];
|
||||
}
|
||||
|
||||
unset($user, $adminchecked);
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = '';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = '';
|
||||
}
|
||||
|
||||
if($settings['panel']['allow_preset'] != '1')
|
||||
{
|
||||
$message = $lng['pwdreminder']['notallowed'];
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("fpwd") . "\";");
|
||||
}
|
||||
|
||||
?>
|
||||
802
install/install.php
Normal file
@@ -0,0 +1,802 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package System
|
||||
* @version $Id: install.php 2724 2009-06-07 14:18:02Z flo $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Most elements are taken from the phpBB (www.phpbb.com)
|
||||
* installer, (c) 1999 - 2004 phpBB Group.
|
||||
*/
|
||||
|
||||
if(file_exists('../lib/userdata.inc.php'))
|
||||
{
|
||||
/**
|
||||
* Includes the Usersettings eg. MySQL-Username/Passwort etc. to test if SysCP is already installed
|
||||
*/
|
||||
|
||||
require ('../lib/userdata.inc.php');
|
||||
|
||||
if(isset($sql)
|
||||
&& is_array($sql))
|
||||
{
|
||||
die('Sorry, SysCP 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>SysCP</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.syscp.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 SysCP. If you refuse
|
||||
to include even this then support on our forums may be affected.
|
||||
The SysCP Team : 2003-2009
|
||||
// -->
|
||||
<!--
|
||||
Templates 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"> </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 />SysCP © 2003-2009 by <a href="http://www.syscp.org/" target="_blank">the SysCP 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 = 'syscp';
|
||||
}
|
||||
|
||||
if(!empty($_POST['mysql_unpriv_user']))
|
||||
{
|
||||
$mysql_unpriv_user = $_POST['mysql_unpriv_user'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$mysql_unpriv_user = 'syscp';
|
||||
}
|
||||
|
||||
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="" /> SysCP Installation</b></td>
|
||||
</tr>
|
||||
<?php
|
||||
$_die = false;
|
||||
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']['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']['diedbecauseofextensions']);
|
||||
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/syscp_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 syscp 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 syscp-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 = './syscp.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($dbversion) . "' WHERE `settinggroup` = 'system' AND `varname` = 'dbversion'");
|
||||
$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/syscp-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/syscp-diroptions/' WHERE `settinggroup` = 'system' AND `varname` = 'apacheconf_diroptions'");
|
||||
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/lighttpd/syscp-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,
|
||||
`edit_billingdata` = 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 SysCP\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']['syscp_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="" /> <?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="" /> <?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="" /> <?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="" /> <?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 <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 ---------------------------------------------------
|
||||
*/
|
||||
|
||||
?>
|
||||
79
install/lng/english.lng.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2007 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Language
|
||||
* @version $Id: english.lng.php 2452 2008-11-30 13:12:36Z flo $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Begin
|
||||
*/
|
||||
|
||||
$lng['install']['language'] = 'Installation - Language';
|
||||
$lng['install']['welcome'] = 'Welcome to SysCP Installation';
|
||||
$lng['install']['welcometext'] = 'Thank you for choosing SysCP. Please fill out the following fields with the required information to start the installation.<br /><b>Attention:</b> If the database you chose for SysCP already exists on your System, it will be erased with all containing data!';
|
||||
$lng['install']['database'] = 'Database';
|
||||
$lng['install']['mysql_hostname'] = 'MySQL-Hostname';
|
||||
$lng['install']['mysql_database'] = 'MySQL-Database';
|
||||
$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_root_user'] = 'Username 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_user'] = 'Administrator Username';
|
||||
$lng['install']['admin_pass'] = 'Administrator Password';
|
||||
$lng['install']['admin_pass_confirm'] = 'Administrator-Password (confirm)';
|
||||
$lng['install']['serversettings'] = 'Server settings';
|
||||
$lng['install']['servername'] = 'Server name (FQDN)';
|
||||
$lng['install']['serverip'] = 'Server IP';
|
||||
$lng['install']['httpuser'] = 'HTTP username';
|
||||
$lng['install']['httpgroup'] = 'HTTP groupname';
|
||||
$lng['install']['apacheversion'] = 'Apacheversion';
|
||||
$lng['install']['next'] = 'Next';
|
||||
|
||||
/**
|
||||
* Progress
|
||||
*/
|
||||
|
||||
$lng['install']['testing_mysql'] = 'Testing if MySQL-root-username and password are correct...';
|
||||
$lng['install']['erasing_old_db'] = 'Erasing old Database...';
|
||||
$lng['install']['backup_old_db'] = 'Create backup of the old Database...';
|
||||
$lng['install']['backing_up'] = 'Backing up';
|
||||
$lng['install']['backing_up_binary_missing'] = '/usr/bin/mysqldump is missing';
|
||||
$lng['install']['create_mysqluser_and_db'] = 'Creating MySQL-database and username...';
|
||||
$lng['install']['testing_new_db'] = 'Testing if MySQL-database and username have been created correctly...';
|
||||
$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_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_failed'] = 'Cannot create lib/userdata.inc.php, please create it manually with the following data:';
|
||||
$lng['install']['syscp_succ_installed'] = 'SysCP 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']['diedbecauseofextensions'] = 'Cannot install SysCP without these extensions! 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. SysCP will not work properly with open_basedir enabled. Please disable open_basedir for syscp';
|
||||
|
||||
/**
|
||||
* Renamed in 1.2.19-svn40
|
||||
*/
|
||||
|
||||
$lng['install']['webserver'] = 'Webserver';
|
||||
|
||||
?>
|
||||
69
install/lng/french.lng.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Tim Zielosko <mail@zielosko.net>
|
||||
* @author Romain MARIADASSOU <roms2000@free.fr>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Language
|
||||
* @version $Id: french.lng.php 2692 2009-03-27 18:04:47Z flo $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Begin
|
||||
*/
|
||||
|
||||
$lng['install']['language'] = 'Langue d\'installation';
|
||||
$lng['install']['welcome'] = 'Bienvenue <20> l\'installation de SysCP';
|
||||
$lng['install']['welcometext'] = 'Merci beaucoup d\'avoir choisi SysCP. Pour installer SysCP 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']['database'] = 'Base de donn<6E>es';
|
||||
$lng['install']['mysql_hostname'] = 'Nom d\'h<>te du serveur MySQL';
|
||||
$lng['install']['mysql_database'] = 'Base de donn<6E>es MySQL';
|
||||
$lng['install']['mysql_unpriv_user'] = 'Utilisateur pour l\'acc<63>s non privil<69>gi<67> <20> MySQL';
|
||||
$lng['install']['mysql_unpriv_pass'] = 'Mot de passe pour l\'acc<63>s non privil<69>gi<67> <20> MySQL';
|
||||
$lng['install']['mysql_root_user'] = 'Utilisateur pour l\'acc<63>s root <20> MySQL';
|
||||
$lng['install']['mysql_root_pass'] = 'Mot de passe pour l\'acc<63>s root <20> MySQL';
|
||||
$lng['install']['admin_account'] = 'Acc<63>s administratif';
|
||||
$lng['install']['admin_user'] = 'Login de l\'administrateur';
|
||||
$lng['install']['admin_pass'] = 'Mot de passe de l\'administrateur';
|
||||
$lng['install']['admin_pass_confirm'] = 'Mot de passe de l\'administrateur (confirmation)';
|
||||
$lng['install']['serversettings'] = 'Configuration du serveur';
|
||||
$lng['install']['servername'] = 'Nom du serveur (FQDN)';
|
||||
$lng['install']['serverip'] = 'Adresse IP du serveur';
|
||||
$lng['install']['apacheversion'] = 'Version du serveur Apache';
|
||||
$lng['install']['next'] = 'Continuer';
|
||||
|
||||
/**
|
||||
* Progress
|
||||
*/
|
||||
|
||||
$lng['install']['testing_mysql'] = 'V<>rification du login root de MySQL ...';
|
||||
$lng['install']['erasing_old_db'] = 'Effacement de l\'ancienne base de donn<6E>es ...';
|
||||
$lng['install']['create_mysqluser_and_db'] = 'Cr<43>ation de la base de donn<6E>es puis des utilisateurs ...';
|
||||
$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 SysCP.';
|
||||
$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 SysCP.';
|
||||
$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']['syscp_succ_installed'] = 'SysCP 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';
|
||||
|
||||
?>
|
||||
76
install/lng/german.lng.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2007 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Language
|
||||
* @version $Id: german.lng.php 2452 2008-11-30 13:12:36Z flo $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Begin
|
||||
*/
|
||||
|
||||
$lng['install']['language'] = 'Installations - Sprache';
|
||||
$lng['install']['welcome'] = 'Willkommen zur SysCP Installation';
|
||||
$lng['install']['welcometext'] = 'Vielen Dank dass Sie sich für SysCP entschieden haben. Um Ihre Installation von SysCP zu starten, fü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öscht!';
|
||||
$lng['install']['database'] = 'Datenbank';
|
||||
$lng['install']['mysql_hostname'] = 'MySQL-Hostname';
|
||||
$lng['install']['mysql_database'] = 'MySQL-Datenbank';
|
||||
$lng['install']['mysql_unpriv_user'] = 'Benutzername für den unprivilegierten MySQL-Account';
|
||||
$lng['install']['mysql_unpriv_pass'] = 'Passwort für den unprivilegierten MySQL-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_user'] = 'Administrator-Benutzername';
|
||||
$lng['install']['admin_pass'] = 'Administrator-Passwort';
|
||||
$lng['install']['admin_pass_confirm'] = 'Administrator-Passwort (Bestätigung)';
|
||||
$lng['install']['serversettings'] = 'Servereinstellungen';
|
||||
$lng['install']['servername'] = 'Servername (FQDN)';
|
||||
$lng['install']['serverip'] = 'Server-IP';
|
||||
$lng['install']['apacheversion'] = 'Apacheversion';
|
||||
$lng['install']['next'] = 'Fortfahren';
|
||||
|
||||
/**
|
||||
* Progress
|
||||
*/
|
||||
|
||||
$lng['install']['testing_mysql'] = 'Teste, ob die MySQL-Root-Benutzerdaten richtig sind...';
|
||||
$lng['install']['erasing_old_db'] = 'Entferne alte Datenbank...';
|
||||
$lng['install']['create_mysqluser_and_db'] = 'Erstelle Datenbank und Benutzer...';
|
||||
$lng['install']['testing_new_db'] = 'Teste, ob die Datenbank und Passwort korrekt angelegt wurden...';
|
||||
$lng['install']['importing_data'] = 'Importiere Daten in die MySQL-Datenbank...';
|
||||
$lng['install']['changing_data'] = 'Passe die importierten Daten an...';
|
||||
$lng['install']['adding_admin_user'] = 'Füge den Admin-Benutzer hinzu...';
|
||||
$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_failed'] = 'Konnte lib/userdata.inc.php nicht erstellen, bitte manuell mit folgendem Inhalt anlegen:';
|
||||
$lng['install']['syscp_succ_installed'] = 'SysCP 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']['diedbecauseofextensions'] = 'Kann SysCP ohne diese Erweiterungen 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ändig zur Verfügung!';
|
||||
$lng['install']['openbasedir'] = 'Teste, ob open_basedir genutzt wird...';
|
||||
$lng['install']['openbasedirenabled'] = 'aktiviert. SysCP wird mit aktiviertem open_basedir nicht vollständig funktionieren. Bitte deaktivieren Sie open_basedir für SysCP';
|
||||
$lng['install']['httpuser'] = 'HTTP Username';
|
||||
$lng['install']['httpgroup'] = 'HTTP Gruppenname';
|
||||
|
||||
/**
|
||||
* Renamed in 1.2.19-svn40
|
||||
*/
|
||||
|
||||
$lng['install']['webserver'] = 'Webserver';
|
||||
|
||||
?>
|
||||
106
install/scripts/htpasswd-htaccess-remover.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2007 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Michael Duergner <michael@duergner.com>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package System
|
||||
* @version $Id: htpasswd-htaccess-remover.php 2244 2008-10-06 11:01:18Z EleRas $
|
||||
*/
|
||||
|
||||
if(@php_sapi_name() != 'cli'
|
||||
&& @php_sapi_name() != 'cgi'
|
||||
&& @php_sapi_name() != 'cgi-fcgi')
|
||||
{
|
||||
die('This script will only work in the shell.');
|
||||
}
|
||||
|
||||
$pathtophpfiles = '/var/www/syscp';
|
||||
$filename = 'htpasswd-htaccess-remover.php';
|
||||
|
||||
/**
|
||||
* Includes the Usersettings eg. MySQL-Username/Passwort etc.
|
||||
*/
|
||||
|
||||
require ("$pathtophpfiles/lib/userdata.inc.php");
|
||||
|
||||
/**
|
||||
* Includes the MySQL-Tabledefinitions etc.
|
||||
*/
|
||||
|
||||
require ("$pathtophpfiles/lib/tables.inc.php");
|
||||
|
||||
/**
|
||||
* Includes the MySQL-Connection-Class
|
||||
*/
|
||||
|
||||
require ("$pathtophpfiles/lib/class_mysqldb.php");
|
||||
$debugMsg[] = 'Database Class has been loaded';
|
||||
$db = new db($sql['host'], $sql['user'], $sql['password'], $sql['db']);
|
||||
$db_root = new db($sql['host'], $sql['root_user'], $sql['root_password'], '');
|
||||
|
||||
if($db->link_id == 0
|
||||
|| $db_root->link_id == 0)
|
||||
{
|
||||
/**
|
||||
* Do not proceed further if no database connection could be established (either normal or root)
|
||||
*/
|
||||
|
||||
die('Cant connect to mysqlserver. Please check userdata.inc.php! Exiting...');
|
||||
}
|
||||
|
||||
unset($sql['password']);
|
||||
unset($db->password);
|
||||
$result = $db->query("SELECT `settingid`, `settinggroup`, `varname`, `value` FROM `" . TABLE_PANEL_SETTINGS . "`");
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
$settings["$row[settinggroup]"]["$row[varname]"] = $row['value'];
|
||||
}
|
||||
|
||||
unset($row);
|
||||
unset($result);
|
||||
|
||||
if(!isset($settings['panel']['version'])
|
||||
|| $settings['panel']['version'] != $version)
|
||||
{
|
||||
/**
|
||||
* Do not proceed further if the Database version is not the same as the script version
|
||||
*/
|
||||
|
||||
die('Version of File doesnt match Version of Database. Exiting...');
|
||||
}
|
||||
|
||||
/**
|
||||
* Includes the Functions
|
||||
*/
|
||||
|
||||
require ("$pathtophpfiles/lib/functions.php");
|
||||
$result = $db->query('SELECT * FROM `' . TABLE_PANEL_HTACCESS . '` ');
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
if(file_exists($row['path'] . '.htaccess'))
|
||||
{
|
||||
unlink($row['path'] . '.htaccess');
|
||||
}
|
||||
}
|
||||
|
||||
$result = $db->query('SELECT * FROM `' . TABLE_PANEL_HTPASSWDS . '` ');
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
if(file_exists($row['path'] . '.htpasswd'))
|
||||
{
|
||||
unlink($row['path'] . '.htpasswd');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
186
install/scripts/language-check.php
Normal file
@@ -0,0 +1,186 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2007 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Martin Burchert <eremit@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package System
|
||||
* @version $Id: language-check.php 2244 2008-10-06 11:01:18Z EleRas $
|
||||
*/
|
||||
|
||||
// some configs
|
||||
|
||||
$baseLanguage = 'english.lng.php';
|
||||
|
||||
// Check if we're in the CLI
|
||||
|
||||
if(@php_sapi_name() != 'cli'
|
||||
&& @php_sapi_name() != 'cgi'
|
||||
&& @php_sapi_name() != 'cgi-fcgi')
|
||||
{
|
||||
die('This script will only work in the shell.');
|
||||
}
|
||||
|
||||
// Check argument count
|
||||
|
||||
if(sizeof($argv) != 2)
|
||||
{
|
||||
print_help($argv);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Load the contents of the given path
|
||||
|
||||
$path = $argv[1];
|
||||
$files = array();
|
||||
|
||||
if($dh = opendir($path))
|
||||
{
|
||||
while(false !== ($file = readdir($dh)))
|
||||
{
|
||||
if($file != "."
|
||||
&& $file != ".."
|
||||
&& !is_dir($file)
|
||||
&& preg_match('/(.+)\.lng\.php/i', $file))
|
||||
{
|
||||
$files[$file] = str_replace('//', '/', $path . '/' . $file);
|
||||
}
|
||||
}
|
||||
|
||||
closedir($dh);
|
||||
}
|
||||
else
|
||||
{
|
||||
print "ERROR: The path you requested cannot be read! \n ";
|
||||
print "\n";
|
||||
print_help();
|
||||
exit;
|
||||
}
|
||||
|
||||
// check if there is the default language defined
|
||||
|
||||
if(!isset($files[$baseLanguage]))
|
||||
{
|
||||
print "ERROR: The baselanguage cannot be found! \n";
|
||||
print "\n";
|
||||
print_help();
|
||||
exit;
|
||||
}
|
||||
|
||||
// import the baselanguage
|
||||
|
||||
$base = import($files[$baseLanguage]);
|
||||
|
||||
// and unset it in the files, because we don't need to compare base to base
|
||||
|
||||
unset($files[$baseLanguage]);
|
||||
|
||||
// compare each language with the baselanguage
|
||||
|
||||
foreach($files as $key => $file)
|
||||
{
|
||||
$comp = import($file);
|
||||
print "\n\nComparing " . $baseLanguage . " to " . $key . "\n";
|
||||
$result = compare($base, $comp);
|
||||
|
||||
if(is_array($result)
|
||||
&& sizeof($result) > 0)
|
||||
{
|
||||
print " found missing strings: \n";
|
||||
foreach($result as $value)
|
||||
{
|
||||
print " " . $value . "\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print " no missing strings found! \n ";
|
||||
}
|
||||
|
||||
print "\nReverse Checking " . $key . " to " . $baseLanguage . "\n";
|
||||
$result = compare($comp, $base);
|
||||
|
||||
if(is_array($result)
|
||||
&& sizeof($result) > 0)
|
||||
{
|
||||
print " found strings not in basefile: \n";
|
||||
foreach($result as $key => $value)
|
||||
{
|
||||
print " " . $value . "\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print " There are no strings which are not in the basefile! \n ";
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------
|
||||
// FUNCTIONS
|
||||
//-----------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* prints the help screen
|
||||
*
|
||||
* @param array $argv
|
||||
*/
|
||||
|
||||
function print_help($argv)
|
||||
{
|
||||
print "Usage: php " . $argv[0] . " /PATH/TO/LNG \n";
|
||||
print " \n ";
|
||||
}
|
||||
|
||||
function import($file)
|
||||
{
|
||||
$input = file($file);
|
||||
$return = array();
|
||||
foreach($input as $key => $value)
|
||||
{
|
||||
if(!preg_match('/^\$/', $value))
|
||||
{
|
||||
unset($input[$key]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// generate the key
|
||||
|
||||
$key = preg_replace('/^\$lng\[\'(.*)=(.*)$/U', '\\1', $value);
|
||||
$key = str_replace('[\'', '/', $key);
|
||||
$key = trim(str_replace('\']', '', $key));
|
||||
|
||||
//generate the value
|
||||
|
||||
$value = trim($value);
|
||||
|
||||
// set the result
|
||||
|
||||
$return[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
function compare($array1, $array2)
|
||||
{
|
||||
$result = array();
|
||||
foreach($array1 as $key => $value)
|
||||
{
|
||||
if(!isset($array2[$key]))
|
||||
{
|
||||
$result[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
?>
|
||||
916
install/syscp.sql
Normal file
@@ -0,0 +1,916 @@
|
||||
# $Id: syscp.sql 2722 2009-05-04 18:59:28Z flo $
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `ftp_groups`
|
||||
#
|
||||
|
||||
DROP TABLE IF EXISTS `ftp_groups`;
|
||||
CREATE TABLE `ftp_groups` (
|
||||
`id` int(20) NOT NULL auto_increment,
|
||||
`groupname` varchar(60) NOT NULL default '',
|
||||
`gid` int(5) NOT NULL default '0',
|
||||
`members` longtext NOT NULL,
|
||||
`customerid` int(11) NOT NULL default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `groupname` (`groupname`),
|
||||
KEY `customerid` (`customerid`)
|
||||
) TYPE=MyISAM ;
|
||||
|
||||
#
|
||||
# Dumping data for table `ftp_groups`
|
||||
#
|
||||
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `ftp_users`
|
||||
#
|
||||
|
||||
DROP TABLE IF EXISTS `ftp_users`;
|
||||
CREATE TABLE `ftp_users` (
|
||||
`id` int(20) NOT NULL auto_increment,
|
||||
`username` varchar(255) NOT NULL default '',
|
||||
`uid` int(5) NOT NULL default '0',
|
||||
`gid` int(5) NOT NULL default '0',
|
||||
`password` varchar(20) NOT NULL default '',
|
||||
`homedir` varchar(255) NOT NULL default '',
|
||||
`shell` varchar(255) NOT NULL default '/bin/false',
|
||||
`login_enabled` enum('N','Y') NOT NULL default 'N',
|
||||
`login_count` int(15) NOT NULL default '0',
|
||||
`last_login` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||
`up_count` int(15) NOT NULL default '0',
|
||||
`up_bytes` bigint(30) NOT NULL default '0',
|
||||
`down_count` int(15) NOT NULL default '0',
|
||||
`down_bytes` bigint(30) NOT NULL default '0',
|
||||
`customerid` int(11) NOT NULL default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `username` (`username`),
|
||||
KEY `customerid` (`customerid`)
|
||||
) TYPE=MyISAM ;
|
||||
|
||||
#
|
||||
# Dumping data for table `ftp_users`
|
||||
#
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
|
||||
#
|
||||
# Table structure for table `mail_users`
|
||||
#
|
||||
|
||||
DROP TABLE IF EXISTS `mail_users`;
|
||||
CREATE TABLE `mail_users` (
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`email` varchar(255) NOT NULL default '',
|
||||
`username` varchar(255) NOT NULL default '',
|
||||
`password` varchar(128) NOT NULL default '',
|
||||
`password_enc` varchar(128) NOT NULL default '',
|
||||
`uid` int(11) NOT NULL default '0',
|
||||
`gid` int(11) NOT NULL default '0',
|
||||
`homedir` varchar(255) NOT NULL default '',
|
||||
`maildir` varchar(255) NOT NULL default '',
|
||||
`postfix` enum('Y','N') NOT NULL default 'Y',
|
||||
`domainid` int(11) NOT NULL default '0',
|
||||
`customerid` int(11) NOT NULL default '0',
|
||||
`quota` bigint(13) NOT NULL default '0',
|
||||
`pop3` tinyint(1) NOT NULL default '1',
|
||||
`imap` tinyint(1) NOT NULL default '1',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `email` (`email`)
|
||||
) TYPE=MyISAM ;
|
||||
|
||||
#
|
||||
# Dumping data for table `mail_users`
|
||||
#
|
||||
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `mail_virtual`
|
||||
#
|
||||
|
||||
DROP TABLE IF EXISTS `mail_virtual`;
|
||||
CREATE TABLE `mail_virtual` (
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`email` varchar(255) NOT NULL default '',
|
||||
`email_full` varchar(255) NOT NULL default '',
|
||||
`destination` text NOT NULL,
|
||||
`domainid` int(11) NOT NULL default '0',
|
||||
`customerid` int(11) NOT NULL default '0',
|
||||
`popaccountid` int(11) NOT NULL default '0',
|
||||
`iscatchall` tinyint(1) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `email` (`email`)
|
||||
) TYPE=MyISAM ;
|
||||
|
||||
#
|
||||
# Dumping data for table `mail_virtual`
|
||||
#
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
|
||||
#
|
||||
# Table structure for table `panel_admins`
|
||||
#
|
||||
|
||||
DROP TABLE IF EXISTS `panel_admins`;
|
||||
CREATE TABLE `panel_admins` (
|
||||
`adminid` int(11) unsigned NOT NULL auto_increment,
|
||||
`loginname` varchar(50) NOT NULL default '',
|
||||
`password` varchar(50) NOT NULL default '',
|
||||
`name` varchar(255) NOT NULL default '',
|
||||
`email` varchar(255) NOT NULL default '',
|
||||
`def_language` varchar(255) NOT NULL default '',
|
||||
`ip` tinyint(4) NOT NULL default '-1',
|
||||
`customers` int(15) NOT NULL default '0',
|
||||
`customers_used` int(15) NOT NULL default '0',
|
||||
`customers_see_all` tinyint(1) NOT NULL default '0',
|
||||
`domains` int(15) NOT NULL default '0',
|
||||
`domains_used` int(15) NOT NULL default '0',
|
||||
`domains_see_all` tinyint(1) NOT NULL default '0',
|
||||
`caneditphpsettings` tinyint(1) NOT NULL default '0',
|
||||
`change_serversettings` tinyint(1) NOT NULL default '0',
|
||||
`edit_billingdata` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`diskspace` int(15) NOT NULL default '0',
|
||||
`diskspace_used` int(15) NOT NULL default '0',
|
||||
`mysqls` int(15) NOT NULL default '0',
|
||||
`mysqls_used` int(15) NOT NULL default '0',
|
||||
`emails` int(15) NOT NULL default '0',
|
||||
`emails_used` int(15) NOT NULL default '0',
|
||||
`email_accounts` int(15) NOT NULL default '0',
|
||||
`email_accounts_used` int(15) NOT NULL default '0',
|
||||
`email_forwarders` int(15) NOT NULL default '0',
|
||||
`email_forwarders_used` int(15) NOT NULL default '0',
|
||||
`email_quota` bigint(13) NOT NULL default '0',
|
||||
`email_quota_used` bigint(13) NOT NULL default '0',
|
||||
`ftps` int(15) NOT NULL default '0',
|
||||
`ftps_used` int(15) NOT NULL default '0',
|
||||
`tickets` int(15) NOT NULL default '-1',
|
||||
`tickets_used` int(15) NOT NULL default '0',
|
||||
`subdomains` int(15) NOT NULL default '0',
|
||||
`subdomains_used` int(15) NOT NULL default '0',
|
||||
`traffic` int(15) NOT NULL default '0',
|
||||
`traffic_used` int(15) NOT NULL default '0',
|
||||
`deactivated` tinyint(1) NOT NULL default '0',
|
||||
`lastlogin_succ` int(11) unsigned NOT NULL default '0',
|
||||
`lastlogin_fail` int(11) unsigned NOT NULL default '0',
|
||||
`loginfail_count` int(11) unsigned NOT NULL default '0',
|
||||
`reportsent` tinyint(4) unsigned NOT NULL default '0',
|
||||
`can_manage_aps_packages` tinyint(1) NOT NULL default '1',
|
||||
`aps_packages` int(5) NOT NULL default '0',
|
||||
`aps_packages_used` int(5) NOT NULL default '0',
|
||||
PRIMARY KEY (`adminid`),
|
||||
UNIQUE KEY `loginname` (`loginname`)
|
||||
) TYPE=MyISAM ;
|
||||
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `panel_customers`
|
||||
#
|
||||
|
||||
DROP TABLE IF EXISTS `panel_customers`;
|
||||
CREATE TABLE `panel_customers` (
|
||||
`customerid` int(11) unsigned NOT NULL auto_increment,
|
||||
`loginname` varchar(50) NOT NULL default '',
|
||||
`password` varchar(50) NOT NULL default '',
|
||||
`adminid` int(11) unsigned NOT NULL default '0',
|
||||
`name` varchar(255) NOT NULL default '',
|
||||
`firstname` varchar(255) NOT NULL default '',
|
||||
`company` varchar(255) NOT NULL default '',
|
||||
`street` varchar(255) NOT NULL default '',
|
||||
`zipcode` varchar(255) NOT NULL default '',
|
||||
`city` varchar(255) NOT NULL default '',
|
||||
`phone` varchar(255) NOT NULL default '',
|
||||
`fax` varchar(255) NOT NULL default '',
|
||||
`email` varchar(255) NOT NULL default '',
|
||||
`customernumber` varchar(255) NOT NULL default '',
|
||||
`def_language` varchar(255) NOT NULL default '',
|
||||
`diskspace` bigint(30) NOT NULL default '0',
|
||||
`diskspace_used` bigint(30) NOT NULL default '0',
|
||||
`mysqls` int(15) NOT NULL default '0',
|
||||
`mysqls_used` int(15) NOT NULL default '0',
|
||||
`emails` int(15) NOT NULL default '0',
|
||||
`emails_used` int(15) NOT NULL default '0',
|
||||
`email_accounts` int(15) NOT NULL default '0',
|
||||
`email_accounts_used` int(15) NOT NULL default '0',
|
||||
`email_forwarders` int(15) NOT NULL default '0',
|
||||
`email_forwarders_used` int(15) NOT NULL default '0',
|
||||
`email_quota` bigint(13) NOT NULL default '0',
|
||||
`email_quota_used` bigint(13) NOT NULL default '0',
|
||||
`ftps` int(15) NOT NULL default '0',
|
||||
`ftps_used` int(15) NOT NULL default '0',
|
||||
`tickets` int(15) NOT NULL default '0',
|
||||
`tickets_used` int(15) NOT NULL default '0',
|
||||
`subdomains` int(15) NOT NULL default '0',
|
||||
`subdomains_used` int(15) NOT NULL default '0',
|
||||
`traffic` bigint(30) NOT NULL default '0',
|
||||
`traffic_used` bigint(30) NOT NULL default '0',
|
||||
`documentroot` varchar(255) NOT NULL default '',
|
||||
`standardsubdomain` int(11) NOT NULL default '0',
|
||||
`guid` int(5) NOT NULL default '0',
|
||||
`ftp_lastaccountnumber` int(11) NOT NULL default '0',
|
||||
`mysql_lastaccountnumber` int(11) NOT NULL default '0',
|
||||
`deactivated` tinyint(1) NOT NULL default '0',
|
||||
`phpenabled` tinyint(1) NOT NULL default '1',
|
||||
`lastlogin_succ` int(11) unsigned NOT NULL default '0',
|
||||
`lastlogin_fail` int(11) unsigned NOT NULL default '0',
|
||||
`loginfail_count` int(11) unsigned NOT NULL default '0',
|
||||
`reportsent` tinyint(4) unsigned NOT NULL default '0',
|
||||
`pop3` tinyint(1) NOT NULL default '1',
|
||||
`imap` tinyint(1) NOT NULL default '1',
|
||||
`aps_packages` int(5) NOT NULL default '0',
|
||||
`aps_packages_used` int(5) NOT NULL default '0',
|
||||
PRIMARY KEY (`customerid`),
|
||||
UNIQUE KEY `loginname` (`loginname`)
|
||||
) TYPE=MyISAM ;
|
||||
#
|
||||
# Dumping data for table `panel_customers`
|
||||
#
|
||||
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `panel_databases`
|
||||
#
|
||||
|
||||
DROP TABLE IF EXISTS `panel_databases`;
|
||||
CREATE TABLE `panel_databases` (
|
||||
`id` int(11) unsigned NOT NULL auto_increment,
|
||||
`customerid` int(11) NOT NULL default '0',
|
||||
`databasename` varchar(255) NOT NULL default '',
|
||||
`description` varchar(255) NOT NULL default '',
|
||||
`dbserver` int(11) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `customerid` (`customerid`)
|
||||
) TYPE=MyISAM ;
|
||||
|
||||
#
|
||||
# Dumping data for table `panel_databases`
|
||||
#
|
||||
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `panel_domains`
|
||||
#
|
||||
DROP TABLE IF EXISTS `panel_domains`;
|
||||
CREATE TABLE `panel_domains` (
|
||||
`id` int(11) unsigned NOT NULL auto_increment,
|
||||
`domain` varchar(255) NOT NULL default '',
|
||||
`adminid` int(11) unsigned NOT NULL default '0',
|
||||
`customerid` int(11) unsigned NOT NULL default '0',
|
||||
`aliasdomain` int(11) unsigned NULL,
|
||||
`documentroot` varchar(255) NOT NULL default '',
|
||||
`ipandport` int(11) unsigned NOT NULL default '1',
|
||||
`isbinddomain` tinyint(1) NOT NULL default '0',
|
||||
`isemaildomain` tinyint(1) NOT NULL default '0',
|
||||
`email_only` tinyint(1) NOT NULL default '0',
|
||||
`iswildcarddomain` tinyint(1) NOT NULL default '0',
|
||||
`subcanemaildomain` tinyint(1) NOT NULL default '0',
|
||||
`caneditdomain` tinyint(1) NOT NULL default '1',
|
||||
`zonefile` varchar(255) NOT NULL default '',
|
||||
`dkim` tinyint(1) NOT NULL default '0',
|
||||
`dkim_id` int(11) unsigned NOT NULL,
|
||||
`dkim_privkey` text NOT NULL,
|
||||
`dkim_pubkey` text NOT NULL,
|
||||
`wwwserveralias` tinyint(1) NOT NULL default '1',
|
||||
`parentdomainid` int(11) unsigned NOT NULL default '0',
|
||||
`openbasedir` tinyint(1) NOT NULL default '0',
|
||||
`openbasedir_path` tinyint(1) NOT NULL default '0',
|
||||
`safemode` tinyint(1) NOT NULL default '0',
|
||||
`speciallogfile` tinyint(1) NOT NULL default '0',
|
||||
`ssl` tinyint(4) NOT NULL default '0',
|
||||
`ssl_redirect` tinyint(4) NOT NULL default '0',
|
||||
`ssl_ipandport` tinyint(4) NOT NULL default '0',
|
||||
`specialsettings` text NOT NULL,
|
||||
`deactivated` tinyint(1) NOT NULL default '0',
|
||||
`bindserial` varchar(10) NOT NULL default '2000010100',
|
||||
`add_date` int( 11 ) NOT NULL default '0',
|
||||
`registration_date` date NOT NULL,
|
||||
`phpsettingid` INT( 11 ) UNSIGNED NOT NULL DEFAULT '1',
|
||||
`mod_fcgid_starter` int(4) default '-1',
|
||||
`mod_fcgid_maxrequests` int(4) default '-1',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `customerid` (`customerid`),
|
||||
KEY `parentdomain` (`parentdomainid`),
|
||||
KEY `domain` (`domain`)
|
||||
) TYPE=MyISAM ;
|
||||
|
||||
#
|
||||
# Dumping data for table `panel_domains`
|
||||
#
|
||||
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `panel_ipsandports`
|
||||
#
|
||||
DROP TABLE IF EXISTS `panel_ipsandports`;
|
||||
CREATE TABLE `panel_ipsandports` (
|
||||
`id` int(11) unsigned NOT NULL auto_increment,
|
||||
`ip` varchar(39) NOT NULL default '',
|
||||
`port` int(5) NOT NULL default '80',
|
||||
`listen_statement` tinyint(1) NOT NULL default '0',
|
||||
`namevirtualhost_statement` tinyint(1) NOT NULL default '0',
|
||||
`vhostcontainer` tinyint(1) NOT NULL default '0',
|
||||
`vhostcontainer_servername_statement` tinyint(1) NOT NULL default '0',
|
||||
`specialsettings` text NOT NULL,
|
||||
`ssl` tinyint(4) NOT NULL default '0',
|
||||
`ssl_cert_file` varchar(255) NOT NULL,
|
||||
`ssl_key_file` varchar(255) NOT NULL,
|
||||
`ssl_ca_file` varchar(255) NOT NULL,
|
||||
`default_vhostconf_domain` text NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) TYPE=MyISAM ;
|
||||
|
||||
#
|
||||
# Dumping data for table `panel_ipsandports`
|
||||
#
|
||||
|
||||
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `panel_htaccess`
|
||||
#
|
||||
|
||||
DROP TABLE IF EXISTS `panel_htaccess`;
|
||||
CREATE TABLE `panel_htaccess` (
|
||||
`id` int(11) unsigned NOT NULL auto_increment,
|
||||
`customerid` int(11) unsigned NOT NULL default '0',
|
||||
`path` varchar(255) NOT NULL default '',
|
||||
`options_indexes` tinyint(1) NOT NULL default '0',
|
||||
`error404path` varchar(255) NOT NULL default '',
|
||||
`error403path` varchar(255) NOT NULL default '',
|
||||
`error500path` varchar(255) NOT NULL default '',
|
||||
`error401path` varchar(255) NOT NULL default '',
|
||||
PRIMARY KEY (`id`)
|
||||
) TYPE=MyISAM ;
|
||||
|
||||
#
|
||||
# Dumping data for table `panel_htaccess`
|
||||
#
|
||||
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `panel_htpasswds`
|
||||
#
|
||||
|
||||
DROP TABLE IF EXISTS `panel_htpasswds`;
|
||||
CREATE TABLE `panel_htpasswds` (
|
||||
`id` int(11) unsigned NOT NULL auto_increment,
|
||||
`customerid` int(11) unsigned NOT NULL default '0',
|
||||
`path` varchar(255) NOT NULL default '',
|
||||
`username` varchar(255) NOT NULL default '',
|
||||
`password` varchar(255) NOT NULL default '',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `customerid` (`customerid`)
|
||||
) TYPE=MyISAM ;
|
||||
|
||||
#
|
||||
# Dumping data for table `panel_htpasswds`
|
||||
#
|
||||
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `panel_sessions`
|
||||
#
|
||||
|
||||
DROP TABLE IF EXISTS `panel_sessions`;
|
||||
CREATE TABLE `panel_sessions` (
|
||||
`hash` varchar(32) NOT NULL default '',
|
||||
`userid` int(11) unsigned NOT NULL default '0',
|
||||
`ipaddress` varchar(255) NOT NULL default '',
|
||||
`useragent` varchar(255) NOT NULL default '',
|
||||
`lastactivity` int(11) unsigned NOT NULL default '0',
|
||||
`lastpaging` varchar(255) NOT NULL default '',
|
||||
`formtoken` char(32) NOT NULL default '',
|
||||
`language` varchar(64) NOT NULL default '',
|
||||
`adminsession` tinyint(1) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`hash`),
|
||||
KEY `userid` (`userid`)
|
||||
) TYPE=HEAP;
|
||||
|
||||
#
|
||||
# Dumping data for table `panel_sessions`
|
||||
#
|
||||
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `panel_settings`
|
||||
#
|
||||
|
||||
DROP TABLE IF EXISTS `panel_settings`;
|
||||
CREATE TABLE `panel_settings` (
|
||||
`settingid` int(11) unsigned NOT NULL auto_increment,
|
||||
`settinggroup` varchar(255) NOT NULL default '',
|
||||
`varname` varchar(255) NOT NULL default '',
|
||||
`value` text NOT NULL,
|
||||
PRIMARY KEY (`settingid`)
|
||||
) TYPE=MyISAM ;
|
||||
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Dumping data for table `panel_settings`
|
||||
#
|
||||
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (1, 'session', 'sessiontimeout', '600');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (2, 'panel', 'adminmail', 'admin@SERVERNAME');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (3, 'panel', 'phpmyadmin_url', '');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (5, 'customer', 'accountprefix', 'web');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (6, 'customer', 'ftpprefix', 'ftp');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (7, 'customer', 'mysqlprefix', 'sql');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (8, 'system', 'lastaccountnumber', '0');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (9, 'system', 'lastguid', '9999');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (10, 'system', 'documentroot_prefix', '/var/customers/webs/');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (11, 'system', 'logfiles_directory', '/var/customers/logs/');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (12, 'system', 'ipaddress', 'SERVERIP');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (14, 'system', 'apachereload_command', '/etc/init.d/apache reload');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (15, 'system', 'last_traffic_run', '000000');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (16, 'system', 'vmail_uid', '2000');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (17, 'system', 'vmail_gid', '2000');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (18, 'system', 'vmail_homedir', '/var/customers/mail/');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (19, 'system', 'bindconf_directory', '/etc/bind/');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (20, 'system', 'bindreload_command', '/etc/init.d/bind9 reload');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (22, 'system', 'dbversion', '1');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (23, 'system', 'hostname', 'SERVERNAME');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (24, 'login', 'maxloginattempts', '3');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (25, 'login', 'deactivatetime', '900');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (26, 'panel', 'webmail_url', '');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (27, 'panel', 'webftp_url', '');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (28, 'panel', 'standardlanguage', 'English');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (29, 'system', 'mysql_access_host', 'localhost');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (30, 'panel', 'pathedit', 'Manual');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (32, 'system', 'lastcronrun', '');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (33, 'panel', 'paging', '20');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (34, 'system', 'defaultip', '1');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (35, 'system', 'phpappendopenbasedir', '/tmp/');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (36, 'panel', 'natsorting', '1');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (37, 'system', 'deactivateddocroot', '');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (38, 'system', 'mailpwcleartext', '1');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (39, 'system', 'last_tasks_run', '000000');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (40, 'customer', 'ftpatdomain', '0');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (41, 'system', 'nameservers', '');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (42, 'system', 'mxservers', '');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (43, 'system', 'mod_log_sql', '0');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (44, 'system', 'mod_fcgid', '0');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (45, 'panel', 'sendalternativemail', '0');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (46, 'system', 'apacheconf_vhost', '/etc/apache/vhosts.conf');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (47, 'system', 'apacheconf_diroptions', '/etc/apache/diroptions.conf');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (48, 'system', 'apacheconf_htpasswddir', '/etc/apache/htpasswd/');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (49, 'system', 'webalizer_quiet', '2');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (50, 'ticket', 'noreply_email', 'NO-REPLY@SERVERNAME');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (51, 'ticket', 'worktime_all', '1');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (52, 'ticket', 'worktime_begin', '00:00');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (53, 'ticket', 'worktime_end', '23:59');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (54, 'ticket', 'worktime_sat', '0');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (55, 'ticket', 'worktime_sun', '0');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (56, 'ticket', 'archiving_days', '5');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (57, 'system', 'last_archive_run', '000000');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (58, 'ticket', 'enabled', '1');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (59, 'ticket', 'concurrently_open', '5');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (60, 'ticket', 'noreply_name', 'SysCP Support');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (61, 'system', 'mod_fcgid_configdir', '/var/www/php-fcgi-scripts');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (62, 'system', 'mod_fcgid_tmpdir', '/var/customers/tmp');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (63, 'ticket', 'reset_cycle', '2');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (64, 'panel', 'no_robots', '1');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (65, 'logger', 'enabled', '1');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (66, 'logger', 'log_cron', '0');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (67, 'logger', 'logfile', '');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (68, 'logger', 'logtypes', 'syslog,mysql');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (69, 'logger', 'severity', '1');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (70, 'system','ssl_cert_file','/etc/apache2/apache2.pem');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (71, 'system','use_ssl','1');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (72, 'system','openssl_cnf','[ req ]\r\ndefault_bits = 1024\r\ndistinguished_name = req_distinguished_name\r\nattributes = req_attributes\r\nprompt = no\r\noutput_password =\r\ninput_password =\r\n[ req_distinguished_name ]\r\nC = DE\r\nST = syscp\r\nL = syscp \r\nO = Testcertificate\r\nOU = syscp \r\nCN = @@domain_name@@\r\nemailAddress = @@email@@ \r\n[ req_attributes ]\r\nchallengePassword =\r\n');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (73, 'system', 'default_vhostconf', '');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (74, 'system', 'mail_quota_enabled', '0');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (75, 'system', 'mail_quota', '100');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (76, 'panel', 'decimal_places', '4');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (77, 'dkim', 'use_dkim', '0');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (78, 'system', 'webalizer_enabled', '1');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (79, 'system', 'awstats_enabled', '0');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (80, 'system', 'awstats_domain_file', '/etc/awstats/');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (81, 'system', 'awstats_model_file', '/etc/awstats/awstats.model.conf.syscp');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (82, 'dkim', 'dkim_prefix', '/etc/postfix/dkim/');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (83, 'dkim', 'dkim_domains', 'domains');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (84, 'dkim', 'dkim_dkimkeys', 'dkim-keys.conf');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (85, 'dkim', 'dkimrestart_command', '/etc/init.d/dkim-filter restart');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (86, 'panel', 'unix_names', '1');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (87, 'panel', 'allow_preset', '1');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (88, 'system', 'awstats_path', '/usr/share/awstats/VERSION/webroot/cgi-bin/');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (89, 'system', 'awstats_updateall_command', '/usr/bin/awstats_updateall.pl');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (90, 'panel', 'allow_preset_admin', '0');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (91, 'system', 'httpuser', 'www-data');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (92, 'system', 'httpgroup', 'www-data');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (93, 'system', 'webserver', 'apache2');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (94, 'autoresponder', 'autoresponder_active', '0');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (95, 'autoresponder', 'last_autoresponder_run', '0');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (96, 'admin', 'show_version_login', '0');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (97, 'admin', 'show_version_footer', '0');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (98, 'admin', 'syscp_graphic', 'images/header.gif');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (99, 'system', 'mod_fcgid_wrapper', '0');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (100, 'system', 'mod_fcgid_starter', '0');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (101, 'system', 'mod_fcgid_peardir', '/usr/share/php/:/usr/share/php5/');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (102, 'system', 'index_file_extension', 'html');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (103, 'aps', 'items_per_page', '20');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (104, 'aps', 'upload_fields', '5');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (105, 'aps', 'aps_active', '0');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (1069, 'aps', 'php-extension', '');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (107, 'aps', 'php-configuration', '');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (108, 'aps', 'webserver-htaccess', '');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (109, 'aps', 'php-function', '');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (110, 'aps', 'webserver-module', '');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (111, 'system', 'realtime_port', '0');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (112, 'session', 'allow_multiple_login', '0');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (113, 'panel', 'allow_domain_change_admin', '0');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (114, 'panel', 'allow_domain_change_customer', '0');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (115, 'system', 'mod_fcgid_maxrequests', '250');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (116, 'system','ssl_key_file','/etc/apache2/apache2.key');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (117, 'system','ssl_ca_file','');
|
||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (118, 'panel', 'frontend', 'froxlor');
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `panel_tasks`
|
||||
#
|
||||
|
||||
DROP TABLE IF EXISTS `panel_tasks`;
|
||||
CREATE TABLE `panel_tasks` (
|
||||
`id` int(11) unsigned NOT NULL auto_increment,
|
||||
`type` int(11) NOT NULL default '0',
|
||||
`data` text NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) TYPE=MyISAM ;
|
||||
|
||||
#
|
||||
# Dumping data for table `panel_tasks`
|
||||
#
|
||||
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `panel_templates`
|
||||
#
|
||||
|
||||
DROP TABLE IF EXISTS `panel_templates`;
|
||||
CREATE TABLE `panel_templates` (
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`adminid` int(11) NOT NULL default '0',
|
||||
`language` varchar(255) NOT NULL default '',
|
||||
`templategroup` varchar(255) NOT NULL default '',
|
||||
`varname` varchar(255) NOT NULL default '',
|
||||
`value` longtext NOT NULL,
|
||||
PRIMARY KEY (id),
|
||||
KEY adminid (adminid)
|
||||
) TYPE=MyISAM;
|
||||
|
||||
#
|
||||
# Dumping data for table `panel_templates`
|
||||
#
|
||||
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `panel_traffic`
|
||||
#
|
||||
|
||||
DROP TABLE IF EXISTS `panel_traffic`;
|
||||
CREATE TABLE `panel_traffic` (
|
||||
`id` int(11) unsigned NOT NULL auto_increment,
|
||||
`customerid` int(11) unsigned NOT NULL default '0',
|
||||
`year` int(4) unsigned zerofill NOT NULL default '0000',
|
||||
`month` int(2) unsigned zerofill NOT NULL default '00',
|
||||
`day` int(2) unsigned zerofill NOT NULL default '00',
|
||||
`stamp` int(11) unsigned NOT NULL default '0',
|
||||
`http` bigint(30) unsigned NOT NULL default '0',
|
||||
`ftp_up` bigint(30) unsigned NOT NULL default '0',
|
||||
`ftp_down` bigint(30) unsigned NOT NULL default '0',
|
||||
`mail` bigint(30) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `customerid` (`customerid`)
|
||||
) TYPE=MyISAM ;
|
||||
|
||||
#
|
||||
# Dumping data for table `panel_traffic`
|
||||
#
|
||||
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `panel_traffic_admins`
|
||||
#
|
||||
|
||||
DROP TABLE IF EXISTS `panel_traffic_admins`;
|
||||
CREATE TABLE `panel_traffic_admins` (
|
||||
`id` int(11) unsigned NOT NULL auto_increment,
|
||||
`adminid` int(11) unsigned NOT NULL default '0',
|
||||
`year` int(4) unsigned zerofill NOT NULL default '0000',
|
||||
`month` int(2) unsigned zerofill NOT NULL default '00',
|
||||
`day` int(2) unsigned zerofill NOT NULL default '00',
|
||||
`stamp` int(11) unsigned NOT NULL default '0',
|
||||
`http` bigint(30) unsigned NOT NULL default '0',
|
||||
`ftp_up` bigint(30) unsigned NOT NULL default '0',
|
||||
`ftp_down` bigint(30) unsigned NOT NULL default '0',
|
||||
`mail` bigint(30) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `adminid` (`adminid`)
|
||||
) TYPE=MyISAM ;
|
||||
|
||||
#
|
||||
# Dumping data for table `panel_traffic_admins`
|
||||
#
|
||||
|
||||
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `panel_diskspace`
|
||||
#
|
||||
|
||||
CREATE TABLE `panel_diskspace` (
|
||||
`id` int(11) unsigned NOT NULL auto_increment,
|
||||
`customerid` int(11) unsigned NOT NULL default '0',
|
||||
`year` int(4) unsigned zerofill NOT NULL default '0000',
|
||||
`month` int(2) unsigned zerofill NOT NULL default '00',
|
||||
`day` int(2) unsigned zerofill NOT NULL default '00',
|
||||
`stamp` int(11) unsigned NOT NULL default '0',
|
||||
`webspace` bigint(30) unsigned NOT NULL default '0',
|
||||
`mail` bigint(30) unsigned NOT NULL default '0',
|
||||
`mysql` bigint(30) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `customerid` (`customerid`)
|
||||
) TYPE=MyISAM ;
|
||||
|
||||
#
|
||||
# Dumping data for table `panel_diskspace`
|
||||
#
|
||||
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `panel_diskspace_admins`
|
||||
#
|
||||
|
||||
CREATE TABLE `panel_diskspace_admins` (
|
||||
`id` int(11) unsigned NOT NULL auto_increment,
|
||||
`adminid` int(11) unsigned NOT NULL default '0',
|
||||
`year` int(4) unsigned zerofill NOT NULL default '0000',
|
||||
`month` int(2) unsigned zerofill NOT NULL default '00',
|
||||
`day` int(2) unsigned zerofill NOT NULL default '00',
|
||||
`stamp` int(11) unsigned NOT NULL default '0',
|
||||
`webspace` bigint(30) unsigned NOT NULL default '0',
|
||||
`mail` bigint(30) unsigned NOT NULL default '0',
|
||||
`mysql` bigint(30) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `adminid` (`adminid`)
|
||||
) TYPE=MyISAM ;
|
||||
|
||||
#
|
||||
# Dumping data for table `panel_diskspace_admins`
|
||||
#
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `panel_languages`
|
||||
#
|
||||
|
||||
DROP TABLE IF EXISTS `panel_languages`;
|
||||
CREATE TABLE `panel_languages` (
|
||||
`id` int(11) unsigned NOT NULL auto_increment,
|
||||
`language` varchar(30) NOT NULL default '',
|
||||
`file` varchar(255) NOT NULL default '',
|
||||
PRIMARY KEY (`id`)
|
||||
) TYPE=MyISAM ;
|
||||
|
||||
#
|
||||
# Dumping data for table `panel_languages`
|
||||
#
|
||||
|
||||
INSERT INTO `panel_languages` VALUES (1, 'Deutsch', 'lng/german.lng.php');
|
||||
INSERT INTO `panel_languages` VALUES (2, 'English', 'lng/english.lng.php');
|
||||
INSERT INTO `panel_languages` VALUES (3, 'Français', 'lng/french.lng.php');
|
||||
INSERT INTO `panel_languages` VALUES (4, 'Chinese', 'lng/zh-cn.lng.php');
|
||||
INSERT INTO `panel_languages` VALUES (5, 'Catalan', 'lng/catalan.lng.php');
|
||||
INSERT INTO `panel_languages` VALUES (6, 'Español', 'lng/spanish.lng.php');
|
||||
INSERT INTO `panel_languages` VALUES (7, 'Português', 'lng/portugues.lng.php');
|
||||
INSERT INTO `panel_languages` VALUES (8, 'Russian', 'lng/russian.lng.php');
|
||||
INSERT INTO `panel_languages` VALUES (9, 'Danish', 'lng/danish.lng.php');
|
||||
INSERT INTO `panel_languages` VALUES (10, 'Italian', 'lng/italian.lng.php');
|
||||
INSERT INTO `panel_languages` VALUES (11, 'Bulgarian', 'lng/bulgarian.lng.php');
|
||||
INSERT INTO `panel_languages` VALUES (12, 'Slovak', 'lng/slovak.lng.php');
|
||||
INSERT INTO `panel_languages` VALUES (13, 'Dutch', 'lng/dutch.lng.php');
|
||||
INSERT INTO `panel_languages` VALUES (14, 'Hungarian', 'lng/hungarian.lng.php');
|
||||
INSERT INTO `panel_languages` VALUES (15, 'Swedish', 'lng/swedish.lng.php');
|
||||
INSERT INTO `panel_languages` VALUES (16, 'Czech', 'lng/czech.lng.php');
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `panel_tickets`
|
||||
#
|
||||
|
||||
DROP TABLE IF EXISTS `panel_tickets`;
|
||||
CREATE TABLE `panel_tickets` (
|
||||
`id` int(11) unsigned NOT NULL auto_increment,
|
||||
`customerid` int(11) NOT NULL,
|
||||
`adminid` int(11) NOT NULL,
|
||||
`category` smallint(5) unsigned NOT NULL default '1',
|
||||
`priority` enum('1','2','3') NOT NULL default '3',
|
||||
`subject` varchar(70) NOT NULL,
|
||||
`message` text NOT NULL,
|
||||
`dt` int(15) NOT NULL,
|
||||
`lastchange` int(15) NOT NULL,
|
||||
`ip` varchar(20) NOT NULL,
|
||||
`status` enum('0','1','2','3') NOT NULL default '1',
|
||||
`lastreplier` enum('0','1') NOT NULL default '0',
|
||||
`answerto` int(11) unsigned NOT NULL,
|
||||
`by` enum('0','1') NOT NULL default '0',
|
||||
`archived` enum('0','1') NOT NULL default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `customerid` (`customerid`)
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `panel_ticket_categories`
|
||||
#
|
||||
|
||||
DROP TABLE IF EXISTS `panel_ticket_categories`;
|
||||
CREATE TABLE `panel_ticket_categories` (
|
||||
`id` smallint(5) unsigned NOT NULL auto_increment,
|
||||
`name` varchar(60) NOT NULL,
|
||||
`adminid` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
#
|
||||
# Dumping data for table `panel_ticket_categories`
|
||||
#
|
||||
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `panel_syslog`
|
||||
#
|
||||
|
||||
DROP TABLE IF EXISTS `panel_syslog`;
|
||||
CREATE TABLE IF NOT EXISTS `panel_syslog` (
|
||||
`logid` bigint(20) NOT NULL auto_increment,
|
||||
`action` int(5) NOT NULL default '10',
|
||||
`type` int(5) NOT NULL default '0',
|
||||
`date` int(15) NOT NULL,
|
||||
`user` varchar(50) NOT NULL,
|
||||
`text` text NOT NULL,
|
||||
PRIMARY KEY (`logid`)
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
#
|
||||
# Dumping data for table `panel_syslog`
|
||||
#
|
||||
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `mail_autoresponder`
|
||||
#
|
||||
|
||||
CREATE TABLE `mail_autoresponder` (
|
||||
`email` varchar(255) NOT NULL default '',
|
||||
`message` text NOT NULL,
|
||||
`enabled` tinyint(1) NOT NULL default '0',
|
||||
`subject` varchar(255) NOT NULL default '',
|
||||
`customerid` int(11) NOT NULL default '0',
|
||||
PRIMARY KEY (`email`),
|
||||
KEY `customerid` (`customerid`),
|
||||
FULLTEXT KEY `message` (`message`)
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
#
|
||||
# Dumping data for table `mail_autoresponder`
|
||||
#
|
||||
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `panel_phpconfigs`
|
||||
#
|
||||
|
||||
CREATE TABLE `panel_phpconfigs` (
|
||||
`id` int(11) unsigned NOT NULL auto_increment,
|
||||
`description` varchar(50) NOT NULL,
|
||||
`binary` varchar(255) NOT NULL,
|
||||
`file_extensions` varchar(255) NOT NULL,
|
||||
`mod_fcgid_starter` int(4) NOT NULL DEFAULT '-1',
|
||||
`mod_fcgid_maxrequests` int(4) NOT NULL DEFAULT '-1',
|
||||
`phpsettings` text NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
#
|
||||
# Dumping data for table `panel_phpconfigs`
|
||||
#
|
||||
|
||||
INSERT INTO `panel_phpconfigs` (`id`, `description`, `binary`, `file_extensions`, `mod_fcgid_starter`, `mod_fcgid_maxrequests`, `phpsettings`) VALUES(1, 'Default Config', '/usr/bin/php-cgi', 'php', '-1', '-1', 'short_open_tag = On\r\nasp_tags = Off\r\nprecision = 14\r\noutput_buffering = 4096\r\nallow_call_time_pass_reference = Off\r\nsafe_mode = {SAFE_MODE}\r\nsafe_mode_gid = Off\r\nsafe_mode_include_dir = "{PEAR_DIR}"\r\nsafe_mode_allowed_env_vars = PHP_\r\nsafe_mode_protected_env_vars = LD_LIBRARY_PATH\r\nopen_basedir = "{OPEN_BASEDIR}"\r\ndisable_functions = exec,passthru,shell_exec,system,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate\r\ndisable_classes =\r\nexpose_php = Off\r\nmax_execution_time = 30\r\nmax_input_time = 60\r\nmemory_limit = 16M\r\npost_max_size = 16M\r\nerror_reporting = E_ALL & ~E_NOTICE\r\ndisplay_errors = On\r\ndisplay_startup_errors = Off\r\nlog_errors = On\r\nlog_errors_max_len = 1024\r\nignore_repeated_errors = Off\r\nignore_repeated_source = Off\r\nreport_memleaks = On\r\ntrack_errors = Off\r\nhtml_errors = Off\r\nvariables_order = "GPCS"\r\nregister_globals = Off\r\nregister_argc_argv = Off\r\ngpc_order = "GPC"\r\nmagic_quotes_gpc = Off\r\nmagic_quotes_runtime = Off\r\nmagic_quotes_sybase = Off\r\ninclude_path = ".:{PEAR_DIR}"\r\nenable_dl = Off\r\nfile_uploads = On\r\nupload_tmp_dir = "{TMP_DIR}"\r\nupload_max_filesize = 32M\r\nallow_url_fopen = Off\r\nsendmail_path = "/usr/sbin/sendmail -t -f {CUSTOMER_EMAIL}"\r\nsession.save_handler = files\r\nsession.save_path = "{TMP_DIR}"\r\nsession.use_cookies = 1\r\nsession.name = PHPSESSID\r\nsession.auto_start = 0\r\nsession.cookie_lifetime = 0\r\nsession.cookie_path = /\r\nsession.cookie_domain =\r\nsession.serialize_handler = php\r\nsession.gc_probability = 1\r\nsession.gc_divisor = 1000\r\nsession.gc_maxlifetime = 1440\r\nsession.bug_compat_42 = 0\r\nsession.bug_compat_warn = 1\r\nsession.referer_check =\r\nsession.entropy_length = 16\r\nsession.entropy_file = /dev/urandom\r\nsession.cache_limiter = nocache\r\nsession.cache_expire = 180\r\nsession.use_trans_sid = 0\r\nsuhosin.simulation = Off\r\nsuhosin.mail.protect = 1\r\n');
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Tabellenstruktur fuer Tabelle `aps_instances`
|
||||
#
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `aps_instances` (
|
||||
`ID` int(4) NOT NULL auto_increment,
|
||||
`CustomerID` int(4) NOT NULL,
|
||||
`PackageID` int(4) NOT NULL,
|
||||
`Status` int(4) NOT NULL,
|
||||
PRIMARY KEY (`ID`)
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Tabellenstruktur fuer Tabelle `aps_packages`
|
||||
#
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `aps_packages` (
|
||||
`ID` int(4) NOT NULL auto_increment,
|
||||
`Path` varchar(500) NOT NULL,
|
||||
`Name` varchar(500) NOT NULL,
|
||||
`Version` varchar(20) NOT NULL,
|
||||
`Release` int(4) NOT NULL,
|
||||
`Status` int(1) NOT NULL default '1',
|
||||
PRIMARY KEY (`ID`)
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Tabellenstruktur fuer Tabelle `aps_settings`
|
||||
#
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `aps_settings` (
|
||||
`ID` int(4) NOT NULL auto_increment,
|
||||
`InstanceID` int(4) NOT NULL,
|
||||
`Name` varchar(250) NOT NULL,
|
||||
`Value` varchar(250) NOT NULL,
|
||||
PRIMARY KEY (`ID`)
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Tabellenstruktur fuer Tabelle `aps_tasks`
|
||||
#
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `aps_tasks` (
|
||||
`ID` int(4) NOT NULL auto_increment,
|
||||
`InstanceID` int(4) NOT NULL,
|
||||
`Task` int(4) NOT NULL,
|
||||
PRIMARY KEY (`ID`)
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Tabellenstruktur fuer Tabelle `aps_temp_settings`
|
||||
#
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `aps_temp_settings` (
|
||||
`ID` int(4) NOT NULL auto_increment,
|
||||
`PackageID` int(4) NOT NULL,
|
||||
`CustomerID` int(4) NOT NULL,
|
||||
`Name` varchar(250) NOT NULL,
|
||||
`Value` varchar(250) NOT NULL,
|
||||
PRIMARY KEY (`ID`)
|
||||
) ENGINE=MyISAM;
|
||||
80
install/updates/1.0/update_1.0.10_1.2-beta1.inc.php
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package System
|
||||
* @version $Id: update_1.0.10_1.2-beta1.inc.php 2692 2009-03-27 18:04:47Z flo $
|
||||
*/
|
||||
|
||||
/**
|
||||
* We need those defines, because the tables.inc.php doesn't have them.
|
||||
*/
|
||||
|
||||
define('TABLE_POSTFIX_TRANSPORT', 'postfix_transport');
|
||||
define('TABLE_POSTFIX_USERS', 'postfix_users');
|
||||
define('TABLE_POSTFIX_VIRTUAL', 'postfix_virtual');
|
||||
define('TABLE_PROFTPD_GROUPS', 'proftpd_groups');
|
||||
define('TABLE_PROFTPD_USERS', 'proftpd_users');
|
||||
|
||||
if($settings['panel']['version'] == '1.0.10')
|
||||
{
|
||||
// Drop/Rename postfix_ tables
|
||||
|
||||
$db->query("DROP TABLE `" . TABLE_POSTFIX_TRANSPORT . "`");
|
||||
$db->query("ALTER TABLE `" . TABLE_POSTFIX_USERS . "` RENAME `" . TABLE_MAIL_USERS . "` ");
|
||||
$db->query("ALTER TABLE `" . TABLE_POSTFIX_VIRTUAL . "` RENAME `" . TABLE_MAIL_VIRTUAL . "` ");
|
||||
|
||||
// Rename proftpd_ tables
|
||||
|
||||
$db->query("ALTER TABLE `" . TABLE_PROFTPD_USERS . "` RENAME `" . TABLE_FTP_USERS . "` ");
|
||||
$db->query("ALTER TABLE `" . TABLE_PROFTPD_GROUPS . "` RENAME `" . TABLE_FTP_GROUPS . "` ");
|
||||
|
||||
// Adding tables
|
||||
|
||||
$db->query("DROP TABLE IF EXISTS `" . TABLE_PANEL_HTACCESS . "`;");
|
||||
$db->query("CREATE TABLE `" . TABLE_PANEL_HTACCESS . "` (" . " `id` int(11) unsigned NOT NULL auto_increment," . " `customerid` int(11) unsigned NOT NULL default '0'," . " `path` varchar(255) NOT NULL default ''," . " `options_indexes` tinyint(1) NOT NULL default '0'," . " PRIMARY KEY (`id`)" . ") TYPE=MyISAM ;");
|
||||
$db->query("DROP TABLE IF EXISTS `" . TABLE_PANEL_ADMINS . "`;");
|
||||
$db->query("CREATE TABLE `" . TABLE_PANEL_ADMINS . "` (" . " `adminid` int(11) unsigned NOT NULL auto_increment," . " `loginname` varchar(50) NOT NULL default ''," . " `password` varchar(50) NOT NULL default ''," . " `name` varchar(255) NOT NULL default ''," . " `email` varchar(255) NOT NULL default ''," . " `customers` int(15) NOT NULL default '0'," . " `customers_used` int(15) NOT NULL default '0'," . " `customers_see_all` tinyint(1) NOT NULL default '0'," . " `domains` int(15) NOT NULL default '0'," . " `domains_used` int(15) NOT NULL default '0'," . " `domains_see_all` tinyint(1) NOT NULL default '0'," . " `change_serversettings` tinyint(1) NOT NULL default '0'," . " `diskspace` int(15) NOT NULL default '0'," . " `diskspace_used` int(15) NOT NULL default '0'," . " `mysqls` int(15) NOT NULL default '0'," . " `mysqls_used` int(15) NOT NULL default '0'," . " `emails` int(15) NOT NULL default '0'," . " `emails_used` int(15) NOT NULL default '0'," . " `email_forwarders` int(15) NOT NULL default '0'," . " `email_forwarders_used` int(15) NOT NULL default '0'," . " `ftps` int(15) NOT NULL default '0'," . " `ftps_used` int(15) NOT NULL default '0'," . " `subdomains` int(15) NOT NULL default '0'," . " `subdomains_used` int(15) NOT NULL default '0'," . " `traffic` int(15) NOT NULL default '0'," . " `traffic_used` int(15) NOT NULL default '0'," . " `deactivated` tinyint(1) NOT NULL default '0'," . " `lastlogin_succ` int(11) unsigned NOT NULL default '0'," . " `lastlogin_fail` int(11) unsigned NOT NULL default '0'," . " `loginfail_count` int(11) unsigned NOT NULL default '0'," . " PRIMARY KEY (`adminid`)" . ") TYPE=MyISAM ;");
|
||||
|
||||
// Insert Admin user
|
||||
|
||||
if(!isset($adminusername)
|
||||
|| $adminusername == '')
|
||||
{
|
||||
$adminusername = 'admin';
|
||||
$adminpassword = 'admin';
|
||||
}
|
||||
|
||||
$db->query("INSERT INTO `" . TABLE_PANEL_ADMINS . "` (`loginname`, `password`, `name`, `email`, `customers`, `customers_used`, `customers_see_all`, `domains`, `domains_used`, `domains_see_all`, `change_serversettings`, `diskspace`, `diskspace_used`, `mysqls`, `mysqls_used`, `emails`, `emails_used`, `email_forwarders`, `email_forwarders_used`, `ftps`, `ftps_used`, `subdomains`, `subdomains_used`, `traffic`, `traffic_used`, `deactivated`) VALUES ('" . $db->escape($adminusername) . "', '" . md5($adminpassword) . "', 'Siteadmin', 'admin@servername', -1, 0, 1, -1, 0, 1, 1, -1024, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1048576, 0, 0);");
|
||||
|
||||
// Alter Tables
|
||||
|
||||
$db->query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` ADD `adminid` INT( 11 ) UNSIGNED NOT NULL ," . "ADD `lastlogin_succ` INT( 11 ) UNSIGNED NOT NULL ," . "ADD `lastlogin_fail` INT( 11 ) UNSIGNED NOT NULL ," . "ADD `loginfail_count` INT( 11 ) UNSIGNED NOT NULL ;");
|
||||
$db->query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` ADD INDEX ( `adminid` ) ;");
|
||||
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `adminid` = '1'");
|
||||
$db->query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` ADD `adminid` INT( 11 ) UNSIGNED NOT NULL ," . "ADD `iswildcarddomain` TINYINT( 1 ) NOT NULL ," . "ADD `speciallogfile` TINYINT( 1 ) NOT NULL ;");
|
||||
$db->query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` ADD INDEX ( `adminid` ) ;");
|
||||
$db->query("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET `adminid` = '1'");
|
||||
$db->query("ALTER TABLE `" . TABLE_PANEL_SESSIONS . "` CHANGE `customerid` `userid` INT( 11 ) UNSIGNED DEFAULT '0' NOT NULL ");
|
||||
$db->query("ALTER TABLE `" . TABLE_MAIL_USERS . "` CHANGE `password` `password_enc` VARCHAR( 128 ) NOT NULL ");
|
||||
$db->query("ALTER TABLE `" . TABLE_MAIL_USERS . "` ADD `password` VARCHAR( 128 ) NOT NULL AFTER `email` ;");
|
||||
$db->query("INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (24, 'login', 'maxloginattempts', '3');");
|
||||
$db->query("INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (25, 'login', 'deactivatetime', '900');");
|
||||
$db->query("INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (26, 'panel', 'webmail_url', '');");
|
||||
$db->query("INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (27, 'panel', 'webftp_url', '');");
|
||||
$db->query("INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (28, 'panel', 'standardlanguage', 'german');");
|
||||
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `varname`='ipaddress' WHERE `settinggroup`='system' AND `varname`='ipadress'");
|
||||
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value`='1.2.0' WHERE `settinggroup`='panel' AND `varname`='version'");
|
||||
$settings['panel']['version'] = '1.2.0';
|
||||
}
|
||||
|
||||
?>
|
||||
130
install/updates/1.0/update_1.0_1.0.10.inc.php
Normal file
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package System
|
||||
* @version $Id: update_1.0_1.0.10.inc.php 2692 2009-03-27 18:04:47Z flo $
|
||||
*/
|
||||
|
||||
define('TABLE_POSTFIX_TRANSPORT', 'postfix_transport');
|
||||
define('TABLE_POSTFIX_USERS', 'postfix_users');
|
||||
define('TABLE_POSTFIX_VIRTUAL', 'postfix_virtual');
|
||||
define('TABLE_PROFTPD_GROUPS', 'proftpd_groups');
|
||||
define('TABLE_PROFTPD_USERS', 'proftpd_users');
|
||||
|
||||
if(!isset($settings['panel']['version']))
|
||||
{
|
||||
$settings['panel']['version'] = '1.0.0';
|
||||
}
|
||||
|
||||
if($settings['panel']['version'] == '1.0.0')
|
||||
{
|
||||
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (22, 'panel', 'version', '1.0.1')");
|
||||
$db->query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` ADD `openbasedir` TINYINT( 1 ) NOT NULL , ADD `safemode` TINYINT( 1 ) NOT NULL");
|
||||
$db->query("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET `openbasedir`='1', `safemode`='1'");
|
||||
$settings['panel']['version'] = '1.0.1';
|
||||
}
|
||||
|
||||
if($settings['panel']['version'] == '1.0.1')
|
||||
{
|
||||
$db->query("ALTER TABLE `" . TABLE_POSTFIX_USERS . "` ADD `domainid` INT( 11 ) NOT NULL AFTER `postfix`");
|
||||
$db->query("ALTER TABLE `" . TABLE_POSTFIX_VIRTUAL . "` ADD `domainid` INT( 11 ) NOT NULL AFTER `destination`");
|
||||
$result = $db->query("SELECT `id`, `domain` FROM `" . TABLE_PANEL_DOMAINS . "`");
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
$db->query("UPDATE `" . TABLE_POSTFIX_USERS . "` SET `domainid`='" . (int)$row['id'] . "' WHERE `email` LIKE '%@" . $db->escape($row['domain']) . "'");
|
||||
$db->query("UPDATE `" . TABLE_POSTFIX_VIRTUAL . "` SET `domainid`='" . (int)$row['id'] . "' WHERE `email` LIKE '%@" . $db->escape($row['domain']) . "'");
|
||||
}
|
||||
|
||||
$db->query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` ADD `createstdsubdomain` TINYINT( 1 ) NOT NULL AFTER `documentroot`");
|
||||
inserttask('1');
|
||||
inserttask('4');
|
||||
$hostname = explode('@', $settings['panel']['adminmail']);
|
||||
$hostname = $hostname[1];
|
||||
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (23, 'system', 'hostname', '" . $db->escape($hostname) . "')");
|
||||
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value`='1.0.2' WHERE `settinggroup`='panel' AND `varname`='version'");
|
||||
$settings['panel']['version'] = '1.0.2';
|
||||
}
|
||||
|
||||
if($settings['panel']['version'] == '1.0.2')
|
||||
{
|
||||
$db->query("ALTER TABLE `" . TABLE_PANEL_SESSIONS . "` ADD `language` VARCHAR( 64 ) NOT NULL AFTER `lastactivity` ;");
|
||||
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value`='1.0.3' WHERE `settinggroup`='panel' AND `varname`='version'");
|
||||
$settings['panel']['version'] = '1.0.3';
|
||||
}
|
||||
|
||||
if($settings['panel']['version'] == '1.0.3')
|
||||
{
|
||||
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value`='1.0.4' WHERE `settinggroup`='panel' AND `varname`='version'");
|
||||
$settings['panel']['version'] = '1.0.4';
|
||||
}
|
||||
|
||||
if($settings['panel']['version'] == '1.0.4')
|
||||
{
|
||||
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value`='1.0.5' WHERE `settinggroup`='panel' AND `varname`='version'");
|
||||
$settings['panel']['version'] = '1.0.5';
|
||||
}
|
||||
|
||||
if($settings['panel']['version'] == '1.0.5')
|
||||
{
|
||||
$db->query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "` ADD `deactivated` TINYINT( 1 ) NOT NULL ;");
|
||||
$db->query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` ADD `deactivated` TINYINT( 1 ) NOT NULL ;");
|
||||
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value`='1.0.6' WHERE `settinggroup`='panel' AND `varname`='version'");
|
||||
$settings['panel']['version'] = '1.0.6';
|
||||
}
|
||||
|
||||
if($settings['panel']['version'] == '1.0.6')
|
||||
{
|
||||
$db->query("ALTER TABLE `" . TABLE_POSTFIX_VIRTUAL . "` ADD `popaccountid` INT( 11 ) NOT NULL ;");
|
||||
$result = $db->query("SELECT `id`, `email` FROM `" . TABLE_POSTFIX_USERS . "`");
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
$db->query("UPDATE `" . TABLE_POSTFIX_VIRTUAL . "` SET `popaccountid`='" . (int)$row['id'] . "' WHERE `email` = '" . $db->escape(str_replace($settings['email']['catchallkeyword'], '', $row['email'])) . "' AND `destination` = '" . $db->escape($row['email']) . "'");
|
||||
}
|
||||
|
||||
$result = $db->query("SELECT `id`, `email`, `destination` FROM `" . TABLE_POSTFIX_VIRTUAL . "` WHERE `popaccountid` = '0'");
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
if(str_replace($settings['email']['catchallkeyword'], '', $row['email']) != $row['email'])
|
||||
{
|
||||
$db->query("UPDATE `" . TABLE_POSTFIX_VIRTUAL . "` SET `email` = '" . $db->escape(str_replace($settings['email']['catchallkeyword'], '', $row['email'])) . "' WHERE `id` = '" . (int)$row['id'] . "'");
|
||||
}
|
||||
}
|
||||
|
||||
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value`='1.0.7' WHERE `settinggroup`='panel' AND `varname`='version'");
|
||||
$settings['panel']['version'] = '1.0.7';
|
||||
}
|
||||
|
||||
if($settings['panel']['version'] == '1.0.7')
|
||||
{
|
||||
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value`='1.0.8' WHERE `settinggroup`='panel' AND `varname`='version'");
|
||||
$settings['panel']['version'] = '1.0.8';
|
||||
}
|
||||
|
||||
if($settings['panel']['version'] == '1.0.8')
|
||||
{
|
||||
$db->query("ALTER TABLE `" . TABLE_PANEL_DATABASES . "` DROP `password` ;");
|
||||
$db->query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` ADD `specialsettings` TEXT NOT NULL AFTER `safemode` ;");
|
||||
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value`='1.0.9' WHERE `settinggroup`='panel' AND `varname`='version'");
|
||||
$settings['panel']['version'] = '1.0.9';
|
||||
}
|
||||
|
||||
if($settings['panel']['version'] == '1.0.9')
|
||||
{
|
||||
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value`='1.0.10' WHERE `settinggroup`='panel' AND `varname`='version'");
|
||||
$settings['panel']['version'] = '1.0.10';
|
||||
}
|
||||
|
||||
?>
|
||||
1187
install/updates/1.2/update_1.2-beta1_1.2.19.inc.php
Normal file
1082
install/updates/1.2/update_1.2.19_1.4.inc.php
Normal file
118
install/updates/1.4/update_1.4.inc.php
Normal file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Aders <eleras@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package System
|
||||
* @version $Id: update_1.4.inc.php 2722 2009-05-04 18:59:28Z flo $
|
||||
*/
|
||||
|
||||
if($settings['panel']['version'] == '1.4')
|
||||
{
|
||||
$updatelog->logAction(ADM_ACTION, LOG_WARNING, "Updating from 1.4 to 1.4-svn1");
|
||||
|
||||
// Going to fix the stuff the update 1.2.19-svn42 to 1.2.19-svn43 broke
|
||||
|
||||
$result = $db->query("SELECT * FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `documentroot` LIKE 'http%';");
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
if(preg_match("#(https?)://?(.*)#i", $row['documentroot'], $matches))
|
||||
{
|
||||
$row['documentroot'] = $matches[1] . "://" . $matches[2];
|
||||
$db->query("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET `documentroot` = '" . $db->escape($row['documentroot']) . "' WHERE `id` = '" . $row['id'] . "';");
|
||||
}
|
||||
}
|
||||
|
||||
// set new version
|
||||
|
||||
$query = 'UPDATE `%s` SET `value` = \'1.4-svn1\' WHERE `settinggroup` = \'panel\' AND `varname` = \'version\'';
|
||||
$query = sprintf($query, TABLE_PANEL_SETTINGS);
|
||||
$db->query($query);
|
||||
$settings['panel']['version'] = '1.4-svn1';
|
||||
}
|
||||
|
||||
if($settings['panel']['version'] == '1.4-svn1')
|
||||
{
|
||||
$updatelog->logAction(ADM_ACTION, LOG_WARNING, "Updating from 1.4-svn1 to 1.4.1");
|
||||
|
||||
// set new version
|
||||
|
||||
$query = 'UPDATE `%s` SET `value` = \'1.4.1\' WHERE `settinggroup` = \'panel\' AND `varname` = \'version\'';
|
||||
$query = sprintf($query, TABLE_PANEL_SETTINGS);
|
||||
$db->query($query);
|
||||
$settings['panel']['version'] = '1.4.1';
|
||||
}
|
||||
|
||||
if($settings['panel']['version'] == '1.4.1')
|
||||
{
|
||||
$updatelog->logAction(ADM_ACTION, LOG_WARNING, "Updating from 1.4.1 to 1.4.1-svn1");
|
||||
|
||||
// give at least ONE admin the permission to edit phpsettings, bug #1031
|
||||
|
||||
$cntCanEditPHP = $db->query_first("SELECT COUNT(`caneditphpsettings`) as `cnt` FROM `" . TABLE_PANEL_ADMINS . "` WHERE `caneditphpsettings` = '1'");
|
||||
|
||||
if($cntCanEditPHP['cnt'] <= 0)
|
||||
{
|
||||
// none of the admins can edit php-settings,
|
||||
//so we give those who can edit serversettings the right to edit php-settings
|
||||
|
||||
$db->query("UPDATE `" . TABLE_PANEL_ADMINS . "` SET `caneditphpsettings` = '1' WHERE `change_serversettings` = '1'");
|
||||
}
|
||||
|
||||
// set new version
|
||||
|
||||
$query = 'UPDATE `%s` SET `value` = \'1.4.1-svn1\' WHERE `settinggroup` = \'panel\' AND `varname` = \'version\'';
|
||||
$query = sprintf($query, TABLE_PANEL_SETTINGS);
|
||||
$db->query($query);
|
||||
$settings['panel']['version'] = '1.4.1-svn1';
|
||||
}
|
||||
|
||||
if($settings['panel']['version'] == '1.4.1-svn1')
|
||||
{
|
||||
$updateto = '1.4.1-svn2';
|
||||
$updatelog->logAction(ADM_ACTION, LOG_WARNING, "Updating from " . $settings['panel']['version'] . " to " . $updateto);
|
||||
|
||||
// set new version
|
||||
|
||||
$query = 'UPDATE `%s` SET `value` = \'' . $updateto . '\' WHERE `settinggroup` = \'panel\' AND `varname` = \'version\'';
|
||||
$query = sprintf($query, TABLE_PANEL_SETTINGS);
|
||||
$db->query($query);
|
||||
$settings['panel']['version'] = $updateto;
|
||||
}
|
||||
|
||||
if($settings['panel']['version'] == '1.4.1-svn2')
|
||||
{
|
||||
$updateto = '1.4.1-svn3';
|
||||
$updatelog->logAction(ADM_ACTION, LOG_WARNING, "Updating from " . $settings['panel']['version'] . " to " . $updateto);
|
||||
|
||||
// set new version
|
||||
|
||||
$query = 'UPDATE `%s` SET `value` = \'' . $updateto . '\' WHERE `settinggroup` = \'panel\' AND `varname` = \'version\'';
|
||||
$query = sprintf($query, TABLE_PANEL_SETTINGS);
|
||||
$db->query($query);
|
||||
$settings['panel']['version'] = $updateto;
|
||||
}
|
||||
|
||||
if($settings['panel']['version'] == '1.4.1-svn3')
|
||||
{
|
||||
$updateto = '1.4.2';
|
||||
$updatelog->logAction(ADM_ACTION, LOG_WARNING, "Updating from " . $settings['panel']['version'] . " to " . $updateto);
|
||||
|
||||
// set new version
|
||||
|
||||
$query = 'UPDATE `%s` SET `value` = \'' . $updateto . '\' WHERE `settinggroup` = \'panel\' AND `varname` = \'version\'';
|
||||
$query = sprintf($query, TABLE_PANEL_SETTINGS);
|
||||
$db->query($query);
|
||||
$settings['panel']['version'] = $updateto;
|
||||
}
|
||||
|
||||
?>
|
||||
198
install/updates/froxlor/upgrade_syscp.inc.php
Normal file
@@ -0,0 +1,198 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2009-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 Michael Kaufmann <d00p@froxlor.org>
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package System
|
||||
* @version $Id: $
|
||||
*/
|
||||
|
||||
|
||||
$updateto = '1.0';
|
||||
$frontend = 'froxlor';
|
||||
|
||||
$updatelog->logAction(ADM_ACTION, LOG_WARNING, "Upgrading SysCP ".$settings['panel']['version']." to Froxlor ". $updateto);
|
||||
|
||||
// set new version
|
||||
$query = 'UPDATE `%s` SET `value` = \'' . $updateto . '\' WHERE `settinggroup` = \'panel\' AND `varname` = \'version\'';
|
||||
$query = sprintf($query, TABLE_PANEL_SETTINGS);
|
||||
$db->query($query);
|
||||
$settings['panel']['version'] = $updateto;
|
||||
// add field frontend
|
||||
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('system','frontend','froxlor')");
|
||||
|
||||
/*
|
||||
* this is the main upgrade
|
||||
*/
|
||||
if($settings['panel']['frontend'] == 'froxlor'
|
||||
&& $settings['panel']['version'] == '1.0')
|
||||
{
|
||||
|
||||
/*
|
||||
* add missing database-updates if necessary (old: update/update_database.php
|
||||
*/
|
||||
if(!isset($settings['system']['dbversion']) || $settings['system']['dbversion'] < '1')
|
||||
{
|
||||
$db->query("ALTER TABLE `panel_databases` ADD `dbserver` INT( 11 ) UNSIGNED NOT NULL default '0';");
|
||||
}
|
||||
if(!isset($settings['system']['dbversion']) || $settings['system']['dbversion'] < '2')
|
||||
{
|
||||
$db->query("ALTER TABLE `panel_ipsandports` CHANGE `ssl_cert` `ssl_cert_file` VARCHAR( 255 ) NOT NULL,
|
||||
ADD `ssl_key_file` VARCHAR( 255 ) NOT NULL,
|
||||
ADD `ssl_ca_file` VARCHAR( 255 ) NOT NULL,
|
||||
ADD `default_vhostconf_domain` TEXT NOT NULL;");
|
||||
|
||||
$db->query("INSERT INTO `panel_settings` SET `settinggroup` = 'system', `varname` = 'ssl_key_file', `value` = '';");
|
||||
$db->query("INSERT INTO `panel_settings` SET `settinggroup` = 'system', `varname` = 'ssl_ca_file', `value` = '';");
|
||||
}
|
||||
// eof(lostuff)
|
||||
|
||||
/*
|
||||
* remove billing tables in database
|
||||
*/
|
||||
define('TABLE_BILLING_INVOICES', 'billing_invoices');
|
||||
define('TABLE_BILLING_INVOICES_ADMINS', 'billing_invoices_admins');
|
||||
define('TABLE_BILLING_INVOICE_CHANGES', 'billing_invoice_changes');
|
||||
define('TABLE_BILLING_INVOICE_CHANGES_ADMINS', 'billing_invoice_changes_admins');
|
||||
define('TABLE_BILLING_SERVICE_CATEGORIES', 'billing_service_categories');
|
||||
define('TABLE_BILLING_SERVICE_CATEGORIES_ADMINS', 'billing_service_categories_admins');
|
||||
define('TABLE_BILLING_SERVICE_DOMAINS_TEMPLATES', 'billing_service_domains_templates');
|
||||
define('TABLE_BILLING_SERVICE_OTHER', 'billing_service_other');
|
||||
define('TABLE_BILLING_SERVICE_OTHER_TEMPLATES', 'billing_service_other_templates');
|
||||
define('TABLE_BILLING_TAXCLASSES', 'billing_taxclasses');
|
||||
define('TABLE_BILLING_TAXRATES', 'billing_taxrates');
|
||||
|
||||
$db->query("DROP TABLE `" . TABLE_BILLING_SERVICE_CATEGORIES . "`;");
|
||||
$db->query("DROP TABLE `" . TABLE_BILLING_SERVICE_CATEGORIES_ADMINS . "`;");
|
||||
$db->query("DROP TABLE `" . TABLE_BILLING_SERVICE_DOMAINS_TEMPLATES . "`;");
|
||||
$db->query("DROP TABLE `" . TABLE_BILLING_SERVICE_OTHER . "`;");
|
||||
$db->query("DROP TABLE `" . TABLE_BILLING_SERVICE_OTHER_TEMPLATES . "`;");
|
||||
$db->query("DROP TABLE `" . TABLE_BILLING_TAXCLASSES . "`;");
|
||||
$db->query("DROP TABLE `" . TABLE_BILLING_TAXRATES . "`;");
|
||||
$db->query("DROP TABLE `" . TABLE_BILLING_INVOICES . "`;");
|
||||
$db->query("DROP TABLE `" . TABLE_BILLING_INVOICES_ADMINS . "`;");
|
||||
$db->query("DROP TABLE `" . TABLE_BILLING_INVOICE_CHANGES . "`;");
|
||||
$db->query("DROP TABLE `" . TABLE_BILLING_INVOICE_CHANGES_ADMINS . "`;");
|
||||
$db->query("DROP TABLE `" . TABLE_PANEL_DISKSPACE . "`;");
|
||||
$db->query("DROP TABLE `" . TABLE_PANEL_DISKSPACE_ADMINS . "`;");
|
||||
|
||||
/*
|
||||
* update panel_domains, panel_customers, panel_admins
|
||||
*/
|
||||
$db->query("ALTER TABLE `" . TABLE_PANEL_ADMINS . "`
|
||||
DROP `firstname`,
|
||||
DROP `title`,
|
||||
DROP `company`,
|
||||
DROP `street`,
|
||||
DROP `zipcode`,
|
||||
DROP `city`,
|
||||
DROP `country`,
|
||||
DROP `phone`,
|
||||
DROP `fax`,
|
||||
DROP `taxid`,
|
||||
DROP `contract_date`,
|
||||
DROP `contract_number`,
|
||||
DROP `contract_details`,
|
||||
DROP `included_domains_qty`,
|
||||
DROP `included_domains_tld`,
|
||||
DROP `additional_traffic_fee`,
|
||||
DROP `additional_traffic_unit`,
|
||||
DROP `additional_diskspace_fee`,
|
||||
DROP `additional_diskspace_unit`,
|
||||
DROP `taxclass`,
|
||||
DROP `setup_fee`,
|
||||
DROP `interval_fee`,
|
||||
DROP `interval_length`,
|
||||
DROP `interval_type`,
|
||||
DROP `interval_payment`,
|
||||
DROP `calc_tax`,
|
||||
DROP `term_of_payment`,
|
||||
DROP `payment_every`,
|
||||
DROP `payment_method`,
|
||||
DROP `bankaccount_holder`,
|
||||
DROP `bankaccount_number`,
|
||||
DROP `bankaccount_blz`,
|
||||
DROP `bankaccount_bank`,
|
||||
DROP `service_active`,
|
||||
DROP `servicestart_date`,
|
||||
DROP `serviceend_date`,
|
||||
DROP `lastinvoiced_date`,
|
||||
DROP `lastinvoiced_date_traffic`,
|
||||
DROP `lastinvoiced_date_diskspace`,
|
||||
DROP `customer_categories_once`,
|
||||
DROP `customer_categories_period`,
|
||||
DROP `invoice_fee`,
|
||||
DROP `invoice_fee_hosting`,
|
||||
DROP `invoice_fee_hosting_customers`,
|
||||
DROP `invoice_fee_domains`,
|
||||
DROP `invoice_fee_traffic`,
|
||||
DROP `invoice_fee_diskspace`,
|
||||
DROP `invoice_fee_other`,
|
||||
DROP `edit_billingdata`;");
|
||||
|
||||
$db->query("ALTER TABLE `" . TABLE_PANEL_CUSTOMERS . "`
|
||||
DROP `taxid`,
|
||||
DROP `title`,
|
||||
DROP `country`,
|
||||
DROP `additional_service_description`,
|
||||
DROP `contract_date`,
|
||||
DROP `contract_number`,
|
||||
DROP `contract_details`,
|
||||
DROP `included_domains_qty`,
|
||||
DROP `included_domains_tld`,
|
||||
DROP `additional_traffic_fee`,
|
||||
DROP `additional_traffic_unit`,
|
||||
DROP `additional_diskspace_fee`,
|
||||
DROP `additional_diskspace_unit`,
|
||||
DROP `taxclass`,
|
||||
DROP `setup_fee`,
|
||||
DROP `interval_fee`,
|
||||
DROP `interval_length`,
|
||||
DROP `interval_type`,
|
||||
DROP `interval_payment`,
|
||||
DROP `calc_tax`,
|
||||
DROP `term_of_payment`,
|
||||
DROP `payment_every`,
|
||||
DROP `payment_method`,
|
||||
DROP `bankaccount_holder`,
|
||||
DROP `bankaccount_number`,
|
||||
DROP `bankaccount_blz`,
|
||||
DROP `bankaccount_bank`,
|
||||
DROP `service_active`,
|
||||
DROP `servicestart_date`,
|
||||
DROP `serviceend_date`,
|
||||
DROP `lastinvoiced_date`,
|
||||
DROP `lastinvoiced_date_traffic`,
|
||||
DROP `lastinvoiced_date_diskspace`,
|
||||
DROP `invoice_fee`,
|
||||
DROP `invoice_fee_hosting`,
|
||||
DROP `invoice_fee_domains`,
|
||||
DROP `invoice_fee_traffic`,
|
||||
DROP `invoice_fee_diskspace`,
|
||||
DROP `invoice_fee_other`;");
|
||||
$db->query("ALTER TABLE `panel_domains`
|
||||
DROP `taxclass`,
|
||||
DROP `setup_fee`,
|
||||
DROP `interval_fee`,
|
||||
DROP `interval_length`,
|
||||
DROP `interval_type`,
|
||||
DROP `interval_payment`,
|
||||
DROP `service_active`,
|
||||
DROP `servicestart_date`,
|
||||
DROP `serviceend_date`,
|
||||
DROP `lastinvoiced_date`;");
|
||||
|
||||
$db->query("DELETE FROM `" . TABLE_PANEL_SETTINGS . "`
|
||||
WHERE `settinggroup` = 'billing';");
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
130
install/updatesql.php
Normal file
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package System
|
||||
* @version $Id: updatesql.php 2724 2009-06-07 14:18:02Z flo $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Includes the Usersettings eg. MySQL-Username/Passwort etc.
|
||||
*/
|
||||
|
||||
require ('../lib/userdata.inc.php');
|
||||
|
||||
/**
|
||||
* Includes the MySQL-Tabledefinitions etc.
|
||||
*/
|
||||
|
||||
require ('../lib/tables.inc.php');
|
||||
|
||||
/**
|
||||
* Inlcudes the MySQL-Connection-Class
|
||||
*/
|
||||
|
||||
require ('../lib/class_mysqldb.php');
|
||||
$db = new db($sql['host'], $sql['user'], $sql['password'], $sql['db']);
|
||||
unset($sql['password']);
|
||||
unset($db->password);
|
||||
$result = $db->query("SELECT `settinggroup`, `varname`, `value` FROM `" . TABLE_PANEL_SETTINGS . "`");
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
$settings[$row['settinggroup']][$row['varname']] = $row['value'];
|
||||
}
|
||||
|
||||
unset($row);
|
||||
unset($result);
|
||||
|
||||
/**
|
||||
* Inlcudes the Functions
|
||||
*/
|
||||
|
||||
require ('../lib/functions.php');
|
||||
|
||||
$updatelog = SysCPLogger::getInstanceOf(array('loginname' => 'updater'), $db, $settings);
|
||||
|
||||
/*
|
||||
* since froxlor, we have to check if there's still someone
|
||||
* out there using syscp and needs to upgrade
|
||||
*/
|
||||
if(!isset($settings['panel']['frontend'])
|
||||
|| $settings['panel']['frontend'] != 'froxlor')
|
||||
{
|
||||
/**
|
||||
* First case: We are updating from a version < 1.0.10
|
||||
*/
|
||||
|
||||
if(!isset($settings['panel']['version'])
|
||||
|| (substr($settings['panel']['version'], 0, 3) == '1.0' && $settings['panel']['version'] != '1.0.10'))
|
||||
{
|
||||
$updatelog->logAction(ADM_ACTION, LOG_WARNING, "Updating from 1.0 to 1.0.10");
|
||||
include_once ('./updates/1.0/update_1.0_1.0.10.inc.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* Second case: We are updating from version = 1.0.10
|
||||
*/
|
||||
|
||||
if($settings['panel']['version'] == '1.0.10')
|
||||
{
|
||||
$updatelog->logAction(ADM_ACTION, LOG_WARNING, "Updating from 1.0.10 to 1.2-beta1");
|
||||
include_once ('./updates/1.0/update_1.0.10_1.2-beta1.inc.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* Third case: We are updating from a version > 1.2-beta1
|
||||
*/
|
||||
|
||||
if(substr($settings['panel']['version'], 0, 3) == '1.2')
|
||||
{
|
||||
$updatelog->logAction(ADM_ACTION, LOG_WARNING, "Updating from 1.2-beta1 to 1.2.19");
|
||||
include_once ('./updates/1.2/update_1.2-beta1_1.2.19.inc.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* 4th case: We are updating from 1.2.19 to 1.2.20 (prolly the last from the 1.2.x series)
|
||||
*/
|
||||
|
||||
if(substr($settings['panel']['version'], 0, 6) == '1.2.19')
|
||||
{
|
||||
$updatelog->logAction(ADM_ACTION, LOG_WARNING, "Updating from 1.2.19 to 1.4");
|
||||
include_once ('./updates/1.2/update_1.2.19_1.4.inc.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* 5th case: We are updating from a version >= 1.4
|
||||
*/
|
||||
|
||||
if(substr($settings['panel']['version'], 0, 3) == '1.4')
|
||||
{
|
||||
$updatelog->logAction(ADM_ACTION, LOG_WARNING, "Updating from 1.4");
|
||||
include_once ('./updates/1.4/update_1.4.inc.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* Upgrading SysCP to Froxlor-1.0
|
||||
*
|
||||
* when we reach this part, all necessary updates
|
||||
* should have been installes automatically by the
|
||||
* update scripts.
|
||||
*/
|
||||
include_once ('./updates/froxlor/upgrade_syscp.inc.php');
|
||||
|
||||
}
|
||||
|
||||
updateCounters();
|
||||
inserttask('1');
|
||||
@chmod('../lib/userdata.inc.php', 0440);
|
||||
header('Location: ../index.php');
|
||||
|
||||
?>
|
||||
561
lib/classes/aps/class.ApsInstaller.php
Normal file
@@ -0,0 +1,561 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Implementation of the Application Packaging Standard from SwSoft/Parallels
|
||||
* http://apsstandard.com
|
||||
*
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Sven Skrabal <info@nexpa.de>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Cron
|
||||
* @version $Id: class.ApsInstaller.php 2724 2009-06-07 14:18:02Z flo $
|
||||
* @todo logging
|
||||
* run with user uid/gid
|
||||
* folder truncation/tar all files
|
||||
*/
|
||||
|
||||
class ApsInstaller extends ApsParser
|
||||
{
|
||||
private $db = false;
|
||||
private $db_root = false;
|
||||
private $DomainPath = '';
|
||||
private $Domain = '';
|
||||
private $RealPath = '';
|
||||
private $RootDir = '';
|
||||
private $Hosts = '';
|
||||
|
||||
/**
|
||||
* constructor of class. setup some basic variables
|
||||
*
|
||||
* @param settings array with the global settings from syscp
|
||||
* @param db instance of the database class from syscp
|
||||
* @param db_root instance of the database class from syscp with root permissions
|
||||
*/
|
||||
|
||||
public function __construct($settings, $db, $db_root)
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->db_root = $db_root;
|
||||
$this->RootDir = dirname(dirname(__FILE__)) . '/';
|
||||
$this->Hosts = $settings['system']['mysql_access_host'];
|
||||
}
|
||||
|
||||
/**
|
||||
* main function of class which handles all
|
||||
*/
|
||||
|
||||
public function InstallHandler()
|
||||
{
|
||||
chdir($this->RootDir);
|
||||
$result = $this->db->query('SELECT * FROM `' . TABLE_APS_TASKS . '` AS `t` INNER JOIN `' . TABLE_APS_INSTANCES . '` AS `i` ON `t`.`InstanceID` = `i`.`ID` INNER JOIN `' . TABLE_APS_PACKAGES . '` AS `p` ON `i`.`PackageID` = `p`.`ID` INNER JOIN `' . TABLE_PANEL_CUSTOMERS . '` AS `c` ON `i`.`CustomerID` = `c`.`customerid` WHERE `TASK` NOT IN (' . TASK_SYSTEM_UPDATE . ', ' . TASK_SYSTEM_DOWNLOAD . ')');
|
||||
|
||||
while($Row = $this->db->fetch_array($result))
|
||||
{
|
||||
//check for existing aps xml file
|
||||
|
||||
if(!file_exists($this->RootDir . 'packages/' . $Row['Path'] . '/APP-META.xml'))
|
||||
{
|
||||
$this->db->query('UPDATE `' . TABLE_APS_INSTANCES . '` SET `Status` = ' . INSTANCE_ERROR . ' WHERE `ID` = ' . $this->db->escape($Row['InstanceID']));
|
||||
continue;
|
||||
}
|
||||
|
||||
//get contents and parse them
|
||||
|
||||
$XmlContent = file_get_contents($this->RootDir . 'packages/' . $Row['Path'] . '/APP-META.xml');
|
||||
$Xml = new SimpleXMLElement($XmlContent);
|
||||
|
||||
//check for unparseable xml data
|
||||
|
||||
if($Xml == false)
|
||||
{
|
||||
$this->db->query('UPDATE `' . TABLE_APS_INSTANCES . '` SET `Status` = ' . INSTANCE_ERROR . ' WHERE `ID` = ' . $this->db->escape($Row['InstanceID']));
|
||||
continue;
|
||||
}
|
||||
|
||||
$Task = $Row['Task'];
|
||||
$this->DomainPath = '';
|
||||
$this->Domain = '';
|
||||
$this->RealPath = '';
|
||||
|
||||
//lock instance so installation cannot be canceled from the panel
|
||||
|
||||
$this->db->query('UPDATE `' . TABLE_APS_INSTANCES . '` SET `Status` = ' . INSTANCE_TASK_ACTIVE . ' WHERE `ID` = ' . $this->db->escape($Row['InstanceID']));
|
||||
|
||||
//setup environment with data for domain/installation location
|
||||
|
||||
self::PrepareBasics($Row);
|
||||
|
||||
//create database if necessary and setup environment variables
|
||||
|
||||
self::PrepareDatabase($Xml, $Row, $Task);
|
||||
|
||||
//unpack installation scripts and package files if necessary
|
||||
|
||||
if(self::PrepareFiles($Xml, $Row, $Task))
|
||||
{
|
||||
//setup environment variables fetched from installation wizard
|
||||
|
||||
self::PrepareWizardData($Xml, $Row, $Task);
|
||||
|
||||
//run installation scripts from packages
|
||||
|
||||
self::RunInstaller($Xml, $Row, $Task);
|
||||
}
|
||||
|
||||
//remove installation scripts
|
||||
|
||||
self::CleanupData($Xml, $Row, $Task);
|
||||
unset($Xml);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* run the installation script and log errors if there are some
|
||||
*
|
||||
* @param xml instance of a valid xml object with a parsed APP-META.xml file
|
||||
* @param row current entry from the database for app to handle
|
||||
* @param task numeric code to specify what to do
|
||||
* @return success true/error false
|
||||
*/
|
||||
|
||||
private function RunInstaller($Xml, $Row, $Task)
|
||||
{
|
||||
//installation
|
||||
|
||||
if($Task == TASK_INSTALL)
|
||||
{
|
||||
//setup right path and run installation script
|
||||
|
||||
chdir($this->RealPath . $this->DomainPath . '/install_scripts/');
|
||||
$Return = array();
|
||||
$ReturnStatus = 0;
|
||||
$Return = safe_exec('php ' . escapeshellcmd($this->RealPath . $this->DomainPath . '/install_scripts/configure install'), $ReturnStatus);
|
||||
|
||||
if($ReturnStatus != 0)
|
||||
{
|
||||
//write output of script on error into database for admin
|
||||
|
||||
$Buffer = '';
|
||||
$Count = 0;
|
||||
foreach($Return as $Line)
|
||||
{
|
||||
$Count+= 1;
|
||||
$Buffer.= $Line;
|
||||
|
||||
if($Count != count($Return))$Buffer.= "\n";
|
||||
}
|
||||
|
||||
//FIXME error logging
|
||||
|
||||
echo ("error : installer\n" . $Buffer . "\n");
|
||||
$this->db->query('UPDATE `' . TABLE_APS_INSTANCES . '` SET `Status` = ' . INSTANCE_ERROR . ' WHERE `ID` = ' . $this->db->escape($Row['InstanceID']));
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
//installation succeeded
|
||||
//chown all files if installtion script has created some new files. otherwise customers cannot edit the files via ftp
|
||||
|
||||
safe_exec('chown ' . (int)$Row['guid'] . ':' . (int)$Row['guid'] . ' -R ' . escapeshellarg($this->RealPath . $this->DomainPath . '/'));
|
||||
|
||||
//update database
|
||||
|
||||
$this->db->query('UPDATE `' . TABLE_APS_INSTANCES . '` SET `Status` = ' . INSTANCE_SUCCESS . ' WHERE `ID` = ' . $this->db->escape($Row['InstanceID']));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* remove installation scripts from filesystem and remove tasks and update the database
|
||||
*
|
||||
* @param xml instance of a valid xml object with a parsed APP-META.xml file
|
||||
* @param row current entry from the database for app to handle
|
||||
* @param task numeric code to specify what to do
|
||||
*/
|
||||
|
||||
private function CleanupData($Xml, $Row, $Task)
|
||||
{
|
||||
chdir($this->RootDir);
|
||||
|
||||
if($Task == TASK_INSTALL)
|
||||
{
|
||||
//cleanup installation
|
||||
|
||||
self::UnlinkRecursive($this->RealPath . $this->DomainPath . '/install_scripts/');
|
||||
|
||||
//remove task
|
||||
|
||||
$this->db->query('DELETE FROM `' . TABLE_APS_TASKS . '` WHERE `Task` = ' . TASK_INSTALL . ' AND `InstanceID` = ' . $this->db->escape($Row['InstanceID']));
|
||||
}
|
||||
elseif($Task == TASK_REMOVE)
|
||||
{
|
||||
//FIXME cleanup installation
|
||||
//remove files from: $this->RealPath . $this->DomainPath . '/'
|
||||
//remove permissions
|
||||
//drop database
|
||||
|
||||
$XmlDb = $Xml->requirements->children('http://apstandard.com/ns/1/db');
|
||||
|
||||
if($XmlDb->db->id)
|
||||
{
|
||||
//database management
|
||||
|
||||
$Database = 'web' . $Row['CustomerID'] . 'aps' . $Row['InstanceID'];
|
||||
foreach(array_map('trim', explode(',', $this->Hosts)) as $DatabaseHost)
|
||||
{
|
||||
$this->db_root->query('REVOKE ALL PRIVILEGES ON * . * FROM `' . $this->db->escape($Database) . '`@`' . $this->db->escape($DatabaseHost) . '`');
|
||||
$this->db_root->query('REVOKE ALL PRIVILEGES ON `' . $this->db->escape($Database) . '` . * FROM `' . $this->db->escape($Database) . '`@`' . $this->db->escape($DatabaseHost) . '`');
|
||||
$this->db_root->query('DELETE FROM `mysql`.`user` WHERE `User` = "' . $this->db->escape($Database) . '" AND `Host` = "' . $this->db->escape($DatabaseHost) . '"');
|
||||
}
|
||||
|
||||
$this->db_root->query('DROP DATABASE IF EXISTS `' . $this->db->escape($Database) . '`');
|
||||
$this->db_root->query('FLUSH PRIVILEGES');
|
||||
}
|
||||
|
||||
//remove task & delete package instance + settings
|
||||
|
||||
$this->db->query('DELETE FROM `' . TABLE_APS_TASKS . '` WHERE `Task` = ' . TASK_REMOVE . ' AND `InstanceID` = ' . $this->db->escape($Row['InstanceID']));
|
||||
$this->db->query('DELETE FROM `' . TABLE_APS_INSTANCES . '` WHERE `ID` = ' . $this->db->escape($Row['InstanceID']));
|
||||
$this->db->query('DELETE FROM `' . TABLE_APS_SETTINGS . '` WHERE `InstanceID` = ' . $this->db->escape($Row['InstanceID']));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* setup all environment variables from the wizard, they're all needed by the installation script
|
||||
*
|
||||
* @param xml instance of a valid xml object with a parsed APP-META.xml file
|
||||
* @param row current entry from the database for app to handle
|
||||
* @param task numeric code to specify what to do
|
||||
*/
|
||||
|
||||
private function PrepareWizardData($Xml, $Row, $Task)
|
||||
{
|
||||
//data collected by wizard
|
||||
//FIXME install_only parameter/reconfigure
|
||||
|
||||
$result = $this->db->query('SELECT * FROM `' . TABLE_APS_SETTINGS . '` WHERE `InstanceID` = ' . $this->db->escape($Row['InstanceID']));
|
||||
|
||||
while($Row2 = $this->db->fetch_array($result))
|
||||
{
|
||||
//skip APS internal data
|
||||
|
||||
if($Row2['Name'] == 'main_location'
|
||||
|| $Row2['Name'] == 'main_domain'
|
||||
|| $Row2['Name'] == 'main_database_password'
|
||||
|| $Row2['Name'] == 'license')continue;
|
||||
putenv('SETTINGS_' . $Row2['Name'] . '=' . $Row2['Value']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* extract all needed files from the aps packages
|
||||
*
|
||||
* @param xml instance of a valid xml object with a parsed APP-META.xml file
|
||||
* @param row current entry from the database for app to handle
|
||||
* @param task numeric code to specify what to do
|
||||
* @return success true/error false
|
||||
*/
|
||||
|
||||
private function PrepareFiles($Xml, $Row, $Task)
|
||||
{
|
||||
if($Task == TASK_INSTALL)
|
||||
{
|
||||
//FIXME truncate customer directory
|
||||
//remove files from: $this->RealPath . $this->DomainPath . '/*'
|
||||
|
||||
if(!file_exists($this->RealPath . $this->DomainPath . '/'))mkdir($this->RealPath . $this->DomainPath . '/', 0777, true);
|
||||
|
||||
//extract all files and chown them to the customer guid
|
||||
|
||||
if(self::ExtractZip($this->RootDir . 'packages/' . $Row['Path'] . '/' . $Row['Path'], $Xml->mapping['path'], $this->RealPath . $this->DomainPath . '/') == false
|
||||
|| self::ExtractZip($this->RootDir . 'packages/' . $Row['Path'] . '/' . $Row['Path'], 'scripts', $this->RealPath . $this->DomainPath . '/install_scripts/') == false)
|
||||
{
|
||||
$this->db->query('UPDATE `' . TABLE_APS_INSTANCES . '` SET `Status` = ' . INSTANCE_ERROR . ' WHERE `ID` = ' . $this->db->escape($Row['InstanceID']));
|
||||
|
||||
//FIXME clean up already installed data
|
||||
//remove files from: $this->RealPath . $this->DomainPath . '/*'
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
safe_exec('chown ' . (int)$Row['guid'] . ':' . (int)$Row['guid'] . ' -R ' . escapeshellarg($this->RealPath . $this->DomainPath . '/'));
|
||||
}
|
||||
else
|
||||
{
|
||||
if(self::ExtractZip($this->RootDir . 'packages/' . $Row['Path'] . '/' . $Row['Path'], 'scripts', $this->RealPath . $this->DomainPath . '/install_scripts/') == false)
|
||||
{
|
||||
$this->db->query('UPDATE `' . TABLE_APS_INSTANCES . '` SET `Status` = ' . INSTANCE_ERROR . ' WHERE `ID` = ' . $this->db->escape($Row['InstanceID']));
|
||||
|
||||
//clean up already installed data
|
||||
|
||||
self::UnlinkRecursive($this->RealPath . $this->DomainPath . '/install_scripts/');
|
||||
return false;
|
||||
}
|
||||
|
||||
//set right file owner
|
||||
|
||||
safe_exec('chown ' . (int)$Row['guid'] . ':' . (int)$Row['guid'] . ' -R ' . escapeshellarg($this->RealPath . $this->DomainPath . '/'));
|
||||
}
|
||||
|
||||
//recursive mappings
|
||||
|
||||
self::PrepareMappings($Xml->mapping, $Xml->mapping['url'], $this->RealPath . $this->DomainPath . '/');
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* setup path environment variables for the installation script
|
||||
*
|
||||
* @param parentmapping instance of parsed xml file, current mapping position
|
||||
* @param url relative path for application specifying the current path within the mapping tree
|
||||
* @param path absolute path for application specifying the current path within the mapping tree
|
||||
*/
|
||||
|
||||
private function PrepareMappings($ParentMapping, $Url, $Path)
|
||||
{
|
||||
//check for special PHP permissions
|
||||
//must be done with xpath otherwise check not possible (XML parser problem with attributes)
|
||||
|
||||
$ParentMapping->registerXPathNamespace('p', 'http://apstandard.com/ns/1/php');
|
||||
$Result = $ParentMapping->xpath('p:permissions');
|
||||
|
||||
if($Result[0]['writable'] == 'true')
|
||||
{
|
||||
//fixing file permissions to writeable
|
||||
|
||||
if(is_dir($Path))
|
||||
{
|
||||
chmod($Path, 0775);
|
||||
}
|
||||
else
|
||||
{
|
||||
chmod($Path, 0664);
|
||||
}
|
||||
}
|
||||
|
||||
if($Result[0]['readable'] == 'false')
|
||||
{
|
||||
//fixing file permissions to non readable
|
||||
|
||||
if(is_dir($Path))
|
||||
{
|
||||
chmod($Path, 0333);
|
||||
}
|
||||
else
|
||||
{
|
||||
chmod($Path, 0222);
|
||||
}
|
||||
}
|
||||
|
||||
//set environment variables
|
||||
|
||||
$EnvVariable = str_replace("/", "_", $Url);
|
||||
putenv('WEB_' . $EnvVariable . '_DIR=' . $Path);
|
||||
|
||||
//resolve deeper mappings
|
||||
|
||||
foreach($ParentMapping->mapping as $Mapping)
|
||||
{
|
||||
//recursive check of other mappings
|
||||
|
||||
if($Url == '/')
|
||||
{
|
||||
self::PrepareMappings($Mapping, $Url . $Mapping['url'], $Path . $Mapping['url']);
|
||||
}
|
||||
else
|
||||
{
|
||||
self::PrepareMappings($Mapping, $Url . '/' . $Mapping['url'], $Path . '/' . $Mapping['url']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* setup domain environment variables for the installation script
|
||||
*
|
||||
* @param xml instance of a valid xml object with a parsed APP-META.xml file
|
||||
*/
|
||||
|
||||
private function PrepareBasics($Row)
|
||||
{
|
||||
//domain
|
||||
|
||||
$result = $this->db->query('SELECT * FROM `' . TABLE_APS_SETTINGS . '` WHERE `InstanceID` = ' . $this->db->escape($Row['InstanceID']) . ' AND `Name` = "main_domain"');
|
||||
$Row3 = $this->db->fetch_array($result);
|
||||
$result2 = $this->db->query('SELECT * FROM `' . TABLE_PANEL_DOMAINS . '` WHERE `id` = ' . $this->db->escape($Row3['Value']));
|
||||
$Row3 = $this->db->fetch_array($result2);
|
||||
$this->Domain = $Row3['domain'];
|
||||
$this->RealPath = $Row3['documentroot'];
|
||||
|
||||
//location
|
||||
|
||||
$result3 = $this->db->query('SELECT * FROM `' . TABLE_APS_SETTINGS . '` WHERE `InstanceID` = ' . $this->db->escape($Row['InstanceID']) . ' AND `Name` = "main_location"');
|
||||
$Row3 = $this->db->fetch_array($result3);
|
||||
$this->DomainPath = $Row3['Value'];
|
||||
|
||||
//if application is directly installed on domain remove / at the end
|
||||
|
||||
if($this->DomainPath == '')$this->RealPath = substr($this->RealPath, 0, strlen($this->RealPath) - 1);
|
||||
|
||||
//url environment variables
|
||||
|
||||
putenv('BASE_URL_HOST=' . $this->Domain);
|
||||
putenv('BASE_URL_PATH=' . $this->DomainPath . '/');
|
||||
putenv('BASE_URL_SCHEME=http');
|
||||
}
|
||||
|
||||
/**
|
||||
* create a database if necessary and setup environment variables
|
||||
*
|
||||
* @param xml instance of a valid xml object with a parsed APP-META.xml file
|
||||
* @param row current entry from the database for app to handle
|
||||
* @param task numeric code to specify what to do
|
||||
*/
|
||||
|
||||
private function PrepareDatabase($Xml, $Row, $Task)
|
||||
{
|
||||
global $db_root;
|
||||
$XmlDb = $Xml->requirements->children('http://apstandard.com/ns/1/db');
|
||||
|
||||
if($XmlDb->db->id)
|
||||
{
|
||||
//database management
|
||||
|
||||
$NewDatabase = 'web' . $Row['CustomerID'] . 'aps' . $Row['InstanceID'];
|
||||
$result = $this->db->query('SELECT * FROM `' . TABLE_APS_SETTINGS . '` WHERE `InstanceID` = ' . $this->db->escape($Row['InstanceID']) . ' AND `Name` = "main_database_password"');
|
||||
$Row3 = $this->db->fetch_array($result);
|
||||
$DbPassword = $Row3['Value'];
|
||||
|
||||
if($Task == TASK_INSTALL)
|
||||
{
|
||||
$this->db_root->query('DROP DATABASE IF EXISTS `' . $this->db->escape($NewDatabase) . '`');
|
||||
$this->db_root->query('CREATE DATABASE IF NOT EXISTS `' . $this->db->escape($NewDatabase) . '`');
|
||||
foreach(array_map('trim', explode(',', $this->Hosts)) as $DatabaseHost)
|
||||
{
|
||||
$this->db_root->query('GRANT ALL PRIVILEGES ON `' . $this->db->escape($NewDatabase) . '`.* TO `' . $this->db->escape($NewDatabase) . '`@`' . $this->db->escape($DatabaseHost) . '` IDENTIFIED BY \'password\'');
|
||||
$this->db_root->query('SET PASSWORD FOR `' . $this->db->escape($NewDatabase) . '`@`' . $this->db->escape($DatabaseHost) . '` = PASSWORD(\'' . $DbPassword . '\')');
|
||||
}
|
||||
|
||||
$this->db_root->query('FLUSH PRIVILEGES');
|
||||
}
|
||||
|
||||
//get first mysql access host
|
||||
|
||||
$AccessHosts = array_map('trim', explode(',', $this->Hosts));
|
||||
|
||||
//environment variables
|
||||
|
||||
putenv('DB_' . $XmlDb->db->id . '_TYPE=mysql');
|
||||
putenv('DB_' . $XmlDb->db->id . '_NAME=' . $NewDatabase);
|
||||
putenv('DB_' . $XmlDb->db->id . '_LOGIN=' . $NewDatabase);
|
||||
putenv('DB_' . $XmlDb->db->id . '_PASSWORD=' . $DbPassword);
|
||||
putenv('DB_' . $XmlDb->db->id . '_HOST=' . $AccessHosts[0]);
|
||||
putenv('DB_' . $XmlDb->db->id . '_PORT=3306');
|
||||
putenv('DB_' . $XmlDb->db->id . '_VERSION=' . mysql_get_server_info());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* extract complete directories from a zipfile
|
||||
*
|
||||
* @param filename path to zipfile to extract
|
||||
* @param directory which directory in zipfile to extract
|
||||
* @param destination destination directory for files to extract
|
||||
* @return success true/error false
|
||||
*/
|
||||
|
||||
private function ExtractZip($Filename, $Directory, $Destination)
|
||||
{
|
||||
if(!file_exists($Filename))return false;
|
||||
|
||||
//fix slash notation for correct paths
|
||||
|
||||
if(substr($Directory, -1, 1) == '/')$Directory = substr($Directory, 0, strlen($Directory) - 1);
|
||||
|
||||
if(substr($Destination, -1, 1) != '/')$Destination.= '/';
|
||||
|
||||
//open zipfile to read its contents
|
||||
|
||||
$ZipHandle = zip_open(realpath($Filename));
|
||||
|
||||
if(is_resource($ZipHandle))
|
||||
{
|
||||
while($ZipEntry = zip_read($ZipHandle))
|
||||
{
|
||||
if(substr(zip_entry_name($ZipEntry), 0, strlen($Directory)) == $Directory)
|
||||
{
|
||||
//fix relative path from zipfile
|
||||
|
||||
$NewPath = zip_entry_name($ZipEntry);
|
||||
$NewPath = substr($NewPath, strlen($Directory));
|
||||
|
||||
//directory
|
||||
|
||||
if(substr($NewPath, -1, 1) == '/')
|
||||
{
|
||||
if(!file_exists($Destination . $NewPath))mkdir($Destination . $NewPath, 0777, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
//files
|
||||
|
||||
if(zip_entry_open($ZipHandle, $ZipEntry))
|
||||
{
|
||||
$File = fopen($Destination . $NewPath, "wb");
|
||||
|
||||
if($File)
|
||||
{
|
||||
while($Line = zip_entry_read($ZipEntry))
|
||||
{
|
||||
fwrite($File, $Line);
|
||||
}
|
||||
|
||||
fclose($File);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
zip_close($ZipHandle);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$ReturnLines = array();
|
||||
$ReturnVal = - 1;
|
||||
|
||||
//on 64 bit systems the zip functions can fail -> use exec to extract the files
|
||||
|
||||
$ReturnLines = safe_exec('unzip -o -qq ' . escapeshellarg(realpath($Filename)) . ' ' . escapeshellarg($Directory . '/*') . ' -d ' . escapeshellarg(sys_get_temp_dir()), $ReturnVal);
|
||||
|
||||
if($ReturnVal == 0)
|
||||
{
|
||||
//fix absolute structure of extracted data
|
||||
|
||||
if(!file_exists($Destination))mkdir($Destination, 0777, true);
|
||||
safe_exec('cp -Rf ' . sys_get_temp_dir() . '/' . $Directory . '/*' . ' ' . escapeshellarg($Destination));
|
||||
self::UnlinkRecursive(sys_get_temp_dir() . '/' . $Directory . '/');
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
3249
lib/classes/aps/class.ApsParser.php
Normal file
269
lib/classes/aps/class.ApsUpdater.php
Normal file
@@ -0,0 +1,269 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Implementation of the Application Packaging Standard from SwSoft/Parallels
|
||||
* http://apsstandard.com
|
||||
*
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Sven Skrabal <info@nexpa.de>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Cron
|
||||
* @version $Id: class.ApsUpdater.php 2724 2009-06-07 14:18:02Z flo $
|
||||
* @todo logging
|
||||
* install specific packages by name
|
||||
* other solution than using url_fopen
|
||||
* move url for distributionserver into panel
|
||||
*/
|
||||
|
||||
class ApsUpdater extends ApsParser
|
||||
{
|
||||
private $settings = array();
|
||||
private $db = false;
|
||||
private $RequestDomain = '';
|
||||
private $RootUrl = '';
|
||||
private $RootDir = '';
|
||||
|
||||
/**
|
||||
* constructor of class. setup some basic variables needed by class
|
||||
*
|
||||
* @param db instance of the database class from syscp
|
||||
*/
|
||||
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->RequestDomain = 'apscatalog.com';
|
||||
$this->RootUrl = '/1/';
|
||||
$this->RootDir = dirname(dirname(__FILE__)) . '/';
|
||||
}
|
||||
|
||||
/**
|
||||
* Main function of class which handles all around the update mechanism
|
||||
*/
|
||||
|
||||
public function UpdateHandler()
|
||||
{
|
||||
chdir($this->RootDir);
|
||||
|
||||
//return if allow_url_fopen is disabled
|
||||
|
||||
if(ini_get('allow_url_fopen') == '0')
|
||||
{
|
||||
echo ("The APS updater cronjob requires that allow_url_fopen is enabled for the PHP CLI binary!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
//return if no task exists
|
||||
|
||||
$Result = $this->db->query('SELECT * FROM `' . TABLE_APS_TASKS . '` WHERE `Task` IN (' . TASK_SYSTEM_UPDATE . ', ' . TASK_SYSTEM_DOWNLOAD . ')');
|
||||
|
||||
if($this->db->num_rows($Result) == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//query first task -> updater can only do one job within a run
|
||||
|
||||
$Task = $this->db->fetch_array($Result);
|
||||
$this->db->query('DELETE FROM `' . TABLE_APS_TASKS . '` WHERE `Task` = ' . $Task['Task']);
|
||||
|
||||
//fetch all vendors
|
||||
|
||||
$Vendors = self::FetchSubUrls($this->RootUrl);
|
||||
foreach($Vendors as $Vendor)
|
||||
{
|
||||
//fetch all applications from vendors
|
||||
|
||||
$Applications = self::FetchSubUrls($this->RootUrl . $Vendor);
|
||||
foreach($Applications as $Application)
|
||||
{
|
||||
//get newest version of package which is already installed
|
||||
|
||||
$CurrentVersion = '';
|
||||
$Result = $this->db->query('SELECT * FROM `' . TABLE_APS_PACKAGES . '` WHERE `Name` = "' . $this->db->escape(substr($Application, 0, -1)) . '"');
|
||||
|
||||
while($Row = $this->db->fetch_array($Result))
|
||||
{
|
||||
if(version_compare($Row['Version'] . '-' . $Row['Release'], $CurrentVersion) == 1)
|
||||
{
|
||||
$CurrentVersion = $Row['Version'] . '-' . $Row['Release'];
|
||||
}
|
||||
}
|
||||
|
||||
if($this->db->num_rows($Result) != 0)
|
||||
{
|
||||
//package already installed in system, search for newer version
|
||||
|
||||
if($Task['Task'] != TASK_SYSTEM_UPDATE)continue;
|
||||
|
||||
//fetch different versions of application from distribution server
|
||||
|
||||
$NewerVersion = '';
|
||||
$Versions = self::FetchSubUrls($this->RootUrl . $Vendor . $Application);
|
||||
foreach($Versions as $Version)
|
||||
{
|
||||
$OnlineVersion = substr($Version, 0, -1);
|
||||
|
||||
//is package newer than current version?
|
||||
|
||||
if(version_compare($OnlineVersion, $CurrentVersion) == 1)
|
||||
{
|
||||
//is new package newer than another one found before?
|
||||
|
||||
if(version_compare($OnlineVersion, $NewerVersion) == 1)
|
||||
{
|
||||
$NewerVersion = $OnlineVersion;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($NewerVersion != '')
|
||||
{
|
||||
//download package as an update
|
||||
|
||||
self::DownloadPackage($this->RootUrl . $Vendor . $Application . $NewerVersion, substr($Application, 0, -1), $NewerVersion);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($Task['Task'] != TASK_SYSTEM_DOWNLOAD)continue;
|
||||
|
||||
//new packages
|
||||
|
||||
$NewVersion = '';
|
||||
$Versions = self::FetchSubUrls($this->RootUrl . $Vendor . $Application);
|
||||
foreach($Versions as $Version)
|
||||
{
|
||||
$OnlineVersion = substr($Version, 0, -1);
|
||||
|
||||
//is package newer than another one found before?
|
||||
|
||||
if(version_compare($OnlineVersion, $NewVersion) == 1)
|
||||
{
|
||||
$NewVersion = $OnlineVersion;
|
||||
}
|
||||
}
|
||||
|
||||
if($NewVersion != '')
|
||||
{
|
||||
//download package as a new one
|
||||
|
||||
self::DownloadPackage($this->RootUrl . $Vendor . $Application . $NewVersion, substr($Application, 0, -1), $NewVersion);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* download a package from the distribution server and move the downloaded file in the temporary directory
|
||||
*
|
||||
* @param url url to download
|
||||
* @param application string identifying the application name
|
||||
* @param version string identifying the application version
|
||||
* @return success true/error false
|
||||
*/
|
||||
|
||||
private function DownloadPackage($Url, $Application, $Version)
|
||||
{
|
||||
$Downloads = self::FetchSubUrls($Url . '/');
|
||||
|
||||
//make url valid
|
||||
|
||||
$Url = str_replace(' ', '%20', $Url);
|
||||
|
||||
//get content from website url
|
||||
|
||||
$Content = @file_get_contents('http://' . $this->RequestDomain . $Url . '.aps' . $Downloads[0]);
|
||||
|
||||
if($Content != false)
|
||||
{
|
||||
//open file to write contents on disk
|
||||
|
||||
$FileHandle = fopen($this->RootDir . 'temp/' . $Application . '-' . $Version . '.app.zip', 'wb');
|
||||
|
||||
if($FileHandle == true)
|
||||
{
|
||||
//write results to disk
|
||||
|
||||
fwrite($FileHandle, $Content);
|
||||
fclose($FileHandle);
|
||||
|
||||
//set right permissions
|
||||
|
||||
chmod($this->RootDir . 'temp/' . $Application . '-' . $Version . '.app.zip', 0664);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* fetch html content of distribution server and parse all information
|
||||
*
|
||||
* @param requestdomain domain to aps-/mirrorserver with package api
|
||||
* @param url url to fetch sub links from
|
||||
* @return error false/success array with relative sub links
|
||||
*/
|
||||
|
||||
private function FetchSubUrls($Url)
|
||||
{
|
||||
$Return = array();
|
||||
|
||||
//make url valid
|
||||
|
||||
$Url = str_replace(' ', '%20', $Url);
|
||||
|
||||
//get content from website url
|
||||
|
||||
$Content = @file('http://' . $this->RequestDomain . $Url);
|
||||
|
||||
if($Content != false)
|
||||
{
|
||||
foreach($Content as $Temp)
|
||||
{
|
||||
//skip empty lines
|
||||
|
||||
if($Temp != "\r\n"
|
||||
&& $Temp != "\r"
|
||||
&& $Temp != "\n"
|
||||
&& $Temp != "")
|
||||
{
|
||||
//remove unwanted characters
|
||||
|
||||
$Temp = trim($Temp);
|
||||
|
||||
//grep URLs which match defined format
|
||||
|
||||
if(preg_match("/^<a href=\"(.+)\".+class=\"(vendor|application|version|packager)\"/", $Temp, $Matches))
|
||||
{
|
||||
if(!in_array(urldecode($Matches[1]), $Return))$Return[] = urldecode($Matches[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $Return;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
341
lib/classes/database/class.db.php
Normal file
@@ -0,0 +1,341 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
* @version $Id: class.db.php 2724 2009-06-07 14:18:02Z flo $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class to manage the connection to the Database
|
||||
* @package Functions
|
||||
*/
|
||||
|
||||
class db
|
||||
{
|
||||
/**
|
||||
* Link ID for every connection
|
||||
* @var int
|
||||
*/
|
||||
|
||||
var $link_id = 0;
|
||||
|
||||
/**
|
||||
* Query ID for every query
|
||||
* @var int
|
||||
*/
|
||||
|
||||
var $query_id = 0;
|
||||
|
||||
/**
|
||||
* Errordescription, if an error occures
|
||||
* @var string
|
||||
*/
|
||||
|
||||
var $errdesc = '';
|
||||
|
||||
/**
|
||||
* Errornumber, if an error occures
|
||||
* @var int
|
||||
*/
|
||||
|
||||
var $errno = 0;
|
||||
|
||||
/**
|
||||
* Servername
|
||||
* @var string
|
||||
*/
|
||||
|
||||
var $server = '';
|
||||
|
||||
/**
|
||||
* Username
|
||||
* @var string
|
||||
*/
|
||||
|
||||
var $user = '';
|
||||
|
||||
/**
|
||||
* Password
|
||||
* @var string
|
||||
*/
|
||||
|
||||
var $password = '';
|
||||
|
||||
/**
|
||||
* Database
|
||||
* @var string
|
||||
*/
|
||||
|
||||
var $database = '';
|
||||
|
||||
/**
|
||||
* Class constructor. Connects to Databaseserver and selects Database
|
||||
*
|
||||
* @param string Servername
|
||||
* @param string Username
|
||||
* @param string Password
|
||||
* @param string Database
|
||||
*/
|
||||
|
||||
function db($server, $user, $password, $database = '')
|
||||
{
|
||||
// check for mysql extension
|
||||
|
||||
if(!extension_loaded('mysql'))
|
||||
{
|
||||
$this->showerror('You should install the PHP MySQL extension!', false);
|
||||
}
|
||||
|
||||
$this->server = $server;
|
||||
$this->user = $user;
|
||||
$this->password = $password;
|
||||
$this->database = $database;
|
||||
$this->link_id = @mysql_connect($this->server, $this->user, $this->password);
|
||||
|
||||
if(!$this->link_id)
|
||||
{
|
||||
//try to connect with no password an change it afterwards. only for root user
|
||||
|
||||
if($this->user == 'root')
|
||||
{
|
||||
$this->link_id = @mysql_connect($this->server, $this->user, '');
|
||||
|
||||
if($this->link_id)
|
||||
{
|
||||
$this->query("SET PASSWORD = PASSWORD('" . $this->escape($this->password) . "')");
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->showerror('Establishing connection failed, exiting');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->showerror('Establishing connection failed, exiting');
|
||||
}
|
||||
}
|
||||
|
||||
if($this->database != '')
|
||||
{
|
||||
if(!@mysql_select_db($this->database, $this->link_id))
|
||||
{
|
||||
$this->showerror('Trying to use database ' . $this->database . ' failed, exiting');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes connection to Databaseserver
|
||||
*/
|
||||
|
||||
function close()
|
||||
{
|
||||
return @mysql_close($this->link_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes user input to be used in mysql queries
|
||||
*
|
||||
* @param string $input
|
||||
* @return string escaped string
|
||||
*/
|
||||
|
||||
function escape($input)
|
||||
{
|
||||
if(is_int($input))
|
||||
{
|
||||
return (int)$input;
|
||||
}
|
||||
elseif(is_float($input))
|
||||
{
|
||||
return (float)$input;
|
||||
}
|
||||
else
|
||||
{
|
||||
return mysql_real_escape_string($input, $this->link_id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Query the Database
|
||||
*
|
||||
* @param string Querystring
|
||||
* @param bool Unbuffered query?
|
||||
* @return string RessourceId
|
||||
*/
|
||||
|
||||
function query($query_str, $unbuffered = false)
|
||||
{
|
||||
global $numbqueries;
|
||||
|
||||
if(!$unbuffered)
|
||||
{
|
||||
$this->query_id = mysql_query($query_str, $this->link_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->query_id = mysql_unbuffered_query($query_str, $this->link_id);
|
||||
}
|
||||
|
||||
if(!$this->query_id)
|
||||
{
|
||||
$this->showerror('Invalid SQL: ' . $query_str);
|
||||
}
|
||||
|
||||
$numbqueries++;
|
||||
|
||||
//echo $query_str.' '.$numbqueries.'<br />';
|
||||
|
||||
return $this->query_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches Row from Query and returns it as array
|
||||
*
|
||||
* @param string RessourceId
|
||||
* @param string Datatype, num or assoc
|
||||
* @return array The row
|
||||
*/
|
||||
|
||||
function fetch_array($query_id = - 1, $datatype = 'assoc')
|
||||
{
|
||||
if($query_id != - 1)
|
||||
{
|
||||
$this->query_id = $query_id;
|
||||
}
|
||||
|
||||
if($datatype == 'num')
|
||||
{
|
||||
$datatype = MYSQL_NUM;
|
||||
}
|
||||
else
|
||||
{
|
||||
$datatype = MYSQL_ASSOC;
|
||||
}
|
||||
|
||||
$this->record = mysql_fetch_array($this->query_id, $datatype);
|
||||
return $this->record;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query Database and fetche the first row from Query and returns it as array
|
||||
*
|
||||
* @param string Querystring
|
||||
* @param string Datatype, num or assoc
|
||||
* @return array The first row
|
||||
*/
|
||||
|
||||
function query_first($query_string, $datatype = 'assoc')
|
||||
{
|
||||
$this->query($query_string);
|
||||
return $this->fetch_array($this->query_id, $datatype);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns how many rows have been selected
|
||||
*
|
||||
* @param string RessourceId
|
||||
* @return int Number of rows
|
||||
*/
|
||||
|
||||
function num_rows($query_id = - 1)
|
||||
{
|
||||
if($query_id != - 1)
|
||||
{
|
||||
$this->query_id = $query_id;
|
||||
}
|
||||
|
||||
return mysql_num_rows($this->query_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the auto_incremental-Value of the inserted row
|
||||
*
|
||||
* @return int auto_incremental-Value
|
||||
*/
|
||||
|
||||
function insert_id()
|
||||
{
|
||||
return mysql_insert_id($this->link_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of rows affected by last query
|
||||
*
|
||||
* @return int affected rows
|
||||
*/
|
||||
|
||||
function affected_rows()
|
||||
{
|
||||
return mysql_affected_rows($this->link_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns errordescription and errornumber if an error occured.
|
||||
*
|
||||
* @return int Errornumber
|
||||
*/
|
||||
|
||||
function geterrdescno()
|
||||
{
|
||||
if($this->link_id != 0)
|
||||
{
|
||||
$this->errdesc = mysql_error($this->link_id);
|
||||
$this->errno = mysql_errno($this->link_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Maybe we don't have any linkid so let's try to catch at least anything
|
||||
|
||||
$this->errdesc = mysql_error();
|
||||
$this->errno = mysql_errno();
|
||||
}
|
||||
|
||||
return $this->errno;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dies with an errormessage
|
||||
*
|
||||
* @param string Errormessage
|
||||
*/
|
||||
|
||||
function showerror($errormsg, $mysqlActive = true)
|
||||
{
|
||||
global $filename;
|
||||
|
||||
if($mysqlActive)
|
||||
{
|
||||
$this->geterrdescno();
|
||||
$errormsg.= "\n";
|
||||
$errormsg.= 'mysql error number: ' . $this->errno . "\n";
|
||||
$errormsg.= 'mysql error desc: ' . $this->errdesc . "\n";
|
||||
}
|
||||
|
||||
$errormsg.= 'Time/date: ' . date('d/m/Y h:i A') . "\n";
|
||||
|
||||
if($filename != 'cronscript.php')
|
||||
{
|
||||
$errormsg.= 'Script: ' . htmlspecialchars(getenv('REQUEST_URI')) . "\n";
|
||||
$errormsg.= 'Referer: ' . htmlspecialchars(getenv('HTTP_REFERER')) . "\n";
|
||||
die(nl2br($errormsg));
|
||||
}
|
||||
else
|
||||
{
|
||||
$errormsg.= 'Script: -- Cronscript --' . "\n";
|
||||
die($errormsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
1381
lib/classes/idna/class.idna_convert.php
Normal file
143
lib/classes/idna/class.idna_convert_wrapper.php
Normal file
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Michael Duergner <michael@duergner.com>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
* @version $Id: class.idna_convert_wrapper.php 2724 2009-06-07 14:18:02Z flo $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class for wrapping a specific idna conversion class and offering a standard interface
|
||||
* @package Functions
|
||||
*/
|
||||
|
||||
class idna_convert_wrapper
|
||||
{
|
||||
/**
|
||||
* idna converter we use
|
||||
* @var object
|
||||
*/
|
||||
|
||||
var $idna_converter;
|
||||
|
||||
/**
|
||||
* Class constructor. Creates a new idna converter
|
||||
*/
|
||||
|
||||
function idna_convert_wrapper()
|
||||
{
|
||||
$this->idna_converter = new idna_convert();
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode a domain name, a email address or a list of one of both.
|
||||
*
|
||||
* @param string May be either a single domain name, e single email address or a list of one
|
||||
* seperated either by ',', ';' or ' '.
|
||||
*
|
||||
* @return string Returns either a single domain name, a single email address or a list of one of
|
||||
* both seperated by the same string as the input.
|
||||
*/
|
||||
|
||||
function encode($to_encode)
|
||||
{
|
||||
return $this->_do_action('encode', $to_encode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode a domain name, a email address or a list of one of both.
|
||||
*
|
||||
* @param string May be either a single domain name, e single email address or a list of one
|
||||
* seperated either by ',', ';' or ' '.
|
||||
*
|
||||
* @return string Returns either a single domain name, a single email address or a list of one of
|
||||
* both seperated by the same string as the input.
|
||||
*/
|
||||
|
||||
function decode($to_decode)
|
||||
{
|
||||
return $this->_do_action('decode', $to_decode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Do the real de- or encoding. First checks if a list is submitted and seperates it. Afterwards sends
|
||||
* each entry to the idna converter to do the converting.
|
||||
*
|
||||
* @param string May be either 'decode' or 'encode'.
|
||||
* @param string The string to de- or endcode.
|
||||
*
|
||||
* @return string The input string after being processed.
|
||||
*/
|
||||
|
||||
function _do_action($action, $string)
|
||||
{
|
||||
$string = trim($string);
|
||||
|
||||
if(strpos($string, ',') !== false)
|
||||
{
|
||||
$strings = explode(',', $string);
|
||||
$sepchar = ',';
|
||||
}
|
||||
elseif(strpos($string, ';') !== false)
|
||||
{
|
||||
$strings = explode(';', $string);
|
||||
$sepchar = ';';
|
||||
}
|
||||
elseif(strpos($string, ' ') !== false)
|
||||
{
|
||||
$strings = explode(' ', $string);
|
||||
$sepchar = ' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
$strings = array(
|
||||
$string
|
||||
);
|
||||
$sepchar = '';
|
||||
}
|
||||
|
||||
for ($i = 0;$i < count($strings);$i++)
|
||||
{
|
||||
if(strpos($strings[$i], '@') !== false)
|
||||
{
|
||||
$split = explode('@', $strings[$i]);
|
||||
$localpart = $split[0];
|
||||
$domain = $split[1];
|
||||
$email = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$domain = $strings[$i];
|
||||
$email = false;
|
||||
}
|
||||
|
||||
if(strlen($domain) !== 0)
|
||||
{
|
||||
$domain = utf8_decode($this->idna_converter->$action(utf8_encode($domain . '.none')));
|
||||
$domain = substr($domain, 0, strlen($domain) - 5);
|
||||
}
|
||||
|
||||
if($email)
|
||||
{
|
||||
$strings[$i] = $localpart . '@' . $domain;
|
||||
}
|
||||
else
|
||||
{
|
||||
$strings[$i] = $domain;
|
||||
}
|
||||
}
|
||||
|
||||
return implode($sepchar, $strings);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
1
lib/classes/idna/npdata.ser
Normal file
100
lib/classes/logger/abstract.AbstractLogger.php
Normal file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Logger - Abstract-Logger-Class
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version. This program is distributed in the
|
||||
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
|
||||
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Michael Kaufmann <mkaufmann@nutime.de>
|
||||
* @license http://www.gnu.org/licenses/gpl.txt
|
||||
* @package Functions
|
||||
* @version CVS: $Id: abstract.AbstractLogger.php 2724 2009-06-07 14:18:02Z flo $
|
||||
* @link http://www.nutime.de/
|
||||
*/
|
||||
|
||||
/* We're using the syslog constants for all the loggers (partly implemented)
|
||||
|
||||
LOG_EMERG system is unusable
|
||||
LOG_ALERT action must be taken immediately
|
||||
LOG_CRIT critical conditions
|
||||
LOG_ERR error conditions
|
||||
LOG_WARNING warning conditions
|
||||
LOG_NOTICE normal, but significant, condition
|
||||
LOG_INFO informational message
|
||||
LOG_DEBUG debug-level message
|
||||
|
||||
*/
|
||||
|
||||
abstract class AbstractLogger
|
||||
{
|
||||
/**
|
||||
* Settings array
|
||||
* @var settings
|
||||
*/
|
||||
|
||||
private $settings = array();
|
||||
|
||||
/**
|
||||
* Enable/Disable Logging
|
||||
* @var logenabled
|
||||
*/
|
||||
|
||||
private $logenabled = false;
|
||||
|
||||
/**
|
||||
* Enable/Disable Cronjob-Logging
|
||||
* @var logcronjob
|
||||
*/
|
||||
|
||||
private $logcronjob = false;
|
||||
|
||||
/**
|
||||
* Loggin-Severity
|
||||
* @var severity
|
||||
*/
|
||||
|
||||
private $severity = 1;
|
||||
|
||||
// normal
|
||||
|
||||
/**
|
||||
* setup the main logger
|
||||
*
|
||||
* @param array settings
|
||||
*/
|
||||
|
||||
protected function setupLogger($settings)
|
||||
{
|
||||
$this->settings = $settings;
|
||||
$this->logenabled = $this->settings['logger']['enabled'];
|
||||
$this->logcronjob = $this->settings['logger']['log_cron'];
|
||||
$this->severity = $this->settings['logger']['severity'];
|
||||
}
|
||||
|
||||
protected function isEnabled()
|
||||
{
|
||||
return $this->logenabled;
|
||||
}
|
||||
|
||||
protected function getSeverity()
|
||||
{
|
||||
return $this->severity;
|
||||
}
|
||||
|
||||
protected function logCron()
|
||||
{
|
||||
return $this->logcronjob;
|
||||
}
|
||||
|
||||
abstract public function logAction();
|
||||
}
|
||||
|
||||
?>
|
||||
188
lib/classes/logger/class.FileLogger.php
Normal file
@@ -0,0 +1,188 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Logger - File-Logger-Class
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version. This program is distributed in the
|
||||
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
|
||||
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Michael Kaufmann <mkaufmann@nutime.de>
|
||||
* @license http://www.gnu.org/licenses/gpl.txt
|
||||
* @package Functions
|
||||
* @version CVS: $Id: class.FileLogger.php 2724 2009-06-07 14:18:02Z flo $
|
||||
* @link http://www.nutime.de/
|
||||
*/
|
||||
|
||||
class FileLogger extends AbstractLogger
|
||||
{
|
||||
/**
|
||||
* Userinfo
|
||||
* @var array
|
||||
*/
|
||||
|
||||
private $userinfo = array();
|
||||
|
||||
/**
|
||||
* Logfile
|
||||
* @var logfile
|
||||
*/
|
||||
|
||||
private $logfile = null;
|
||||
|
||||
/**
|
||||
* Syslogger Objects Array
|
||||
* @var loggers
|
||||
*/
|
||||
|
||||
static private $loggers = array();
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
* @param array userinfo
|
||||
* @param array settings
|
||||
*/
|
||||
|
||||
protected function __construct($userinfo, $settings)
|
||||
{
|
||||
parent::setupLogger($settings);
|
||||
$this->userinfo = $userinfo;
|
||||
$this->setLogFile($settings['logger']['logfile']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Singleton ftw ;-)
|
||||
*
|
||||
*/
|
||||
|
||||
static public function getInstanceOf($_usernfo, $_settings)
|
||||
{
|
||||
if(!isset(self::$loggers[$_usernfo['loginname']]))
|
||||
{
|
||||
self::$loggers[$_usernfo['loginname']] = new FileLogger($_usernfo, $_settings);
|
||||
}
|
||||
|
||||
return self::$loggers[$_usernfo['loginname']];
|
||||
}
|
||||
|
||||
public function logAction($action = USR_ACTION, $type = LOG_NOTICE, $text = null)
|
||||
{
|
||||
if(parent::isEnabled())
|
||||
{
|
||||
if(parent::getSeverity() <= 1
|
||||
&& $type == LOG_NOTICE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$_action = 'unknown';
|
||||
|
||||
switch($action)
|
||||
{
|
||||
case USR_ACTION:
|
||||
$_action = 'customer';
|
||||
break;
|
||||
case RES_ACTION:
|
||||
$_action = 'reseller';
|
||||
break;
|
||||
case ADM_ACTION:
|
||||
$_action = 'administrator';
|
||||
break;
|
||||
case CRON_ACTION:
|
||||
$_action = 'cronjob';
|
||||
break;
|
||||
case LOG_ERROR:
|
||||
$_action = 'internal';
|
||||
break;
|
||||
default:
|
||||
$_action = 'unknown';
|
||||
break;
|
||||
}
|
||||
|
||||
$_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;
|
||||
}
|
||||
|
||||
if(!isset($this->userinfo['loginname'])
|
||||
|| $this->userinfo['loginname'] == '')
|
||||
{
|
||||
$name = 'unknown';
|
||||
}
|
||||
else
|
||||
{
|
||||
$name = " (" . $this->userinfo['loginname'] . ")";
|
||||
}
|
||||
|
||||
$fp = @fopen($this->logfile, 'a');
|
||||
|
||||
if($fp !== false)
|
||||
{
|
||||
$now = time();
|
||||
|
||||
if($text != null
|
||||
&& $text != '')
|
||||
{
|
||||
fwrite($fp, date("d.m.Y H:i:s", $now) . " [" . $_type . "] [" . $_action . "-action" . $name . "] " . $text . "\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
fwrite($fp, date("d.m.Y H:i:s", $now) . " [" . $_type . "] [" . $_action . "-action" . $name . "] No text given!!! Check scripts!\n");
|
||||
}
|
||||
|
||||
fclose($fp);
|
||||
}
|
||||
else
|
||||
{
|
||||
if($this->logfile != null
|
||||
|| $this->logfile != '')
|
||||
{
|
||||
throw new Exception("Cannot open logfile '" . $this->logfile . "' for writing!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function setLogFile($filename = null)
|
||||
{
|
||||
if($filename != null
|
||||
&& $filename != ''
|
||||
&& $filename != "."
|
||||
&& $filename != ".."
|
||||
&& !is_dir($filename))
|
||||
{
|
||||
$this->logfile = $filename;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
113
lib/classes/logger/class.MysqlLogger.php
Normal file
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Logger - MySQL-Logger-Class
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version. This program is distributed in the
|
||||
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
|
||||
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Michael Kaufmann <mkaufmann@nutime.de>
|
||||
* @license http://www.gnu.org/licenses/gpl.txt
|
||||
* @package Functions
|
||||
* @version CVS: $Id: class.MysqlLogger.php 2724 2009-06-07 14:18:02Z flo $
|
||||
* @link http://www.nutime.de/
|
||||
*/
|
||||
|
||||
class MysqlLogger extends AbstractLogger
|
||||
{
|
||||
/**
|
||||
* Userinfo
|
||||
* @var array
|
||||
*/
|
||||
|
||||
private $userinfo = array();
|
||||
|
||||
/**
|
||||
* Database handler
|
||||
* @var db
|
||||
*/
|
||||
|
||||
private $db = false;
|
||||
|
||||
/**
|
||||
* Syslogger Objects Array
|
||||
* @var loggers
|
||||
*/
|
||||
|
||||
static private $loggers = array();
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
* @param array userinfo
|
||||
* @param array settings
|
||||
* @param resource database
|
||||
*/
|
||||
|
||||
protected function __construct($userinfo, $settings, $db)
|
||||
{
|
||||
parent::setupLogger($settings);
|
||||
$this->userinfo = $userinfo;
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
/**
|
||||
* Singleton ftw ;-)
|
||||
*
|
||||
*/
|
||||
|
||||
static public function getInstanceOf($_usernfo, $_settings, $_db)
|
||||
{
|
||||
if(!isset(self::$loggers[$_usernfo['loginname']]))
|
||||
{
|
||||
self::$loggers[$_usernfo['loginname']] = new MysqlLogger($_usernfo, $_settings, $_db);
|
||||
}
|
||||
|
||||
return self::$loggers[$_usernfo['loginname']];
|
||||
}
|
||||
|
||||
public function logAction($action = USR_ACTION, $type = LOG_NOTICE, $text = null)
|
||||
{
|
||||
if(parent::isEnabled())
|
||||
{
|
||||
if(parent::getSeverity() <= 1
|
||||
&& $type == LOG_NOTICE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(!isset($this->userinfo['loginname'])
|
||||
|| $this->userinfo['loginname'] == '')
|
||||
{
|
||||
$name = 'unknown';
|
||||
}
|
||||
else
|
||||
{
|
||||
$name = " (" . $this->userinfo['loginname'] . ")";
|
||||
}
|
||||
|
||||
$now = time();
|
||||
|
||||
if($text != null
|
||||
&& $text != '')
|
||||
{
|
||||
$this->db->query("INSERT INTO `panel_syslog` (`type`, `date`, `action`, `user`, `text`)
|
||||
VALUES ('" . (int)$type . "', '" . $now . "', '" . (int)$action . "', '" . $this->db->escape($name) . "', '" . $this->db->escape($text) . "')");
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->query("INSERT INTO `panel_syslog` (`type`, `date`, `action`, `userid`, `text`)
|
||||
VALUES ('" . (int)$type . "', '" . $now . "', '" . (int)$action . "', '" . $this->db->escape($name) . "', 'No text given!!! Check scripts!')");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
205
lib/classes/logger/class.SysCPLogger.php
Normal file
@@ -0,0 +1,205 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Logger - SysCP-Logger Class
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version. This program is distributed in the
|
||||
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
|
||||
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Michael Kaufmann <mkaufmann@nutime.de>
|
||||
* @license http://www.gnu.org/licenses/gpl.txt
|
||||
* @package Functions
|
||||
* @version CVS: $Id: class.SysCPLogger.php 2724 2009-06-07 14:18:02Z flo $
|
||||
* @link http://www.nutime.de/
|
||||
*/
|
||||
|
||||
class SysCPLogger
|
||||
{
|
||||
/**
|
||||
* Userinfo
|
||||
* @var array
|
||||
*/
|
||||
|
||||
private $userinfo = array();
|
||||
|
||||
/**
|
||||
* Database handler
|
||||
* @var db
|
||||
*/
|
||||
|
||||
private $db = false;
|
||||
|
||||
/**
|
||||
* Settings array
|
||||
* @var settings
|
||||
*/
|
||||
|
||||
private $settings = array();
|
||||
|
||||
/**
|
||||
* LogTypes Array
|
||||
* @var logtypes
|
||||
*/
|
||||
|
||||
static private $logtypes = null;
|
||||
|
||||
/**
|
||||
* Logger-Object-Array
|
||||
* @var loggers
|
||||
*/
|
||||
|
||||
static private $loggers = null;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
* @param array userinfo
|
||||
* @param array settings
|
||||
*/
|
||||
|
||||
protected function __construct($userinfo, $db, $settings)
|
||||
{
|
||||
$this->userinfo = $userinfo;
|
||||
$this->db = $db;
|
||||
$this->settings = $settings;
|
||||
self::$logtypes = array();
|
||||
|
||||
if(!isset($this->settings['logger']['logtypes'])
|
||||
&& (!isset($this->settings['logger']['logtypes']) || $this->settings['logger']['logtypes'] == '')
|
||||
&& isset($this->settings['logger']['enabled'])
|
||||
&& $this->settings['logger']['enabled'])
|
||||
{
|
||||
self::$logtypes[0] = 'syslog';
|
||||
self::$logtypes[1] = 'mysql';
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($this->settings['logger']['logtypes'])
|
||||
&& $this->settings['logger']['logtypes'] != '')
|
||||
{
|
||||
self::$logtypes = explode(',', $this->settings['logger']['logtypes']);
|
||||
}
|
||||
else
|
||||
{
|
||||
self::$logtypes = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Singleton ftw ;-)
|
||||
*
|
||||
*/
|
||||
|
||||
static public function getInstanceOf($_usernfo, $_db, $_settings)
|
||||
{
|
||||
if(!isset($_usernfo)
|
||||
|| $_usernfo == null)
|
||||
{
|
||||
$_usernfo = array();
|
||||
$_usernfo['loginname'] = 'unknown';
|
||||
}
|
||||
|
||||
if(!isset(self::$loggers[$_usernfo['loginname']]))
|
||||
{
|
||||
self::$loggers[$_usernfo['loginname']] = new SysCPLogger($_usernfo, $_db, $_settings);
|
||||
}
|
||||
|
||||
return self::$loggers[$_usernfo['loginname']];
|
||||
}
|
||||
|
||||
public function logAction($action = USR_ACTION, $type = LOG_NOTICE, $text = null)
|
||||
{
|
||||
if(self::$logtypes == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if($this->settings['logger']['log_cron'] == '0'
|
||||
&& $action == CRON_ACTION)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach(self::$logtypes as $logger)
|
||||
{
|
||||
switch($logger)
|
||||
{
|
||||
case 'syslog':
|
||||
$_log = SysLogger::getInstanceOf($this->userinfo, $this->settings);
|
||||
break;
|
||||
case 'file':
|
||||
try
|
||||
{
|
||||
$_log = FileLogger::getInstanceOf($this->userinfo, $this->settings);
|
||||
}
|
||||
|
||||
catch(Exception $e)
|
||||
{
|
||||
if($action != CRON_ACTION)
|
||||
{
|
||||
standard_error('logerror', $e->getMessage());
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Log-Error: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case 'mysql':
|
||||
$_log = MysqlLogger::getInstanceOf($this->userinfo, $this->settings, $this->db);
|
||||
break;
|
||||
default:
|
||||
$_log = null;
|
||||
break;
|
||||
}
|
||||
|
||||
if($_log != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
$_log->logAction($action, $type, $text);
|
||||
}
|
||||
|
||||
catch(Exception $e)
|
||||
{
|
||||
if($action != CRON_ACTION)
|
||||
{
|
||||
standard_error('logerror', $e->getMessage());
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Log-Error: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function setCronLog($_cronlog = 0)
|
||||
{
|
||||
$_cronlog = (int)$_cronlog;
|
||||
|
||||
if($_cronlog != 0
|
||||
&& $_cronlog != 1)
|
||||
{
|
||||
$_cronlog = 0;
|
||||
}
|
||||
|
||||
$this->db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "`
|
||||
SET `value`='" . $this->db->escape($_cronlog) . "'
|
||||
WHERE `settinggroup`='logger'
|
||||
AND `varname`='log_cron'");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
128
lib/classes/logger/class.SysLogger.php
Normal file
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Logger - SysLog-Logger-Class
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version. This program is distributed in the
|
||||
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
|
||||
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Michael Kaufmann <mkaufmann@nutime.de>
|
||||
* @license http://www.gnu.org/licenses/gpl.txt
|
||||
* @package Functions
|
||||
* @version CVS: $Id: class.SysLogger.php 2724 2009-06-07 14:18:02Z flo $
|
||||
* @link http://www.nutime.de/
|
||||
*/
|
||||
|
||||
class SysLogger extends AbstractLogger
|
||||
{
|
||||
/**
|
||||
* Userinfo
|
||||
* @var array
|
||||
*/
|
||||
|
||||
private $userinfo = array();
|
||||
|
||||
/**
|
||||
* Syslogger Objects Array
|
||||
* @var loggers
|
||||
*/
|
||||
|
||||
static private $loggers = array();
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
* @param array userinfo
|
||||
* @param array settings
|
||||
*/
|
||||
|
||||
protected function __construct($userinfo, $settings)
|
||||
{
|
||||
parent::setupLogger($settings);
|
||||
$this->userinfo = $userinfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Singleton ftw ;-)
|
||||
*
|
||||
*/
|
||||
|
||||
static public function getInstanceOf($_usernfo, $_settings)
|
||||
{
|
||||
if(!isset(self::$loggers[$_usernfo['loginname']]))
|
||||
{
|
||||
self::$loggers[$_usernfo['loginname']] = new SysLogger($_usernfo, $_settings);
|
||||
}
|
||||
|
||||
return self::$loggers[$_usernfo['loginname']];
|
||||
}
|
||||
|
||||
public function logAction($action = USR_ACTION, $type = LOG_NOTICE, $text = null)
|
||||
{
|
||||
if(parent::isEnabled())
|
||||
{
|
||||
if(parent::getSeverity() <= 1
|
||||
&& $type == LOG_NOTICE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$_action = 'unknown';
|
||||
|
||||
switch($action)
|
||||
{
|
||||
case USR_ACTION:
|
||||
$_action = 'customer';
|
||||
break;
|
||||
case RES_ACTION:
|
||||
$_action = 'reseller';
|
||||
break;
|
||||
case ADM_ACTION:
|
||||
$_action = 'administrator';
|
||||
break;
|
||||
case CRON_ACTION:
|
||||
$_action = 'cronjob';
|
||||
break;
|
||||
case LOG_ERROR:
|
||||
$_action = 'internal';
|
||||
break;
|
||||
default:
|
||||
$_action = 'unknown';
|
||||
break;
|
||||
}
|
||||
|
||||
if(!isset($this->userinfo['loginname'])
|
||||
|| $this->userinfo['loginname'] == '')
|
||||
{
|
||||
$name = 'unknown';
|
||||
}
|
||||
else
|
||||
{
|
||||
$name = " (" . $this->userinfo['loginname'] . ")";
|
||||
}
|
||||
|
||||
openlog("SysCP", LOG_NDELAY, LOG_USER);
|
||||
|
||||
if($text != null
|
||||
&& $text != '')
|
||||
{
|
||||
syslog((int)$type, "[" . ucfirst($_action) . " Action" . $name . "] " . $text);
|
||||
}
|
||||
else
|
||||
{
|
||||
syslog((int)$type, "[" . ucfirst($_action) . " Action" . $name . "] No text given!!! Check scripts!");
|
||||
}
|
||||
|
||||
closelog();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
518
lib/classes/output/class.paging.php
Normal file
@@ -0,0 +1,518 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
* @version $Id: class.paging.php 2724 2009-06-07 14:18:02Z flo $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class to manage paging system
|
||||
* @package Functions
|
||||
*/
|
||||
|
||||
class paging
|
||||
{
|
||||
/**
|
||||
* Userinfo
|
||||
* @var array
|
||||
*/
|
||||
|
||||
var $userinfo = array();
|
||||
|
||||
/**
|
||||
* Database handler
|
||||
* @var db
|
||||
*/
|
||||
|
||||
var $db = false;
|
||||
|
||||
/**
|
||||
* MySQL-Table
|
||||
* @var string
|
||||
*/
|
||||
|
||||
var $table = '';
|
||||
|
||||
/**
|
||||
* Fields with description which should be selectable
|
||||
* @var array
|
||||
*/
|
||||
|
||||
var $fields = array();
|
||||
|
||||
/**
|
||||
* Entries per page
|
||||
* @var int
|
||||
*/
|
||||
|
||||
var $entriesperpage = 0;
|
||||
|
||||
/**
|
||||
* Number of entries of table
|
||||
* @var int
|
||||
*/
|
||||
|
||||
var $entries = 0;
|
||||
|
||||
/**
|
||||
* Sortorder, asc or desc
|
||||
* @var string
|
||||
*/
|
||||
|
||||
var $sortorder = 'asc';
|
||||
|
||||
/**
|
||||
* Sortfield
|
||||
* @var string
|
||||
*/
|
||||
|
||||
var $sortfield = '';
|
||||
|
||||
/**
|
||||
* Searchfield
|
||||
* @var string
|
||||
*/
|
||||
|
||||
var $searchfield = '';
|
||||
|
||||
/**
|
||||
* Searchtext
|
||||
* @var string
|
||||
*/
|
||||
|
||||
var $searchtext = '';
|
||||
|
||||
/**
|
||||
* Pagenumber
|
||||
* @var int
|
||||
*/
|
||||
|
||||
var $pageno = 0;
|
||||
|
||||
/**
|
||||
* Switch natsorting on/off
|
||||
* @var bool
|
||||
*/
|
||||
|
||||
var $natSorting = false;
|
||||
|
||||
/**
|
||||
* Class constructor. Loads settings from request or from userdata and saves them to session.
|
||||
*
|
||||
* @param array userinfo
|
||||
* @param string Name of Table
|
||||
* @param array Fields, in format array( 'fieldname_in_mysql' => 'field_caption' )
|
||||
* @param int entries per page
|
||||
* @param bool Switch natsorting on/off (global, affects all calls of sort)
|
||||
*/
|
||||
|
||||
function paging($userinfo, $db, $table, $fields, $entriesperpage, $natSorting = false)
|
||||
{
|
||||
$this->userinfo = $userinfo;
|
||||
|
||||
if(!is_array($this->userinfo['lastpaging']))
|
||||
{
|
||||
$this->userinfo['lastpaging'] = unserialize($this->userinfo['lastpaging']);
|
||||
}
|
||||
|
||||
$this->db = $db;
|
||||
$this->table = $table;
|
||||
$this->fields = $fields;
|
||||
$this->entriesperpage = $entriesperpage;
|
||||
$this->natSorting = $natSorting;
|
||||
$checklastpaging = (isset($this->userinfo['lastpaging']['table']) && $this->userinfo['lastpaging']['table'] == $this->table);
|
||||
$this->userinfo['lastpaging']['table'] = $this->table;
|
||||
|
||||
if(isset($_REQUEST['sortorder'])
|
||||
&& (strtolower($_REQUEST['sortorder']) == 'desc' || strtolower($_REQUEST['sortorder']) == 'asc'))
|
||||
{
|
||||
$this->sortorder = strtolower($_REQUEST['sortorder']);
|
||||
}
|
||||
else
|
||||
{
|
||||
if($checklastpaging
|
||||
&& isset($this->userinfo['lastpaging']['sortorder'])
|
||||
&& (strtolower($this->userinfo['lastpaging']['sortorder']) == 'desc' || strtolower($this->userinfo['lastpaging']['sortorder']) == 'asc'))
|
||||
{
|
||||
$this->sortorder = strtolower($this->userinfo['lastpaging']['sortorder']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->sortorder = 'asc';
|
||||
}
|
||||
}
|
||||
|
||||
$this->userinfo['lastpaging']['sortorder'] = $this->sortorder;
|
||||
|
||||
if(isset($_REQUEST['sortfield'])
|
||||
&& isset($fields[$_REQUEST['sortfield']]))
|
||||
{
|
||||
$this->sortfield = $_REQUEST['sortfield'];
|
||||
}
|
||||
else
|
||||
{
|
||||
if($checklastpaging
|
||||
&& isset($this->userinfo['lastpaging']['sortfield'])
|
||||
&& isset($fields[$this->userinfo['lastpaging']['sortfield']]))
|
||||
{
|
||||
$this->sortfield = $this->userinfo['lastpaging']['sortfield'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$fieldnames = array_keys($fields);
|
||||
$this->sortfield = $fieldnames[0];
|
||||
}
|
||||
}
|
||||
|
||||
$this->userinfo['lastpaging']['sortfield'] = $this->sortfield;
|
||||
|
||||
if(isset($_REQUEST['searchfield'])
|
||||
&& isset($fields[$_REQUEST['searchfield']]))
|
||||
{
|
||||
$this->searchfield = $_REQUEST['searchfield'];
|
||||
}
|
||||
else
|
||||
{
|
||||
if($checklastpaging
|
||||
&& isset($this->userinfo['lastpaging']['searchfield'])
|
||||
&& isset($fields[$this->userinfo['lastpaging']['searchfield']]))
|
||||
{
|
||||
$this->searchfield = $this->userinfo['lastpaging']['searchfield'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$fieldnames = array_keys($fields);
|
||||
$this->searchfield = $fieldnames[0];
|
||||
}
|
||||
}
|
||||
|
||||
$this->userinfo['lastpaging']['searchfield'] = $this->searchfield;
|
||||
|
||||
if(isset($_REQUEST['searchtext'])
|
||||
&& (preg_match("/^[@0-9a-zA-Z<><5A><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\-\*\.]+$/", $_REQUEST['searchtext']) || $_REQUEST['searchtext'] === ''))
|
||||
{
|
||||
$this->searchtext = $_REQUEST['searchtext'];
|
||||
}
|
||||
else
|
||||
{
|
||||
if($checklastpaging
|
||||
&& isset($this->userinfo['lastpaging']['searchtext'])
|
||||
&& preg_match("/^[@0-9a-zA-Z<><5A><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\-\*\.]+$/", $this->userinfo['lastpaging']['searchtext']))
|
||||
{
|
||||
$this->searchtext = $this->userinfo['lastpaging']['searchtext'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->searchtext = '';
|
||||
}
|
||||
}
|
||||
|
||||
$this->userinfo['lastpaging']['searchtext'] = $this->searchtext;
|
||||
|
||||
if(isset($_REQUEST['pageno'])
|
||||
&& intval($_REQUEST['pageno']) != 0)
|
||||
{
|
||||
$this->pageno = intval($_REQUEST['pageno']);
|
||||
}
|
||||
else
|
||||
{
|
||||
if($checklastpaging
|
||||
&& isset($this->userinfo['lastpaging']['pageno'])
|
||||
&& intval($this->userinfo['lastpaging']['pageno']) != 0)
|
||||
{
|
||||
$this->pageno = intval($this->userinfo['lastpaging']['pageno']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->pageno = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$this->userinfo['lastpaging']['pageno'] = $this->pageno;
|
||||
$query = 'UPDATE `' . TABLE_PANEL_SESSIONS . '` SET `lastpaging`="' . $this->db->escape(serialize($this->userinfo['lastpaging'])) . '" WHERE `hash`="' . $this->db->escape($userinfo['hash']) . '" AND `userid` = "' . $this->db->escape($userinfo['userid']) . '" AND `ipaddress` = "' . $this->db->escape($userinfo['ipaddress']) . '" AND `useragent` = "' . $this->db->escape($userinfo['useragent']) . '" AND `adminsession` = "' . $this->db->escape($userinfo['adminsession']) . '" ';
|
||||
$this->db->query($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets number of entries and adjusts pageno if the number of entries doesn't correspond to the pageno.
|
||||
*
|
||||
* @param int entries
|
||||
*/
|
||||
|
||||
function setEntries($entries)
|
||||
{
|
||||
$this->entries = $entries;
|
||||
|
||||
if(($this->pageno - 1) * $this->entriesperpage > $this->entries)
|
||||
{
|
||||
$this->pageno = 1;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a row should be displayed or not, used in loops
|
||||
*
|
||||
* @param int number of row
|
||||
* @return bool to display or not to display, that's the question
|
||||
*/
|
||||
|
||||
function checkDisplay($count)
|
||||
{
|
||||
$begin = (intval($this->pageno) - 1) * intval($this->entriesperpage);
|
||||
$end = (intval($this->pageno) * intval($this->entriesperpage));
|
||||
return (($count >= $begin && $count < $end) || $this->entriesperpage == 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns condition code for sql query
|
||||
*
|
||||
* @param bool should returned condition code start with WHERE (false) or AND (true)?
|
||||
* @return string the condition code
|
||||
*/
|
||||
|
||||
function getSqlWhere($append = false)
|
||||
{
|
||||
if($this->searchtext != '')
|
||||
{
|
||||
if($append == true)
|
||||
{
|
||||
$condition = ' AND ';
|
||||
}
|
||||
else
|
||||
{
|
||||
$condition = ' WHERE ';
|
||||
}
|
||||
|
||||
$searchfield = explode('.', $this->searchfield);
|
||||
foreach($searchfield as $id => $field)
|
||||
{
|
||||
if(substr($field, -1, 1) != '`')
|
||||
{
|
||||
$field.= '`';
|
||||
}
|
||||
|
||||
if($field{0} != '`')
|
||||
{
|
||||
$field = '`' . $field;
|
||||
}
|
||||
|
||||
$searchfield[$id] = $field;
|
||||
}
|
||||
|
||||
$searchfield = implode('.', $searchfield);
|
||||
$searchtext = str_replace('*', '%', $this->searchtext);
|
||||
$condition.= $searchfield . ' LIKE "' . $this->db->escape($searchtext) . '" ';
|
||||
}
|
||||
else
|
||||
{
|
||||
$condition = '';
|
||||
}
|
||||
|
||||
return $condition;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns "order by"-code for sql query
|
||||
*
|
||||
* @param bool Switch natsorting on/off (local, affects just this call)
|
||||
* @return string the "order by"-code
|
||||
*/
|
||||
|
||||
function getSqlOrderBy($natSorting = null)
|
||||
{
|
||||
$sortfield = explode('.', $this->sortfield);
|
||||
foreach($sortfield as $id => $field)
|
||||
{
|
||||
if(substr($field, -1, 1) != '`')
|
||||
{
|
||||
$field.= '`';
|
||||
}
|
||||
|
||||
if($field{0} != '`')
|
||||
{
|
||||
$field = '`' . $field;
|
||||
}
|
||||
|
||||
$sortfield[$id] = $field;
|
||||
}
|
||||
|
||||
$sortfield = implode('.', $sortfield);
|
||||
$sortorder = strtoupper($this->sortorder);
|
||||
|
||||
if($natSorting == true
|
||||
|| ($natSorting === null && $this->natSorting == true))
|
||||
{
|
||||
// Acts similar to php's natsort(), found in one comment at http://my.opera.com/cpr/blog/show.dml/160556
|
||||
|
||||
$sortcode = 'ORDER BY CONCAT( IF( ASCII( LEFT( ' . $sortfield . ', 1 ) ) > 57, LEFT( ' . $sortfield . ', 1 ), \'0\' ), IF( ASCII( RIGHT( ' . $sortfield . ', 1 ) ) > 57, LPAD( ' . $sortfield . ', 255, \'0\' ), LPAD( CONCAT( ' . $sortfield . ', \'-\' ), 255, \'0\' ) ) ) ' . $sortorder;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sortcode = 'ORDER BY ' . $sortfield . ' ' . $sortorder;
|
||||
}
|
||||
|
||||
return $sortcode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Currently not used
|
||||
*
|
||||
* @return string always empty
|
||||
*/
|
||||
|
||||
function getSqlLimit()
|
||||
{
|
||||
/**
|
||||
* currently not in use
|
||||
*/
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns html code for sorting field
|
||||
*
|
||||
* @param array Language array
|
||||
* @return string the html sortcode
|
||||
*/
|
||||
|
||||
function getHtmlSortCode($lng, $break = false)
|
||||
{
|
||||
$sortcode = '<select class="dropdown_noborder" name="sortfield">';
|
||||
foreach($this->fields as $fieldname => $fieldcaption)
|
||||
{
|
||||
$sortcode.= makeoption($fieldcaption, $fieldname, $this->sortfield, true, true);
|
||||
}
|
||||
|
||||
$sortcode.= '</select>' . ($break ? '<br />' : ' ') . '<select class="dropdown_noborder" name="sortorder">';
|
||||
foreach(array('asc' => $lng['panel']['ascending'], 'desc' => $lng['panel']['decending']) as $sortordertype => $sortorderdescription)
|
||||
{
|
||||
$sortcode.= makeoption($sortorderdescription, $sortordertype, $this->sortorder, true, true);
|
||||
}
|
||||
|
||||
$sortcode.= '</select> <input type="submit" name="Go" value="Go" />';
|
||||
return $sortcode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns html code for sorting arrows
|
||||
*
|
||||
* @param string URL to use as base for links
|
||||
* @param string If set, only this field will be returned
|
||||
* @return mixed An array or a string (if field is set) of html code of arrows
|
||||
*/
|
||||
|
||||
function getHtmlArrowCode($baseurl, $field = '')
|
||||
{
|
||||
if($field != ''
|
||||
&& isset($this->fields[$field]))
|
||||
{
|
||||
$arrowcode = '<a href="' . htmlspecialchars($baseurl) . '&sortfield=' . htmlspecialchars($field) . '&sortorder=desc"><img src="images/order_desc.gif" border="0" alt="" /></a><a href="' . htmlspecialchars($baseurl) . '&sortfield=' . htmlspecialchars($field) . '&sortorder=asc"><img src="images/order_asc.gif" border="0" alt="" /></a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$arrowcode = array();
|
||||
foreach($this->fields as $fieldname => $fieldcaption)
|
||||
{
|
||||
$arrowcode[$fieldname] = '<a href="' . htmlspecialchars($baseurl) . '&sortfield=' . htmlspecialchars($fieldname) . '&sortorder=desc"><img src="images/order_desc.gif" border="0" alt="" /></a><a href="' . htmlspecialchars($baseurl) . '&sortfield=' . htmlspecialchars($fieldname) . '&sortorder=asc"><img src="images/order_asc.gif" border="0" alt="" /></a>';
|
||||
}
|
||||
}
|
||||
|
||||
return $arrowcode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns html code for searching field
|
||||
*
|
||||
* @param array Language array
|
||||
* @return string the html searchcode
|
||||
*/
|
||||
|
||||
function getHtmlSearchCode($lng)
|
||||
{
|
||||
$sortcode = $lng['panel']['search'] . ': <select class="dropdown_noborder" name="searchfield">';
|
||||
foreach($this->fields as $fieldname => $fieldcaption)
|
||||
{
|
||||
$sortcode.= makeoption($fieldcaption, $fieldname, $this->searchfield, true, true);
|
||||
}
|
||||
|
||||
$sortcode.= '</select> <input type="text" name="searchtext" value="' . htmlspecialchars($this->searchtext) . '" /> <input type="submit" name="Go" value="Go" />';
|
||||
return $sortcode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns html code for paging
|
||||
*
|
||||
* @param string URL to use as base for links
|
||||
* @return string the html pagingcode
|
||||
*/
|
||||
|
||||
function getHtmlPagingCode($baseurl)
|
||||
{
|
||||
if($this->entriesperpage == 0)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$pages = intval($this->entries / $this->entriesperpage);
|
||||
}
|
||||
|
||||
if($this->entries % $this->entriesperpage != 0)
|
||||
{
|
||||
$pages++;
|
||||
}
|
||||
|
||||
if($pages > 1)
|
||||
{
|
||||
$start = $this->pageno - 4;
|
||||
|
||||
if($start < 1)
|
||||
{
|
||||
$start = 1;
|
||||
}
|
||||
|
||||
$stop = $this->pageno + 4;
|
||||
|
||||
if($stop > $pages)
|
||||
{
|
||||
$stop = $pages;
|
||||
}
|
||||
|
||||
$pagingcode = '<a href="' . htmlspecialchars($baseurl) . '&pageno=1">«</a> <a href="' . htmlspecialchars($baseurl) . '&pageno=' . ((intval($this->pageno) - 1) == 0 ? '1' : intval($this->pageno) - 1) . '"><</a> ';
|
||||
for ($i = $start;$i <= $stop;$i++)
|
||||
{
|
||||
if($i != $this->pageno)
|
||||
{
|
||||
$pagingcode.= ' <a href="' . htmlspecialchars($baseurl) . '&pageno=' . $i . '">' . $i . '</a> ';
|
||||
}
|
||||
else
|
||||
{
|
||||
$pagingcode.= ' <b>' . $i . '</b> ';
|
||||
}
|
||||
}
|
||||
|
||||
$pagingcode.= ' <a href="' . htmlspecialchars($baseurl) . '&pageno=' . ((intval($this->pageno) + 1) > $pages ? $pages : intval($this->pageno) + 1) . '">></a> <a href="' . $baseurl . '&pageno=' . $pages . '">»</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$pagingcode = '';
|
||||
}
|
||||
|
||||
return $pagingcode;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
2084
lib/classes/phpmailer/class.PHPMailer.php
Normal file
1348
lib/classes/phpmailer/class.SMTP.php
Normal file
663
lib/classes/ticket/class.ticket.php
Normal file
@@ -0,0 +1,663 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Support-Tickets - Ticket-Class
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version. This program is distributed in the
|
||||
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
|
||||
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Michael Kaufmann <mkaufmann@nutime.de>
|
||||
* @license http://www.gnu.org/licenses/gpl.txt
|
||||
* @package Functions
|
||||
* @version CVS: $Id: class.ticket.php 2724 2009-06-07 14:18:02Z flo $
|
||||
* @link http://www.nutime.de/
|
||||
* @since File available since Release 1.2.18
|
||||
*/
|
||||
|
||||
class ticket
|
||||
{
|
||||
/**
|
||||
* Userinfo
|
||||
* @var array
|
||||
*/
|
||||
|
||||
private $userinfo = array();
|
||||
|
||||
/**
|
||||
* Database handler
|
||||
* @var db
|
||||
*/
|
||||
|
||||
private $db = false;
|
||||
|
||||
/**
|
||||
* Settings array
|
||||
* @var settings
|
||||
*/
|
||||
|
||||
private $settings = array();
|
||||
|
||||
/**
|
||||
* Ticket ID
|
||||
* @var tid
|
||||
*/
|
||||
|
||||
private $tid = - 1;
|
||||
|
||||
/**
|
||||
* Ticket Data Array
|
||||
* @var t_data
|
||||
*/
|
||||
|
||||
private $t_data = array();
|
||||
|
||||
/**
|
||||
* Ticket-Object-Array
|
||||
* @var tickets
|
||||
*/
|
||||
|
||||
static private $tickets = array();
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
* @param array userinfo
|
||||
* @param resource database
|
||||
* @param array settings
|
||||
* @param int ticket id
|
||||
*/
|
||||
|
||||
private function __construct($userinfo, $db, $settings, $tid = - 1)
|
||||
{
|
||||
$this->userinfo = $userinfo;
|
||||
$this->db = $db;
|
||||
$this->settings = $settings;
|
||||
$this->tid = $tid;
|
||||
|
||||
// initialize data array
|
||||
|
||||
$this->initData();
|
||||
|
||||
// read data from database
|
||||
|
||||
$this->readData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Singleton ftw ;-)
|
||||
*
|
||||
* @param int ticket id
|
||||
*/
|
||||
|
||||
static public function getInstanceOf($_usernfo, $_db, $_settings, $_tid)
|
||||
{
|
||||
if(!isset(self::$tickets[$_tid]))
|
||||
{
|
||||
self::$tickets[$_tid] = new ticket($_usernfo, $_db, $_settings, $_tid);
|
||||
}
|
||||
|
||||
return self::$tickets[$_tid];
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize data-array
|
||||
*/
|
||||
|
||||
private function initData()
|
||||
{
|
||||
$this->Set('customer', 0, true, true);
|
||||
$this->Set('admin', 1, true, true);
|
||||
$this->Set('subject', '', true, true);
|
||||
$this->Set('category', '0', true, true);
|
||||
$this->Set('priority', '2', true, true);
|
||||
$this->Set('message', '', true, true);
|
||||
$this->Set('dt', 0, true, true);
|
||||
$this->Set('lastchange', 0, true, true);
|
||||
$this->Set('ip', '', true, true);
|
||||
$this->Set('status', '0', true, true);
|
||||
$this->Set('lastreplier', '0', true, true);
|
||||
$this->Set('by', '0', true, true);
|
||||
$this->Set('answerto', '0', true, true);
|
||||
$this->Set('archived', '0', true, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read ticket data from database.
|
||||
*/
|
||||
|
||||
private function readData()
|
||||
{
|
||||
if(isset($this->tid)
|
||||
&& $this->tid != - 1)
|
||||
{
|
||||
$_ticket = $this->db->query_first('SELECT * FROM `' . TABLE_PANEL_TICKETS . '` WHERE `id` = "' . $this->tid . '"');
|
||||
$this->Set('customer', $_ticket['customerid'], true, false);
|
||||
$this->Set('admin', $_ticket['adminid'], true, false);
|
||||
$this->Set('subject', $_ticket['subject'], true, false);
|
||||
$this->Set('category', $_ticket['category'], true, false);
|
||||
$this->Set('priority', $_ticket['priority'], true, false);
|
||||
$this->Set('message', $_ticket['message'], true, false);
|
||||
$this->Set('dt', $_ticket['dt'], true, false);
|
||||
$this->Set('lastchange', $_ticket['lastchange'], true, false);
|
||||
$this->Set('ip', $_ticket['ip'], true, false);
|
||||
$this->Set('status', $_ticket['status'], true, false);
|
||||
$this->Set('lastreplier', $_ticket['lastreplier'], true, false);
|
||||
$this->Set('by', $_ticket['by'], true, false);
|
||||
$this->Set('answerto', $_ticket['answerto'], true, false);
|
||||
$this->Set('archived', $_ticket['archived'], true, false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert data to database
|
||||
*/
|
||||
|
||||
public function Insert()
|
||||
{
|
||||
$this->db->query("INSERT INTO `" . TABLE_PANEL_TICKETS . "`
|
||||
(`customerid`,
|
||||
`adminid`,
|
||||
`category`,
|
||||
`priority`,
|
||||
`subject`,
|
||||
`message`,
|
||||
`dt`,
|
||||
`lastchange`,
|
||||
`ip`,
|
||||
`status`,
|
||||
`lastreplier`,
|
||||
`by`,
|
||||
`answerto`)
|
||||
VALUES
|
||||
('" . (int)$this->Get('customer') . "',
|
||||
'" . (int)$this->Get('admin') . "',
|
||||
'" . (int)$this->Get('category') . "',
|
||||
'" . (int)$this->Get('priority') . "',
|
||||
'" . $this->db->escape($this->Get('subject')) . "',
|
||||
'" . $this->db->escape($this->Get('message')) . "',
|
||||
'" . (int)$this->Get('dt') . "',
|
||||
'" . (int)$this->Get('lastchange') . "',
|
||||
'" . $this->db->escape($this->Get('ip')) . "',
|
||||
'" . (int)$this->Get('status') . "',
|
||||
'" . (int)$this->Get('lastreplier') . "',
|
||||
'" . (int)$this->Get('by') . "',
|
||||
'" . (int)$this->Get('answerto') . "');");
|
||||
$this->tid = $this->db->insert_id();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update data in database
|
||||
*/
|
||||
|
||||
public function Update()
|
||||
{
|
||||
// Update "main" ticket
|
||||
|
||||
$this->db->query('UPDATE `' . TABLE_PANEL_TICKETS . '` SET
|
||||
`priority` = "' . (int)$this->Get('priority') . '",
|
||||
`lastchange` = "' . (int)$this->Get('lastchange') . '",
|
||||
`status` = "' . (int)$this->Get('status') . '",
|
||||
`lastreplier` = "' . (int)$this->Get('lastreplier') . '"
|
||||
WHERE `id` = "' . (int)$this->tid . '";');
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves a ticket to the archive
|
||||
*/
|
||||
|
||||
public function Archive()
|
||||
{
|
||||
// Update "main" ticket
|
||||
|
||||
$this->db->query('UPDATE `' . TABLE_PANEL_TICKETS . '` SET `archived` = "1" WHERE `id` = "' . (int)$this->tid . '";');
|
||||
|
||||
// Update "answers" to ticket
|
||||
|
||||
$this->db->query('UPDATE `' . TABLE_PANEL_TICKETS . '` SET `archived` = "1" WHERE `answerto` = "' . (int)$this->tid . '";');
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove ticket from database
|
||||
*/
|
||||
|
||||
public function Delete()
|
||||
{
|
||||
// Delete "main" ticket
|
||||
|
||||
$this->db->query('DELETE FROM `' . TABLE_PANEL_TICKETS . '` WHERE `id` = "' . (int)$this->tid . '";');
|
||||
|
||||
// Delete "answers" to ticket"
|
||||
|
||||
$this->db->query('DELETE FROM `' . TABLE_PANEL_TICKETS . '` WHERE `answerto` = "' . (int)$this->tid . '";');
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mail notifications
|
||||
*/
|
||||
|
||||
public function sendMail($customerid = - 1, $template_subject = null, $default_subject = null, $template_body = null, $default_body = null)
|
||||
{
|
||||
global $mail;
|
||||
|
||||
// Some checks are to be made here in the future
|
||||
|
||||
if($customerid != - 1)
|
||||
{
|
||||
// Get e-mail message for customer
|
||||
|
||||
$usr = $this->db->query_first('SELECT `name`, `firstname`, `email`
|
||||
FROM `' . TABLE_PANEL_CUSTOMERS . '`
|
||||
WHERE `customerid` = "' . (int)$customerid . '"');
|
||||
$replace_arr = array(
|
||||
'FIRSTNAME' => $usr['firstname'],
|
||||
'NAME' => $usr['name'],
|
||||
'SUBJECT' => $this->Get('subject', true)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$replace_arr = array(
|
||||
'SUBJECT' => $this->Get('subject', true)
|
||||
);
|
||||
}
|
||||
|
||||
$result = $this->db->query_first('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '`
|
||||
WHERE `adminid`=\'' . (int)$this->userinfo['adminid'] . '\'
|
||||
AND `language`=\'' . $this->db->escape($this->userinfo['def_language']) . '\'
|
||||
AND `templategroup`=\'mails\'
|
||||
AND `varname`=\'' . $template_subject . '\'');
|
||||
$mail_subject = html_entity_decode(replace_variables((($result['value'] != '') ? $result['value'] : $default_subject), $replace_arr));
|
||||
$result = $this->db->query_first('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '`
|
||||
WHERE `adminid`=\'' . (int)$this->userinfo['adminid'] . '\'
|
||||
AND `language`=\'' . $this->db->escape($this->userinfo['def_language']) . '\'
|
||||
AND `templategroup`=\'mails\'
|
||||
AND `varname`=\'' . $template_body . '\'');
|
||||
$mail_body = html_entity_decode(replace_variables((($result['value'] != '') ? $result['value'] : $default_body), $replace_arr));
|
||||
|
||||
if($customerid != - 1)
|
||||
{
|
||||
$mail->From = $this->settings['ticket']['noreply_email'];
|
||||
$mail->FromName = $this->settings['ticket']['noreply_name'];
|
||||
$mail->Subject = $mail_subject;
|
||||
$mail->Body = $mail_body;
|
||||
$mail->AddAddress($usr['email'], $usr['firstname'] . ' ' . $usr['name']);
|
||||
|
||||
if(!$mail->Send())
|
||||
{
|
||||
standard_error(array('errorsendingmail', $usr['email']));
|
||||
}
|
||||
|
||||
$mail->ClearAddresses();
|
||||
}
|
||||
else
|
||||
{
|
||||
$admin = $this->db->query_first("SELECT `email` FROM `" . TABLE_PANEL_ADMINS . "` WHERE `adminid`='" . (int)$this->userinfo['adminid'] . "'");
|
||||
$mail->From = $this->settings['ticket']['noreply_email'];
|
||||
$mail->FromName = $this->settings['ticket']['noreply_name'];
|
||||
$mail->Subject = $mail_subject;
|
||||
$mail->Body = $mail_body;
|
||||
$mail->AddAddress($admin['email'], $admin['firstname'] . ' ' . $admin['name']);
|
||||
|
||||
if(!$mail->Send())
|
||||
{
|
||||
standard_error(array('errorsendingmail', $admin['email']));
|
||||
}
|
||||
|
||||
$mail->ClearAddresses();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a support-categories
|
||||
*/
|
||||
|
||||
static public function addCategory($_db, $_category = null, $_admin = 1)
|
||||
{
|
||||
if($_category != null
|
||||
&& $_category != '')
|
||||
{
|
||||
$_db->query('INSERT INTO `' . TABLE_PANEL_TICKET_CATS . '` (`name`, `adminid`) VALUES ("' . $_db->escape($_category) . '", "' . (int)$_admin . '")');
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit a support-categories
|
||||
*/
|
||||
|
||||
static public function editCategory($_db, $_category = null, $_id = 0)
|
||||
{
|
||||
if($_category != null
|
||||
&& $_category != ''
|
||||
&& $_id != 0)
|
||||
{
|
||||
$_db->query('UPDATE `' . TABLE_PANEL_TICKET_CATS . '` SET `name` = "' . $_db->escape($_category) . '"
|
||||
WHERE `id` = "' . (int)$_id . '"');
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a support-categories
|
||||
*/
|
||||
|
||||
static public function deleteCategory($_db, $_id = 0)
|
||||
{
|
||||
if($_id != 0)
|
||||
{
|
||||
$result = $_db->query_first('SELECT COUNT(`id`) as `numtickets` FROM `' . TABLE_PANEL_TICKETS . '`
|
||||
WHERE `category` = "' . (int)$_id . '"');
|
||||
|
||||
if($result['numtickets'] == "0")
|
||||
{
|
||||
$_db->query('DELETE FROM `' . TABLE_PANEL_TICKET_CATS . '` WHERE `id` = "' . (int)$_id . '"');
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a support-category-name
|
||||
*/
|
||||
|
||||
static public function getCategoryName($_db, $_id = 0)
|
||||
{
|
||||
if($_id != 0)
|
||||
{
|
||||
$category = $_db->query_first('SELECT `name` FROM `' . TABLE_PANEL_TICKET_CATS . '` WHERE `id` = "' . (int)$_id . '"');
|
||||
return $category['name'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the last x archived tickets
|
||||
*/
|
||||
|
||||
static public function getLastArchived($_db, $_num = 10, $_admin = 1)
|
||||
{
|
||||
if($_num > 0)
|
||||
{
|
||||
$archived = array();
|
||||
$counter = 0;
|
||||
$result = $_db->query('SELECT *,
|
||||
(SELECT COUNT(`sub`.`id`)
|
||||
FROM `' . TABLE_PANEL_TICKETS . '` `sub`
|
||||
WHERE `sub`.`answerto` = `main`.`id`) as `ticket_answers`
|
||||
FROM `' . TABLE_PANEL_TICKETS . '` `main`
|
||||
WHERE `main`.`answerto` = "0"
|
||||
AND `main`.`archived` = "1" AND `main`.`adminid` = "' . (int)$_admin . '"
|
||||
ORDER BY `main`.`lastchange` DESC LIMIT 0, ' . (int)$_num);
|
||||
|
||||
while($row = $_db->fetch_array($result))
|
||||
{
|
||||
$archived[$counter]['id'] = $row['id'];
|
||||
$archived[$counter]['customerid'] = $row['customerid'];
|
||||
$archived[$counter]['adminid'] = $row['adminid'];
|
||||
$archived[$counter]['lastreplier'] = $row['lastreplier'];
|
||||
$archived[$counter]['ticket_answers'] = $row['ticket_answers'];
|
||||
$archived[$counter]['category'] = $row['category'];
|
||||
$archived[$counter]['priority'] = $row['priority'];
|
||||
$archived[$counter]['subject'] = $row['subject'];
|
||||
$archived[$counter]['message'] = $row['message'];
|
||||
$archived[$counter]['dt'] = $row['dt'];
|
||||
$archived[$counter]['lastchange'] = $row['lastchange'];
|
||||
$archived[$counter]['status'] = $row['status'];
|
||||
$archived[$counter]['by'] = $row['by'];
|
||||
$counter++;
|
||||
}
|
||||
|
||||
if(isset($archived[0]['id']))
|
||||
{
|
||||
return $archived;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a sql-statement to search the archive
|
||||
*/
|
||||
|
||||
static public function getArchiveSearchStatement($subject = NULL, $priority = NULL, $fromdate = NULL, $todate = NULL, $message = NULL, $customer = - 1, $admin = 1, $categories = NULL)
|
||||
{
|
||||
$query = 'SELECT `main`.*,
|
||||
(SELECT COUNT(`sub`.`id`) FROM `' . TABLE_PANEL_TICKETS . '` `sub`
|
||||
WHERE `sub`.`answerto` = `main`.`id`) as `ticket_answers`
|
||||
FROM `' . TABLE_PANEL_TICKETS . '` `main`
|
||||
WHERE `main`.`archived` = "1" AND `main`.`answerto` = "0" AND `main`.`adminid` = "' . (int)$admin . '"';
|
||||
|
||||
if($subject != NULL
|
||||
&& $subject != '')
|
||||
{
|
||||
$query.= 'AND `main`.`subject` LIKE "%' . $subject . '%" ';
|
||||
}
|
||||
|
||||
if($priority != NULL
|
||||
&& isset($priority[0])
|
||||
&& $priority[0] != '')
|
||||
{
|
||||
if(isset($priority[1])
|
||||
&& $priority[1] != '')
|
||||
{
|
||||
if(isset($priority[2])
|
||||
&& $priority[2] != '')
|
||||
{
|
||||
$query.= 'AND (`main`.`priority` = "1"
|
||||
OR `main`.`priority` = "2"
|
||||
OR `main`.`priority` = "3") ';
|
||||
}
|
||||
else
|
||||
{
|
||||
$query.= 'AND (`main`.`priority` = "1"
|
||||
OR `main`.`priority` = "2") ';
|
||||
}
|
||||
}
|
||||
elseif(isset($priority[2])
|
||||
&& $priority[2] != '')
|
||||
{
|
||||
$query.= 'AND (`main`.`priority` = "1"
|
||||
OR `main`.`priority` = "3") ';
|
||||
}
|
||||
else
|
||||
{
|
||||
$query.= 'AND `main`.`priority` = "1" ';
|
||||
}
|
||||
}
|
||||
elseif($priority != NULL
|
||||
&& isset($priority[1])
|
||||
&& $priority[1] != '')
|
||||
{
|
||||
if(isset($priority[2])
|
||||
&& $priority[2] != '')
|
||||
{
|
||||
$query.= 'AND (`main`.`priority` = "2"
|
||||
OR `main`.`priority` = "3") ';
|
||||
}
|
||||
else
|
||||
{
|
||||
$query.= 'AND `main`.`priority` = "2" ';
|
||||
}
|
||||
}
|
||||
elseif($priority != NULL)
|
||||
{
|
||||
if(isset($priority[3])
|
||||
&& $priority[3] != '')
|
||||
{
|
||||
$query.= 'AND `main`.`priority` = "3" ';
|
||||
}
|
||||
}
|
||||
|
||||
if($fromdate != NULL
|
||||
&& $fromdate > 0)
|
||||
{
|
||||
$query.= 'AND `main`.`lastchange` > "' . $fromdate . '" ';
|
||||
}
|
||||
|
||||
if($todate != NULL
|
||||
&& $todate > 0)
|
||||
{
|
||||
$query.= 'AND `main`.`lastchange` < "' . $todate . '" ';
|
||||
}
|
||||
|
||||
if($message != NULL
|
||||
&& $message != '')
|
||||
{
|
||||
$query.= 'AND `main`.`message` LIKE "%' . $message . '%" ';
|
||||
}
|
||||
|
||||
if($customer != - 1)
|
||||
{
|
||||
$query.= 'AND `main`.`customerid` = "' . $customer . '" ';
|
||||
}
|
||||
|
||||
if($categories != NULL)
|
||||
{
|
||||
if($categories[0] != '')
|
||||
{
|
||||
$query.= 'AND (';
|
||||
}
|
||||
|
||||
foreach($categories as $catid)
|
||||
{
|
||||
if(isset($catid)
|
||||
&& $catid > 0)
|
||||
{
|
||||
$query.= '`main`.`category` = "' . $catid . '" OR ';
|
||||
}
|
||||
}
|
||||
|
||||
if($categories[0] != '')
|
||||
{
|
||||
$query = substr($query, 0, strlen($query) - 3);
|
||||
$query.= ') ';
|
||||
}
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get statustext by status-no
|
||||
*/
|
||||
|
||||
static public function getStatusText($_lng, $_status = 0)
|
||||
{
|
||||
switch($_status)
|
||||
{
|
||||
case 0:
|
||||
return $_lng['ticket']['open'];
|
||||
break;
|
||||
case 1:
|
||||
return $_lng['ticket']['wait_reply'];
|
||||
break;
|
||||
case 2:
|
||||
return $_lng['ticket']['replied'];
|
||||
break;
|
||||
default:
|
||||
return $_lng['ticket']['closed'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get prioritytext by priority-no
|
||||
*/
|
||||
|
||||
static public function getPriorityText($_lng, $_priority = 0)
|
||||
{
|
||||
switch($_priority)
|
||||
{
|
||||
case 1:
|
||||
return $_lng['ticket']['high'];
|
||||
break;
|
||||
case 2:
|
||||
return $_lng['ticket']['normal'];
|
||||
break;
|
||||
default:
|
||||
return $_lng['ticket']['low'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a data-var
|
||||
*/
|
||||
|
||||
public function Get($_var = '', $_vartrusted = false)
|
||||
{
|
||||
if($_var != '')
|
||||
{
|
||||
if(!$_vartrusted)
|
||||
{
|
||||
$_var = htmlspecialchars($_var);
|
||||
}
|
||||
|
||||
if(isset($this->t_data[$_var]))
|
||||
{
|
||||
if(strtolower($_var) == 'message')
|
||||
{
|
||||
return htmlspecialchars_decode(nl2br($this->t_data[$_var]));
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->t_data[$_var];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a data-var
|
||||
*/
|
||||
|
||||
public function Set($_var = '', $_value = '', $_vartrusted = false, $_valuetrusted = false)
|
||||
{
|
||||
if($_var != ''
|
||||
&& $_value != '')
|
||||
{
|
||||
if(!$_vartrusted)
|
||||
{
|
||||
$_var = htmlspecialchars($_var);
|
||||
}
|
||||
|
||||
if(!$_valuetrusted)
|
||||
{
|
||||
$_value = htmlspecialchars($_value);
|
||||
}
|
||||
|
||||
$this->t_data[$_var] = $_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
267
lib/configfiles/etch.inc.php
Normal file
@@ -0,0 +1,267 @@
|
||||
<?php
|
||||
return Array(
|
||||
'debian_etch' => Array(
|
||||
'label' => 'Debian 4.0 (Etch)',
|
||||
'services' => Array(
|
||||
'http' => Array(
|
||||
'label' => $lng['admin']['configfiles']['http'],
|
||||
'daemons' => Array(
|
||||
'apache2' => Array(
|
||||
'label' => 'Apache 2',
|
||||
'commands' => Array(
|
||||
'mkdir -p ' . $settings['system']['documentroot_prefix'],
|
||||
'mkdir -p ' . $settings['system']['logfiles_directory'],
|
||||
'mkdir -p ' . $settings['system']['mod_fcgid_tmpdir'],
|
||||
'chmod 1777 ' . $settings['system']['mod_fcgid_tmpdir'],
|
||||
'a2dismod userdir',
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/apache2 restart'
|
||||
),
|
||||
),
|
||||
'lighttpd' => Array(
|
||||
'label' => 'Lighttpd Webserver',
|
||||
'commands_1' => Array(
|
||||
'apt-get install lighttpd',
|
||||
),
|
||||
'files' => Array(
|
||||
'etc_lighttpd.conf' => '/etc/lighttpd/lighttpd.conf',
|
||||
),
|
||||
'commands_2' => Array(
|
||||
$configcommand['vhost'],
|
||||
$configcommand['diroptions'],
|
||||
$configcommand['v_inclighty'],
|
||||
$configcommand['d_inclighty'],
|
||||
'mkdir -p ' . $settings['system']['documentroot_prefix'],
|
||||
'mkdir -p ' . $settings['system']['logfiles_directory'],
|
||||
'mkdir -p ' . $settings['system']['mod_fcgid_tmpdir'],
|
||||
'chmod 1777 ' . $settings['system']['mod_fcgid_tmpdir'],
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/lighttpd restart'
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
'dns' => Array(
|
||||
'label' => $lng['admin']['configfiles']['dns'],
|
||||
'daemons' => Array(
|
||||
'bind' => Array(
|
||||
'label' => 'Bind9',
|
||||
'commands' => Array(
|
||||
'apt-get install bind9',
|
||||
'echo "include \"' . $settings['system']['bindconf_directory'] . 'syscp_bind.conf\";" >> /etc/bind/named.conf',
|
||||
'touch ' . $settings['system']['bindconf_directory'] . 'syscp_bind.conf'
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/bind9 restart'
|
||||
)
|
||||
),
|
||||
'powerdns' => Array(
|
||||
'label' => 'PowerDNS',
|
||||
'files' => Array(
|
||||
'etc_powerdns_pdns.conf' => '/etc/powerdns/pdns.conf',
|
||||
'etc_powerdns_pdns-syscp.conf' => '/etc/powerdns/pdns_syscp.conf',
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/pdns restart'
|
||||
)
|
||||
),
|
||||
)
|
||||
),
|
||||
'smtp' => Array(
|
||||
'label' => $lng['admin']['configfiles']['smtp'],
|
||||
'daemons' => Array(
|
||||
'postfix' => Array(
|
||||
'label' => 'Postfix',
|
||||
'commands' => Array(
|
||||
'apt-get install postfix postfix-mysql libsasl2 libsasl2-modules libsasl2-modules-sql',
|
||||
'mkdir -p /etc/postfix/sasl',
|
||||
'mkdir -p /var/spool/postfix/etc/pam.d',
|
||||
'mkdir -p /var/spool/postfix/var/run/mysqld',
|
||||
'groupadd -g ' . $settings['system']['vmail_gid'] . ' vmail',
|
||||
'useradd -u ' . $settings['system']['vmail_uid'] . ' -g vmail vmail',
|
||||
'mkdir -p ' . $settings['system']['vmail_homedir'],
|
||||
'chown -R vmail:vmail ' . $settings['system']['vmail_homedir'],
|
||||
'touch /etc/postfix/mysql-virtual_alias_maps.cf',
|
||||
'touch /etc/postfix/mysql-virtual_mailbox_domains.cf',
|
||||
'touch /etc/postfix/mysql-virtual_mailbox_maps.cf',
|
||||
'touch /etc/postfix/sasl/smtpd.conf',
|
||||
'chown root:root /etc/postfix/main.cf',
|
||||
'chown root:root /etc/postfix/master.cf',
|
||||
'chown root:postfix /etc/postfix/mysql-virtual_alias_maps.cf',
|
||||
'chown root:postfix /etc/postfix/mysql-virtual_mailbox_domains.cf',
|
||||
'chown root:postfix /etc/postfix/mysql-virtual_mailbox_maps.cf',
|
||||
'chown root:root /etc/postfix/sasl/smtpd.conf',
|
||||
'chmod 0644 /etc/postfix/main.cf',
|
||||
'chmod 0644 /etc/postfix/master.cf',
|
||||
'chmod 0640 /etc/postfix/mysql-virtual_alias_maps.cf',
|
||||
'chmod 0640 /etc/postfix/mysql-virtual_mailbox_domains.cf',
|
||||
'chmod 0640 /etc/postfix/mysql-virtual_mailbox_maps.cf',
|
||||
'chmod 0600 /etc/postfix/sasl/smtpd.conf',
|
||||
),
|
||||
'files' => Array(
|
||||
'etc_postfix_main.cf' => '/etc/postfix/main.cf',
|
||||
'etc_postfix_master.cf' => '/etc/postfix/master.cf',
|
||||
'etc_postfix_mysql-virtual_alias_maps.cf' => '/etc/postfix/mysql-virtual_alias_maps.cf',
|
||||
'etc_postfix_mysql-virtual_mailbox_domains.cf' => '/etc/postfix/mysql-virtual_mailbox_domains.cf',
|
||||
'etc_postfix_mysql-virtual_mailbox_maps.cf' => '/etc/postfix/mysql-virtual_mailbox_maps.cf',
|
||||
'etc_postfix_sasl_smtpd.conf' => '/etc/postfix/sasl/smtpd.conf'
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/postfix restart',
|
||||
'newaliases'
|
||||
)
|
||||
),
|
||||
'exim4' => Array(
|
||||
'label' => 'Exim4',
|
||||
'commands_1' => Array(
|
||||
'dpkg-reconfigure exim4-config',
|
||||
'# choose "no configuration at this time" and "splitted configuration files" in the dialog'
|
||||
),
|
||||
'files' => Array(
|
||||
'etc_exim4_conf.d_acl_30_exim4-config_check_rcpt.rul' => '/etc/exim4/conf.d/acl/30_exim4-config_check_rcpt.rul',
|
||||
'etc_exim4_conf.d_auth_30_syscp-config' => '/etc/exim4/conf.d/auth/30_syscp-config',
|
||||
'etc_exim4_conf.d_main_10_syscp-config_options' => '/etc/exim4/conf.d/main/10_syscp-config_options',
|
||||
'etc_exim4_conf.d_router_180_syscp-config' => '/etc/exim4/conf.d/router/180_syscp-config',
|
||||
'etc_exim4_conf.d_transport_30_syscp-config' => '/etc/exim4/conf.d/transport/30_syscp-config'
|
||||
),
|
||||
'commands_2' => Array(
|
||||
'chmod o-rx /var/lib/exim4',
|
||||
'chmod o-rx /etc/exim4/conf.d/main/10_syscp-config_options'
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/exim4 restart'
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
'mail' => Array(
|
||||
'label' => $lng['admin']['configfiles']['mail'],
|
||||
'daemons' => Array(
|
||||
'courier' => Array(
|
||||
'label' => 'Courier',
|
||||
'commands' => Array(
|
||||
'apt-get install courier-pop courier-imap courier-authlib-mysql'
|
||||
),
|
||||
'files' => Array(
|
||||
'etc_courier_authdaemonrc' => '/etc/courier/authdaemonrc',
|
||||
'etc_courier_authmysqlrc' => '/etc/courier/authmysqlrc'
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/courier-authdaemon restart',
|
||||
'/etc/init.d/courier-pop restart'
|
||||
)
|
||||
),
|
||||
'dovecot' => Array(
|
||||
'label' => 'Dovecot',
|
||||
'commands' => Array(
|
||||
'apt-get install dovecot-imapd dovecot-pop3d'
|
||||
),
|
||||
'files' => Array(
|
||||
'etc_dovecot_dovecot.conf' => '/etc/dovecot/dovecot.conf',
|
||||
'etc_dovecot_dovecot-sql.conf' => '/etc/dovecot/dovecot-sql.conf'
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/dovecot restart'
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
'ftp' => Array(
|
||||
'label' => $lng['admin']['configfiles']['ftp'],
|
||||
'daemons' => Array(
|
||||
'proftpd' => Array(
|
||||
'label' => 'ProFTPd',
|
||||
'files' => Array(
|
||||
'etc_proftpd_modules.conf' => '/etc/proftpd/modules.conf',
|
||||
'etc_proftpd_proftpd.conf' => '/etc/proftpd/proftpd.conf'
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/proftpd restart'
|
||||
)
|
||||
),
|
||||
'pure-ftpd' => Array(
|
||||
'label' => 'Pure FTPd',
|
||||
'commands' => Array(
|
||||
'apt-get install pure-ftpd-common pure-ftpd-mysql'
|
||||
),
|
||||
'files' => Array(
|
||||
'etc_pure-ftpd_conf_MinUID' => '/etc/pure-ftpd/conf/MinUID',
|
||||
'etc_pure-ftpd_conf_MySQLConfigFile' => '/etc/pure-ftpd/conf/MySQLConfigFile',
|
||||
'etc_pure-ftpd_conf_NoAnonymous' => '/etc/pure-ftpd/conf/NoAnonymous',
|
||||
'etc_pure-ftpd_conf_MaxIdleTime' => '/etc/pure-ftpd/conf/MaxIdleTime',
|
||||
'etc_pure-ftpd_conf_ChrootEveryone' => '/etc/pure-ftpd/conf/ChrootEveryone',
|
||||
'etc_pure-ftpd_conf_PAMAuthentication' => '/etc/pure-ftpd/conf/PAMAuthentication',
|
||||
'etc_pure-ftpd_db_mysql.conf' => '/etc/pure-ftpd/db/mysql.conf',
|
||||
'etc_pure-ftpd_conf_CustomerProof' => '/etc/pure-ftpd/conf/CustomerProof',
|
||||
'etc_pure-ftpd_conf_Bind' => '/etc/pure-ftpd/conf/Bind',
|
||||
'etc_default_pure-ftpd-common' => '/etc/default/pure-ftpd-common'
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/pure-ftpd-mysql restart'
|
||||
)
|
||||
),
|
||||
)
|
||||
),
|
||||
'etc' => Array(
|
||||
'label' => $lng['admin']['configfiles']['etc'],
|
||||
'daemons' => Array(
|
||||
'cron' => Array(
|
||||
'label' => 'Crond (cronscript)',
|
||||
'files' => Array(
|
||||
'etc_cron.d_syscp' => '/etc/cron.d/syscp'
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/cron restart'
|
||||
)
|
||||
),
|
||||
'xinetd' => Array(
|
||||
'label' => 'xinet.d (syscp updates in realtime)',
|
||||
'commands' => Array(
|
||||
'apt-get install xinetd',
|
||||
'echo -e "syscp ' . $settings['system']['realtime_port'] . '/tcp # SysCP Realtime" >> /etc/services'
|
||||
),
|
||||
'files' => Array(
|
||||
'etc_xinet.d_syscp' => '/etc/xinetd.d/syscp'
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/xinetd restart'
|
||||
)
|
||||
),
|
||||
'awstats' => Array(
|
||||
'label' => 'Awstats',
|
||||
'files' => Array(
|
||||
($settings['system']['mod_log_sql'] == 1 ? 'etc_awstats_awstats.model_log_sql.conf.syscp' : 'etc_awstats_awstats.model.conf.syscp') => '/etc/awstats/awstats.model.conf.syscp',
|
||||
($settings['system']['mod_log_sql'] == 1 ? 'etc_cron.d_awstats_log_sql' : 'etc_cron.d_awstats') => '/etc/cron.d/awstats',
|
||||
($settings['system']['webserver'] == 'lighttpd' ? 'etc_lighttpd_syscp-awstats.conf' : 'etc_apache_vhosts_05_awstats.conf') => ($settings['system']['webserver'] == 'lighttpd' ? '/etc/lighttpd/syscp-awstats.conf' : '/etc/apache2/sites-enabled/05_awstats.conf')
|
||||
),
|
||||
'commands' => Array(
|
||||
($settings['system']['webserver'] == 'lighttpd' ? 'echo "include \"syscp-awstats.conf\"" >> /etc/lighttpd/lighttpd.conf' : '')
|
||||
),
|
||||
'restart' => Array(
|
||||
($settings['system']['webserver'] == 'lighttpd' ? '/etc/init.d/lighttpd restart' : '/etc/init.d/apache2 restart')
|
||||
)
|
||||
),
|
||||
'libnss' => Array(
|
||||
'label' => 'libnss (system login with mysql)',
|
||||
'commands' => Array(
|
||||
'apt-get install libnss-mysql nscd',
|
||||
'chmod 600 /etc/nss-mysql.conf /etc/nss-mysql-root.conf'
|
||||
),
|
||||
'files' => Array(
|
||||
'etc_nss-mysql.conf' => '/etc/nss-mysql.conf',
|
||||
'etc_nss-mysql-root.conf' => '/etc/nss-mysql-root.conf',
|
||||
'etc_nsswitch.conf' => '/etc/nsswitch.conf',
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/nscd restart'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
290
lib/configfiles/gentoo.inc.php
Normal file
@@ -0,0 +1,290 @@
|
||||
<?php
|
||||
return Array(
|
||||
'gentoo' => Array(
|
||||
'label' => 'Gentoo',
|
||||
'services' => Array(
|
||||
'http' => Array(
|
||||
'label' => $lng['admin']['configfiles']['http'],
|
||||
'daemons' => Array(
|
||||
'apache2' => Array(
|
||||
'label' => 'Apache2 Webserver',
|
||||
'commands' => Array(
|
||||
'touch ' . $settings['system']['apacheconf_vhost'],
|
||||
'chown root:0 ' . $settings['system']['apacheconf_vhost'],
|
||||
'chmod 0600 ' . $settings['system']['apacheconf_vhost'],
|
||||
'touch ' . $settings['system']['apacheconf_diroptions'],
|
||||
'chown root:0 ' . $settings['system']['apacheconf_diroptions'],
|
||||
'chmod 0600 ' . $settings['system']['apacheconf_diroptions'],
|
||||
'mkdir -p ' . $settings['system']['documentroot_prefix'],
|
||||
'mkdir -p ' . $settings['system']['logfiles_directory'],
|
||||
'mkdir -p ' . $settings['system']['mod_fcgid_tmpdir'],
|
||||
'chmod 1777 ' . $settings['system']['mod_fcgid_tmpdir'],
|
||||
),
|
||||
'restart' => Array(
|
||||
'rc-update add apache2 default',
|
||||
'/etc/init.d/apache2 restart'
|
||||
)
|
||||
),
|
||||
'lighttpd' => Array(
|
||||
'label' => 'Lighttpd Webserver',
|
||||
'files' => Array(
|
||||
'etc_lighttpd.conf' => '/etc/lighttpd/lighttpd.conf'
|
||||
),
|
||||
'commands' => Array(
|
||||
$configcommand['vhost'],
|
||||
$configcommand['diroptions'],
|
||||
$configcommand['v_inclighty'],
|
||||
$configcommand['d_inclighty'],
|
||||
'mkdir -p ' . $settings['system']['documentroot_prefix'],
|
||||
'mkdir -p ' . $settings['system']['logfiles_directory']
|
||||
),
|
||||
'restart' => Array(
|
||||
'rc-update add lighttpd default',
|
||||
'/etc/init.d/lighttpd restart'
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
'dns' => Array(
|
||||
'label' => $lng['admin']['configfiles']['dns'],
|
||||
'daemons' => Array(
|
||||
'bind' => Array(
|
||||
'label' => 'Bind9 Nameserver',
|
||||
'files' => Array(
|
||||
'etc_bind_default.zone' => '/etc/bind/default.zone'
|
||||
),
|
||||
'commands' => Array(
|
||||
'echo "include \"' . $settings['system']['bindconf_directory'] . 'syscp_bind.conf\";" >> /etc/bind/named.conf',
|
||||
'touch ' . $settings['system']['bindconf_directory'] . 'syscp_bind.conf',
|
||||
'chown root:0 ' . $settings['system']['bindconf_directory'] . 'syscp_bind.conf',
|
||||
'chmod 0600 ' . $settings['system']['bindconf_directory'] . 'syscp_bind.conf'
|
||||
),
|
||||
'restart' => Array(
|
||||
'rc-update add named default',
|
||||
'/etc/init.d/named restart'
|
||||
)
|
||||
),
|
||||
)
|
||||
),
|
||||
'smtp' => Array(
|
||||
'label' => $lng['admin']['configfiles']['smtp'],
|
||||
'daemons' => Array(
|
||||
'postfix' => Array(
|
||||
'label' => 'Postfix',
|
||||
'commands_1' => Array(
|
||||
'mkdir -p ' . $settings['system']['vmail_homedir'],
|
||||
'chown -R vmail:vmail ' . $settings['system']['vmail_homedir'],
|
||||
'chmod 0750 ' . $settings['system']['vmail_homedir'],
|
||||
'mv /etc/postfix/main.cf /etc/postfix/main.cf.gentoo',
|
||||
'touch /etc/postfix/main.cf',
|
||||
'touch /etc/postfix/master.cf',
|
||||
'touch /etc/postfix/mysql-virtual_alias_maps.cf',
|
||||
'touch /etc/postfix/mysql-virtual_mailbox_domains.cf',
|
||||
'touch /etc/postfix/mysql-virtual_mailbox_maps.cf',
|
||||
'touch /etc/sasl2/smtpd.conf',
|
||||
'chown root:root /etc/postfix/main.cf',
|
||||
'chown root:root /etc/postfix/master.cf',
|
||||
'chown root:postfix /etc/postfix/mysql-virtual_alias_maps.cf',
|
||||
'chown root:postfix /etc/postfix/mysql-virtual_mailbox_domains.cf',
|
||||
'chown root:postfix /etc/postfix/mysql-virtual_mailbox_maps.cf',
|
||||
'chown root:root /etc/sasl2/smtpd.conf',
|
||||
'chmod 0644 /etc/postfix/main.cf',
|
||||
'chmod 0644 /etc/postfix/master.cf',
|
||||
'chmod 0640 /etc/postfix/mysql-virtual_alias_maps.cf',
|
||||
'chmod 0640 /etc/postfix/mysql-virtual_mailbox_domains.cf',
|
||||
'chmod 0640 /etc/postfix/mysql-virtual_mailbox_maps.cf',
|
||||
'chmod 0600 /etc/sasl2/smtpd.conf',
|
||||
),
|
||||
'files' => Array(
|
||||
'etc_postfix_main.cf' => '/etc/postfix/main.cf',
|
||||
'etc_postfix_master.cf' => '/etc/postfix/master.cf',
|
||||
'etc_postfix_mysql-virtual_alias_maps.cf' => '/etc/postfix/mysql-virtual_alias_maps.cf',
|
||||
'etc_postfix_mysql-virtual_mailbox_domains.cf' => '/etc/postfix/mysql-virtual_mailbox_domains.cf',
|
||||
'etc_postfix_mysql-virtual_mailbox_maps.cf' => '/etc/postfix/mysql-virtual_mailbox_maps.cf',
|
||||
'etc_sasl2_smtpd.conf' => '/etc/sasl2/smtpd.conf'
|
||||
),
|
||||
'restart' => Array(
|
||||
'rc-update add postfix default',
|
||||
'/etc/init.d/postfix restart'
|
||||
)
|
||||
),
|
||||
'dkim' => Array(
|
||||
'label' => 'DomainKey filter',
|
||||
'commands_1' => Array(
|
||||
'mkdir -p /etc/postfix/dkim'
|
||||
),
|
||||
'files' => Array(
|
||||
'dkim-filter.conf' => '/etc/postfix/dkim/dkim-filter.conf'
|
||||
),
|
||||
'commands_2' => Array(
|
||||
'chgrp postfix /etc/postfix/dkim/dkim-filter.conf',
|
||||
'echo "smtpd_milters = inet:localhost:8891\n
|
||||
milter_macro_daemon_name = SIGNING\n
|
||||
milter_default_action = accept\n" >> /etc/postfix/main.cf'
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/dkim-filter restart'
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
'mail' => Array(
|
||||
'label' => $lng['admin']['configfiles']['mail'],
|
||||
'daemons' => Array(
|
||||
'courier' => Array(
|
||||
'label' => 'Courier-IMAP (POP3/IMAP)',
|
||||
'files' => Array(
|
||||
'etc_courier_authlib_authdaemonrc' => '/etc/courier/authlib/authdaemonrc',
|
||||
'etc_courier_authlib_authmysqlrc' => '/etc/courier/authlib/authmysqlrc',
|
||||
'etc_courier-imap_pop3d' => '/etc/courier-imap/pop3d',
|
||||
'etc_courier-imap_imapd' => '/etc/courier-imap/imapd',
|
||||
'etc_courier-imap_pop3d-ssl' => '/etc/courier-imap/pop3d-ssl',
|
||||
'etc_courier-imap_imapd-ssl' => '/etc/courier-imap/imapd-ssl'
|
||||
),
|
||||
'commands' => Array(
|
||||
'rm /etc/courier/authlib/authdaemonrc',
|
||||
'rm /etc/courier/authlib/authmysqlrc',
|
||||
'rm /etc/courier-imap/pop3d',
|
||||
'rm /etc/courier-imap/imapd',
|
||||
'rm /etc/courier-imap/pop3d-ssl',
|
||||
'rm /etc/courier-imap/imapd-ssl',
|
||||
'touch /etc/courier/authlib/authdaemonrc',
|
||||
'touch /etc/courier/authlib/authmysqlrc',
|
||||
'touch /etc/courier-imap/pop3d',
|
||||
'touch /etc/courier-imap/imapd',
|
||||
'touch /etc/courier-imap/pop3d-ssl',
|
||||
'touch /etc/courier-imap/imapd-ssl',
|
||||
'chown root:0 /etc/courier/authlib/authdaemonrc',
|
||||
'chown root:0 /etc/courier/authlib/authmysqlrc',
|
||||
'chown root:0 /etc/courier-imap/pop3d',
|
||||
'chown root:0 /etc/courier-imap/imapd',
|
||||
'chown root:0 /etc/courier-imap/pop3d-ssl',
|
||||
'chown root:0 /etc/courier-imap/imapd-ssl',
|
||||
'chmod 0600 /etc/courier/authlib/authdaemonrc',
|
||||
'chmod 0600 /etc/courier/authlib/authmysqlrc',
|
||||
'chmod 0600 /etc/courier-imap/pop3d',
|
||||
'chmod 0600 /etc/courier-imap/imapd',
|
||||
'chmod 0600 /etc/courier-imap/pop3d-ssl',
|
||||
'chmod 0600 /etc/courier-imap/imapd-ssl'
|
||||
),
|
||||
'restart' => Array(
|
||||
'rc-update add courier-authlib default',
|
||||
'rc-update add courier-pop3d default',
|
||||
'rc-update add courier-imapd default',
|
||||
'/etc/init.d/courier-authlib restart',
|
||||
'/etc/init.d/courier-pop3d restart',
|
||||
'/etc/init.d/courier-imapd restart'
|
||||
)
|
||||
),
|
||||
'dovecot' => Array(
|
||||
'label' => 'Dovecot',
|
||||
'commands_1' => Array(
|
||||
'mv dovecot.conf dovecot.conf.gentoo',
|
||||
'mv dovecot-sql.conf dovecot-sql.conf.gentoo',
|
||||
'touch dovecot.conf',
|
||||
'touch dovecot-sql.conf',
|
||||
),
|
||||
'files' => Array(
|
||||
'etc_dovecot_dovecot.conf' => '/etc/dovecot/dovecot.conf',
|
||||
'etc_dovecot_dovecot-sql.conf' => '/etc/dovecot/dovecot-sql.conf'
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/dovecot restart'
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
'ftp' => Array(
|
||||
'label' => $lng['admin']['configfiles']['ftp'],
|
||||
'daemons' => Array(
|
||||
'proftpd' => Array(
|
||||
'label' => 'ProFTPd',
|
||||
'files' => Array(
|
||||
'etc_proftpd_proftpd.conf' => '/etc/proftpd/proftpd.conf'
|
||||
),
|
||||
'commands' => Array(
|
||||
'touch /etc/proftpd/proftpd.conf',
|
||||
'chown root:0 /etc/proftpd/proftpd.conf',
|
||||
'chmod 0600 /etc/proftpd/proftpd.conf'
|
||||
),
|
||||
'restart' => Array(
|
||||
'rc-update add proftpd default',
|
||||
'/etc/init.d/proftpd restart'
|
||||
)
|
||||
),
|
||||
)
|
||||
),
|
||||
'etc' => Array(
|
||||
'label' => $lng['admin']['configfiles']['etc'],
|
||||
'daemons' => Array(
|
||||
'cron' => Array(
|
||||
'label' => 'Crond (cronscript)',
|
||||
'files' => Array(
|
||||
'etc_php_syscp-cronjob_php.ini' => '/etc/php/syscp-cronjob/php.ini',
|
||||
'etc_cron.d_syscp' => '/etc/cron.d/syscp'
|
||||
),
|
||||
'commands' => Array(
|
||||
'touch /etc/cron.d/syscp',
|
||||
'chown root:0 /etc/cron.d/syscp',
|
||||
'chmod 0640 /etc/cron.d/syscp',
|
||||
'mkdir -p /etc/php/syscp-cronjob',
|
||||
'touch /etc/php/syscp-cronjob/php.ini',
|
||||
'chown -R root:0 /etc/php/syscp-cronjob',
|
||||
'chmod 0750 /etc/php/syscp-cronjob',
|
||||
'chmod 0640 /etc/php/syscp-cronjob/php.ini'
|
||||
),
|
||||
'restart' => Array(
|
||||
'rc-update add vixie-cron default',
|
||||
'/etc/init.d/vixie-cron restart'
|
||||
)
|
||||
),
|
||||
'xinetd' => Array(
|
||||
'label' => 'xinet.d (syscp updates in realtime)',
|
||||
'commands' => Array(
|
||||
'emerge -av xinetd',
|
||||
'echo -e "syscp ' . $settings['system']['realtime_port'] . '/tcp # SysCP Realtime" >> /etc/services'
|
||||
),
|
||||
'files' => Array(
|
||||
'etc_xinet.d_syscp' => '/etc/xinetd.d/syscp'
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/xinetd restart'
|
||||
)
|
||||
),
|
||||
'awstats' => Array(
|
||||
'label' => 'Awstats',
|
||||
'files' => Array(
|
||||
($settings['system']['mod_log_sql'] == 1 ? 'etc_awstats_awstats.model_log_sql.conf.syscp' : 'etc_awstats_awstats.model.conf.syscp') => '/etc/awstats/awstats.model.conf.syscp',
|
||||
($settings['system']['mod_log_sql'] == 1 ? 'etc_cron.d_awstats_log_sql' : 'etc_cron.d_awstats') => '/etc/cron.d/awstats',
|
||||
($settings['system']['webserver'] == 'lighttpd' ? 'etc_lighttpd_syscp-awstats.conf' : 'etc_apache_vhosts_05_awstats.conf') => ($settings['system']['webserver'] == 'lighttpd' ? '/etc/lighttpd/syscp-awstats.conf' : '/etc/apache2/sites-enabled/05_awstats.conf')
|
||||
),
|
||||
'commands' => Array(
|
||||
($settings['system']['webserver'] == 'lighttpd' ? 'echo "include \"syscp-awstats.conf\"" >> /etc/lighttpd/lighttpd.conf' : '')
|
||||
),
|
||||
'restart' => Array(
|
||||
($settings['system']['webserver'] == 'lighttpd' ? '/etc/init.d/lighttpd restart' : '/etc/init.d/apache2 restart')
|
||||
)
|
||||
),
|
||||
'libnss' => Array(
|
||||
'label' => 'libnss (system login with mysql)',
|
||||
'files' => Array(
|
||||
'etc_libnss-mysql.cfg' => '/etc/libnss-mysql.cfg',
|
||||
'etc_libnss-mysql-root.cfg' => '/etc/libnss-mysql-root.cfg',
|
||||
'etc_nsswitch.conf' => '/etc/nsswitch.conf',
|
||||
),
|
||||
'commands' => Array(
|
||||
'emerge -av libnss-mysql',
|
||||
'chmod 600 /etc/libnss-mysql.cfg /etc/libnss-mysql-root.cfg'
|
||||
),
|
||||
'restart' => Array(
|
||||
'rc-update add nscd default',
|
||||
'/etc/init.d/nscd restart'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
261
lib/configfiles/hardy.inc.php
Normal file
@@ -0,0 +1,261 @@
|
||||
<?php
|
||||
return Array(
|
||||
'ubuntu_hardy' => Array(
|
||||
'label' => 'Ubuntu 8.04 (Hardy)',
|
||||
'services' => Array(
|
||||
'http' => Array(
|
||||
'label' => $lng['admin']['configfiles']['http'],
|
||||
'daemons' => Array(
|
||||
'apache2' => Array(
|
||||
'label' => 'Apache 2',
|
||||
'commands' => Array(
|
||||
'mkdir -p ' . $settings['system']['documentroot_prefix'],
|
||||
'mkdir -p ' . $settings['system']['logfiles_directory'],
|
||||
'mkdir -p ' . $settings['system']['mod_fcgid_tmpdir'],
|
||||
'chmod 1777 ' . $settings['system']['mod_fcgid_tmpdir'],
|
||||
'a2dismod userdir',
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/apache2 restart'
|
||||
)
|
||||
),
|
||||
'lighttpd' => Array(
|
||||
'label' => 'Lighttpd Webserver',
|
||||
'commands_1' => Array(
|
||||
'apt-get install lighttpd',
|
||||
),
|
||||
'files' => Array(
|
||||
'etc_lighttpd.conf' => '/etc/lighttpd/lighttpd.conf',
|
||||
),
|
||||
'commands_2' => Array(
|
||||
$configcommand['vhost'],
|
||||
$configcommand['diroptions'],
|
||||
$configcommand['v_inclighty'],
|
||||
$configcommand['d_inclighty'],
|
||||
'mkdir -p ' . $settings['system']['documentroot_prefix'],
|
||||
'mkdir -p ' . $settings['system']['logfiles_directory'],
|
||||
'mkdir -p ' . $settings['system']['mod_fcgid_tmpdir'],
|
||||
'chmod 1777 ' . $settings['system']['mod_fcgid_tmpdir'],
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/lighttpd restart'
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
'dns' => Array(
|
||||
'label' => $lng['admin']['configfiles']['dns'],
|
||||
'daemons' => Array(
|
||||
'bind' => Array(
|
||||
'label' => 'Bind9',
|
||||
'commands' => Array(
|
||||
'echo "include \"' . $settings['system']['bindconf_directory'] . 'syscp_bind.conf\";" >> /etc/bind/named.conf',
|
||||
'touch ' . $settings['system']['bindconf_directory'] . 'syscp_bind.conf'
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/bind9 restart'
|
||||
)
|
||||
),
|
||||
'powerdns' => Array(
|
||||
'label' => 'PowerDNS',
|
||||
'files' => Array(
|
||||
'etc_powerdns_pdns.conf' => '/etc/powerdns/pdns.conf',
|
||||
'etc_powerdns_pdns-syscp.conf' => '/etc/powerdns/pdns_syscp.conf',
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/pdns restart'
|
||||
)
|
||||
),
|
||||
)
|
||||
),
|
||||
'smtp' => Array(
|
||||
'label' => $lng['admin']['configfiles']['smtp'],
|
||||
'daemons' => Array(
|
||||
'postfix' => Array(
|
||||
'label' => 'Postfix',
|
||||
'commands_1' => Array(
|
||||
'mkdir -p /etc/postfix/sasl',
|
||||
'mkdir -p /var/spool/postfix/etc/pam.d',
|
||||
'mkdir -p /var/spool/postfix/var/run/mysqld',
|
||||
'groupadd -g ' . $settings['system']['vmail_gid'] . ' vmail',
|
||||
'useradd -u ' . $settings['system']['vmail_uid'] . ' -g vmail vmail',
|
||||
'mkdir -p ' . $settings['system']['vmail_homedir'],
|
||||
'chown -R vmail:vmail ' . $settings['system']['vmail_homedir'],
|
||||
'mv /etc/postfix/main.cf /etc/postfix/main.cf.ubuntu',
|
||||
'touch /etc/postfix/main.cf',
|
||||
'touch /etc/postfix/mysql-virtual_alias_maps.cf',
|
||||
'touch /etc/postfix/mysql-virtual_mailbox_domains.cf',
|
||||
'touch /etc/postfix/mysql-virtual_mailbox_maps.cf',
|
||||
'touch /etc/postfix/sasl/smtpd.conf',
|
||||
'chown root:root /etc/postfix/main.cf',
|
||||
'chown root:root /etc/postfix/master.cf',
|
||||
'chown root:postfix /etc/postfix/mysql-virtual_alias_maps.cf',
|
||||
'chown root:postfix /etc/postfix/mysql-virtual_mailbox_domains.cf',
|
||||
'chown root:postfix /etc/postfix/mysql-virtual_mailbox_maps.cf',
|
||||
'chown root:root /etc/postfix/sasl/smtpd.conf',
|
||||
'chmod 0644 /etc/postfix/main.cf',
|
||||
'chmod 0644 /etc/postfix/master.cf',
|
||||
'chmod 0640 /etc/postfix/mysql-virtual_alias_maps.cf',
|
||||
'chmod 0640 /etc/postfix/mysql-virtual_mailbox_domains.cf',
|
||||
'chmod 0640 /etc/postfix/mysql-virtual_mailbox_maps.cf',
|
||||
'chmod 0600 /etc/postfix/sasl/smtpd.conf',
|
||||
),
|
||||
'files' => Array(
|
||||
'etc_postfix_main.cf' => '/etc/postfix/main.cf',
|
||||
'etc_postfix_master.cf' => '/etc/postfix/master.cf',
|
||||
'etc_postfix_mysql-virtual_alias_maps.cf' => '/etc/postfix/mysql-virtual_alias_maps.cf',
|
||||
'etc_postfix_mysql-virtual_mailbox_domains.cf' => '/etc/postfix/mysql-virtual_mailbox_domains.cf',
|
||||
'etc_postfix_mysql-virtual_mailbox_maps.cf' => '/etc/postfix/mysql-virtual_mailbox_maps.cf',
|
||||
'etc_postfix_sasl_smtpd.conf' => '/etc/postfix/sasl/smtpd.conf'
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/postfix restart',
|
||||
'newaliases'
|
||||
)
|
||||
),
|
||||
'exim4' => Array(
|
||||
'label' => 'Exim4',
|
||||
'commands_1' => Array(
|
||||
'dpkg-reconfigure exim4-config',
|
||||
'# choose "no configuration at this time" and "splitted configuration files" in the dialog'
|
||||
),
|
||||
'files' => Array(
|
||||
'etc_exim4_conf.d_acl_30_exim4-config_check_rcpt.rul' => '/etc/exim4/conf.d/acl/30_exim4-config_check_rcpt.rul',
|
||||
'etc_exim4_conf.d_auth_30_syscp-config' => '/etc/exim4/conf.d/auth/30_syscp-config',
|
||||
'etc_exim4_conf.d_main_10_syscp-config_options' => '/etc/exim4/conf.d/main/10_syscp-config_options',
|
||||
'etc_exim4_conf.d_router_180_syscp-config' => '/etc/exim4/conf.d/router/180_syscp-config',
|
||||
'etc_exim4_conf.d_transport_30_syscp-config' => '/etc/exim4/conf.d/transport/30_syscp-config'
|
||||
),
|
||||
'commands_2' => Array(
|
||||
'chmod o-rx /var/lib/exim4',
|
||||
'chmod o-rx /etc/exim4/conf.d/main/10_syscp-config_options'
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/exim4 restart'
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
'mail' => Array(
|
||||
'label' => $lng['admin']['configfiles']['mail'],
|
||||
'daemons' => Array(
|
||||
'courier' => Array(
|
||||
'label' => 'Courier',
|
||||
'files' => Array(
|
||||
'etc_courier_authdaemonrc' => '/etc/courier/authdaemonrc',
|
||||
'etc_courier_authmysqlrc' => '/etc/courier/authmysqlrc'
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/courier-authdaemon restart',
|
||||
'/etc/init.d/courier-pop restart'
|
||||
)
|
||||
),
|
||||
'dovecot' => Array(
|
||||
'label' => 'Dovecot',
|
||||
'commands' => Array(
|
||||
'/etc/init.d/dovecot stop',
|
||||
),
|
||||
'files' => Array(
|
||||
'etc_dovecot_dovecot.conf' => '/etc/dovecot/dovecot.conf',
|
||||
'etc_dovecot_dovecot-sql.conf' => '/etc/dovecot/dovecot-sql.conf'
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/dovecot restart'
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
'ftp' => Array(
|
||||
'label' => $lng['admin']['configfiles']['ftp'],
|
||||
'daemons' => Array(
|
||||
'proftpd' => Array(
|
||||
'label' => 'ProFTPd',
|
||||
'files' => Array(
|
||||
'etc_proftpd_modules.conf' => '/etc/proftpd/modules.conf',
|
||||
'etc_proftpd_proftpd.conf' => '/etc/proftpd/proftpd.conf'
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/proftpd restart'
|
||||
)
|
||||
),
|
||||
'pure-ftpd' => Array(
|
||||
'label' => 'Pure FTPd',
|
||||
'files' => Array(
|
||||
'etc_pure-ftpd_conf_MinUID' => '/etc/pure-ftpd/conf/MinUID',
|
||||
'etc_pure-ftpd_conf_MySQLConfigFile' => '/etc/pure-ftpd/conf/MySQLConfigFile',
|
||||
'etc_pure-ftpd_conf_NoAnonymous' => '/etc/pure-ftpd/conf/NoAnonymous',
|
||||
'etc_pure-ftpd_conf_MaxIdleTime' => '/etc/pure-ftpd/conf/MaxIdleTime',
|
||||
'etc_pure-ftpd_conf_ChrootEveryone' => '/etc/pure-ftpd/conf/ChrootEveryone',
|
||||
'etc_pure-ftpd_conf_PAMAuthentication' => '/etc/pure-ftpd/conf/PAMAuthentication',
|
||||
'etc_pure-ftpd_db_mysql.conf' => '/etc/pure-ftpd/db/mysql.conf',
|
||||
'etc_pure-ftpd_conf_CustomerProof' => '/etc/pure-ftpd/conf/CustomerProof',
|
||||
'etc_pure-ftpd_conf_Bind' => '/etc/pure-ftpd/conf/Bind',
|
||||
'etc_default_pure-ftpd-common' => '/etc/default/pure-ftpd-common'
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/pure-ftpd-mysql restart'
|
||||
)
|
||||
),
|
||||
)
|
||||
),
|
||||
'etc' => Array(
|
||||
'label' => $lng['admin']['configfiles']['etc'],
|
||||
'daemons' => Array(
|
||||
'cron' => Array(
|
||||
'label' => 'Crond (cronscript)',
|
||||
'files' => Array(
|
||||
'etc_cron.d_syscp' => '/etc/cron.d/syscp'
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/cron restart'
|
||||
)
|
||||
),
|
||||
'xinetd' => Array(
|
||||
'label' => 'xinet.d (syscp updates in realtime)',
|
||||
'commands' => Array(
|
||||
'apt-get install xinetd',
|
||||
'echo -e "syscp ' . $settings['system']['realtime_port'] . '/tcp # SysCP Realtime" >> /etc/services'
|
||||
),
|
||||
'files' => Array(
|
||||
'etc_xinet.d_syscp' => '/etc/xinetd.d/syscp'
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/xinetd restart'
|
||||
)
|
||||
),
|
||||
'awstats' => Array(
|
||||
'label' => 'Awstats',
|
||||
'files' => Array(
|
||||
($settings['system']['mod_log_sql'] == 1 ? 'etc_awstats_awstats.model_log_sql.conf.syscp' : 'etc_awstats_awstats.model.conf.syscp') => '/etc/awstats/awstats.model.conf.syscp',
|
||||
($settings['system']['mod_log_sql'] == 1 ? 'etc_cron.d_awstats_log_sql' : 'etc_cron.d_awstats') => '/etc/cron.d/awstats',
|
||||
($settings['system']['webserver'] == 'lighttpd' ? 'etc_lighttpd_syscp-awstats.conf' : 'etc_apache_vhosts_05_awstats.conf') => ($settings['system']['webserver'] == 'lighttpd' ? '/etc/lighttpd/syscp-awstats.conf' : '/etc/apache2/sites-enabled/05_awstats.conf')
|
||||
),
|
||||
'commands' => Array(
|
||||
($settings['system']['webserver'] == 'lighttpd' ? 'echo "include \"syscp-awstats.conf\"" >> /etc/lighttpd/lighttpd.conf' : '')
|
||||
),
|
||||
'restart' => Array(
|
||||
($settings['system']['webserver'] == 'lighttpd' ? '/etc/init.d/lighttpd restart' : '/etc/init.d/apache2 restart')
|
||||
)
|
||||
),
|
||||
'libnss' => Array(
|
||||
'label' => 'libnss (system login with mysql)',
|
||||
'commands' => Array(
|
||||
'apt-get install libnss-mysql nscd',
|
||||
'chmod 600 /etc/nss-mysql.conf /etc/nss-mysql-root.conf'
|
||||
),
|
||||
'files' => Array(
|
||||
'etc_nss-mysql.conf' => '/etc/nss-mysql.conf',
|
||||
'etc_nss-mysql-root.conf' => '/etc/nss-mysql-root.conf',
|
||||
'etc_nsswitch.conf' => '/etc/nsswitch.conf',
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/nscd restart'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
268
lib/configfiles/lenny.inc.php
Normal file
@@ -0,0 +1,268 @@
|
||||
<?php
|
||||
return Array(
|
||||
'debian_lenny' => Array(
|
||||
'label' => 'Debian 5.0 (Lenny)',
|
||||
'services' => Array(
|
||||
'http' => Array(
|
||||
'label' => $lng['admin']['configfiles']['http'],
|
||||
'daemons' => Array(
|
||||
'apache2' => Array(
|
||||
'label' => 'Apache 2',
|
||||
'commands' => Array(
|
||||
'mkdir -p ' . $settings['system']['documentroot_prefix'],
|
||||
'mkdir -p ' . $settings['system']['logfiles_directory'],
|
||||
'mkdir -p ' . $settings['system']['mod_fcgid_tmpdir'],
|
||||
'chmod 1777 ' . $settings['system']['mod_fcgid_tmpdir'],
|
||||
'a2dismod userdir',
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/apache2 restart'
|
||||
),
|
||||
),
|
||||
'lighttpd' => Array(
|
||||
'label' => 'Lighttpd Webserver',
|
||||
'commands_1' => Array(
|
||||
'apt-get install lighttpd',
|
||||
),
|
||||
'files' => Array(
|
||||
'etc_lighttpd.conf' => '/etc/lighttpd/lighttpd.conf',
|
||||
),
|
||||
'commands_2' => Array(
|
||||
$configcommand['vhost'],
|
||||
$configcommand['diroptions'],
|
||||
$configcommand['v_inclighty'],
|
||||
$configcommand['d_inclighty'],
|
||||
'mkdir -p ' . $settings['system']['documentroot_prefix'],
|
||||
'mkdir -p ' . $settings['system']['logfiles_directory'],
|
||||
'mkdir -p ' . $settings['system']['mod_fcgid_tmpdir'],
|
||||
'chmod 1777 ' . $settings['system']['mod_fcgid_tmpdir'],
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/lighttpd restart'
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
'dns' => Array(
|
||||
'label' => $lng['admin']['configfiles']['dns'],
|
||||
'daemons' => Array(
|
||||
'bind' => Array(
|
||||
'label' => 'Bind9',
|
||||
'commands' => Array(
|
||||
'apt-get install bind9',
|
||||
'echo "include \"' . $settings['system']['bindconf_directory'] . 'syscp_bind.conf\";" >> /etc/bind/named.conf',
|
||||
'touch ' . $settings['system']['bindconf_directory'] . 'syscp_bind.conf'
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/bind9 restart'
|
||||
)
|
||||
),
|
||||
'powerdns' => Array(
|
||||
'label' => 'PowerDNS',
|
||||
'files' => Array(
|
||||
'etc_powerdns_pdns.conf' => '/etc/powerdns/pdns.conf',
|
||||
'etc_powerdns_pdns-syscp.conf' => '/etc/powerdns/pdns_syscp.conf',
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/pdns restart'
|
||||
)
|
||||
),
|
||||
)
|
||||
),
|
||||
'smtp' => Array(
|
||||
'label' => $lng['admin']['configfiles']['smtp'],
|
||||
'daemons' => Array(
|
||||
'postfix' => Array(
|
||||
'label' => 'Postfix',
|
||||
'commands' => Array(
|
||||
'apt-get install postfix postfix-mysql libsasl2 libsasl2-modules libsasl2-modules-sql',
|
||||
'mkdir -p /etc/postfix/sasl',
|
||||
'mkdir -p /var/spool/postfix/etc/pam.d',
|
||||
'mkdir -p /var/spool/postfix/var/run/mysqld',
|
||||
'groupadd -g ' . $settings['system']['vmail_gid'] . ' vmail',
|
||||
'useradd -u ' . $settings['system']['vmail_uid'] . ' -g vmail vmail',
|
||||
'mkdir -p ' . $settings['system']['vmail_homedir'],
|
||||
'chown -R vmail:vmail ' . $settings['system']['vmail_homedir'],
|
||||
'touch /etc/postfix/mysql-virtual_alias_maps.cf',
|
||||
'touch /etc/postfix/mysql-virtual_mailbox_domains.cf',
|
||||
'touch /etc/postfix/mysql-virtual_mailbox_maps.cf',
|
||||
'touch /etc/postfix/sasl/smtpd.conf',
|
||||
'chown root:root /etc/postfix/main.cf',
|
||||
'chown root:root /etc/postfix/master.cf',
|
||||
'chown root:postfix /etc/postfix/mysql-virtual_alias_maps.cf',
|
||||
'chown root:postfix /etc/postfix/mysql-virtual_mailbox_domains.cf',
|
||||
'chown root:postfix /etc/postfix/mysql-virtual_mailbox_maps.cf',
|
||||
'chown root:root /etc/postfix/sasl/smtpd.conf',
|
||||
'chmod 0644 /etc/postfix/main.cf',
|
||||
'chmod 0644 /etc/postfix/master.cf',
|
||||
'chmod 0640 /etc/postfix/mysql-virtual_alias_maps.cf',
|
||||
'chmod 0640 /etc/postfix/mysql-virtual_mailbox_domains.cf',
|
||||
'chmod 0640 /etc/postfix/mysql-virtual_mailbox_maps.cf',
|
||||
'chmod 0600 /etc/postfix/sasl/smtpd.conf',
|
||||
),
|
||||
'files' => Array(
|
||||
'etc_postfix_main.cf' => '/etc/postfix/main.cf',
|
||||
'etc_postfix_master.cf' => '/etc/postfix/master.cf',
|
||||
'etc_postfix_mysql-virtual_alias_maps.cf' => '/etc/postfix/mysql-virtual_alias_maps.cf',
|
||||
'etc_postfix_mysql-virtual_mailbox_domains.cf' => '/etc/postfix/mysql-virtual_mailbox_domains.cf',
|
||||
'etc_postfix_mysql-virtual_mailbox_maps.cf' => '/etc/postfix/mysql-virtual_mailbox_maps.cf',
|
||||
'etc_postfix_sasl_smtpd.conf' => '/etc/postfix/sasl/smtpd.conf'
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/postfix restart',
|
||||
'newaliases'
|
||||
)
|
||||
),
|
||||
'exim4' => Array(
|
||||
'label' => 'Exim4',
|
||||
'commands_1' => Array(
|
||||
'dpkg-reconfigure exim4-config',
|
||||
'# choose "no configuration at this time" and "splitted configuration files" in the dialog'
|
||||
),
|
||||
'files' => Array(
|
||||
'etc_exim4_conf.d_acl_30_exim4-config_check_rcpt.rul' => '/etc/exim4/conf.d/acl/30_exim4-config_check_rcpt.rul',
|
||||
'etc_exim4_conf.d_auth_30_syscp-config' => '/etc/exim4/conf.d/auth/30_syscp-config',
|
||||
'etc_exim4_conf.d_main_10_syscp-config_options' => '/etc/exim4/conf.d/main/10_syscp-config_options',
|
||||
'etc_exim4_conf.d_router_180_syscp-config' => '/etc/exim4/conf.d/router/180_syscp-config',
|
||||
'etc_exim4_conf.d_transport_30_syscp-config' => '/etc/exim4/conf.d/transport/30_syscp-config'
|
||||
),
|
||||
'commands_2' => Array(
|
||||
'chmod o-rx /var/lib/exim4',
|
||||
'chmod o-rx /etc/exim4/conf.d/main/10_syscp-config_options'
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/exim4 restart'
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
'mail' => Array(
|
||||
'label' => $lng['admin']['configfiles']['mail'],
|
||||
'daemons' => Array(
|
||||
'courier' => Array(
|
||||
'label' => 'Courier',
|
||||
'commands' => Array(
|
||||
'apt-get install courier-pop courier-imap courier-authlib-mysql'
|
||||
),
|
||||
'files' => Array(
|
||||
'etc_courier_authdaemonrc' => '/etc/courier/authdaemonrc',
|
||||
'etc_courier_authmysqlrc' => '/etc/courier/authmysqlrc'
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/courier-authdaemon restart',
|
||||
'/etc/init.d/courier-pop restart'
|
||||
)
|
||||
),
|
||||
'dovecot' => Array(
|
||||
'label' => 'Dovecot',
|
||||
'commands' => Array(
|
||||
'apt-get install dovecot-imapd dovecot-pop3d'
|
||||
),
|
||||
'files' => Array(
|
||||
'etc_dovecot_dovecot.conf' => '/etc/dovecot/dovecot.conf',
|
||||
'etc_dovecot_dovecot-sql.conf' => '/etc/dovecot/dovecot-sql.conf'
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/dovecot restart'
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
'ftp' => Array(
|
||||
'label' => $lng['admin']['configfiles']['ftp'],
|
||||
'daemons' => Array(
|
||||
'proftpd' => Array(
|
||||
'label' => 'ProFTPd',
|
||||
'files' => Array(
|
||||
'etc_proftpd_sql.conf' => '/etc/proftpd/sql.conf',
|
||||
'etc_proftpd_modules.conf' => '/etc/proftpd/modules.conf',
|
||||
'etc_proftpd_proftpd.conf' => '/etc/proftpd/proftpd.conf'
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/proftpd restart'
|
||||
)
|
||||
),
|
||||
'pure-ftpd' => Array(
|
||||
'label' => 'Pure FTPd',
|
||||
'commands' => Array(
|
||||
'apt-get install pure-ftpd-common pure-ftpd-mysql'
|
||||
),
|
||||
'files' => Array(
|
||||
'etc_pure-ftpd_conf_MinUID' => '/etc/pure-ftpd/conf/MinUID',
|
||||
'etc_pure-ftpd_conf_MySQLConfigFile' => '/etc/pure-ftpd/conf/MySQLConfigFile',
|
||||
'etc_pure-ftpd_conf_NoAnonymous' => '/etc/pure-ftpd/conf/NoAnonymous',
|
||||
'etc_pure-ftpd_conf_MaxIdleTime' => '/etc/pure-ftpd/conf/MaxIdleTime',
|
||||
'etc_pure-ftpd_conf_ChrootEveryone' => '/etc/pure-ftpd/conf/ChrootEveryone',
|
||||
'etc_pure-ftpd_conf_PAMAuthentication' => '/etc/pure-ftpd/conf/PAMAuthentication',
|
||||
'etc_pure-ftpd_db_mysql.conf' => '/etc/pure-ftpd/db/mysql.conf',
|
||||
'etc_pure-ftpd_conf_CustomerProof' => '/etc/pure-ftpd/conf/CustomerProof',
|
||||
'etc_pure-ftpd_conf_Bind' => '/etc/pure-ftpd/conf/Bind',
|
||||
'etc_default_pure-ftpd-common' => '/etc/default/pure-ftpd-common'
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/pure-ftpd-mysql restart'
|
||||
)
|
||||
),
|
||||
)
|
||||
),
|
||||
'etc' => Array(
|
||||
'label' => $lng['admin']['configfiles']['etc'],
|
||||
'daemons' => Array(
|
||||
'cron' => Array(
|
||||
'label' => 'Crond (cronscript)',
|
||||
'files' => Array(
|
||||
'etc_cron.d_syscp' => '/etc/cron.d/syscp'
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/cron restart'
|
||||
)
|
||||
),
|
||||
'xinetd' => Array(
|
||||
'label' => 'xinet.d (syscp updates in realtime)',
|
||||
'commands' => Array(
|
||||
'apt-get install xinetd',
|
||||
'echo -e "syscp ' . $settings['system']['realtime_port'] . '/tcp # SysCP Realtime" >> /etc/services'
|
||||
),
|
||||
'files' => Array(
|
||||
'etc_xinet.d_syscp' => '/etc/xinetd.d/syscp'
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/xinetd restart'
|
||||
)
|
||||
),
|
||||
'awstats' => Array(
|
||||
'label' => 'Awstats',
|
||||
'files' => Array(
|
||||
($settings['system']['mod_log_sql'] == 1 ? 'etc_awstats_awstats.model_log_sql.conf.syscp' : 'etc_awstats_awstats.model.conf.syscp') => '/etc/awstats/awstats.model.conf.syscp',
|
||||
($settings['system']['mod_log_sql'] == 1 ? 'etc_cron.d_awstats_log_sql' : 'etc_cron.d_awstats') => '/etc/cron.d/awstats',
|
||||
($settings['system']['webserver'] == 'lighttpd' ? 'etc_lighttpd_syscp-awstats.conf' : 'etc_apache_vhosts_05_awstats.conf') => ($settings['system']['webserver'] == 'lighttpd' ? '/etc/lighttpd/syscp-awstats.conf' : '/etc/apache2/sites-enabled/05_awstats.conf')
|
||||
),
|
||||
'commands' => Array(
|
||||
($settings['system']['webserver'] == 'lighttpd' ? 'echo "include \"syscp-awstats.conf\"" >> /etc/lighttpd/lighttpd.conf' : '')
|
||||
),
|
||||
'restart' => Array(
|
||||
($settings['system']['webserver'] == 'lighttpd' ? '/etc/init.d/lighttpd restart' : '/etc/init.d/apache2 restart')
|
||||
)
|
||||
),
|
||||
'libnss' => Array(
|
||||
'label' => 'libnss (system login with mysql)',
|
||||
'commands' => Array(
|
||||
'apt-get install libnss-mysql nscd',
|
||||
'chmod 600 /etc/nss-mysql.conf /etc/nss-mysql-root.conf'
|
||||
),
|
||||
'files' => Array(
|
||||
'etc_nss-mysql.conf' => '/etc/nss-mysql.conf',
|
||||
'etc_nss-mysql-root.conf' => '/etc/nss-mysql-root.conf',
|
||||
'etc_nsswitch.conf' => '/etc/nsswitch.conf',
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/nscd restart'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
139
lib/configfiles/suse10.inc.php
Normal file
@@ -0,0 +1,139 @@
|
||||
<?php
|
||||
return Array(
|
||||
'suse_linux_10_0' => Array(
|
||||
'label' => 'SUSE Linux 10.0',
|
||||
'services' => Array(
|
||||
'http' => Array(
|
||||
'label' => $lng['admin']['configfiles']['http'],
|
||||
'daemons' => Array(
|
||||
'apache' => Array(
|
||||
'label' => 'Apache',
|
||||
'commands' => Array(
|
||||
$configcommand['vhost'],
|
||||
$configcommand['diroptions'],
|
||||
$configcommand['include'],
|
||||
'mkdir -p ' . $settings['system']['documentroot_prefix'],
|
||||
'mkdir -p ' . $settings['system']['logfiles_directory']
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/apache2 restart'
|
||||
)
|
||||
),
|
||||
)
|
||||
),
|
||||
'dns' => Array(
|
||||
'label' => $lng['admin']['configfiles']['dns'],
|
||||
'daemons' => Array(
|
||||
'bind' => Array(
|
||||
'label' => 'Bind9',
|
||||
'commands' => Array(
|
||||
'echo "include \"' . $settings['system']['bindconf_directory'] . 'syscp_bind.conf\";" >> /etc/named.conf',
|
||||
'touch ' . $settings['system']['bindconf_directory'] . 'syscp_bind.conf'
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/named restart'
|
||||
)
|
||||
),
|
||||
)
|
||||
),
|
||||
'smtp' => Array(
|
||||
'label' => $lng['admin']['configfiles']['smtp'],
|
||||
'daemons' => Array(
|
||||
'postfix' => Array(
|
||||
'label' => 'Postfix',
|
||||
'files' => Array(
|
||||
'etc_postfix_main.cf' => '/etc/postfix/main.cf',
|
||||
'etc_postfix_mysql-virtual_alias_maps.cf' => '/etc/postfix/mysql-virtual_alias_maps.cf',
|
||||
'etc_postfix_mysql-virtual_mailbox_domains.cf' => '/etc/postfix/mysql-virtual_mailbox_domains.cf',
|
||||
'etc_postfix_mysql-virtual_mailbox_maps.cf' => '/etc/postfix/mysql-virtual_mailbox_maps.cf',
|
||||
'usr_lib_sasl2_smtpd.conf' => '/usr/lib/sasl2/smtpd.conf'
|
||||
),
|
||||
'commands' => Array(
|
||||
'mkdir -p /var/spool/postfix/etc/pam.d',
|
||||
'groupadd -g ' . $settings['system']['vmail_gid'] . ' vmail',
|
||||
'useradd -u ' . $settings['system']['vmail_uid'] . ' -g vmail vmail',
|
||||
'mkdir -p ' . $settings['system']['vmail_homedir'],
|
||||
'chown -R vmail:vmail ' . $settings['system']['vmail_homedir'],
|
||||
'touch /etc/postfix/mysql-virtual_alias_maps.cf',
|
||||
'touch /etc/postfix/mysql-virtual_mailbox_domains.cf',
|
||||
'touch /etc/postfix/mysql-virtual_mailbox_maps.cf',
|
||||
'touch /usr/lib/sasl2/smtpd.conf',
|
||||
'chmod 660 /etc/postfix/mysql-virtual_alias_maps.cf',
|
||||
'chmod 660 /etc/postfix/mysql-virtual_mailbox_domains.cf',
|
||||
'chmod 660 /etc/postfix/mysql-virtual_mailbox_maps.cf',
|
||||
'chmod 660 /usr/lib/sasl2/smtpd.conf',
|
||||
'chgrp postfix /etc/postfix/mysql-virtual_alias_maps.cf',
|
||||
'chgrp postfix /etc/postfix/mysql-virtual_mailbox_domains.cf',
|
||||
'chgrp postfix /etc/postfix/mysql-virtual_mailbox_maps.cf',
|
||||
'chgrp postfix /usr/lib/sasl2/smtpd.conf'
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/postfix restart'
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
'mail' => Array(
|
||||
'label' => $lng['admin']['configfiles']['mail'],
|
||||
'daemons' => Array(
|
||||
'courier' => Array(
|
||||
'label' => 'Courier',
|
||||
'files' => Array(
|
||||
'etc_authlib_authdaemonrc' => '/etc/authlib/authdaemonrc',
|
||||
'etc_authlib_authmysqlrc' => '/etc/authlib/authmysqlrc'
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/courier-authdaemon restart',
|
||||
'/etc/init.d/courier-pop restart'
|
||||
)
|
||||
),
|
||||
)
|
||||
),
|
||||
'ftp' => Array(
|
||||
'label' => $lng['admin']['configfiles']['ftp'],
|
||||
'daemons' => Array(
|
||||
'proftpd' => Array(
|
||||
'label' => 'ProFTPd',
|
||||
'files' => Array(
|
||||
'etc_proftpd_modules.conf' => '/etc/proftpd/modules.conf',
|
||||
'etc_proftpd_proftpd.conf' => '/etc/proftpd/proftpd.conf'
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/proftpd restart'
|
||||
)
|
||||
),
|
||||
)
|
||||
),
|
||||
'etc' => Array(
|
||||
'label' => $lng['admin']['configfiles']['etc'],
|
||||
'daemons' => Array(
|
||||
'cron' => Array(
|
||||
'label' => 'Crond (cronscript)',
|
||||
'files' => Array(
|
||||
'etc_cron.d_syscp' => '/etc/cron.d/syscp'
|
||||
),
|
||||
'restart' => Array(
|
||||
'/etc/init.d/cron restart'
|
||||
)
|
||||
),
|
||||
'awstats' => Array(
|
||||
'label' => 'Awstats',
|
||||
'files' => Array(
|
||||
($settings['system']['mod_log_sql'] == 1 ? 'etc_awstats_awstats.model_log_sql.conf.syscp' : 'etc_awstats_awstats.model.conf.syscp') => '/etc/awstats/awstats.model.conf.syscp',
|
||||
($settings['system']['mod_log_sql'] == 1 ? 'etc_cron.d_awstats_log_sql' : 'etc_cron.d_awstats') => '/etc/cron.d/awstats',
|
||||
($settings['system']['webserver'] == 'lighttpd' ? 'etc_lighttpd_syscp-awstats.conf' : 'etc_apache_vhosts_05_awstats.conf') => ($settings['system']['webserver'] == 'lighttpd' ? '/etc/lighttpd/syscp-awstats.conf' : '/etc/apache2/sites-enabled/05_awstats.conf')
|
||||
),
|
||||
'commands' => Array(
|
||||
($settings['system']['webserver'] == 'lighttpd' ? 'echo "include \"syscp-awstats.conf\"" >> /etc/lighttpd/lighttpd.conf' : '')
|
||||
),
|
||||
'restart' => Array(
|
||||
($settings['system']['webserver'] == 'lighttpd' ? '/etc/init.d/lighttpd restart' : '/etc/init.d/apache2 restart')
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
48
lib/configfiles_index.inc.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
* @version $Id: configfiles_index.inc.php 2692 2009-03-27 18:04:47Z flo $
|
||||
*/
|
||||
|
||||
$configcommand = array();
|
||||
|
||||
if(isConfigDir($settings['system']['apacheconf_vhost']))
|
||||
{
|
||||
$configcommand['vhost'] = 'mkdir -p ' . $settings['system']['apacheconf_vhost'];
|
||||
$configcommand['include'] = 'echo -e "\\nInclude ' . makeCorrectDir($settings['system']['apacheconf_vhost']) . '*.conf" >> ' . makeCorrectFile(makeCorrectDir($settings['system']['apacheconf_vhost']) . '/httpd.conf');
|
||||
$configcommand['v_inclighty'] = 'echo -e \'\\ninclude_shell "find ' . makeCorrectDir($settings['system']['apacheconf_vhost']) . ' -maxdepth 1 -name \'*.conf\' -exec cat {} \;"\' >> /etc/lighttpd/lighttpd.conf';
|
||||
}
|
||||
else
|
||||
{
|
||||
$configcommand['vhost'] = 'touch ' . $settings['system']['apacheconf_vhost'];
|
||||
$configcommand['include'] = 'echo -e "\\nInclude ' . $settings['system']['apacheconf_vhost'] . '" >> ' . makeCorrectFile(dirname($settings['system']['apacheconf_vhost']) . '/httpd.conf');
|
||||
$configcommand['v_inclighty'] = 'echo -e \'\\ninclude "' . $settings['system']['apacheconf_vhost'] . '"\' >> /etc/lighttpd/lighttpd.conf';
|
||||
}
|
||||
|
||||
if(isConfigDir($settings['system']['apacheconf_diroptions']))
|
||||
{
|
||||
$configcommand['diroptions'] = 'mkdir -p ' . $settings['system']['apacheconf_diroptions'];
|
||||
$configcommand['d_inclighty'] = 'echo -e \'\\ninclude_shell "find ' . makeCorrectDir($settings['system']['apacheconf_diroptions']) . ' -maxdepth 1 -name \'*.conf\' -exec cat {} \;"\' >> /etc/lighttpd/lighttpd.conf';
|
||||
}
|
||||
else
|
||||
{
|
||||
$configcommand['diroptions'] = 'touch ' . $settings['system']['apacheconf_diroptions'];
|
||||
$configcommand['d_inclighty'] = 'echo -e \'\\ninclude "' . $settings['system']['apacheconf_diroptions'] . '"\' >> /etc/lighttpd/lighttpd.conf';
|
||||
}
|
||||
|
||||
$cfgPath = 'lib/configfiles/';
|
||||
$configfiles = Array();
|
||||
$configfiles = array_merge(include $cfgPath . 'lenny.inc.php', include $cfgPath . 'etch.inc.php', include $cfgPath . 'hardy.inc.php', include $cfgPath . 'gentoo.inc.php', include $cfgPath . 'suse10.inc.php');
|
||||
|
||||
?>
|
||||
248
lib/cron_init.php
Normal file
@@ -0,0 +1,248 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @author Florian Aders <eleras@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package System
|
||||
* @version $Id: cron_init.php 2724 2009-06-07 14:18:02Z flo $
|
||||
*/
|
||||
|
||||
if(@php_sapi_name() != 'cli'
|
||||
&& @php_sapi_name() != 'cgi'
|
||||
&& @php_sapi_name() != 'cgi-fcgi')
|
||||
{
|
||||
die('This script will only work in the shell.');
|
||||
}
|
||||
|
||||
$cronscriptDebug = false;
|
||||
$lockdir = '/var/run/';
|
||||
$lockFilename = 'syscp_' . basename($_SERVER['PHP_SELF'], '.php') . '.lock-';
|
||||
$lockfName = $lockFilename . getmypid();
|
||||
$lockfile = $lockdir . $lockfName;
|
||||
|
||||
// guess the syscp installation path
|
||||
// normally you should not need to modify this script anymore, if your
|
||||
// syscp installation isn't in /var/www/syscp
|
||||
|
||||
$pathtophpfiles = dirname(dirname(__FILE__));
|
||||
|
||||
// should the syscp installation guessing not work correctly,
|
||||
// uncomment the following line, and put your path in there!
|
||||
//$pathtophpfiles = '/var/www/syscp/';
|
||||
// create and open the lockfile!
|
||||
|
||||
$keepLockFile = false;
|
||||
$debugHandler = fopen($lockfile, 'w');
|
||||
fwrite($debugHandler, 'Setting Lockfile to ' . $lockfile . "\n");
|
||||
fwrite($debugHandler, 'Setting SysCP installation path to ' . $pathtophpfiles . "\n");
|
||||
|
||||
// open the lockfile directory and scan for existing lockfiles
|
||||
|
||||
$lockDirHandle = opendir($lockdir);
|
||||
|
||||
while($fName = readdir($lockDirHandle))
|
||||
{
|
||||
if($lockFilename == substr($fName, 0, strlen($lockFilename))
|
||||
&& $lockfName != $fName)
|
||||
{
|
||||
// Check if last run jailed out with an exception
|
||||
|
||||
$croncontent = file($lockdir . $fName);
|
||||
$lastline = $croncontent[(count($croncontent) - 1)];
|
||||
|
||||
if($lastline == '=== Keep lockfile because of exception ===')
|
||||
{
|
||||
fclose($debugHandler);
|
||||
unlink($lockfile);
|
||||
die('Last cron jailed out with an exception. Exiting...' . "\n" . 'Take a look into the contents of ' . $lockdir . $fName . '* for more information!' . "\n");
|
||||
}
|
||||
|
||||
// Check if cron is running or has died.
|
||||
|
||||
$check_pid = substr(strstr($fName, "-"), 1);
|
||||
system("kill -CHLD " . $check_pid . " 1> /dev/null 2> /dev/null", $check_pid_return);
|
||||
|
||||
if($check_pid_return == 1)
|
||||
{
|
||||
// Result: Existing lockfile/pid isnt running
|
||||
// Most likely it has died
|
||||
//
|
||||
// Action: Remove it and continue
|
||||
//
|
||||
|
||||
fwrite($debugHandler, 'Previous cronjob didn\'t exit clean. PID: ' . $check_pid . "\n");
|
||||
fwrite($debugHandler, 'Removing lockfile: ' . $lockdir . $fName . "\n");
|
||||
unlink($lockdir . $fName);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Result: A Cronscript with this pid
|
||||
// is still running
|
||||
// Action: remove my own Lock and die
|
||||
//
|
||||
// close the current lockfile
|
||||
|
||||
fclose($debugHandler);
|
||||
|
||||
// ... and delete it
|
||||
|
||||
unlink($lockfile);
|
||||
die('There is already a Cronjob in progress. Exiting...' . "\n" . 'Take a look into the contents of ' . $lockdir . $lockFilename . '* for more information!' . "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Includes the Usersettings eg. MySQL-Username/Passwort etc.
|
||||
*/
|
||||
|
||||
require ($pathtophpfiles . '/lib/userdata.inc.php');
|
||||
fwrite($debugHandler, 'Userdatas included' . "\n");
|
||||
|
||||
// Legacy sql-root-information
|
||||
if(isset($sql['root_user']) && isset($sql['root_password']) && (!isset($sql_root) || !is_array($sql_root)))
|
||||
{
|
||||
$sql_root = array(0 => array('caption' => 'Default', 'host' => $sql['host'], 'user' => $sql['root_user'], 'password' => $sql['root_password']));
|
||||
unset($sql['root_user']);
|
||||
unset($sql['root_password']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Includes the Functions
|
||||
*/
|
||||
|
||||
require ($pathtophpfiles . '/lib/functions.php');
|
||||
|
||||
/**
|
||||
* Includes the MySQL-Tabledefinitions etc.
|
||||
*/
|
||||
|
||||
require ($pathtophpfiles . '/lib/tables.inc.php');
|
||||
fwrite($debugHandler, 'Table definitions included' . "\n");
|
||||
|
||||
/**
|
||||
* Includes the MySQL-Connection-Class
|
||||
*/
|
||||
|
||||
fwrite($debugHandler, 'Database Class has been loaded' . "\n");
|
||||
$db = new db($sql['host'], $sql['user'], $sql['password'], $sql['db']);
|
||||
|
||||
// If one cronscript needs root, it should say $needrootdb = true before the include
|
||||
/*
|
||||
if(isset($needrootdb)
|
||||
&& $needrootdb === true)
|
||||
{
|
||||
$db_root = new db($sql['host'], $sql['root_user'], $sql['root_password'], '');
|
||||
|
||||
if($db_root->link_id == 0)
|
||||
{
|
||||
/**
|
||||
* Do not proceed further if no database connection could be established
|
||||
*
|
||||
|
||||
fclose($debugHandler);
|
||||
unlink($lockfile);
|
||||
die('root can\'t connect to mysqlserver. Please check userdata.inc.php! Exiting...');
|
||||
}
|
||||
|
||||
unset($db_root->password);
|
||||
fwrite($debugHandler, 'Database-rootconnection established' . "\n");
|
||||
}*/
|
||||
|
||||
unset($sql['root_user'], $sql['root_password']);
|
||||
|
||||
if($db->link_id == 0)
|
||||
{
|
||||
/**
|
||||
* Do not proceed further if no database connection could be established
|
||||
*/
|
||||
|
||||
fclose($debugHandler);
|
||||
unlink($lockfile);
|
||||
die('SysCP can\'t connect to mysqlserver. Please check userdata.inc.php! Exiting...');
|
||||
}
|
||||
|
||||
fwrite($debugHandler, 'Database-connection established' . "\n");
|
||||
unset($sql);
|
||||
unset($db->password);
|
||||
$result = $db->query("SELECT `settingid`, `settinggroup`, `varname`, `value` FROM `" . TABLE_PANEL_SETTINGS . "`");
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
$settings[$row['settinggroup']][$row['varname']] = $row['value'];
|
||||
}
|
||||
|
||||
unset($row);
|
||||
unset($result);
|
||||
fwrite($debugHandler, 'SysCP Settings has been loaded from the database' . "\n");
|
||||
|
||||
if(!isset($settings['system']['dbversion'])
|
||||
|| $settings['system']['dbversion'] != $dbversion)
|
||||
{
|
||||
/**
|
||||
* Do not proceed further if the Database version is not the same as the script version
|
||||
*/
|
||||
|
||||
fclose($debugHandler);
|
||||
unlink($lockfile);
|
||||
die('Version of File doesnt match Version of Database. Exiting...');
|
||||
}
|
||||
|
||||
fwrite($debugHandler, 'SysCP Version and Database Version are correct' . "\n");
|
||||
|
||||
$cronbasedir = makeCorrectDir($pathtophpfiles . '/scripts/');
|
||||
$crondir = new DirectoryIterator($cronbasedir);
|
||||
$cronfilename = basename($_SERVER['PHP_SELF'], '.php');
|
||||
$cronscriptFullName = makeCorrectFile($cronbasedir . basename($_SERVER['PHP_SELF']));
|
||||
$inc_crons = array();
|
||||
foreach($crondir as $file)
|
||||
{
|
||||
if(!$file->isDot()
|
||||
&& !$file->isDir()
|
||||
&& preg_match("/^" . $cronfilename . "\.inc\.(.*)\.php$/D", $file->getFilename()))
|
||||
{
|
||||
if(fileowner($cronscriptFullName) == $file->getOwner()
|
||||
&& filegroup($cronscriptFullName) == $file->getGroup()
|
||||
&& $file->isReadable())
|
||||
{
|
||||
$inc_crons[] = $file->getPathname();
|
||||
}
|
||||
else
|
||||
{
|
||||
fwrite($debugHandler, 'WARNING! uid and/or gid of "' . $cronscriptFullName . '" and "' . $file->getPathname() . '" don\'t match! Execution aborted!' . "\n");
|
||||
fclose($debugHandler);
|
||||
die('WARNING! uid and/or gid of "' . $cronscriptFullName . '" and "' . $file->getPathname() . '" don\'t match! Execution aborted!');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($inc_crons[0]))
|
||||
{
|
||||
natsort($inc_crons);
|
||||
foreach($inc_crons as $cfile)
|
||||
{
|
||||
fwrite($debugHandler, 'Including ...' . $cfile . "\n");
|
||||
include_once ($cfile);
|
||||
}
|
||||
}
|
||||
|
||||
unset($file, $crondir, $cronname, $cronscriptFullName, $cronfilename, $cronbasedir);
|
||||
fwrite($debugHandler, 'Functions have been included' . "\n");
|
||||
|
||||
/**
|
||||
* Initialize logging
|
||||
*/
|
||||
|
||||
$cronlog = SysCPLogger::getInstanceOf(array('loginname' => 'cronjob'), $db, $settings);
|
||||
fwrite($debugHandler, 'Logger has been included' . "\n");
|
||||
|
||||
?>
|
||||
46
lib/cron_shutdown.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @author Florian Aders <eleras@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package System
|
||||
* @version $Id: cron_shutdown.php 2692 2009-03-27 18:04:47Z flo $
|
||||
*/
|
||||
|
||||
if($settings['logger']['log_cron'] == '1')
|
||||
{
|
||||
$cronlog->setCronLog(0);
|
||||
fwrite($debugHandler, 'Logging for cron has been shutdown' . "\n");
|
||||
}
|
||||
|
||||
$db->close();
|
||||
fwrite($debugHandler, 'Closing database connection' . "\n");
|
||||
|
||||
if(isset($db_root))
|
||||
{
|
||||
$db_root->close();
|
||||
fwrite($debugHandler, 'Closing database rootconnection' . "\n");
|
||||
}
|
||||
|
||||
if($keepLockFile === true)
|
||||
{
|
||||
fwrite($debugHandler, '=== Keep lockfile because of exception ===');
|
||||
}
|
||||
|
||||
fclose($debugHandler);
|
||||
|
||||
if($keepLockFile === false
|
||||
&& $cronscriptDebug === false)
|
||||
{
|
||||
unlink($lockfile);
|
||||
}
|
||||
|
||||
76
lib/functions.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
* @version $Id: functions.php 2724 2009-06-07 14:18:02Z flo $
|
||||
*/
|
||||
|
||||
$libdirname = dirname(__FILE__);
|
||||
|
||||
includeFunctions($libdirname . '/functions/');
|
||||
|
||||
function includeFunctions($dirname)
|
||||
{
|
||||
$dirhandle = opendir($dirname);
|
||||
while(false !== ($filename = readdir($dirhandle)))
|
||||
{
|
||||
if($filename != '.' && $filename != '..' && $filename != '')
|
||||
{
|
||||
if((substr($filename, 0, 9) == 'function.' || substr($filename, 0, 9) == 'constant.') && substr($filename, -4 ) == '.php')
|
||||
{
|
||||
include($dirname . $filename);
|
||||
}
|
||||
|
||||
if(is_dir($dirname . $filename))
|
||||
{
|
||||
includeFunctions($dirname . $filename . '/');
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dirhandle);
|
||||
}
|
||||
|
||||
function __autoload($classname)
|
||||
{
|
||||
global $libdirname;
|
||||
findIncludeClass($libdirname . '/classes/', $classname);
|
||||
}
|
||||
|
||||
function findIncludeClass($dirname, $classname)
|
||||
{
|
||||
$dirhandle = opendir($dirname);
|
||||
while(false !== ($filename = readdir($dirhandle)))
|
||||
{
|
||||
if($filename != '.' && $filename != '..' && $filename != '')
|
||||
{
|
||||
if($filename == 'class.' . $classname . '.php' || $filename == 'abstract.' . $classname . '.php')
|
||||
{
|
||||
include($dirname . $filename);
|
||||
return;
|
||||
}
|
||||
|
||||
if(is_dir($dirname . $filename))
|
||||
{
|
||||
findIncludeClass($dirname . $filename . '/', $classname);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dirhandle);
|
||||
}
|
||||
|
||||
|
||||
function exportDetails($fielddata, $newfieldvalue)
|
||||
{
|
||||
print_r($newfieldvalue);
|
||||
}
|
||||
|
||||
42
lib/functions/aps/function.storeSettingApsPhpExtensions.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the SysCP project.
|
||||
* Copyright (c) 2003-2009 the SysCP 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.syscp.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
* @version $Id: function.storeSettingApsPhpExtensions.php 2724 2009-06-07 14:18:02Z flo $
|
||||
*/
|
||||
|
||||
function storeSettingApsPhpExtensions($fieldname, $fielddata, $newfieldvalue)
|
||||
{
|
||||
$returnvalue = storeSettingField($fieldname, $fielddata, $newfieldvalue);
|
||||
|
||||
if($returnvalue !== false && is_array($fielddata) && isset($fielddata['settinggroup']) && $fielddata['settinggroup'] == 'aps' && isset($fielddata['varname']) && $fielddata['varname'] == 'php-extension')
|
||||
{
|
||||
$newfieldvalue_array = explode(',', $newfieldvalue);
|
||||
|
||||
if(in_array('mcrypt', $newfieldvalue_array))
|
||||
{
|
||||
$functions = 'mcrypt_encrypt,mcrypt_decrypt';
|
||||
}
|
||||
else
|
||||
{
|
||||
$functions = '';
|
||||
}
|
||||
|
||||
if($functions != getSetting('aps', 'php-function'))
|
||||
{
|
||||
saveSetting('aps', 'php-function', $functions);
|
||||
}
|
||||
}
|
||||
|
||||
return $returnvalue;
|
||||
}
|
||||