initial import

This commit is contained in:
Sebijk 2022-02-06 14:27:29 +01:00
commit b07a8a8de5
1665 changed files with 249089 additions and 0 deletions

8
AUTHORS Normal file
View file

@ -0,0 +1,8 @@
# This is the list of b1gMail's significant contributors.
#
# This does not necessarily list everyone who has contributed code,
# especially since many employees of one corporation may be contributing.
# To see the full list of contributors, see the revision history in
# source control.
Patrick Schlangen <patrick@schlangen.me>

340
LICENSE Normal file
View file

@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 Lesser 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
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 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.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

51
README.md Normal file
View file

@ -0,0 +1,51 @@
<div align="center">
<a href="https://www.b1gmail.eu">
<img width="200" height="200" src="https://www.b1gmail.eu/b1gmaillogo.png">
</a>
<br>
<h1>b1gMail 7.4 OpenSource version</h1>
<br>
<p>
Email for your website, Modern user interface, Easy to administrate
</p>
<br>
</div>
## About b1gMail
A big thanks goes to b1gMail founder Patrick Schlangen. He released b1gMail as freeware back then and since version 6 it was commercial. With version 7.4.1 the license is changed to GPL and all proprietary components were removed.
## Getting started
It is recommended to install the b1gMail developer copy on a local web server,
e.g. standard Apache/PHP/MySQL on Linux or Wamp on Windows. Even better results
on Windows can be achieved with a WSL setup.
In order to install a development environment, proceed as follows:
1. Clone the repository
2. Go to `src/serverlib/` and copy `config.default.inc.php` to `config.inc.php`
3. Open the folder `src` in your web browser, e.g. `http://localhost/b1gMail/src/`
4. Follow the setup instructs, use the normal serial number of your b1gMail license
## Staying up to date
When pulling new changes from the server, you will need to update your database
structure in case it changed. In order to do so, log in to the ACP of your b1gMail
development copy, go to "Tools" -> "Optimize" and chose "Check structure". Let
the ACP fix any issues it found.
## Contributing
You want to contribute to the b1gMail code? Great! In order to do so, it's
probably the best idea to fork the b1gMail repository here and start creating your own commits.
As soon as you feel the commit is mature and you would like to integrate it into the b1gMail code base,
create a merge request to the master repository and we will review it.
### Basic guidelines for commits
* Adhere to the b1gMail coding style
* If your commit requires database structure changes, include the updated database
structure in the commit (you can export it using the `tools/db_struct.php` tool)
* If your commit requires other DB changes (i.e. change values), include update code
in the update script (it should be executed when updating to the next major version)
## Migrating from the commercial to the GPL version
look at b1gMail Wiki.
## Installation
look at b1gMail Wiki.

151
servertest/de/liesmich.html Normal file
View file

@ -0,0 +1,151 @@
<html>
<head>
<title>b1gMail Server-Test - Liesmich</title>
<style type="text/css">
<!--
BODY
{
background-color: #666666;
margin: 0px;
}
BODY,DIV,SPAN,P,TD
{
color: #333333;
font-family: verdana, arial;
font-size: 12px;
}
H1
{
color: #FFFFFF;
background-color: #F2911D;
text-align: left;
padding: 15px;
margin-top: 0px;
}
H2
{
margin-top: 20px;
font-size: 14px;
border-bottom: 1px solid #333333;
}
LI
{
margin-top: 5px;
}
A
{
color: #0000FF;
text-decoration: none;
}
A:hover
{
text-decoration: underline;
}
.footer
{
color: #FFFFFF;
background-color: #F2911D;
text-align: center;
padding: 5px;
}
.tabActive
{
background-color: #F2911D;
color: #FFFFFF;
padding: 10px;
line-height: 24px;
}
.tabInactive
{
color: #EFEFEF;
padding: 10px;
line-height: 24px;
font-size: 11px;
}
#tabBar
{
background-color: #666666;
}
#main
{
width: 80%;
background-color: #FFFFFF;
text-align: left;
}
#content
{
padding-left: 15px;
padding-right: 15px;
padding-bottom: 5px;
text-align: justify;
}
//-->
</style>
</head>
<body>
<center>
<div id="main">
<div id="tabBar">
<a class="tabActive" href="liesmich.html">Liesmich (Deutsch)</a>
</div>
<h1>b1gMail Server-Test Liesmich</h1>
<div id="content">
<p>
Vielen Dank f&uuml;r Ihr Interesse an b1gMail! Mit diesem Server-Test-Script
k&ouml;nnen Sie &uuml;perpr&uuml;fen, ob b1gMail auf Ihrem Webspace bzw. Server
lauff&auml;hig ist.
</p>
<p>
<h2>Anleitung</h2>
Gehen Sie bitte folgenderma&szlig;en vor, um den b1gMail-Server-Test zu nutzen:
<ol>
<li>Entpacken Sie, falls nicht schon geschehen, die Datei &quot;servertest.zip&quot;.</li>
<li>Laden Sie mit Ihrem FTP-Programm oder einem anderen Datentransfer-Programm die entpackte
Datei &quot;servertest.php&quot; auf Ihren Webspace hoch.</li>
<li>Rufen Sie die soeben hochgeladene Datei &quot;servertest.php&quot; in Ihrem Webbrowser
auf.</li>
<li>Sie sehen das Test-Resultat. Sollte der Test negativ ausfallen und b1gMail nicht mir Ihrem
Webspace kompatibel sein, aktiviert Ihr Webhoster die fehlenden Funktionen ggf. auf Anfrage,
sodass Sie b1gMail dennoch einsetzen k&ouml;nnen.</li>
</ol>
</p>
<p>
<h2>Hilfe</h2>
Sollten Probleme oder Fragen
auftauchen, z&ouml;gern Sie nicht, uns zu kontakieren.
Kontakt-Informationen finden Sie auf unserer
<a target="_blank" href="http://www.b1gmail.com/contact/">Webseite</a>.
</p>
</div>
<div class="footer">
&copy; 2002-2018 B1G Software
</div>
</div>
</center>
</body>
</html>

File diff suppressed because one or more lines are too long

149
servertest/en/readme.html Normal file
View file

@ -0,0 +1,149 @@
<html>
<head>
<title>b1gMail Server Test - Readme</title>
<style type="text/css">
<!--
BODY
{
background-color: #666666;
margin: 0px;
}
BODY,DIV,SPAN,P,TD
{
color: #333333;
font-family: verdana, arial;
font-size: 12px;
}
H1
{
color: #FFFFFF;
background-color: #F2911D;
text-align: left;
padding: 15px;
margin-top: 0px;
}
H2
{
margin-top: 20px;
font-size: 14px;
border-bottom: 1px solid #333333;
}
LI
{
margin-top: 5px;
}
A
{
color: #0000FF;
text-decoration: none;
}
A:hover
{
text-decoration: underline;
}
.footer
{
color: #FFFFFF;
background-color: #F2911D;
text-align: center;
padding: 5px;
}
.tabActive
{
background-color: #F2911D;
color: #FFFFFF;
padding: 10px;
line-height: 24px;
}
.tabInactive
{
color: #EFEFEF;
padding: 10px;
line-height: 24px;
font-size: 11px;
}
#tabBar
{
background-color: #666666;
}
#main
{
width: 80%;
background-color: #FFFFFF;
text-align: left;
}
#content
{
padding-left: 15px;
padding-right: 15px;
padding-bottom: 5px;
text-align: justify;
}
//-->
</style>
</head>
<body>
<center>
<div id="main">
<div id="tabBar">
<a class="tabActive" href="readme.html">Readme (English)</a>
</div>
<h1>b1gMail Server Test Readme</h1>
<div id="content">
<p>
Thank you for your interest in b1gMail! Using this Server Test script you can
check wether b1gMail is compatible with your webspace/server or not and if
your server configuration limits some of b1gMail's functionality.
</p>
<p>
<h2>Instructions</h2>
Please use the following instructions to test your server:
<ol>
<li>Unzip, if not yet done, the file &quot;servertest.zip&quot;.</li>
<li>Using a FTP client or a file transfer application of your choice,
upload the file &quot;servertest.php&quot; to your webspace.</li>
<li>Open the uploaded file &quot;servertest.php&quot; in your web
browser.</li>
<li>You should see the test results. In case your webspace fails to
meet some requirements, please ask your webhoster to enable the
missing features.</li>
</ol>
</p>
<p>
<h2>Help</h2>
In case of problems we are happy to help. You can find contact information on our
<a target="_blank" href="http://www.b1gmail.com/contact/">website</a>.
</p>
</div>
<div class="footer">
&copy; 2002-2018 B1G Software
</div>
</div>
</center>
</body>
</html>

File diff suppressed because one or more lines are too long

444
src/admin/abuse.php Normal file
View file

@ -0,0 +1,444 @@
<?php
/*
* b1gMail
* Copyright (c) 2021 Patrick Schlangen et al
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
include('../serverlib/admin.inc.php');
RequestPrivileges(PRIVILEGES_ADMIN);
AdminRequirePrivilege('abuse');
if(!isset($_REQUEST['action']))
$_REQUEST['action'] = 'overview';
$tabs = array(
0 => array(
'title' => $lang_admin['overview'],
'relIcon' => 'abuse32.png',
'link' => 'abuse.php?',
'active' => $_REQUEST['action'] == 'overview'
)
);
/**
* activity
*/
if($_REQUEST['action'] == 'overview')
{
if(!isset($_REQUEST['do']))
$_REQUEST['do'] = 'list';
//
// list
//
if($_REQUEST['do'] == 'list')
{
// single action?
if(isset($_REQUEST['singleAction']))
{
if($_REQUEST['singleAction'] == 'lock')
{
$db->Query('UPDATE {pre}users SET gesperrt=? WHERE id=?',
'yes',
$_REQUEST['singleID']);
}
else if($_REQUEST['singleAction'] == 'unlock'
|| $_REQUEST['singleAction'] == 'activate'
|| $_REQUEST['singleAction'] == 'recover')
{
if($_REQUEST['singleAction'] == 'unlock')
{
$db->Query('UPDATE {pre}abuse_points SET `expired`=1 WHERE `userid`=?',
$_REQUEST['singleID']);
}
$db->Query('UPDATE {pre}users SET gesperrt=? WHERE id=?',
'no',
$_REQUEST['singleID']);
}
else if($_REQUEST['singleAction'] == 'delete')
{
$res = $db->Query('SELECT gesperrt FROM {pre}users WHERE id=?',
$_REQUEST['singleID']);
list($userStatus) = $res->FetchArray(MYSQLI_NUM);
$res->Free();
if($userStatus != 'delete')
{
$db->Query('UPDATE {pre}users SET gesperrt=? WHERE id=?',
'delete',
$_REQUEST['singleID']);
}
else
{
DeleteUser((int)$_REQUEST['singleID']);
}
}
}
// mass action
if(isset($_REQUEST['executeMassAction']))
{
// get user IDs
$userIDs = array();
if(isset($_POST['users']) && count($_POST['users']) > 0)
$userIDs = array_map('intval', $_POST['users']);
if(count($userIDs) > 0)
{
if($_REQUEST['massAction'] == 'delete')
{
// get states
$markIDs = $deleteIDs = array();
$res = $db->Query('SELECT id,gesperrt FROM {pre}users WHERE id IN(' . implode(',', $userIDs) . ')');
while($row = $res->FetchArray(MYSQLI_ASSOC))
if($row['gesperrt'] == 'delete')
$deleteIDs[] = $row['id'];
else
$markIDs[] = $row['id'];
// mark users
if(count($markIDs) > 0)
$db->Query('UPDATE {pre}users SET gesperrt=? WHERE id IN(' . implode(',', $markIDs) . ')',
'delete');
// delete users
foreach($deleteIDs as $userID)
DeleteUser($userID);
}
else if($_REQUEST['massAction'] == 'restore'
|| $_REQUEST['massAction'] == 'unlock')
{
if($_REQUEST['massAction'] == 'unlock')
{
$db->Query('UPDATE {pre}abuse_points SET `expired`=1 WHERE `userid` IN ?',
$userIDs);
}
$db->Query('UPDATE {pre}users SET gesperrt=? WHERE id IN(' . implode(',', $userIDs) . ')',
'no');
}
else if($_REQUEST['massAction'] == 'lock')
{
$db->Query('UPDATE {pre}users SET gesperrt=? WHERE id IN(' . implode(',', $userIDs) . ')',
'yes');
}
else if(substr($_REQUEST['massAction'], 0, 7) == 'moveto_')
{
$groupID = (int)substr($_REQUEST['massAction'], 7);
$db->Query('UPDATE {pre}users SET gruppe=? WHERE id IN(' . implode(',', $userIDs) . ')',
$groupID);
}
}
}
// sort options
$sortBy = isset($_REQUEST['sortBy'])
? $_REQUEST['sortBy']
: 'pointsum';
$sortOrder = isset($_REQUEST['sortOrder'])
? strtolower($_REQUEST['sortOrder'])
: 'desc';
$perPage = 50;
// page calculation
$res = $db->Query('SELECT COUNT(DISTINCT(`userid`)) FROM {pre}abuse_points');
list($entryCount) = $res->FetchArray(MYSQLI_NUM);
$res->Free();
$pageCount = ceil($entryCount / $perPage);
$pageNo = isset($_REQUEST['page'])
? max(1, min($pageCount, (int)$_REQUEST['page']))
: 1;
$startPos = max(0, min($perPage*($pageNo-1), $entryCount));
// users
$users = array();
$res = $db->Query('SELECT id,gruppe,email,gesperrt,SUM(points) AS pointsum FROM {pre}users INNER JOIN {pre}abuse_points ON {pre}abuse_points.`userid`={pre}users.`id` WHERE {pre}abuse_points.`expired`=0 GROUP BY `id` ORDER BY ' . $sortBy . ' ' . $sortOrder . ' ' . 'LIMIT ' . $startPos . ',' . $perPage);
while($row = $res->FetchArray(MYSQLI_ASSOC))
{
if($row['pointsum'] >= $bm_prefs['ap_hard_limit'])
$row['indicator'] = 'red';
else if($row['pointsum'] >= $bm_prefs['ap_medium_limit'])
$row['indicator'] = 'yellow';
else
$row['indicator'] = 'green';
$row['statusImg'] = $statusImgTable[$row['gesperrt']];
$users[$row['id']] = $row;
}
$res->Free();
// assign
$tpl->assign('users', $users);
$tpl->assign('pageNo', $pageNo);
$tpl->assign('pageCount', $pageCount);
$tpl->assign('sortBy', $sortBy);
$tpl->assign('sortOrder', $sortOrder);
$tpl->assign('sortOrderInv', $sortOrder == 'asc' ? 'desc' : 'asc');
$tpl->assign('page', 'abuse.list.tpl');
}
//
// show send stats details for a day
//
else if($_REQUEST['do']=='statsDetails' && isset($_REQUEST['userid']) && isset($_REQUEST['day']) && isset($_REQUEST['type']))
{
$type = in_array($_REQUEST['type'], array('send', 'recv')) ? $_REQUEST['type'] : 'send';
if($type == 'send')
{
$field = 'recipients';
$table = '{pre}sendstats';
}
else
{
$field = 'size';
$table = '{pre}recvstats';
}
$dayBegin = mktime(0, 0, 0, date('n', $_REQUEST['day']), date('j', $_REQUEST['day']), date('Y', $_REQUEST['day']));
$dayEnd = mktime(23, 59, 59, date('n', $_REQUEST['day']), date('j', $_REQUEST['day']), date('Y', $_REQUEST['day']));
$stats = array();
$res = $db->Query('SELECT `'.$field.'`,`time` FROM '.$table.' WHERE `time`>=? AND `time`<=? AND `userid`=? ORDER BY `time` ASC',
$dayBegin, $dayEnd, $_REQUEST['userid']);
while($row = $res->FetchArray(MYSQLI_ASSOC))
{
$hour = date('H', $row['time']);
if(!isset($stats[$hour]))
$stats[$hour] = array('mails' => 0, $field => 0, 'timeStamp' => $row['time']);
++$stats[$hour]['mails'];
$stats[$hour][$field] += $row[$field];
}
$res->Free();
header('Content-Type: application/json; charset="' . $currentCharset . '"');
echo '[';
foreach($stats as $hour=>$item)
{
if($type == 'recv')
$item['size'] = TemplateSize(array('bytes' => $item['size']), $tpl);
printf('{ "mails": %d, "%s": "%s", "timeStamp": %d, "hour": "%d:00 - %d:59" },',
$item['mails'], $field, $item[$field], $item['timeStamp'], $hour, $hour);
}
echo ']';
exit;
}
//
// show points
//
else if($_REQUEST['do']=='show' && isset($_REQUEST['userid']))
{
$userID = (int)$_REQUEST['userid'];
$types = GetAbuseTypes();
// single action?
if(isset($_REQUEST['singleAction']))
{
if($_REQUEST['singleAction'] == 'delete')
{
$db->Query('DELETE FROM {pre}abuse_points WHERE `userid`=? AND `entryid`=?',
$userID,
$_REQUEST['singleID']);
}
else if($_REQUEST['singleAction'] == 'lockUser')
{
$db->Query('UPDATE {pre}users SET gesperrt=? WHERE id=?',
'yes',
$_REQUEST['singleID']);
}
else if($_REQUEST['singleAction'] == 'unlockUser'
|| $_REQUEST['singleAction'] == 'activateUser'
|| $_REQUEST['singleAction'] == 'recoverUser')
{
if($_REQUEST['singleAction'] == 'unlockUser')
{
$db->Query('UPDATE {pre}abuse_points SET `expired`=1 WHERE `userid`=?',
$_REQUEST['singleID']);
}
$db->Query('UPDATE {pre}users SET gesperrt=? WHERE id=?',
'no',
$_REQUEST['singleID']);
}
else if($_REQUEST['singleAction'] == 'deleteUser')
{
$res = $db->Query('SELECT gesperrt FROM {pre}users WHERE id=?',
$_REQUEST['singleID']);
list($userStatus) = $res->FetchArray(MYSQLI_NUM);
$res->Free();
if($userStatus != 'delete')
{
$db->Query('UPDATE {pre}users SET gesperrt=? WHERE id=?',
'delete',
$_REQUEST['singleID']);
}
else
{
DeleteUser((int)$_REQUEST['singleID']);
}
}
}
// mass action
if(isset($_REQUEST['executeMassAction']))
{
if(isset($_POST['entries']) && is_array($_POST['entries']) && count($_POST['entries']) > 0)
{
$_POST['entries'] = array_map('intval', $_POST['entries']);
if($_REQUEST['massAction'] == 'delete')
{
$db->Query('DELETE FROM {pre}abuse_points WHERE `userid`=? AND `entryid` IN ?',
$userID,
$_POST['entries']);
}
}
}
// save notes
if(isset($_POST['save']) && isset($_POST['notes']))
{
$db->Query('UPDATE {pre}users SET `notes`=? WHERE `id`=?',
$_POST['notes'],
$userID);
}
// user info
$user = _new('BMUser', array($userID));
$group = $user->GetGroup();
// get usage stuff
$res = $db->Query('SELECT COUNT(*) FROM {pre}mails WHERE userid=?',
$userID);
list($emailMails) = $res->FetchArray(MYSQLI_NUM);
$res->Free();
$res = $db->Query('SELECT COUNT(*) FROM {pre}folders WHERE userid=?',
$userID);
list($emailFolders) = $res->FetchArray(MYSQLI_NUM);
$res->Free();
$res = $db->Query('SELECT COUNT(*) FROM {pre}diskfiles WHERE user=?',
$userID);
list($diskFiles) = $res->FetchArray(MYSQLI_NUM);
$res->Free();
$res = $db->Query('SELECT COUNT(*) FROM {pre}diskfolders WHERE user=?',
$userID);
list($diskFolders) = $res->FetchArray(MYSQLI_NUM);
$res->Free();
$usedMonthSMS = $user->GetUsedMonthSMS();
// fetch points from db
$sum = 0;
$points = array();
$res = $db->Query('SELECT `entryid`,`date`,`type`,`points`,`comment`,`expired` FROM {pre}abuse_points '
. 'WHERE `userid`=? ORDER BY `expired` DESC,`entryid` ASC', $userID);
while($row = $res->FetchArray(MYSQLI_ASSOC))
{
if($row['expired'])
{
$row['indicator'] = 'grey';
$row['sum'] = 0;
}
else
{
$sum += $row['points'];
$row['sum'] = $sum;
if($sum >= $bm_prefs['ap_hard_limit'])
$row['indicator'] = 'red';
else if($sum >= $bm_prefs['ap_medium_limit'])
$row['indicator'] = 'yellow';
else
$row['indicator'] = 'green';
}
$row['typeText'] = $types[$row['type']]['title'];
$points[$row['entryid']] = $row;
}
$res->Free();
// page calculation
$perPage = 50;
$entryCount = count($points);
$pageCount = ceil($entryCount / $perPage);
$pageNo = isset($_REQUEST['page'])
? max(1, min($pageCount, (int)$_REQUEST['page']))
: 1;
$startPos = max(0, min($perPage*($pageNo-1), $entryCount));
$points = array_slice(array_reverse($points, true), $startPos, $perPage);
// send stats
$sendStats = array();
$res = $db->Query('SELECT `recipients`,`time` FROM {pre}sendstats WHERE `time`>=? AND `userid`=? ORDER BY `time` DESC',
time()-TIME_ONE_WEEK, $userID);
while($row = $res->FetchArray(MYSQLI_ASSOC))
{
$day = date('d.m.Y', $row['time']);
if(!isset($sendStats[$day]))
$sendStats[$day] = array('mails' => 0, 'recipients' => 0, 'timeStamp' => $row['time']);
++$sendStats[$day]['mails'];
$sendStats[$day]['recipients'] += $row['recipients'];
}
$res->Free();
// receive stats
$recvStats = array();
$res = $db->Query('SELECT `size`,`time` FROM {pre}recvstats WHERE `time`>=? AND `userid`=? ORDER BY `time` DESC',
time()-TIME_ONE_WEEK, $userID);
while($row = $res->FetchArray(MYSQLI_ASSOC))
{
$day = date('d.m.Y', $row['time']);
if(!isset($recvStats[$day]))
$recvStats[$day] = array('mails' => 0, 'size' => 0, 'timeStamp' => $row['time']);
++$recvStats[$day]['mails'];
$recvStats[$day]['size'] += $row['size'];
}
$res->Free();
// assign
$tpl->assign('sendStats', $sendStats);
$tpl->assign('recvStats', $recvStats);
$tpl->assign('usedMonthSMS', (int)$usedMonthSMS);
$tpl->assign('emailMails', $emailMails);
$tpl->assign('emailFolders', $emailFolders);
$tpl->assign('diskFiles', $diskFiles);
$tpl->assign('diskFolders', $diskFolders);
$tpl->assign('userStatusImg', $statusImgTable[$user->_row['gesperrt']]);
$tpl->assign('userRow', $user->_row);
$tpl->assign('groupRow', $group->_row);
$tpl->assign('userID', $userID);
$tpl->assign('pageNo', $pageNo);
$tpl->assign('pageCount', $pageCount);
$tpl->assign('points', $points);
$tpl->assign('page', 'abuse.show.tpl');
}
}
/**
* prefs
*/
else if($_REQUEST['action'] == 'prefs')
{
$tpl->assign('page', 'abuse.prefs.tpl');
}
$tpl->assign('tabs', $tabs);
$tpl->assign('title', $lang_admin['usersgroups'] . ' &raquo; ' . $lang_admin['abuseprotect']);
$tpl->display('page.tpl');
?>

199
src/admin/activity.php Normal file
View file

@ -0,0 +1,199 @@
<?php
/*
* b1gMail
* Copyright (c) 2021 Patrick Schlangen et al
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
include('../serverlib/admin.inc.php');
RequestPrivileges(PRIVILEGES_ADMIN);
AdminRequirePrivilege('activity');
if(!isset($_REQUEST['action']))
$_REQUEST['action'] = 'activity';
$tabs = array(
0 => array(
'title' => $lang_admin['activity'],
'relIcon' => 'activity32.png',
'link' => 'activity.php?',
'active' => $_REQUEST['action'] == 'activity'
)
);
/**
* activity
*/
if($_REQUEST['action'] == 'activity')
{
if(!isset($_REQUEST['do']))
$_REQUEST['do'] = 'list';
//
// list
//
if($_REQUEST['do'] == 'list')
{
// single action?
if(isset($_REQUEST['singleAction']))
{
if($_REQUEST['singleAction'] == 'lock')
{
$db->Query('UPDATE {pre}users SET gesperrt=? WHERE id=?',
'yes',
$_REQUEST['singleID']);
}
else if($_REQUEST['singleAction'] == 'unlock'
|| $_REQUEST['singleAction'] == 'activate'
|| $_REQUEST['singleAction'] == 'recover')
{
$db->Query('UPDATE {pre}users SET gesperrt=? WHERE id=?',
'no',
$_REQUEST['singleID']);
}
else if($_REQUEST['singleAction'] == 'delete')
{
$res = $db->Query('SELECT gesperrt FROM {pre}users WHERE id=?',
$_REQUEST['singleID']);
list($userStatus) = $res->FetchArray(MYSQLI_NUM);
$res->Free();
if($userStatus != 'delete')
{
$db->Query('UPDATE {pre}users SET gesperrt=? WHERE id=?',
'delete',
$_REQUEST['singleID']);
}
else
{
DeleteUser((int)$_REQUEST['singleID']);
}
}
}
// mass action
if(isset($_REQUEST['executeMassAction']))
{
// get user IDs
$userIDs = array();
foreach($_POST as $key=>$val)
if(substr($key, 0, 5) == 'user_')
$userIDs[] = (int)substr($key, 5);
if(count($userIDs) > 0)
{
if($_REQUEST['massAction'] == 'delete')
{
// get states
$markIDs = $deleteIDs = array();
$res = $db->Query('SELECT id,gesperrt FROM {pre}users WHERE id IN(' . implode(',', $userIDs) . ')');
while($row = $res->FetchArray(MYSQLI_ASSOC))
if($row['gesperrt'] == 'delete')
$deleteIDs[] = $row['id'];
else
$markIDs[] = $row['id'];
// mark users
if(count($markIDs) > 0)
$db->Query('UPDATE {pre}users SET gesperrt=? WHERE id IN(' . implode(',', $markIDs) . ')',
'delete');
// delete users
foreach($deleteIDs as $userID)
DeleteUser($userID);
}
else if($_REQUEST['massAction'] == 'restore'
|| $_REQUEST['massAction'] == 'unlock')
{
$db->Query('UPDATE {pre}users SET gesperrt=? WHERE id IN(' . implode(',', $userIDs) . ')',
'no');
}
else if($_REQUEST['massAction'] == 'lock')
{
$db->Query('UPDATE {pre}users SET gesperrt=? WHERE id IN(' . implode(',', $userIDs) . ')',
'yes');
}
else if(substr($_REQUEST['massAction'], 0, 7) == 'moveto_')
{
$groupID = (int)substr($_REQUEST['massAction'], 7);
$db->Query('UPDATE {pre}users SET gruppe=? WHERE id IN(' . implode(',', $userIDs) . ')',
$groupID);
}
}
}
// sort options
$sortBy = isset($_REQUEST['sortBy'])
? $_REQUEST['sortBy']
: 'mailspace_used';
$sortOrder = isset($_REQUEST['sortOrder'])
? strtolower($_REQUEST['sortOrder'])
: 'desc';
$perPage = 50;
// groups
$groups = array();
$res = $db->Query('SELECT id,storage,webdisk,traffic,titel AS title FROM {pre}gruppen');
while($row = $res->FetchArray(MYSQLI_ASSOC))
{
$groups[$row['id']] = $row;
}
$res->Free();
// page calculation
$res = $db->Query('SELECT COUNT(*) FROM {pre}users');
list($userCount) = $res->FetchArray(MYSQLI_NUM);
$res->Free();
$pageCount = ceil($userCount / $perPage);
$pageNo = isset($_REQUEST['page'])
? max(1, min($pageCount, (int)$_REQUEST['page']))
: 1;
$startPos = max(0, min($perPage*($pageNo-1), $userCount));
// users
$users = array();
$res = $db->Query('SELECT id,gruppe,email,gesperrt,mailspace_used,diskspace_used,(traffic_down+traffic_up) AS traffic,mailspace_add,diskspace_add,traffic_add,received_mails,sent_mails,traffic_status FROM {pre}users ORDER BY ' . $sortBy . ' ' . $sortOrder . ' ' . 'LIMIT ' . $startPos . ',' . $perPage);
while($row = $res->FetchArray(MYSQLI_ASSOC))
{
$row['mailspace_max'] = $groups[$row['gruppe']]['storage'] + $row['mailspace_add'];
$row['diskspace_max'] = $groups[$row['gruppe']]['webdisk'] + $row['diskspace_add'];
$row['traffic_max'] = $groups[$row['gruppe']]['traffic'] + $row['traffic_add'];
$row['statusImg'] = $statusImgTable[$row['gesperrt']];
if($row['traffic_status'] != (int)date('m'))
$row['traffic'] = 0;
$users[$row['id']] = $row;
}
$res->Free();
// assign
$tpl->assign('groups', $groups);
$tpl->assign('users', $users);
$tpl->assign('pageNo', $pageNo);
$tpl->assign('pageCount', $pageCount);
$tpl->assign('sortBy', $sortBy);
$tpl->assign('sortOrder', $sortOrder);
$tpl->assign('sortOrderInv', $sortOrder == 'asc' ? 'desc' : 'asc');
$tpl->assign('page', 'activity.list.tpl');
}
}
$tpl->assign('tabs', $tabs);
$tpl->assign('title', $lang_admin['usersgroups'] . ' &raquo; ' . $lang_admin['activity']);
$tpl->display('page.tpl');
?>

277
src/admin/admins.php Normal file
View file

@ -0,0 +1,277 @@
<?php
/*
* b1gMail
* Copyright (c) 2021 Patrick Schlangen et al
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
include('../serverlib/admin.inc.php');
RequestPrivileges(PRIVILEGES_ADMIN);
if(!isset($_REQUEST['action']))
$_REQUEST['action'] = 'account';
$tabs = array(
0 => array(
'title' => $lang_admin['account'],
'relIcon' => 'user_active32.png',
'link' => 'admins.php?',
'active' => $_REQUEST['action'] == 'account'
),
1 => array(
'title' => $lang_admin['admins'],
'relIcon' => 'ico_users.png',
'link' => 'admins.php?action=admins&',
'active' => $_REQUEST['action'] == 'admins'
)
);
if($adminRow['type'] != 0)
unset($tabs[1]);
/**
* accounts
*/
if($_REQUEST['action'] == 'account')
{
$displayPage = true;
if(isset($_REQUEST['changePassword']) && isset($_POST['newpw1']))
{
if(strlen($_POST['newpw1']) < 6 || $_POST['newpw1'] != $_POST['newpw2'])
{
$tpl->assign('msgTitle', $lang_admin['error']);
$tpl->assign('msgText', $lang_admin['pwerror']);
$tpl->assign('msgIcon', 'error32');
$tpl->assign('page', 'msg.tpl');
$displayPage = false;
}
else
{
$newSalt = GenerateRandomSalt(8);
$newPW = md5($_POST['newpw1'] . $newSalt);
$db->Query('UPDATE {pre}admins SET `password`=?,`password_salt`=? WHERE `adminid`=?',
$newPW,
$newSalt,
$adminRow['adminid']);
$_SESSION['bm_adminAuth'] = md5($newPW.$_SERVER['HTTP_USER_AGENT']);
}
}
if($displayPage)
{
$tpl->assign('page', 'admins.account.tpl');
}
}
else if($_REQUEST['action'] == 'admins' && $adminRow['type'] == 0)
{
if(isset($_REQUEST['do']) && $_REQUEST['do'] == 'edit')
{
$res = $db->Query('SELECT * FROM {pre}admins WHERE `adminid`=?',
$_REQUEST['id']);
if($res->RowCount() != 1)
die('Admin not found');
$admin = $res->FetchArray(MYSQLI_ASSOC);
$res->Free();
$displayPage = true;
if(isset($_REQUEST['save']) && isset($_POST['username']))
{
$res = $db->Query('SELECT `adminid` FROM {pre}admins WHERE `username`=?',
$_POST['username']);
$existingCount = $res->RowCount();
if($existingCount > 0)
list($existingID) = $res->FetchArray(MYSQLI_NUM);
$res->Free();
if(($existingCount > 0 && $existingID != $admin['adminid']) || trim($_POST['username']) == '')
{
$tpl->assign('msgTitle', $lang_admin['error']);
$tpl->assign('msgText', $lang_admin['adminexists']);
$tpl->assign('msgIcon', 'error32');
$tpl->assign('page', 'msg.tpl');
$displayPage = false;
}
else if(($_POST['newpw1'] != '' || $_POST['newpw2'] != '') && strlen($_POST['newpw1']) < 6 || $_POST['newpw1'] != $_POST['newpw2'])
{
$tpl->assign('msgTitle', $lang_admin['error']);
$tpl->assign('msgText', $lang_admin['pwerror']);
$tpl->assign('msgIcon', 'error32');
$tpl->assign('page', 'msg.tpl');
$displayPage = false;
}
else
{
if($_POST['newpw1'] != '')
{
$salt = GenerateRandomSalt(8);
$pw = md5($_POST['newpw1'] . $salt);
}
else
{
$salt = $admin['password_salt'];
$pw = $admin['password'];
}
if($admin['adminid'] == $adminRow['adminid'])
{
$_SESSION['bm_adminAuth'] = md5($pw.$_SERVER['HTTP_USER_AGENT']);
}
if(isset($_POST['perms']) && is_array($_POST['perms']))
{
$privileges = serialize($_POST['perms']);
}
else
{
$privileges = serialize(array());
}
if($admin['adminid'] == 1)
{
$_POST['type'] = 0;
$privileges = '';
}
$db->Query('UPDATE {pre}admins SET `username`=?,`password`=?,`password_salt`=?,`firstname`=?,`lastname`=?,`type`=?,`privileges`=? WHERE `adminid`=?',
$_POST['username'],
$pw,
$salt,
$_POST['firstname'],
$_POST['lastname'],
$_POST['type'],
$privileges,
$admin['adminid']);
header('Location: admins.php?action=admins&sid='.session_id());
exit();
}
}
if($displayPage)
{
$pluginList = array();
// build plugin list
foreach($plugins->_plugins as $className=>$pluginInfo)
{
if($plugins->getParam('admin_pages', $className))
$pluginList[$className] = $plugins->getParam('admin_page_title', $className);
}
$admin['perms'] = @unserialize($admin['privileges']);
$tpl->assign('permsTable', $permsTable);
$tpl->assign('admin', $admin);
$tpl->assign('pluginList', $pluginList);
$tpl->assign('page', 'admins.edit.tpl');
}
}
else
{
$displayPage = true;
if(isset($_REQUEST['add']) && isset($_POST['username']))
{
$res = $db->Query('SELECT COUNT(*) FROM {pre}admins WHERE `username`=?',
$_POST['username']);
list($existingCount) = $res->FetchArray(MYSQLI_NUM);
$res->Free();
if($existingCount > 0 || trim($_POST['username']) == '')
{
$tpl->assign('msgTitle', $lang_admin['error']);
$tpl->assign('msgText', $lang_admin['adminexists']);
$tpl->assign('msgIcon', 'error32');
$tpl->assign('page', 'msg.tpl');
$displayPage = false;
}
else if(strlen($_POST['pw1']) < 6 || $_POST['pw1'] != $_POST['pw2'])
{
$tpl->assign('msgTitle', $lang_admin['error']);
$tpl->assign('msgText', $lang_admin['pwerror']);
$tpl->assign('msgIcon', 'error32');
$tpl->assign('page', 'msg.tpl');
$displayPage = false;
}
else
{
$salt = GenerateRandomSalt(8);
$pw = md5($_POST['pw1'] . $salt);
$db->Query('INSERT INTO {pre}admins(`username`,`firstname`,`lastname`,`password`,`password_salt`,`type`) VALUES(?,?,?,?,?,?)',
$_POST['username'],
$_POST['firstname'],
$_POST['lastname'],
$pw,
$salt,
$_POST['type']);
$adminID = $db->InsertId();
header('Location: admins.php?action=admins&do=edit&id='.$adminID.'&sid='.session_id());
exit();
}
}
else if(isset($_REQUEST['delete']) && (int)$_REQUEST['delete']>1)
{
$db->Query('DELETE FROM {pre}admins WHERE `adminid`=?',
(int)$_REQUEST['delete']);
}
// mass action?
else if(isset($_REQUEST['executeMassAction']))
{
// get domains
$massAdmins = array();
foreach($_POST as $key=>$val)
if(substr($key, 0, 6) == 'admin_' && (int)substr($key, 6) > 1)
$massAdmins[] = substr($key, 6);
if(count($massAdmins) > 0)
{
if($_REQUEST['massAction'] == 'delete')
{
// delete admin
$db->Query('DELETE FROM {pre}admins WHERE `adminid` IN ?', $massAdmins);
}
}
}
if($displayPage)
{
$admins = array();
$res = $db->Query('SELECT `adminid`,`username`,`firstname`,`lastname`,`type` FROM {pre}admins ORDER BY `username` ASC');
while($row = $res->FetchArray(MYSQLI_ASSOC))
{
$admins[$row['adminid']] = $row;
}
$res->Free();
$tpl->assign('admins', $admins);
$tpl->assign('page', 'admins.admins.tpl');
}
}
}
$tpl->assign('tabs', $tabs);
$tpl->assign('title', $lang_admin['welcome'] . ' &raquo; ' . $lang_admin['admins']);
$tpl->display('page.tpl');
?>

84
src/admin/backup.php Normal file
View file

@ -0,0 +1,84 @@
<?php
/*
* b1gMail
* Copyright (c) 2021 Patrick Schlangen et al
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
include('../serverlib/admin.inc.php');
RequestPrivileges(PRIVILEGES_ADMIN);
AdminRequirePrivilege('backup');
if(!isset($_REQUEST['action']))
$_REQUEST['action'] = 'backup';
$tabs = array(
0 => array(
'title' => $lang_admin['backup'],
'link' => 'backup.php?',
'active' => $_REQUEST['action'] == 'backup'
)
);
/**
* backup
*/
if($_REQUEST['action'] == 'backup')
{
if(!isset($_REQUEST['do']))
$_REQUEST['do'] = 'page';
//
// default page
//
if($_REQUEST['do'] == 'page')
{
// assign
$tpl->assign('sizes', GetCategorizedSpaceUsage());
$tpl->assign('page', 'backup.tpl');
}
//
// create backup page
//
else if($_REQUEST['do'] == 'createBackup')
{
// backup sequence
$sequence = $fileSequence = array();
if(isset($_REQUEST['backup_prefs']))
$sequence = array_merge($sequence, $backupTables['prefs']);
if(isset($_REQUEST['backup_stats']))
$sequence = array_merge($sequence, $backupTables['stats']);
if(isset($_REQUEST['backup_users']))
$sequence = array_merge($sequence, $backupTables['users']);
if(isset($_REQUEST['backup_organizer']))
$sequence = array_merge($sequence, $backupTables['organizer']);
if(isset($_REQUEST['backup_mails']))
$sequence = array_merge($sequence, $backupTables['mails']);
if(isset($_REQUEST['backup_webdisk']))
$sequence = array_merge($sequence, $backupTables['webdisk']);
// assign
$tpl->assign('sequence', $sequence);
$tpl->assign('page', 'backup.create.tpl');
}
}
$tpl->assign('tabs', $tabs);
$tpl->assign('title', $lang_admin['tools'] . ' &raquo; ' . $lang_admin['backup']);
$tpl->display('page.tpl');
?>

BIN
src/admin/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

422
src/admin/groups.php Normal file
View file

@ -0,0 +1,422 @@
<?php
/*
* b1gMail
* Copyright (c) 2021 Patrick Schlangen et al
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
include('../serverlib/admin.inc.php');
RequestPrivileges(PRIVILEGES_ADMIN);
AdminRequirePrivilege('groups');
if(!isset($_REQUEST['action']))
$_REQUEST['action'] = 'groups';
$tabs = array(
0 => array(
'title' => $lang_admin['groups'],
'relIcon' => 'group32.png',
'link' => 'groups.php?',
'active' => $_REQUEST['action'] == 'groups'
),
1 => array(
'title' => $lang_admin['create'],
'relIcon' => 'group_add32.png',
'link' => 'groups.php?action=create&',
'active' => $_REQUEST['action'] == 'create'
)
);
/**
* groups
*/
if($_REQUEST['action'] == 'groups')
{
if(!isset($_REQUEST['do']))
$_REQUEST['do'] = 'list';
//
// list
//
if($_REQUEST['do'] == 'list')
{
// mass action
if(isset($_REQUEST['executeMassAction']))
{
// get group IDs
$groupIDs = array();
foreach($_POST as $key=>$val)
if(substr($key, 0, 6) == 'group_'
&& ($id = (int)substr($key, 6)) != $bm_prefs['std_gruppe'])
$groupIDs[] = $id;
if(count($groupIDs) > 0)
{
if($_REQUEST['massAction'] == 'delete')
{
// fetch
$groups = array();
$res = $db->Query('SELECT id,titel FROM {pre}gruppen ORDER BY titel ASC');
while($row = $res->FetchArray(MYSQLI_ASSOC))
$groups[$row['id']] = $row['titel'];
$res->Free();
// assign
$groupsToDelete = array();
foreach($groupIDs as $id)
{
$groupsToDelete[$id] = $groups[$id];
unset($groups[$id]);
}
$tpl->assign('groupsToDelete', $groupsToDelete);
$tpl->assign('groups', $groups);
$tpl->assign('page', 'groups.delete.tpl');
$stop = true;
}
}
}
if(!isset($stop))
{
// groups
$groups = array();
$res = $db->Query('SELECT id,titel FROM {pre}gruppen ORDER BY titel ASC');
while($row = $res->FetchArray(MYSQLI_ASSOC))
{
$res2 = $db->Query('SELECT COUNT(*) FROM {pre}users WHERE gruppe=?',
$row['id']);
list($memberCount) = $res2->FetchArray(MYSQLI_NUM);
$res2->Free();
$row['members'] = $memberCount;
$row['default'] = $row['id'] == $bm_prefs['std_gruppe'];
$groups[$row['id']] = $row;
}
$res->Free();
// assign
$tpl->assign('groups', $groups);
$tpl->assign('page', 'groups.list.tpl');
}
}
//
// edit
//
else if($_REQUEST['do'] == 'edit'
&& isset($_REQUEST['id']))
{
// save?
if(isset($_REQUEST['save']))
{
// prepare arrays
$saliaseArray = explode("\n", $_REQUEST['saliase']);
foreach($saliaseArray as $key=>$val)
if(($val = trim($val)) != '')
$saliaseArray[$key] = EncodeDomain($val);
else
unset($saliaseArray[$key]);
$saliase = implode(':', $saliaseArray);
$sms_preArray = explode("\n", $_REQUEST['sms_pre']);
foreach($sms_preArray as $key=>$val)
if(($val = trim($val)) != '')
$sms_preArray[$key] = $val;
else
unset($sms_preArray[$key]);
$sms_pre = implode(':', $sms_preArray);
// prepare sizes
$_REQUEST['storage'] *= 1024*1024;
$_REQUEST['webdisk'] *= 1024*1024;
$_REQUEST['maxsize'] *= 1024;
$_REQUEST['anlagen'] *= 1024;
if($_REQUEST['traffic'] > 0)
$_REQUEST['traffic'] *= 1024*1024;
$db->Query('UPDATE {pre}gruppen SET titel=?, soforthtml=?, sms_monat=?, storage=?, webdisk=?, maxsize=?, anlagen=?, traffic=?, wd_member_kbs=?, wd_open_kbs=?, send_limit_count=?, send_limit_time=?, ownpop3=?, ownpop3_interval=?, selfpop3_check=?, aliase=?, sms_pre=?, mail2sms=?, wap=?, sms_ownfrom=?, checker=?, tbx_webdisk=?, tbx_smsmanager=?, ads=?, share=?, pop3=?, smtp=?, responder=?, imap=?, forward=?, webdav=?, saliase=?, sms_price_per_credit=?, sms_from=?, sms_sig=?, signatur=?, smsvalidation=?, allow_newsletter_optout=?, smime=?, issue_certificates=?, upload_certificates=?, max_recps=?, sender_aliases=?, syncml=?, organizerdav=?, ftsearch=?, notifications=?, maildeliverystatus=?, abuseprotect=?, mail_send_code=?, sms_send_code=?, auto_save_drafts=? WHERE id=?',
$_REQUEST['titel'],
isset($_REQUEST['soforthtml']) ? 'yes' : 'no',
$_REQUEST['sms_monat'],
$_REQUEST['storage'],
$_REQUEST['webdisk'],
$_REQUEST['maxsize'],
$_REQUEST['anlagen'],
$_REQUEST['traffic'],
$_REQUEST['wd_member_kbs'],
$_REQUEST['wd_open_kbs'],
$_REQUEST['send_limit_count'],
$_REQUEST['send_limit_time'],
$_REQUEST['ownpop3'],
$_REQUEST['ownpop3_interval'],
isset($_REQUEST['selfpop3_check']) ? 'yes' : 'no',
$_REQUEST['aliase'],
$sms_pre,
isset($_REQUEST['mail2sms']) ? 'yes' : 'no',
isset($_REQUEST['wap']) ? 'yes' : 'no',
isset($_REQUEST['sms_ownfrom']) ? 'yes' : 'no',
isset($_REQUEST['checker']) ? 'yes' : 'no',
isset($_REQUEST['tbx_webdisk']) ? 'yes' : 'no',
isset($_REQUEST['tbx_smsmanager']) ? 'yes' : 'no',
isset($_REQUEST['ads']) ? 'yes' : 'no',
isset($_REQUEST['share']) ? 'yes' : 'no',
isset($_REQUEST['pop3']) ? 'yes' : 'no',
isset($_REQUEST['smtp']) ? 'yes' : 'no',
isset($_REQUEST['responder']) ? 'yes' : 'no',
isset($_REQUEST['imap']) ? 'yes' : 'no',
isset($_REQUEST['forward']) ? 'yes' : 'no',
isset($_REQUEST['webdav']) ? 'yes' : 'no',
$saliase,
$_REQUEST['sms_price_per_credit'],
$_REQUEST['sms_from'],
$_REQUEST['sms_sig'],
$_REQUEST['signatur'],
isset($_REQUEST['smsvalidation']) ? 'yes' : 'no',
isset($_REQUEST['allow_newsletter_optout']) ? 'yes' : 'no',
isset($_REQUEST['smime']) ? 'yes' : 'no',
isset($_REQUEST['issue_certificates']) ? 'yes' : 'no',
isset($_REQUEST['upload_certificates']) ? 'yes' : 'no',
(int)$_REQUEST['max_recps'],
isset($_REQUEST['sender_aliases']) ? 'yes' : 'no',
isset($_REQUEST['syncml']) ? 'yes' : 'no',
isset($_REQUEST['organizerdav']) ? 'yes' : 'no',
isset($_REQUEST['ftsearch']) ? 'yes' : 'no',
isset($_REQUEST['notifications']) ? 'yes' : 'no',
isset($_REQUEST['maildeliverystatus']) ? 'yes' : 'no',
isset($_REQUEST['abuseprotect']) ? 'yes' : 'no',
isset($_REQUEST['mail_send_code']) ? 'yes' : 'no',
isset($_REQUEST['sms_send_code']) ? 'yes' : 'no',
isset($_REQUEST['auto_save_drafts']) ? 'yes' : 'no',
$_REQUEST['id']);
$cacheManager->Delete('group:' . $_REQUEST['id']);
// save group options
$groupOptions = $plugins->GetGroupOptions();
foreach($groupOptions as $key=>$val)
{
$db->Query('REPLACE INTO {pre}groupoptions(gruppe,module,`key`,value) VALUES(?,?,?,?)',
$_REQUEST['id'],
$val['module'],
$val['key'],
!isset($_REQUEST[$key]) ? 0 : $_REQUEST[$key]);
}
}
// fetch from DB
$res = $db->Query('SELECT * FROM {pre}gruppen WHERE id=?',
(int)$_REQUEST['id']);
$group = $res->FetchArray(MYSQLI_ASSOC);
$res->Free();
// assign
$group['saliase'] = implode("\n", array_map('DecodeDomain', explode(':', $group['saliase'])));
$group['sms_pre'] = str_replace(':', "\n", $group['sms_pre']);
$tpl->assign('groupOptions', $plugins->GetGroupOptions($group['id']));
$tpl->assign('group', $group);
$tpl->assign('page', 'groups.edit.tpl');
}
//
// delete
//
else if($_REQUEST['do'] == 'delete'
&& isset($_REQUEST['id']))
{
// fetch
$groups = array();
$res = $db->Query('SELECT id,titel FROM {pre}gruppen ORDER BY titel ASC');
while($row = $res->FetchArray(MYSQLI_ASSOC))
$groups[$row['id']] = $row['titel'];
$res->Free();
// assign
$groupsToDelete = array($_REQUEST['id'] => $groups[$_REQUEST['id']]);
unset($groups[$_REQUEST['id']]);
$tpl->assign('groupsToDelete', $groupsToDelete);
$tpl->assign('groups', $groups);
$tpl->assign('page', 'groups.delete.tpl');
}
//
// real delete
//
else if($_REQUEST['do'] == 'realDelete'
&& isset($_REQUEST['groups'])
&& is_array($_REQUEST['groups']))
{
foreach($_REQUEST['groups'] as $groupID=>$newGroupID)
{
$groupNames = array();
$res = $db->Query('SELECT `titel`,`id` FROM {pre}gruppen WHERE `id` IN(?,?)',
$groupID, $newGroupID);
while($row = $res->FetchArray(MYSQLI_ASSOC))
$groupNames[$row['id']] = $row['titel'];
$res->Free();
$db->Query('UPDATE {pre}users SET gruppe=? WHERE gruppe=?',
$newGroupID,
$groupID);
$db->Query('DELETE FROM {pre}gruppen WHERE id=?',
$groupID);
$cacheManager->Delete('group:' . $groupID);
PutLog(sprintf('Admin <%s> deleted group <%s>, moving its users to group <%s>',
$adminRow['username'],
$groupNames[$groupID],
$groupNames[$newGroupID]),
PRIO_NOTE,
__FILE__,
__LINE__);
}
header('Location: groups.php?sid=' . session_id());
exit();
}
}
/**
* create group
*/
else if($_REQUEST['action'] == 'create')
{
// create group
if(isset($_REQUEST['create']))
{
// prepare arrays
$saliaseArray = explode("\n", $_REQUEST['saliase']);
foreach($saliaseArray as $key=>$val)
if(($val = trim($val)) != '')
$saliaseArray[$key] = EncodeDomain($val);
else
unset($saliaseArray[$key]);
$saliase = implode(':', $saliaseArray);
$sms_preArray = explode("\n", $_REQUEST['sms_pre']);
foreach($sms_preArray as $key=>$val)
if(($val = trim($val)) != '')
$sms_preArray[$key] = $val;
else
unset($sms_preArray[$key]);
$sms_pre = implode(':', $sms_preArray);
// prepare sizes
$_REQUEST['storage'] *= 1024*1024;
$_REQUEST['webdisk'] *= 1024*1024;
$_REQUEST['maxsize'] *= 1024;
$_REQUEST['anlagen'] *= 1024;
if($_REQUEST['traffic'] > 0)
$_REQUEST['traffic'] *= 1024*1024;
$db->Query('INSERT INTO {pre}gruppen(titel,soforthtml,sms_monat,storage,webdisk,maxsize,anlagen,traffic,wd_member_kbs,wd_open_kbs,send_limit_count,send_limit_time,ownpop3,ownpop3_interval,selfpop3_check,aliase,sms_pre,mail2sms,wap,sms_ownfrom,checker,tbx_webdisk,tbx_smsmanager,ads,share,pop3,smtp,responder,imap,forward,webdav,saliase,sms_price_per_credit,sms_from,sms_sig,signatur,smsvalidation,allow_newsletter_optout,smime,issue_certificates,upload_certificates,sender_aliases,syncml,organizerdav,ftsearch,notifications,maildeliverystatus,abuseprotect,mail_send_code,sms_send_code,auto_save_drafts) VALUES '
. '(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)',
$_REQUEST['titel'],
isset($_REQUEST['soforthtml']) ? 'yes' : 'no',
$_REQUEST['sms_monat'],
$_REQUEST['storage'],
$_REQUEST['webdisk'],
$_REQUEST['maxsize'],
$_REQUEST['anlagen'],
$_REQUEST['traffic'],
$_REQUEST['wd_member_kbs'],
$_REQUEST['wd_open_kbs'],
$_REQUEST['send_limit_count'],
$_REQUEST['send_limit_time'],
$_REQUEST['ownpop3'],
$_REQUEST['ownpop3_interval'],
isset($_REQUEST['selfpop3_check']) ? 'yes' : 'no',
$_REQUEST['aliase'],
$sms_pre,
isset($_REQUEST['mail2sms']) ? 'yes' : 'no',
isset($_REQUEST['wap']) ? 'yes' : 'no',
isset($_REQUEST['sms_ownfrom']) ? 'yes' : 'no',
isset($_REQUEST['checker']) ? 'yes' : 'no',
isset($_REQUEST['tbx_webdisk']) ? 'yes' : 'no',
isset($_REQUEST['tbx_smsmanager']) ? 'yes' : 'no',
isset($_REQUEST['ads']) ? 'yes' : 'no',
isset($_REQUEST['share']) ? 'yes' : 'no',
isset($_REQUEST['pop3']) ? 'yes' : 'no',
isset($_REQUEST['smtp']) ? 'yes' : 'no',
isset($_REQUEST['responder']) ? 'yes' : 'no',
isset($_REQUEST['imap']) ? 'yes' : 'no',
isset($_REQUEST['forward']) ? 'yes' : 'no',
isset($_REQUEST['webdav']) ? 'yes' : 'no',
$saliase,
$_REQUEST['sms_price_per_credit'],
$_REQUEST['sms_from'],
$_REQUEST['sms_sig'],
$_REQUEST['signatur'],
isset($_REQUEST['smsvalidation']) ? 'yes' : 'no',
isset($_REQUEST['allow_newsletter_optout']) ? 'yes' : 'no',
isset($_REQUEST['smime']) ? 'yes' : 'no',
isset($_REQUEST['issue_certificates']) ? 'yes' : 'no',
isset($_REQUEST['upload_certificates']) ? 'yes' : 'no',
isset($_REQUEST['sender_aliases']) ? 'yes' : 'no',
isset($_REQUEST['syncml']) ? 'yes' : 'no',
isset($_REQUEST['organizerdav']) ? 'yes' : 'no',
isset($_REQUEST['ftsearch']) ? 'yes' : 'no',
isset($_REQUEST['notifications']) ? 'yes' : 'no',
isset($_REQUEST['maildeliverystatus']) ? 'yes' : 'no',
isset($_REQUEST['abuseprotect']) ? 'yes' : 'no',
isset($_REQUEST['mail_send_code']) ? 'yes' : 'no',
isset($_REQUEST['sms_send_code']) ? 'yes' : 'no',
isset($_REQUEST['auto_save_drafts']) ? 'yes' : 'no');
$groupID = $db->InsertId();
// save group options
$groupOptions = $plugins->GetGroupOptions();
foreach($groupOptions as $key=>$val)
{
$db->Query('REPLACE INTO {pre}groupoptions(gruppe,module,`key`,value) VALUES(?,?,?,?)',
$groupID,
$val['module'],
$val['key'],
!isset($_REQUEST[$key]) ? 0 : $_REQUEST[$key]);
}
header('Location: groups.php?sid=' . session_id());
exit();
}
// display form
else
{
// inherit from default group -> fetch from DB
$res = $db->Query('SELECT * FROM {pre}gruppen WHERE id=?',
$bm_prefs['std_gruppe']);
if($res->RowCount() == 1)
{
$group = $res->FetchArray(MYSQLI_ASSOC);
$group['titel'] = '';
$res->Free();
}
else
$group = array();
// assign
$group['saliase'] = implode("\n", array_map('DecodeDomain', explode(':', $group['saliase'])));
$group['sms_pre'] = str_replace(':', "\n", $group['sms_pre']);
$tpl->assign('groupOptions', $plugins->GetGroupOptions($group['id']));
$tpl->assign('group', $group);
$tpl->assign('create', true);
$tpl->assign('page', 'groups.edit.tpl');
}
}
$tpl->assign('davSupport', PHPNumVersion() >= 540);
$tpl->assign('ftsSupport', FTS_SUPPORT);
$tpl->assign('smimeSupport', SMIME_SUPPORT);
$tpl->assign('currency', $bm_prefs['currency']);
$tpl->assign('tabs', $tabs);
$tpl->assign('title', $lang_admin['usersgroups'] . ' &raquo; ' . $lang_admin['groups']);
$tpl->display('page.tpl');

145
src/admin/index.php Normal file
View file

@ -0,0 +1,145 @@
<?php
/*
* b1gMail
* Copyright (c) 2021 Patrick Schlangen et al
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
include('../serverlib/admin.inc.php');
if(isset($_REQUEST['action']) && $_REQUEST['action']=='login')
{
$username = $_POST['username'];
$pw = $_POST['password'];
if(trim($username) != '' && trim($pw) != '')
{
$res = $db->Query('SELECT `adminid`,`username`,`password`,`password_salt`,`last_try` FROM {pre}admins WHERE `username`=?',
$username);
if($res->RowCount() == 1)
{
$adminUserRow = $res->FetchArray(MYSQLI_ASSOC);
$res->Free();
if($adminUserRow['last_try'] > (time()-60*5))
{
$errorMsg = sprintf($lang_admin['dattempt2'], FormatDate($adminUserRow['last_try']+60*5));
}
else
{
if($adminUserRow['last_try'] > 10)
{
$adminUserRow['last_try'] = 0;
$db->Query('UPDATE {pre}admins SET `last_try`=0 WHERE `adminid`=?', $adminUserRow['adminid']);
}
if(md5($pw.$adminUserRow['password_salt']) === $adminUserRow['password'])
{
$db->Query('UPDATE {pre}admins SET `last_try`=0 AND `adminid`=?', $adminUserRow['adminid']);
// create session
session_start();
$sessionID = session_id();
$_SESSION['bm_adminLoggedIn'] = true;
$_SESSION['bm_adminID'] = $adminUserRow['adminid'];
$_SESSION['bm_adminAuth'] = md5($adminUserRow['password'].$_SERVER['HTTP_USER_AGENT']);
$_SESSION['bm_sessionToken'] = SessionToken();
$_SESSION['bm_timezone'] = isset($_REQUEST['timezone'])
? (int)$_REQUEST['timezone']
: date('Z');
// log
PutLog(sprintf('Admin <%s> logged in from <%s>',
$adminUserRow['username'],
$_SERVER['REMOTE_ADDR']),
PRIO_NOTE,
__FILE__,
__LINE__);
// redirect
$jump = 'welcome.php?';
if(isset($_REQUEST['jump']) && strpos($_REQUEST['jump'], '://') === false)
{
$jump = trim($_REQUEST['jump']);
if(substr($jump, -1) != '&')
$jump .= '&';
}
header(sprintf('Location: %ssid=%s',
$jump,
session_id()));
exit();
}
else
{
// log
PutLog(sprintf('Admin login from <%s> as <%s> failed (invalid password)',
$_SERVER['REMOTE_ADDR'],
$adminUserRow['username']),
PRIO_NOTE,
__FILE__,
__LINE__);
if($adminUserRow['last_try']+1 > 4)
{
// log
PutLog(sprintf('Admin login for <%s> locked until %s',
$adminUserRow['last_try'],
date('r', time()+60*5)),
PRIO_WARNING,
__FILE__,
__LINE__);
$last_try = time();
}
else
$last_try = $adminUserRow['last_try']+1;
$db->Query('UPDATE {pre}admins SET `last_try`=? WHERE `adminid`=?',
$last_try,
$adminUserRow['adminid']);
$errorMsg = $lang_admin['loginerror'];
}
}
}
else
{
$errorMsg = $lang_admin['loginerror'];
// log
PutLog(sprintf('Admin login from <%s> as <%s> failed (invalid username)',
$_SERVER['REMOTE_ADDR'],
$username),
PRIO_NOTE,
__FILE__,
__LINE__);
}
$tpl->assign('error', $errorMsg);
}
}
else if(isset($_REQUEST['action']) && $_REQUEST['action']=='logout')
{
RequestPrivileges(PRIVILEGES_ADMIN);
$_SESSION = array();
session_destroy();
header('Location: index.php');
exit();
}
if(isset($_REQUEST['jump']))
$tpl->assign('jump', $_REQUEST['jump']);
$tpl->assign('timezone', date('Z'));
$tpl->display('login.tpl');
?>

170
src/admin/logs.php Normal file
View file

@ -0,0 +1,170 @@
<?php
/*
* b1gMail
* Copyright (c) 2021 Patrick Schlangen et al
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
include('../serverlib/admin.inc.php');
RequestPrivileges(PRIVILEGES_ADMIN);
AdminRequirePrivilege('logs');
if(!isset($_REQUEST['action']))
$_REQUEST['action'] = 'logs';
$tabs = array(
0 => array(
'title' => $lang_admin['logs'],
'relIcon' => 'logs.png',
'link' => 'logs.php?',
'active' => $_REQUEST['action'] == 'logs'
),
1 => array(
'title' => $lang_admin['archiving'],
'relIcon' => 'archiving.png',
'link' => 'logs.php?action=archiving&',
'active' => $_REQUEST['action'] == 'archiving'
)
);
/**
* logs
*/
if($_REQUEST['action'] == 'logs')
{
$prioImg = array(
PRIO_DEBUG => 'debug',
PRIO_ERROR => 'error',
PRIO_NOTE => 'info',
PRIO_WARNING => 'warning',
PRIO_PLUGIN => 'plugin'
);
$start = isset($_REQUEST['startDay']) ? SmartyDateTime('start')
: (isset($_REQUEST['start']) ? (int)$_REQUEST['start']
: mktime(0, 0, 0, date('m'), date('d'), date('Y')));
$end = isset($_REQUEST['endDay']) ? SmartyDateTime('end') + 59
: (isset($_REQUEST['end']) ? (int)$_REQUEST['end']
: time());
$addQ = isset($_REQUEST['q']) && trim($_REQUEST['q']) != ''
? ' AND eintrag LIKE \'%' . $db->Escape($_REQUEST['q']) . '%\''
: '';
$prio = isset($_REQUEST['prio']) && is_array($_REQUEST['prio'])
? $_REQUEST['prio']
: array(PRIO_DEBUG => false, PRIO_ERROR => true, PRIO_NOTE => true,
PRIO_WARNING => true, PRIO_PLUGIN => true);
/**
* export?
*/
$exportMode = false;
if(isset($_REQUEST['do']) && $_REQUEST['do'] == 'export')
{
$exportMode = true;
header('Pragma: public');
header('Content-Type: text/plain');
header(sprintf('Content-Disposition: attachment; filename=b1gMailLog-%d-%d.log',
$start, $end));
// header
echo '#' . "\n";
echo '# b1gMail ' . B1GMAIL_VERSION . "\n";
echo '# Log file' . "\n";
echo '#' . "\n";
echo '# From: ' . date('r', $start) . "\n";
echo '# To: ' . date('r', $end) . "\n";
echo '# Generated: ' . date('r') . "\n";
echo '#' . "\n";
echo "\n";
}
$entries = array();
$res = $db->Query('SELECT prio,eintrag,zeitstempel FROM {pre}logs WHERE zeitstempel>='.$start.' AND zeitstempel<='.$end.$addQ.' AND prio IN ? ORDER BY id ASC',
array_keys($prio));
while($row = $res->FetchArray())
{
if($exportMode)
{
printf('%s [%d]: %s' . "\n",
date('r', $row['zeitstempel']),
$row['prio'],
$row['eintrag']);
}
else
{
$row['prioImg'] = $prioImg[$row['prio']];
$entries[] = $row;
}
}
$res->Free();
if($exportMode)
die();
$prioQ = '';
foreach($prio as $key=>$val)
$prioQ .= '&prio[' . ((int)$key) . ']=true';
$tpl->assign('prioQ', $prioQ);
$tpl->assign('prio', $prio);
$tpl->assign('q', isset($_REQUEST['q']) ? $_REQUEST['q'] : '');
$tpl->assign('ueQ', isset($_REQUEST['q']) ? urlencode($_REQUEST['q']) : '');
$tpl->assign('start', $start);
$tpl->assign('end', $end);
$tpl->assign('entries', $entries);
$tpl->assign('page', 'logs.tpl');
}
/**
* archiving
*/
else if($_REQUEST['action'] == 'archiving')
{
/**
* do it?
*/
if(isset($_REQUEST['do']) && $_REQUEST['do'] == 'archive')
{
$date = SmartyDateTime('date');
$archive = isset($_REQUEST['saveCopy']);
if(!ArchiveLogs($date, $archive))
{
DisplayError(0x15, 'Cannot create log archive file',
'Failed to create a new log archive file. The archiving procedure has been aborted.',
'See logs.',
__FILE__,
__LINE__);
}
else
{
PutLog(sprintf('Admin <%s> deleted all log entries before %s (save archive copy: %d)',
$adminRow['username'],
date('r', $date),
$archive ? 1 : 0),
PRIO_NOTE,
__FILE__,
__LINE__);
}
}
$tpl->assign('page', 'logs.archiving.tpl');
}
$tpl->assign('tabs', $tabs);
$tpl->assign('title', $lang_admin['tools'] . ' &raquo; ' . $lang_admin['logs']);
$tpl->display('page.tpl');
?>

649
src/admin/maintenance.php Normal file
View file

@ -0,0 +1,649 @@
<?php
/*
* b1gMail
* Copyright (c) 2021 Patrick Schlangen et al
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
include('../serverlib/admin.inc.php');
include('../serverlib/mailbox.class.php');
RequestPrivileges(PRIVILEGES_ADMIN);
AdminRequirePrivilege('maintenance');
if(!isset($_REQUEST['action']))
$_REQUEST['action'] = 'inactive';
$tabs = array(
0 => array(
'title' => $lang_admin['inactiveusers'],
'relIcon' => 'user_inactive32.png',
'link' => 'maintenance.php?',
'active' => $_REQUEST['action'] == 'inactive'
),
1 => array(
'title' => $lang_admin['trash'],
'relIcon' => 'trash32.png',
'link' => 'maintenance.php?action=trash&',
'active' => $_REQUEST['action'] == 'trash'
),
2 => array(
'title' => $lang_admin['orphans'],
'relIcon' => 'orphans32.png',
'link' => 'maintenance.php?action=orphans&',
'active' => $_REQUEST['action'] == 'orphans'
)
);
if(FTS_SUPPORT)
{
$tabs[] = array(
'title' => $lang_admin['ftsindex'],
'relIcon' => 'search32.png',
'link' => 'maintenance.php?action=fts&',
'active' => $_REQUEST['action'] == 'fts'
);
}
if($bm_prefs['receive_method'] == 'pop3')
{
$tabs[] = array(
'title' => $lang_admin['pop3gateway'],
'relIcon' => 'fetch.png',
'link' => 'maintenance.php?action=pop3gateway&',
'active' => $_REQUEST['action'] == 'pop3gateway'
);
}
/**
* inactive users
*/
if($_REQUEST['action'] == 'inactive')
{
//
// form
//
if(!isset($_REQUEST['do']))
{
// assign
$tpl->assign('groups', BMGroup::GetSimpleGroupList());
$tpl->assign('page', 'maintenance.inactive.tpl');
}
//
// exec
//
else if($_REQUEST['do'] == 'exec')
{
// conditions
$condition = array();
if(isset($_REQUEST['queryTypeLogin']))
{
$timeDiff = time() - max(1, $_REQUEST['loginDays']) * TIME_ONE_DAY;
$condition[] = sprintf('((lastlogin!=0 AND lastlogin<%d AND last_pop3<%d AND last_imap<%d AND last_smtp<%d) OR (lastlogin=0 AND last_pop3=0 AND last_imap=0 AND last_smtp=0 AND reg_date!=0 AND reg_date<%d))',
$timeDiff, $timeDiff, $timeDiff, $timeDiff, $timeDiff);
}
if(isset($_REQUEST['queryTypeGroups'])
&& isset($_REQUEST['groups'])
&& is_array($_REQUEST['groups'])
&& count($_REQUEST['groups']) > 0)
{
$condition[] = '(gruppe IN (' . implode(',', array_keys($_REQUEST['groups'])) . '))';
}
// conditions given?
if(count($condition) == 0)
{
header('Location: maintenance.php?sid=' . session_id());
exit();
}
$condition = 'WHERE `id`!=1 AND (' . implode(' AND ', $condition) . ')';
// update
$affectedUsers = 0;
$action = $_REQUEST['queryAction'];
if($action == 'show')
{
// single action?
if(isset($_REQUEST['singleAction']))
{
if($_REQUEST['singleAction'] == 'lock')
{
$db->Query('UPDATE {pre}users SET gesperrt=? WHERE id=?',
'yes',
$_REQUEST['singleID']);
}
else if($_REQUEST['singleAction'] == 'unlock'
|| $_REQUEST['singleAction'] == 'activate'
|| $_REQUEST['singleAction'] == 'recover')
{
$db->Query('UPDATE {pre}users SET gesperrt=? WHERE id=?',
'no',
$_REQUEST['singleID']);
}
else if($_REQUEST['singleAction'] == 'delete')
{
$res = $db->Query('SELECT gesperrt FROM {pre}users WHERE id=?',
$_REQUEST['singleID']);
list($userStatus) = $res->FetchArray(MYSQLI_NUM);
$res->Free();
if($userStatus != 'delete')
{
$db->Query('UPDATE {pre}users SET gesperrt=? WHERE id=?',
'delete',
$_REQUEST['singleID']);
}
else
{
DeleteUser((int)$_REQUEST['singleID']);
}
}
}
// mass action
if(isset($_REQUEST['executeMassAction']))
{
// get user IDs
$userIDs = array();
foreach($_POST as $key=>$val)
if(substr($key, 0, 5) == 'user_')
$userIDs[] = (int)substr($key, 5);
if(count($userIDs) > 0)
{
if($_REQUEST['massAction'] == 'delete')
{
// get states
$markIDs = $deleteIDs = array();
$res = $db->Query('SELECT id,gesperrt FROM {pre}users WHERE id IN(' . implode(',', $userIDs) . ')');
while($row = $res->FetchArray(MYSQLI_ASSOC))
if($row['gesperrt'] == 'delete')
$deleteIDs[] = $row['id'];
else
$markIDs[] = $row['id'];
// mark users
if(count($markIDs) > 0)
$db->Query('UPDATE {pre}users SET gesperrt=? WHERE id IN(' . implode(',', $markIDs) . ')',
'delete');
// delete users
foreach($deleteIDs as $userID)
DeleteUser($userID);
}
else if($_REQUEST['massAction'] == 'restore'
|| $_REQUEST['massAction'] == 'unlock')
{
$db->Query('UPDATE {pre}users SET gesperrt=? WHERE id IN(' . implode(',', $userIDs) . ')',
'no');
}
else if($_REQUEST['massAction'] == 'lock')
{
$db->Query('UPDATE {pre}users SET gesperrt=? WHERE id IN(' . implode(',', $userIDs) . ')',
'yes');
}
else if(substr($_REQUEST['massAction'], 0, 7) == 'moveto_')
{
$groupID = (int)substr($_REQUEST['massAction'], 7);
$db->Query('UPDATE {pre}users SET gruppe=? WHERE id IN(' . implode(',', $userIDs) . ')',
$groupID);
}
}
}
// sort options
$sortBy = isset($_REQUEST['sortBy'])
? $_REQUEST['sortBy']
: 'lastactivity';
$sortOrder = isset($_REQUEST['sortOrder'])
? strtolower($_REQUEST['sortOrder'])
: 'asc';
$perPage = max(1, isset($_REQUEST['perPage'])
? (int)$_REQUEST['perPage']
: 50);
if($sortBy == 'lastactivity')
$qSortBy = 'GREATEST(`lastlogin`,`last_pop3`,`last_imap`,`last_smtp`,`reg_date`)';
else
$qSortBy = $sortBy;
// page calculation
$res = $db->Query('SELECT COUNT(*) FROM {pre}users ' . $condition);
list($userCount) = $res->FetchArray(MYSQLI_NUM);
$res->Free();
$pageCount = ceil($userCount / $perPage);
$pageNo = isset($_REQUEST['page'])
? max(1, min($pageCount, (int)$_REQUEST['page']))
: 1;
$startPos = max(0, min($perPage*($pageNo-1), $userCount));
// query
$groups = BMGroup::GetSimpleGroupList();
$users = array();
$res = $db->Query('SELECT * FROM {pre}users ' . $condition . ' ORDER BY ' . $qSortBy . ' ' . $sortOrder . ' LIMIT ' . $startPos . ',' . $perPage);
while($row = $res->FetchArray(MYSQLI_ASSOC))
{
$aliases = array();
$aliasRes = $db->Query('SELECT email FROM {pre}aliase WHERE type=? AND user=? ORDER BY email ASC',
ALIAS_RECIPIENT|ALIAS_SENDER,
$row['id']);
while($aliasRow = $aliasRes->FetchArray())
$aliases[] = $aliasRow['email'];
$aliasRes->Free();
$row['groupName'] = isset($groups[$row['gruppe']])
? $groups[$row['gruppe']]['title']
: $lang_admin['missing'];
$row['aliases'] = count($aliases) > 0
? implode(', ', $aliases)
: '';
if($row['lastlogin'] == 0 && $row['gesperrt'] == 'no')
{
$row['status'] = $statusTable['registered'];
$row['statusImg'] = $statusImgTable['registered'];
}
else
{
$row['status'] = $statusTable[$row['gesperrt']];
$row['statusImg'] = $statusImgTable[$row['gesperrt']];
}
$row['lastActivity']= max($row['lastlogin'], $row['last_pop3'], $row['last_imap'], $row['last_smtp'], $row['reg_date']);
$users[$row['id']] = $row;
}
$res->Free();
$tpl->assign('pageNo', $pageNo);
$tpl->assign('pageCount', $pageCount);
$tpl->assign('sortBy', $sortBy);
$tpl->assign('sortOrder', $sortOrder);
$tpl->assign('sortOrderInv', $sortOrder == 'asc' ? 'desc' : 'asc');
$tpl->assign('users', $users);
$tpl->assign('groups', $groups);
$tpl->assign('perPage', $perPage);
$tpl->assign('page', 'maintenance.inactive.list.tpl');
}
else
{
if($action == 'lock')
{
$db->Query('UPDATE {pre}users SET gesperrt=? ' . $condition,
'yes');
$affectedUsers = $db->AffectedRows();
}
else if($action == 'move')
{
$db->Query('UPDATE {pre}users SET gruppe=? ' . $condition,
$_REQUEST['moveGroup']);
$affectedUsers = $db->AffectedRows();
}
else if($action == 'delete')
{
$db->Query('UPDATE {pre}users SET gesperrt=? ' . $condition,
'delete');
$affectedUsers = $db->AffectedRows();
}
// assign
$tpl->assign('msgTitle', $lang_admin['inactiveusers']);
$tpl->assign('msgText', sprintf($lang_admin['activity_done'], $affectedUsers));
$tpl->assign('msgIcon', 'info32');
$tpl->assign('backLink', 'maintenance.php?');
$tpl->assign('page', 'msg.tpl');
}
}
}
/**
* trash
*/
else if($_REQUEST['action'] == 'trash')
{
//
// form
//
if(!isset($_REQUEST['do']))
{
// assign
$tpl->assign('groups', BMGroup::GetSimpleGroupList());
$tpl->assign('page', 'maintenance.trash.tpl');
}
//
// exec
//
else if($_REQUEST['do'] == 'exec')
{
if(!isset($_REQUEST['groups']) || !is_array($_REQUEST['groups'])
|| count($_REQUEST['groups']) < 1)
{
die('DONE');
}
$perPage = max(isset($_REQUEST['perpage']) ? (int)$_REQUEST['perpage'] : 50, 1);
$pos = (int)$_REQUEST['pos'];
$res = $db->Query('SELECT COUNT(*) FROM {pre}users WHERE gruppe IN(' . implode(',', array_keys($_REQUEST['groups'])) . ')');
list($count) = $res->FetchArray(MYSQLI_NUM);
$res->Free();
if($pos >= $count)
{
die('DONE');
}
else
{
$mails = $mailSizes = 0;
$res = $db->Query('SELECT id,email FROM {pre}users WHERE gruppe IN(' . implode(',', array_keys($_REQUEST['groups'])) . ') ORDER BY id ASC LIMIT '
. (int)$pos . ',' . (int)$perPage);
while($row = $res->FetchArray(MYSQLI_ASSOC))
{
$user = _new('BMUser', array($row['id']));
$mailbox = _new('BMMailbox', array($row['id'], $row['email'], $user));
$trashMails = $mailbox->GetMailList(FOLDER_TRASH);
foreach($trashMails as $mailID=>$mail)
{
if((!isset($_REQUEST['daysOnly'])
|| $mail['timestamp'] < time()-max(1, $_REQUEST['days'])*TIME_ONE_DAY)
&& (!isset($_REQUEST['sizesOnly'])
|| $mail['size'] > max(1, $_REQUEST['size']) * 1024))
{
// delete
$mailbox->DeleteMail($mailID);
// stats
$mails++;
$mailSizes += $mail['size'];
}
}
unset($mailbox);
unset($user);
$pos++;
}
$res->Free();
if($pos >= $count)
die('DONE');
else
die($pos . '/' . $count);
}
// assign
$tpl->assign('msgTitle', $lang_admin['trash']);
$tpl->assign('msgText', sprintf($lang_admin['trash_done'], $mails, round($mailSizes/1024/1024, 2)));
$tpl->assign('msgIcon', 'info32');
$tpl->assign('backLink', 'maintenance.php?action=trash&');
$tpl->assign('page', 'msg.tpl');
}
}
/**
* full-text search index
*/
else if($_REQUEST['action'] == 'fts' && FTS_SUPPORT)
{
if(!class_exists('BMSearchIndex'))
include(B1GMAIL_DIR . 'serverlib/searchindex.class.php');
//
// form
//
if(!isset($_REQUEST['do']))
{
$tpl->assign('page', 'maintenance.fts.tpl');
}
//
// build index
//
else if($_REQUEST['do'] == 'buildIndex')
{
$perPage = max(1, $_REQUEST['perpage']);
$qPart = ' FROM {pre}mails '
. 'INNER JOIN {pre}users ON {pre}mails.`userid`={pre}users.`id` '
. 'INNER JOIN {pre}gruppen ON {pre}gruppen.`id`={pre}users.`gruppe` '
. 'WHERE ({pre}mails.`flags`&'.(FLAG_INDEXED|FLAG_DECEPTIVE).')=0 AND {pre}gruppen.`ftsearch`=\'yes\'';
if(!isset($_REQUEST['all']))
{
$res = $db->Query('SELECT COUNT(*)' . $qPart);
while($row = $res->FetchArray(MYSQLI_NUM))
{
$all = $row[0];
}
$res->Free();
}
else
$all = max(0, (int)$_REQUEST['all']);
if(!isset($all) || $all == 0)
die('DONE');
$processedMails = 0;
$currentUserID = 0;
$currentMailbox = false;
$currentIndex = false;
$res = $db->Query('SELECT {pre}mails.`id` AS `id`,{pre}mails.`userid` AS `userid`' . $qPart . ' ORDER BY {pre}mails.`userid` ASC LIMIT ' . (int)$perPage);
while($row = $res->FetchArray(MYSQLI_ASSOC))
{
$success = false;
if($currentUserID != $row['userid'])
{
$currentUserID = $row['userid'];
$userObject = _new('BMUser', array($currentUserID));
$userRow = $userObject->Fetch();
if(is_array($userRow))
{
if(is_object($currentIndex))
$currentIndex->endTx();
$currentMailbox = _new('BMMailbox', array($currentUserID, $userRow['email'], $userObject));
$currentIndex = _new('BMSearchIndex', array($currentUserID));
$currentIndex->beginTx();
}
}
if(is_object($currentMailbox) && is_object($currentIndex))
{
$mail = $currentMailbox->GetMail($row['id']);
if(is_object($mail))
{
$mail->AddToIndex($currentIndex);
$currentMailbox->FlagMail(FLAG_INDEXED, true, $mail->id);
unset($mail);
$success = true;
}
}
if(!$success)
{
// flag mail as indexed even if we failed to index it
// it is probably corrupt and we do not want to process it again in the next iteration
$db->Query('UPDATE {pre}mails SET `flags`=`flags`|'.FLAG_INDEXED.' WHERE `id`=?',
$row['id']);
}
++$processedMails;
}
$res->Free();
if(is_object($currentIndex))
{
$currentIndex->endTx();
unset($currentIndex);
}
if($processedMails == 0)
echo 'DONE';
else
printf('%d/%d', $processedMails, $all);
exit;
}
//
// optimize index
//
else if($_REQUEST['do'] == 'optimizeIndex')
{
$perPage = max(1, $_REQUEST['perpage']);
$pos = !isset($_REQUEST['pos']) ? 0 : max(0, $_REQUEST['pos']);
$qPart = ' FROM {pre}users '
. 'INNER JOIN {pre}gruppen ON {pre}gruppen.`id`={pre}users.`gruppe` '
. 'WHERE {pre}gruppen.`ftsearch`=\'yes\'';
if(!isset($_REQUEST['all']))
{
$res = $db->Query('SELECT COUNT(*)' . $qPart);
while($row = $res->FetchArray(MYSQLI_NUM))
{
$all = $row[0];
}
$res->Free();
}
else
$all = max(0, (int)$_REQUEST['all']);
if(!isset($all) || $all == 0)
die('DONE');
$res = $db->Query('SELECT {pre}users.`id` AS `userid`' . $qPart . ' ORDER BY {pre}users.`id` ASC LIMIT ' . (int)$pos . ',' . (int)$perPage);
while($row = $res->FetchArray(MYSQLI_ASSOC))
{
$idx = _new('BMSearchIndex', array($row['userid']));
if(is_object($idx))
$idx->optimize();
++$pos;
}
$res->Free();
if($pos >= $all)
echo 'DONE';
else
printf('%d/%d', $pos, $all);
exit;
}
}
/**
* orphaned emails
*/
else if($_REQUEST['action'] == 'orphans')
{
//
// form
//
if(!isset($_REQUEST['do']))
{
$tpl->assign('page', 'maintenance.orphans.tpl');
}
//
// exec (mail)
//
else if($_REQUEST['do'] == 'exec')
{
$deletedCount = $deletedSize = 0;
$res = $db->Query('SELECT `id`,`size`,`blobstorage`,`userid` FROM {pre}mails WHERE `userid`!=-1 AND `userid` NOT IN(SELECT `id` FROM {pre}users)');
while($row = $res->FetchArray(MYSQLI_ASSOC))
{
BMBlobStorage::createProvider($row['blobstorage'], $row['userid'])->deleteBlob(BMBLOB_TYPE_MAIL, $row['id']);
$db->Query('DELETE FROM {pre}mails WHERE `id`=?',
$row['id']);
$db->Query('DELETE FROM {pre}attachments WHERE `mailid`=?',
$row['id']);
$deletedCount++;
$deletedSize += $row['size'];
}
$res->Free();
// assign
$tpl->assign('msgTitle', $lang_admin['mailorphans']);
$tpl->assign('msgText', sprintf($lang_admin['orphans_done'], $deletedCount, $deletedSize/1024));
$tpl->assign('msgIcon', 'info32');
$tpl->assign('backLink', 'maintenance.php?action=orphans&');
$tpl->assign('page', 'msg.tpl');
}
//
// exec (disk)
//
else if($_REQUEST['do'] == 'diskExec')
{
$deletedCount = $deletedSize = 0;
$res = $db->Query('SELECT `id`,`size`,`blobstorage`,`user` FROM {pre}diskfiles WHERE `user`!=-1 AND `user` NOT IN(SELECT `id` FROM {pre}users)');
while($row = $res->FetchArray(MYSQLI_ASSOC))
{
BMBlobStorage::createProvider($row['blobstorage'], $row['user'])->deleteBlob(BMBLOB_TYPE_WEBDISK, $row['id']);
$db->Query('DELETE FROM {pre}diskfiles WHERE `id`=?',
$row['id']);
$deletedCount++;
$deletedSize += $row['size'];
}
$res->Free();
// assign
$tpl->assign('msgTitle', $lang_admin['diskorphans']);
$tpl->assign('msgText', sprintf($lang_admin['orphans_done'], $deletedCount, $deletedSize/1024));
$tpl->assign('msgIcon', 'info32');
$tpl->assign('backLink', 'maintenance.php?action=orphans&');
$tpl->assign('page', 'msg.tpl');
}
}
/**
* pop3 gateway
*/
else if($_REQUEST['action'] == 'pop3gateway')
{
// fetch
if(isset($_REQUEST['do']) && $_REQUEST['do'] == 'fetch')
{
$perPage = max(isset($_REQUEST['perpage']) ? (int)$_REQUEST['perpage'] : 50, 1);
if(!class_exists('BMPOP3Gateway'))
include(B1GMAIL_REL . 'serverlib/pop3gateway.class.php');
$pop3Gateway = _new('BMPOP3Gateway');
list($mailCount, $processedMails) = $pop3Gateway->Run($perPage);
if($mailCount == 0 || $mailCount == 0)
{
die('DONE');
}
else
{
die($processedMails . '/' . $mailCount);
}
}
// assign
$tpl->assign('page', 'maintenance.pop3gateway.tpl');
}
$tpl->assign('tabs', $tabs);
$tpl->assign('title', $lang_admin['prefs'] . ' &raquo; ' . $lang_admin['maintenance']);
$tpl->display('page.tpl');

465
src/admin/newsletter.php Normal file
View file

@ -0,0 +1,465 @@
<?php
/*
* b1gMail
* Copyright (c) 2021 Patrick Schlangen et al
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
include('../serverlib/admin.inc.php');
if(!class_exists('BMMailBuilder'))
include('../serverlib/mailbuilder.class.php');
RequestPrivileges(PRIVILEGES_ADMIN);
AdminRequirePrivilege('newsletter');
if(!isset($_REQUEST['action']))
$_REQUEST['action'] = 'newsletter';
$tabs = array(
0 => array(
'title' => $lang_admin['newsletter'],
'relIcon' => 'newsletter.png',
'link' => 'newsletter.php?',
'active' => $_REQUEST['action'] == 'newsletter'
),
1 => array(
'title' => $lang_admin['templates'],
'relIcon' => 'template32.png',
'link' => 'newsletter.php?action=templates&',
'active' => $_REQUEST['action'] == 'templates'
)
);
if($_REQUEST['action'] == 'newsletter')
{
//
// form
//
if(!isset($_REQUEST['do']))
{
// templates
$templates = array();
$res = $db->Query('SELECT `templateid`,`title` FROM {pre}newsletter_templates ORDER BY `title` ASC');
while($row = $res->FetchArray(MYSQLI_ASSOC))
{
$templates[$row['templateid']] = $row['title'];
}
$res->Free();
// countries
$allCountries = CountryList();
$countries = array($bm_prefs['std_land'] => $allCountries[$bm_prefs['std_land']]);
$res = $db->Query('SELECT DISTINCT(`land`) FROM {pre}users');
while($row = $res->FetchArray(MYSQLI_NUM))
if(isset($allCountries[$row[0]]))
$countries[$row[0]] = $allCountries[$row[0]];
else
$countries[145] = $allCountries[145];
$res->Free();
asort($countries);
// assign
$tpl->assign('from', sprintf('"%s - %s" <%s>',
$bm_prefs['titel'],
$lang_admin['team'],
GetPostmasterMail()));
$tpl->assign('countries', $countries);
$tpl->assign('templates', $templates);
$tpl->assign('groups', BMGroup::GetSimpleGroupList());
$tpl->assign('usertpldir', B1GMAIL_REL . 'templates/' . $bm_prefs['template'] . '/');
$tpl->assign('page', 'newsletter.tpl');
}
//
// get TPL data
//
else if($_REQUEST['do'] == 'getTemplateData' && isset($_REQUEST['templateID']))
{
$res = $db->Query('SELECT * FROM {pre}newsletter_templates WHERE `templateid`=?',
(int)$_REQUEST['templateID']);
if($res->RowCount() != 1)
die('Template not found');
$row = $res->FetchArray(MYSQLI_ASSOC);
$res->Free();
header('Content-Type: application/json; charset="' . $currentCharset . '"');
echo '{ ' . "\n";
$i = 0;
foreach($row as $key=>$val)
{
printf("\t\"%s\" : \"%s\"%s\n", addslashes($key), str_replace(array("\r\n", "\n"), '\n', addslashes($val)),
++$i == count($row) ? ' ' : ',');
}
echo '}' . "\n";
exit;
}
//
// determine recipient count
//
else if($_REQUEST['do'] == 'determineRecipients')
{
$groups = preg_replace('/[^0-9,]/', '', $_REQUEST['groups']);
$sendto = $_REQUEST['sendto'];
// status?
$lockedValues = array();
$statusActive = isset($_REQUEST['statusActive']);
$statusLocked = isset($_REQUEST['statusLocked']);
$statusNotActivated = isset($_REQUEST['statusNotActivated']);
$statusDeleted = isset($_REQUEST['statusDeleted']);
if($statusActive) $lockedValues[] = '\'no\'';
if($statusLocked) $lockedValues[] = '\'yes\'';
if($statusNotActivated) $lockedValues[] = '\'locked\'';
$countries = $_REQUEST['countries'];
if(!is_array($countries))
$countries = array();
if(in_array(145, $countries))
$countries[] = 0;
foreach($countries as $key=>$val)
$countries[$key] = (int)$val;
if(count($countries) == 0)
$countries[] = -1;
// no groups or locked values?
if(trim($groups) == '' || count($lockedValues) == 0)
die('0');
// determine count
$res = $db->Query('SELECT COUNT(*) FROM {pre}users,{pre}gruppen WHERE {pre}gruppen.id={pre}users.gruppe AND {pre}users.land IN ? AND {pre}users.gesperrt IN(' . implode(',', $lockedValues) . ') AND {pre}users.gruppe IN(' . $groups . ') AND ({pre}gruppen.allow_newsletter_optout=\'no\' OR {pre}users.newsletter_optin=\'yes\')'
. ($sendto == 'altmails' ? ' AND LENGTH({pre}users.altmail)>3' : ''),
$countries);
list($recpCount) = $res->FetchArray(MYSQLI_NUM);
$res->Free();
die($recpCount);
}
//
// send initiator
//
else if($_REQUEST['do'] == 'send')
{
// groups?
$groups = array();
foreach($_POST as $key=>$val)
if(substr($key, 0, 6) == 'group_')
$groups[] = (int)substr($key, 6);
// sendto?
$sendto = $_REQUEST['sendto'];
// status?
$lockedValues = array();
$statusActive = isset($_REQUEST['statusActive']);
$statusLocked = isset($_REQUEST['statusLocked']);
$statusNotActivated = isset($_REQUEST['statusNotActivated']);
$statusDeleted = isset($_REQUEST['statusDeleted']);
if($statusActive) $lockedValues[] = '\'no\'';
if($statusLocked) $lockedValues[] = '\'yes\'';
if($statusNotActivated) $lockedValues[] = '\'locked\'';
$countries = $_REQUEST['countries'];
if(!is_array($countries))
$countries = array();
if(in_array(145, $countries))
$countries[] = 0;
foreach($countries as $key=>$val)
$countries[$key] = (int)$val;
if(count($countries) == 0)
$countries[] = -1;
// no groups or locked values?
if(count($groups) == 0 || count($lockedValues) == 0)
die('No recipients');
// build condition
$condition = '{pre}gruppen.id={pre}users.gruppe AND {pre}users.land IN (' . implode(',', $countries) . ') AND {pre}users.gesperrt IN(' . implode(',', $lockedValues) . ') AND {pre}users.gruppe IN(' . implode(',', $groups) . ')'
. ($sendto == 'altmails' ? ' AND LENGTH({pre}users.altmail)>3' : '');
$condition .= ' AND ({pre}gruppen.allow_newsletter_optout=\'no\' OR {pre}users.newsletter_optin=\'yes\')';
// determine count
$res = $db->Query('SELECT COUNT(*) FROM {pre}users,{pre}gruppen WHERE ' . $condition);
list($recpCount) = $res->FetchArray(MYSQLI_NUM);
$res->Free();
if($recpCount == 0)
die('No recipients');
// just export?
if(isset($_REQUEST['exportRecipients']))
{
// headers
header('Pragma: public');
header('Content-Disposition: attachment; filename="newsletter-recipients.csv"');
header('Content-Type: text/csv');
// send recipients
$res = $db->Query('SELECT {pre}users.id AS UserID,{pre}users.email AS Email,{pre}users.altmail AS AltEmail,{pre}users.vorname AS Firstname,{pre}users.nachname AS Lastname,{pre}users.anrede AS Salutation FROM {pre}users,{pre}gruppen WHERE '
. $condition . ' ORDER BY {pre}users.id ASC');
$count = $res->RowCount();
if($count > 0)
{
PutLog(sprintf('Admin <%s> exports %d newsletter recipients as CSV file', $adminRow['username'], $count),
PRIO_NOTE,
__FILE__,
__LINE__);
}
$res->ExportCSV();
$res->Free();
exit;
}
// put newsletter info to array
$newsletter = array(
'from' => $_REQUEST['from'],
'subject' => $_REQUEST['subject'],
'priority' => $_REQUEST['priority'],
'text' => $_REQUEST['emailText'],
'textMode' => $_REQUEST['mode'],
'sendto' => $sendto,
'condition' => $condition,
'recpCount' => $recpCount,
'success' => 0,
'failed' => 0
);
// save array to session
if(!isset($_SESSION['newsletters']))
$_SESSION['newsletters'] = array();
$newsletterID = GenerateRandomKey('newsletter');
$_SESSION['newsletters'][$newsletterID] = $newsletter;
// log
PutLog(sprintf('Admin <%s> sends newsletter to %d recipients', $adminRow['username'], $recpCount),
PRIO_NOTE,
__FILE__,
__LINE__);
// assign
$tpl->assign('id', $newsletterID);
$tpl->assign('recpCount', $recpCount);
$tpl->assign('perPage', max(1, (int)$_REQUEST['perpage']));
$tpl->assign('page', 'newsletter.send.tpl');
}
//
// send step
//
else if($_REQUEST['do'] == 'sendStep'
&& isset($_REQUEST['id'])
&& isset($_REQUEST['perpage'])
&& isset($_REQUEST['pos']))
{
// check input
$id = $_REQUEST['id'];
if(!isset($_SESSION['newsletters']) || !isset($_SESSION['newsletters'][$id]))
die('DONE');
// get newsletter data
$newsletter = $_SESSION['newsletters'][$id];
// position
$pos = (int)$_REQUEST['pos'];
// get count
$res = $db->Query('SELECT COUNT(*) FROM {pre}users,{pre}gruppen WHERE ' . $newsletter['condition']);
list($count) = $res->FetchArray(MYSQLI_NUM);
$res->Free();
if($pos >= $count)
{
die('DONE');
}
else
{
// select recipients
$res = $db->Query('SELECT {pre}users.id,{pre}users.email,{pre}users.altmail,{pre}users.vorname,{pre}users.nachname,{pre}users.anrede FROM {pre}users,{pre}gruppen WHERE '
. $newsletter['condition'] . ' ORDER BY {pre}users.id ASC LIMIT ' . $pos . ',' . max(1, (int)$_REQUEST['perpage']));
while($row = $res->FetchArray(MYSQLI_ASSOC))
{
$to = $newsletter['sendto'] == 'altmails' ? $row['altmail'] : $row['email'];
if($row['anrede'] == 'herr')
{
$salutation = $lang_admin['mr'];
$greeting = sprintf($lang_admin['greeting_mr'], $row['nachname']);
}
else if($row['anrede'] == 'frau')
{
$salutation = $lang_admin['mrs'];
$greeting = sprintf($lang_admin['greeting_mrs'], $row['nachname']);
}
else
{
$salutation = '';
$greeting = $lang_admin['greeting_none'];
}
// create text
$text = $newsletter['text'];
$text = str_replace('%%email%%', DecodeEMail($row['email']), $text);
$text = str_replace('%%greeting%%', $greeting, $text);
$text = str_replace('%%salutation%%', $salutation, $text);
$text = str_replace('%%firstname%%', $row['vorname'], $text);
$text = str_replace('%%lastname%%', $row['nachname'], $text);
// create mail
$mail = _new('BMMailBuilder', array(true));
$mail->SetUserID(USERID_ADMIN);
$mail->AddHeaderField('From', $newsletter['from']);
$mail->AddHeaderField('To', $to);
$mail->AddHeaderField('Subject', $newsletter['subject']);
// priority
if($newsletter['priority'] != 0)
{
$mail->AddHeaderField('X-Priority', $newsletter['priority'] == ITEMPRIO_HIGH
? 1
: ($newsletter['priority'] == ITEMPRIO_LOW
? 5
: 3));
}
// text
$mail->AddText($text,
$newsletter['textMode'] == 'html' ? 'html' : 'plain',
$currentCharset);
// send
$result = $mail->Send() !== false;
$mail->CleanUp();
// stats
if($result)
$_SESSION['newsletters'][$id]['success']++;
else
$_SESSION['newsletters'][$id]['failed']++;
$pos++;
}
$res->Free();
if($pos >= $count)
die('DONE');
else
die($pos . '/' . $count);
}
}
//
// done
//
else if($_REQUEST['do'] == 'done'
&& isset($_REQUEST['id'])
&& isset($_SESSION['newsletters'])
&& isset($_SESSION['newsletters'][$_REQUEST['id']]))
{
// remove entry from session
$newsletter = $_SESSION['newsletters'][$_REQUEST['id']];
unset($_SESSION['newsletters'][$_REQUEST['id']]);
// assign
$tpl->assign('msgTitle', $lang_admin['newsletter']);
$tpl->assign('msgText', sprintf($lang_admin['newsletter_done'], $newsletter['success'], $newsletter['failed']));
$tpl->assign('msgIcon', 'info32');
$tpl->assign('backLink', 'newsletter.php?');
$tpl->assign('page', 'msg.tpl');
}
}
else if($_REQUEST['action'] == 'templates')
{
$tpl->assign('usertpldir', B1GMAIL_REL . 'templates/' . $bm_prefs['template'] . '/');
//
// list
//
if(!isset($_REQUEST['do']))
{
// delete?
if(isset($_REQUEST['delete']))
{
$db->Query('DELETE FROM {pre}newsletter_templates WHERE `templateid`=?',
(int)$_REQUEST['delete']);
}
// add?
if(isset($_REQUEST['add']))
{
$db->Query('INSERT INTO {pre}newsletter_templates(`title`,`subject`,`from`,`mode`,`priority`,`body`) VALUES(?,?,?,?,?,?)',
$_REQUEST['title'],
$_REQUEST['subject'],
$_REQUEST['from'],
$_REQUEST['mode'],
$_REQUEST['priority'],
$_REQUEST['emailText']);
}
// templates
$templates = array();
$res = $db->Query('SELECT `templateid`,`title`,`subject` FROM {pre}newsletter_templates ORDER BY `title` ASC');
while($row = $res->FetchArray(MYSQLI_ASSOC))
{
$templates[$row['templateid']] = $row;
}
$res->Free();
// show page
$tpl->assign('from', sprintf('"%s - %s" <%s>',
$bm_prefs['titel'],
$lang_admin['team'],
GetPostmasterMail()));
$tpl->assign('templates', $templates);
$tpl->assign('page', 'newsletter.templates.tpl');
}
//
// edit
//
else if($_REQUEST['do'] == 'edit' && isset($_REQUEST['templateID']))
{
if(isset($_REQUEST['save']) && isset($_POST['priority']))
{
$db->Query('UPDATE {pre}newsletter_templates SET `title`=?,`mode`=?,`from`=?,`subject`=?,`priority`=?,`body`=? WHERE `templateid`=?',
$_REQUEST['title'],
$_REQUEST['mode'],
$_REQUEST['from'],
$_REQUEST['subject'],
$_REQUEST['priority'],
$_REQUEST['emailText'],
(int)$_REQUEST['templateID']
);
header('Location: newsletter.php?action=templates&sid=' . session_id());
exit;
}
$res = $db->Query('SELECT * FROM {pre}newsletter_templates WHERE `templateid`=?',
(int)$_REQUEST['templateID']);
if($res->RowCount() != 1)
die('Template not found');
$template = $res->FetchArray(MYSQLI_ASSOC);
$res->Free();
$tpl->assign('tpl', $template);
$tpl->assign('page', 'newsletter.templates.edit.tpl');
}
}
$tpl->assign('tabs', $tabs);
$tpl->assign('title', $lang_admin['usersgroups'] . ' &raquo; ' . $lang_admin['newsletter']);
$tpl->display('page.tpl');

618
src/admin/optimize.php Normal file
View file

@ -0,0 +1,618 @@
<?php
/*
* b1gMail
* Copyright (c) 2021 Patrick Schlangen et al
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
include('../serverlib/admin.inc.php');
RequestPrivileges(PRIVILEGES_ADMIN);
AdminRequirePrivilege('optimize');
if(!isset($_REQUEST['action']))
$_REQUEST['action'] = 'db';
$tabs = array(
0 => array(
'title' => $lang_admin['db'],
'relIcon' => 'db_optimize.png',
'link' => 'optimize.php?',
'active' => $_REQUEST['action'] == 'db'
),
1 => array(
'title' => $lang_admin['filesystem'],
'relIcon' => 'tempfiles.png',
'link' => 'optimize.php?action=filesystem&',
'active' => $_REQUEST['action'] == 'filesystem'
),
2 => array(
'title' => $lang_admin['cache'],
'relIcon' => 'cache.png',
'link' => 'optimize.php?action=cache&',
'active' => $_REQUEST['action'] == 'cache'
)
);
/**
* optimize DB
*/
if($_REQUEST['action'] == 'db')
{
if(isset($_REQUEST['do']) && $_REQUEST['do'] == 'execute')
{
if($_REQUEST['operation'] == 'struct')
{
// read default structure
include('../serverlib/database.struct.php');
$databaseStructure = unserialize(base64_decode($databaseStructure));
// get tables
$defaultTables = array();
$res = $db->Query('SHOW TABLES');
while($row = $res->FetchArray(MYSQLI_NUM))
$myTables[] = $row[0];
$res->Free();
// compare tables
$result = array();
$repair = false;
foreach($databaseStructure as $tableName=>$tableInfo)
{
$tableFields = $tableInfo['fields'];
$tableIndexes = $tableInfo['indexes'];
$tableResult = array();
$tableResult['table'] = $tableName;
$tableResult['exists'] = false;
$tableResult['missing'] = 0;
$tableResult['invalid'] = 0;
if(in_array($tableName, $myTables))
{
$tableResult['exists'] = true;
// get my fields
$myFields = array();
$res = $db->Query('SHOW FIELDS FROM ' . $tableName);
while($row = $res->FetchArray(MYSQLI_ASSOC))
{
if($row['Null'] == '') $row['Null'] = 'NO';
$myFields[$row['Field']] = array($row['Field'], $row['Type'], $row['Null'], $row['Key'], $row['Default'], $row['Extra']);
}
$res->Free();
// get my indexes
$myIndexes = array();
$res = $db->Query('SHOW INDEX FROM ' . $tableName);
while($row = $res->FetchArray(MYSQLI_ASSOC))
if(isset($myIndexes[$row['Key_name']]))
$myIndexes[$row['Key_name']][] = $row['Column_name'];
else
$myIndexes[$row['Key_name']] = array($row['Column_name']);
$res->Free();
// compare fields
foreach($tableFields as $field)
{
if(!isset($myFields[$field[0]]))
$tableResult['missing']++;
else
{
$myField = $myFields[$field[0]];
if($myField[1] != $field[1]
|| $myField[2] != $field[2]
|| ($myField[4] != $field[4] && !(($myField[4]==0 && $field[4]=='') || ($myField[4]=='' && $field[4]==0)))
|| $myField[5] != $field[5])
$tableResult['invalid']++;
}
}
// compare indexes
foreach($tableIndexes as $indexName=>$indexFields)
{
if(!isset($myIndexes[$indexName]))
$tableResult['missing']++;
else if($myIndexes[$indexName] != $indexFields)
$tableResult['invalid']++;
}
}
if(!$tableResult['exists'] || $tableResult['missing'] > 0 || $tableResult['invalid'] > 0)
$repair = true;
$result[] = $tableResult;
}
$tpl->assign('repair', $repair);
$tpl->assign('result', $result);
$tpl->assign('executeStruct', true);
}
else
{
$op = $_REQUEST['operation'] == 'optimize'
? 'OPTIMIZE TABLE '
: 'REPAIR TABLE ';
$result = array();
foreach($_POST['tables'] as $table)
{
$res = $db->Query($op . $table);
if($res)
{
$row = $res->FetchArray();
$res->Free();
$result[] = array(
'table' => $table,
'type' => $row['Msg_type'],
'status' => $row['Msg_text'],
'query' => $op . $table
);
}
else
{
$result[] = array(
'table' => $table,
'type' => 'error',
'query' => $op . $table
);
}
}
$tpl->assign('result', $result);
$tpl->assign('execute', true);
}
// assign
$tpl->assign('page', 'optimize.db.tpl');
}
else if(isset($_REQUEST['do']) && $_REQUEST['do'] == 'repairStruct')
{
// read default structure
include('../serverlib/database.struct.php');
$databaseStructure = unserialize(base64_decode($databaseStructure));
$executedQueries = SyncDBStruct($databaseStructure);
// assign
$tpl->assign('backLink', 'optimize.php?');
$tpl->assign('msgIcon', 'info32');
$tpl->assign('msgTitle', $lang_admin['repairstruct']);
$tpl->assign('msgText', $lang_admin['repairdone']);
$tpl->assign('page', 'msg.tpl');
}
else
{
$tables = array();
$res = $db->Query('SHOW TABLES');
while($row = $res->FetchArray(MYSQLI_NUM))
if(substr($row[0], 0, strlen($mysql['prefix'])) == $mysql['prefix'])
$tables[] = $row[0];
// assign
$tpl->assign('tables', $tables);
$tpl->assign('page', 'optimize.db.tpl');
}
}
/**
* optimize filesystem
*/
else if($_REQUEST['action'] == 'filesystem')
{
if(isset($_REQUEST['do']) && $_REQUEST['do'] == 'cleanupTempFiles')
{
CleanupTempFiles();
}
else if(isset($_REQUEST['do']) && $_REQUEST['do'] == 'vacuumBlobStor')
{
$perPage = max(1, $_REQUEST['perpage']);
$pos = (int)$_REQUEST['pos'];
$res = $db->Query('SELECT COUNT(*) FROM {pre}users');
list($count) = $res->FetchArray(MYSQLI_NUM);
$res->Free();
if($pos >= $count)
{
die('DONE');
}
else
{
$res = $db->Query('SELECT `id` FROM {pre}users ORDER BY `id` ASC LIMIT '
. (int)$pos . ',' . (int)$perPage);
while($row = $res->FetchArray())
{
$dbFileName = DataFilename($row['id'], 'blobdb');
if(file_exists($dbFileName))
{
try
{
$sdb = new SQLite3($dbFileName);
$sdb->busyTimeout(500);
$sdb->query('VACUUM');
unset($sdb);
}
catch(Exception $ex) { }
}
$pos++;
}
$res->Free();
if($pos >= $count)
die('DONE');
else
die($pos . '/' . $count);
}
}
else if(isset($_REQUEST['do']) && $_REQUEST['do'] == 'rebuildBlobStor' && isset($_REQUEST['rebuild']))
{
$perPage = max(1, $_REQUEST['perpage']);
if($_REQUEST['rebuild'] == 'email')
{
$destBlobStorage = $bm_prefs['blobstorage_provider'];
$blobType = BMBLOB_TYPE_MAIL;
$queryAll = 'SELECT COUNT(*) FROM {pre}mails '
. 'LEFT JOIN {pre}blobstate ON {pre}blobstate.`blobstorage`={pre}mails.`blobstorage` AND {pre}blobstate.blobid={pre}mails.`id` AND {pre}blobstate.`blobtype`='.BMBLOB_TYPE_MAIL.' '
. 'WHERE {pre}mails.`userid`!=-1 AND {pre}mails.`blobstorage`!=? AND ({pre}blobstate.`defect` IS NULL OR {pre}blobstate.`defect`=0)';
$query = 'SELECT {pre}mails.`id`,{pre}mails.`userid`,{pre}mails.`blobstorage` FROM {pre}mails '
. 'LEFT JOIN {pre}blobstate ON {pre}blobstate.`blobstorage`={pre}mails.`blobstorage` AND {pre}blobstate.blobid={pre}mails.`id` AND {pre}blobstate.`blobtype`='.BMBLOB_TYPE_MAIL.' '
. 'WHERE {pre}mails.`userid`!=-1 AND {pre}mails.`blobstorage`!=? AND ({pre}blobstate.`defect` IS NULL OR {pre}blobstate.`defect`=0) ORDER BY {pre}mails.`userid` ASC, {pre}mails.`blobstorage` ASC LIMIT ' . (int)$perPage;
$queryUpdate = 'UPDATE {pre}mails SET `blobstorage`=? WHERE `id`=?';
}
else if($_REQUEST['rebuild'] == 'webdisk')
{
$destBlobStorage = $bm_prefs['blobstorage_provider_webdisk'];
$blobType = BMBLOB_TYPE_WEBDISK;
$queryAll = 'SELECT COUNT(*) FROM {pre}diskfiles '
. 'LEFT JOIN {pre}blobstate ON {pre}blobstate.`blobstorage`={pre}diskfiles.`blobstorage` AND {pre}blobstate.blobid={pre}diskfiles.`id` AND {pre}blobstate.`blobtype`='.BMBLOB_TYPE_WEBDISK.' '
. 'WHERE {pre}diskfiles.`user`!=-1 AND {pre}diskfiles.`blobstorage`!=? AND ({pre}blobstate.`defect` IS NULL OR {pre}blobstate.`defect`=0)';
$query = 'SELECT {pre}diskfiles.`id`,`user` AS `userid`,{pre}diskfiles.`blobstorage` FROM {pre}diskfiles '
. 'LEFT JOIN {pre}blobstate ON {pre}blobstate.`blobstorage`={pre}diskfiles.`blobstorage` AND {pre}blobstate.blobid={pre}diskfiles.`id` AND {pre}blobstate.`blobtype`='.BMBLOB_TYPE_WEBDISK.' '
. 'WHERE {pre}diskfiles.`user`!=-1 AND {pre}diskfiles.`blobstorage`!=? AND ({pre}blobstate.`defect` IS NULL OR {pre}blobstate.`defect`=0) ORDER BY {pre}diskfiles.`user` ASC, {pre}diskfiles.`blobstorage` ASC LIMIT ' . (int)$perPage;
$queryUpdate = 'UPDATE {pre}diskfiles SET `blobstorage`=? WHERE `id`=?';
}
else
die('Invalid rebuild type');
if(!isset($_REQUEST['all']))
{
$db->Query('DELETE FROM {pre}blobstate WHERE `blobtype`=?',
$blobType);
$res = $db->Query($queryAll, $destBlobStorage);
while($row = $res->FetchArray(MYSQLI_NUM))
{
$all = $row[0];
}
$res->Free();
}
else
$all = max(0, (int)$_REQUEST['all']);
if(!isset($all) || $all == 0)
die('DONE');
$processedCount = 0;
$currentUserID = 0;
$currentSourceProvider = $currentDestProvider = false;
$currentToDelete = array();
$currentToUpdate = array();
$res = $db->Query($query, $destBlobStorage);
while($row = $res->FetchArray(MYSQLI_ASSOC))
{
if($currentUserID != $row['userid'])
{
$currentUserID = $row['userid'];
if(is_object($currentDestProvider))
{
$currentDestProvider->endTx();
foreach($currentToUpdate as $rowID)
{
$db->Query($queryUpdate,
$currentDestProvider->providerID,
$rowID);
}
$currentToUpdate = array();
}
$currentDestProvider = BMBlobStorage::createProvider($destBlobStorage, $row['userid']);
$currentDestProvider->beginTx();
if(is_object($currentSourceProvider))
{
foreach($currentToDelete as $rowID)
$currentSourceProvider->deleteBlob($blobType, $rowID);
$currentSourceProvider->endTx();
$currentToDelete = array();
}
$currentSourceProvider = false;
}
if(!is_object($currentSourceProvider) || $currentSourceProvider->providerID != $row['blobstorage'])
{
if(is_object($currentSourceProvider))
{
foreach($currentToDelete as $rowID)
$currentSourceProvider->deleteBlob($blobType, $rowID);
$currentSourceProvider->endTx();
$currentToDelete = array();
}
$currentSourceProvider = BMBlobStorage::createProvider($row['blobstorage'], $row['userid']);
$currentSourceProvider->beginTx();
}
$defect = false;
$fpSource = $currentSourceProvider->loadBlob($blobType, $row['id']);
if($fpSource)
{
if($currentDestProvider->storeBlob($blobType, $row['id'], $fpSource))
{
fclose($fpSource);
$currentToDelete[] = $row['id'];
$currentToUpdate[] = $row['id'];
}
else
$defect = true;
}
else
$defect = true;
if($defect)
{
$db->Query('REPLACE INTO {pre}blobstate(`blobstorage`,`blobtype`,`blobid`,`defect`) VALUES(?,?,?,?)',
$row['blobstorage'],
$blobType,
$row['id'],
1);
}
++$processedCount;
}
$res->Free();
if(is_object($currentSourceProvider))
{
foreach($currentToDelete as $rowID)
$currentSourceProvider->deleteBlob($blobType, $rowID);
$currentSourceProvider->endTx();
unset($currentSourceProvider);
$currentToDelete = array();
}
if(is_object($currentDestProvider))
{
$currentDestProvider->endTx();
foreach($currentToUpdate as $rowID)
{
$db->Query($queryUpdate,
$currentDestProvider->providerID,
$rowID);
}
unset($currentDestProvider);
$currentToUpdate = array();
}
if($processedCount == 0 || $processedCount >= $all)
echo 'DONE';
else
printf('%d/%d', $processedCount, $all);
exit;
}
//
// temp files
//
$tempFileCount = 0;
$tempFileSize = 0;
$res = $db->Query('SELECT id FROM {pre}tempfiles');
while($row = $res->FetchArray())
{
$tempFileCount++;
$fileName = TempFileName($row['id']);
$tempFileSize += @filesize($fileName);
}
$res->Free();
$tpl->assign('haveSQLite3', class_exists('SQLite3'));
$tpl->assign('tempFileCount', $tempFileCount);
$tpl->assign('tempFileSize', $tempFileSize);
$tpl->assign('msTitle', $bm_prefs['storein'] == 'db' ? $lang_admin['file2db'] : $lang_admin['db2file']);
$tpl->assign('msDesc', $bm_prefs['storein'] == 'db' ? $lang_admin['file2db_desc'] : $lang_admin['db2file_desc']);
$tpl->assign('page', 'optimize.filesystem.tpl');
}
/**
* optimize caches
*/
else if($_REQUEST['action'] == 'cache')
{
//
// empty file cache
//
if(isset($_REQUEST['do']) && $_REQUEST['do'] == 'cleanupFileCache'
&& $bm_prefs['cache_type'] == CACHE_B1GMAIL)
{
$cacheManager->CleanUp(true);
}
//
// rebuild caches
//
if(isset($_REQUEST['do']) && $_REQUEST['do'] == 'rebuild'
&& isset($_REQUEST['perpage']) && isset($_REQUEST['pos']))
{
$perpage = (int)$_REQUEST['perpage'];
$pos = (int)$_REQUEST['pos'];
//
// rebuild mailsizes
//
if($_REQUEST['rebuild'] == 'mailsizes')
{
$res = $db->Query('SELECT COUNT(*) FROM {pre}mails WHERE (`flags`&'.FLAG_DECEPTIVE.')=0');
list($count) = $res->FetchArray(MYSQLI_NUM);
$res->Free();
if($pos >= $count)
{
die('DONE');
}
else
{
$res = $db->Query('SELECT id,size,blobstorage,userid FROM {pre}mails WHERE (`flags`&'.FLAG_DECEPTIVE.')=0 ORDER BY id DESC LIMIT '
. (int)$pos . ',' . (int)$perpage);
while($row = $res->FetchArray())
{
$cachedSize = $row['size'];
$actualSize = BMBlobStorage::createProvider($row['blobstorage'], $row['userid'])->getBlobSize(BMBLOB_TYPE_MAIL, $row['id']);
if($actualSize != $cachedSize)
$db->Query('UPDATE {pre}mails SET size=? WHERE id=?',
$actualSize,
$row['id']);
$pos++;
}
$res->Free();
if($pos >= $count)
die('DONE');
else
die($pos . '/' . $count);
}
}
//
// rebuild disk sizes
//
else if($_REQUEST['rebuild'] == 'disksizes')
{
$res = $db->Query('SELECT COUNT(*) FROM {pre}diskfiles');
list($count) = $res->FetchArray(MYSQLI_NUM);
$res->Free();
if($pos >= $count)
{
die('DONE');
}
else
{
$res = $db->Query('SELECT `id`,`size`,`blobstorage`,`user` FROM {pre}diskfiles ORDER BY id DESC LIMIT '
. (int)$pos . ',' . (int)$perpage);
while($row = $res->FetchArray())
{
$cachedSize = $row['size'];
$actualSize = BMBlobStorage::createProvider($row['blobstorage'], $row['user'])->getBlobSize(BMBLOB_TYPE_WEBDISK, $row['id']);
if($actualSize != $cachedSize)
$db->Query('UPDATE {pre}diskfiles SET size=? WHERE id=?',
$actualSize,
$row['id']);
$pos++;
}
$res->Free();
if($pos >= $count)
die('DONE');
else
die($pos . '/' . $count);
}
}
//
// rebuild user sizes
//
else if($_REQUEST['rebuild'] == 'usersizes')
{
$res = $db->Query('SELECT COUNT(*) FROM {pre}users');
list($count) = $res->FetchArray(MYSQLI_NUM);
$res->Free();
if($pos >= $count)
{
die('DONE');
}
else
{
$res = $db->Query('SELECT id,email,mailspace_used,diskspace_used FROM {pre}users ORDER BY id DESC LIMIT '
. (int)$pos . ',' . (int)$perpage);
while($row = $res->FetchArray())
{
$cachedMailSize = $row['mailspace_used'];
$cachedDiskSize = $row['diskspace_used'];
$res2 = $db->Query('SELECT SUM(size) FROM {pre}mails WHERE userid=?',
$row['id']);
list($actualMailSize) = $res2->FetchArray(MYSQLI_NUM);
$res2->Free();
$res2 = $db->Query('SELECT SUM(size) FROM {pre}diskfiles WHERE user=?',
$row['id']);
list($actualDiskSize) = $res2->FetchArray(MYSQLI_NUM);
$res2->Free();
if($actualDiskSize != $cachedDiskSize
|| $actualMailSize != $cachedMailSize)
$db->Query('UPDATE {pre}users SET mailspace_used=?,diskspace_used=? WHERE id=?',
$actualMailSize,
$actualDiskSize,
$row['id']);
$pos++;
}
$res->Free();
if($pos >= $count)
die('DONE');
else
die($pos . '/' . $count);
}
}
}
// retrieve cache info
$res = $db->Query('SELECT COUNT(*),SUM(size) FROM {pre}file_cache');
list($cacheFileCount, $cacheFileSize) = $res->FetchArray(MYSQLI_NUM);
$res->Free();
// assign
$tpl->assign('fileCache', $bm_prefs['cache_type'] == CACHE_B1GMAIL);
$tpl->assign('cacheFileCount', $cacheFileCount);
$tpl->assign('cacheFileSize', $cacheFileSize);
$tpl->assign('page', 'optimize.cache.tpl');
}
$tpl->assign('tabs', $tabs);
$tpl->assign('title', $lang_admin['tools'] . ' &raquo; ' . $lang_admin['optimize']);
$tpl->display('page.tpl');
?>

480
src/admin/payments.php Normal file
View file

@ -0,0 +1,480 @@
<?php
/*
* b1gMail
* Copyright (c) 2021 Patrick Schlangen et al
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
include('../serverlib/admin.inc.php');
include('../serverlib/payment.class.php');
RequestPrivileges(PRIVILEGES_ADMIN);
AdminRequirePrivilege('payments');
if(!isset($_REQUEST['action']))
$_REQUEST['action'] = 'payments';
$tabs = array(
0 => array(
'title' => $lang_admin['payments'],
'relIcon' => 'ico_prefs_payments.png',
'link' => 'payments.php?',
'active' => $_REQUEST['action'] == 'payments'
),
1 => array(
'title' => $lang_admin['export2'],
'relIcon' => 'ico_accentries.png',
'link' => 'payments.php?action=export&',
'active' => $_REQUEST['action'] == 'export'
)
);
/**
* payments
*/
if($_REQUEST['action'] == 'payments')
{
if(!isset($_REQUEST['do']))
$_REQUEST['do'] = 'list';
//
// list
//
if($_REQUEST['do'] == 'list')
{
// single action
if(isset($_REQUEST['singleAction'])
&& in_array($_REQUEST['singleAction'], array('download', 'activate', 'delete')))
{
$_REQUEST['executeMassAction'] = true;
$_REQUEST['massAction'] = $_REQUEST['singleAction'];
$_POST['payment'] = array((int)$_REQUEST['singleID'] => true);
}
// mass action
if(isset($_REQUEST['executeMassAction']))
{
// get payment IDs
$paymentIDs = isset($_POST['payment']) ? $_POST['payment'] : array();
if(!is_array($paymentIDs))
$paymentIDs = array();
else
$paymentIDs = array_keys($paymentIDs);
if(count($paymentIDs) > 0)
{
// delete payments
if($_REQUEST['massAction'] == 'delete')
{
$db->Query('DELETE FROM {pre}orders WHERE `orderid` IN ?',
$paymentIDs);
$db->Query('DELETE FROM {pre}invoices WHERE `orderid` IN ?',
$paymentIDs);
}
// activate payments
else if($_REQUEST['massAction'] == 'activate')
{
$res = $db->Query('SELECT `orderid`,`amount` FROM {pre}orders WHERE `orderid` IN ? AND `status`=?',
$paymentIDs,
ORDER_STATUS_CREATED);
while($row = $res->FetchArray(MYSQLI_ASSOC))
BMPayment::ActivateOrder($row['orderid'], $row['amount']);
$res->Free();
}
// download invoices
else if($_REQUEST['massAction'] == 'download')
{
if(!class_exists('BMZIP'))
include(B1GMAIL_DIR . 'serverlib/zip.class.php');
// create zip archive
$tempID = RequestTempFile(0);
$tempFileName = TempFileName($tempID);
$invTempID = RequestTempFile(0);
$invTempFileName = TempFileName($invTempID);
$fp = fopen($tempFileName, 'wb+');
$zip = _new('BMZIP', array($fp));
// fetch invoices
$res = $db->Query('SELECT `orderid`,`invoice` FROM {pre}invoices WHERE `orderid` IN ?',
$paymentIDs);
while($row = $res->FetchArray(MYSQLI_ASSOC))
{
$invFP = fopen($invTempFileName, 'w+');
fprintf($invFP, '<meta http-equiv="content-type" content="text/html; charset=%s" />',
$currentCharset);
fprintf($invFP, '<title>%s</title>', BMPayment::InvoiceNo($row['orderid']));
fwrite($invFP, $row['invoice']);
fclose($invFP);
$zip->AddFile($invTempFileName, sprintf('%s.html', BMPayment::InvoiceNo($row['orderid'])));
}
$res->Free();
// finish
$size = $zip->Finish();
// headers
header('Pragma: public');
header('Content-Disposition: attachment; filename="invoices.zip"');
header('Content-Type: application/zip');
header(sprintf('Content-Length: %d',
$size));
// send
while(is_resource($fp) && !feof($fp))
{
$block = fread($fp, 4096);
echo $block;
}
// clean up
fclose($fp);
ReleaseTempFile(0, $tempFileID);
ReleaseTempFile(0, $invTempID);
exit();
}
}
}
// sort options
$sortBy = isset($_REQUEST['sortBy'])
? $_REQUEST['sortBy']
: 'created';
$sortOrder = isset($_REQUEST['sortOrder'])
? strtolower($_REQUEST['sortOrder'])
: 'desc';
$perPage = max(1, isset($_REQUEST['perPage'])
? (int)$_REQUEST['perPage']
: 50);
// filter stuff
$payMethods = BMPayment::GetCustomPaymentMethods();
$statusIDs = array(0 => true, 1 => true);
$paymentMethods = array(0 => true, 1 => true, 2 => true, 3 => true);
foreach($payMethods as $methodID=>$method)
$paymentMethods[-$methodID] = true;
$queryAdd = '';
if(isset($_REQUEST['filter']))
{
if(!isset($_REQUEST['status']))
$_REQUEST['status'] = array();
$statusIDs = $_REQUEST['status'];
$queryStatus = count(array_keys($statusIDs)) > 0 ? implode(',', array_keys($statusIDs)) : '-1';
$queryAdd = 'WHERE `status` IN(' . $queryStatus . ') ';
if(!isset($_REQUEST['paymentMethod']))
$_REQUEST['paymentMethod'] = array();
$paymentMethods = $_REQUEST['paymentMethod'];
$queryPaymentMethods = count(array_keys($paymentMethods)) > 0 ? implode(',', array_keys($paymentMethods)) : '-1';
$queryAdd .= 'AND `paymethod` IN(' . $queryPaymentMethods . ') ';
}
// page calculation
$res = $db->Query('SELECT COUNT(*) FROM {pre}orders ' . $queryAdd);
list($paymentCount) = $res->FetchArray(MYSQLI_NUM);
$res->Free();
$pageCount = ceil($paymentCount / $perPage);
$pageNo = isset($_REQUEST['page'])
? max(1, min($pageCount, (int)$_REQUEST['page']))
: 1;
$startPos = max(0, min($perPage*($pageNo-1), $paymentCount));
// fetch rows
$users = array();
$payments = array();
$res = $db->Query('SELECT * FROM {pre}orders ' . $queryAdd . ' ORDER BY ' . $sortBy . ' ' . $sortOrder . ' LIMIT ' . $startPos . ',' . $perPage);
while($row = $res->FetchArray(MYSQLI_ASSOC))
{
if(!isset($users[$row['userid']]))
{
$res2 = $db->Query('SELECT `id`,`email`,`vorname`,`nachname` FROM {pre}users WHERE `id`=?',
$row['userid']);
$users[$row['userid']] = $res2->FetchArray(MYSQLI_ASSOC);
$res2->Free();
}
$res2 = $db->Query('SELECT COUNT(*) FROM {pre}invoices WHERE `orderid`=?',
$row['orderid']);
list($row['hasInvoice']) = $res2->FetchArray(MYSQLI_NUM);
$res2->Free();
if($row['paymethod'] == PAYMENT_METHOD_BANKTRANSFER)
$row['method'] = $lang_admin['banktransfer'];
else if($row['paymethod'] == PAYMENT_METHOD_PAYPAL)
$row['method'] = $lang_admin['paypal'];
else if($row['paymethod'] == PAYMENT_METHOD_SOFORTUEBERWEISUNG)
$row['method'] = $lang_admin['su'];
else if($row['paymethod'] == PAYMENT_METHOD_SKRILL)
$row['method'] = $lang_admin['skrill'];
else if($row['paymethod'] < 0)
{
if(isset($payMethods[abs($row['paymethod'])]))
$row['method'] = $payMethods[abs($row['paymethod'])]['title'];
else
$row['method'] = $lang_admin['unknown'];
}
$row['user'] = $users[$row['userid']];
$row['customerNo'] = BMPayment::CustomerNo($row['userid']);
$row['invoiceNo'] = BMPayment::InvoiceNo($row['orderid']);
$row['amount'] = sprintf('%.02f %s', $row['amount']/100, $bm_prefs['currency']);
$payments[] = $row;
}
$res->Free();
// assign
$tpl->assign('payMethods', $payMethods);
$tpl->assign('payments', $payments);
$tpl->assign('pageNo', $pageNo);
$tpl->assign('pageCount', $pageCount);
$tpl->assign('sortBy', $sortBy);
$tpl->assign('sortOrder', $sortOrder);
$tpl->assign('sortOrderInv', $sortOrder == 'asc' ? 'desc' : 'asc');
$tpl->assign('perPage', $perPage);
$tpl->assign('paymentMethod', $paymentMethods);
$tpl->assign('status', $statusIDs);
$tpl->assign('bm_prefs', $bm_prefs);
$tpl->assign('page', 'payments.list.tpl');
}
//
// details
//
else if($_REQUEST['do'] == 'details' && isset($_REQUEST['orderid']))
{
$payMethods = BMPayment::GetCustomPaymentMethods();
$res = $db->Query('SELECT * FROM {pre}orders WHERE `orderid`=?',
(int)$_REQUEST['orderid']);
if($res->RowCount() != 1)
die('Payment not found.');
$row = $res->FetchArray(MYSQLI_ASSOC);
$res->Free();
$row['paymethod_params'] = @unserialize($row['paymethod_params']);
if(!is_array($row['paymethod_params']))
$row['paymethod_params'] = array();
// get user details
$res = $db->Query('SELECT `id`,`email`,`vorname`,`nachname` FROM {pre}users WHERE `id`=?',
$row['userid']);
$row['user'] = $res->FetchArray(MYSQLI_ASSOC);
$res->Free();
// generate customer/invoice no, format amount
$row['customerNo'] = BMPayment::CustomerNo($row['userid']);
$row['invoiceNo'] = BMPayment::InvoiceNo($row['orderid']);
$row['amount'] = sprintf('%.02f %s', $row['amount']/100, $bm_prefs['currency']);
// get payment method title
if($row['paymethod'] == PAYMENT_METHOD_BANKTRANSFER)
$row['method'] = $lang_admin['banktransfer'];
else if($row['paymethod'] == PAYMENT_METHOD_PAYPAL)
$row['method'] = $lang_admin['paypal'];
else if($row['paymethod'] == PAYMENT_METHOD_SOFORTUEBERWEISUNG)
$row['method'] = $lang_admin['su'];
else if($row['paymethod'] == PAYMENT_METHOD_SKRILL)
$row['method'] = $lang_admin['skrill'];
else if($row['paymethod'] < 0)
{
if(isset($payMethods[abs($row['paymethod'])]))
$row['method'] = $payMethods[abs($row['paymethod'])]['title'];
else
$row['method'] = $lang_admin['unknown'];
}
// invoice?
$res = $db->Query('SELECT COUNT(*) FROM {pre}invoices WHERE `orderid`=?',
$row['orderid']);
list($row['hasInvoice']) = $res->FetchArray(MYSQLI_NUM);
$res->Free();
$tpl->assign('payment', $row);
$tpl->assign('page', 'payments.details.tpl');
}
}
/**
* export
*/
else if($_REQUEST['action'] == 'export')
{
if(!isset($_REQUEST['do']))
{
$tpl->assign('paymentMethods', BMPayment::GetCustomPaymentMethods());
$tpl->assign('start', mktime(0, 0, 0, date('m', time()-TIME_ONE_MONTH), 1, date('Y', time()-TIME_ONE_MONTH)));
$tpl->assign('end', mktime(23, 59, 59, date('m', time()-TIME_ONE_MONTH), date('t', time()-TIME_ONE_MONTH), date('Y', time()-TIME_ONE_MONTH)));
$tpl->assign('page', 'payments.export.tpl');
}
else if($_REQUEST['do'] == 'exportAccEntries'
&& isset($_REQUEST['startDay'])
&& isset($_REQUEST['endDay']))
{
$from = SmartyDateTime('start');
$to = SmartyDateTime('end') + TIME_ONE_DAY;
// headers
header('Pragma: public');
header('Content-Disposition: attachment; filename="acc_entries.csv"');
header('Content-Type: text/csv');
$res = $db->Query('SELECT `orderid`,`amount`,`tax`,`orderid`,`paymethod`,`activated`,`cart` FROM {pre}orders WHERE `status`=1 AND `activated`>=? AND `activated`<=? ORDER BY `activated` ASC',
$from,
$to);
while($row = $res->FetchArray(MYSQLI_ASSOC))
{
$desc = '';
$cart = @unserialize($row['cart']);
if(!is_array($cart) || count($cart) == 0)
{
$desc = 'Order';
}
else
{
$desc = array();
foreach($cart as $cartItem)
$desc[] = $cartItem['text'];
$desc = implode(', ', $desc);
}
printf("%s;%s;%s;%.02f;%04d;%04d;%s\n",
date('d.m.Y', $row['activated']),
str_replace(';', ',', $desc),
BMPayment::InvoiceNo($row['orderid']),
round($row['amount']/100, 2),
$_REQUEST['account'],
$_REQUEST['accounts'][$row['paymethod']],
$row['tax'] == 0 ? '-' : sprintf('USt%d', $row['tax']));
}
$res->Free();
exit();
}
else if($_REQUEST['do'] == 'exportInvoices'
&& isset($_REQUEST['startDay'])
&& isset($_REQUEST['endDay']))
{
$from = SmartyDateTime('start');
$to = SmartyDateTime('end') + TIME_ONE_DAY;
if(!class_exists('BMZIP'))
include(B1GMAIL_DIR . 'serverlib/zip.class.php');
// create zip archive
$tempID = RequestTempFile(0);
$tempFileName = TempFileName($tempID);
$invTempID = RequestTempFile(0);
$invTempFileName = TempFileName($invTempID);
$fp = fopen($tempFileName, 'wb+');
$zip = _new('BMZIP', array($fp));
// fetch invoices
if(isset($_REQUEST['paidOnly']))
{
$res = $db->Query('SELECT {pre}orders.`orderid`,{pre}invoices.`invoice` FROM {pre}orders,{pre}invoices WHERE {pre}orders.`activated`>=? AND {pre}orders.`activated`<=? AND {pre}invoices.`orderid`={pre}orders.`orderid`',
$from,
$to);
}
else
{
$res = $db->Query('SELECT {pre}orders.`orderid`,{pre}invoices.`invoice` FROM {pre}orders,{pre}invoices WHERE (({pre}orders.`status`=1 AND {pre}orders.`activated`>=? AND {pre}orders.`activated`<=?) OR ({pre}orders.`status`=0 AND {pre}orders.`created`>=? AND {pre}orders.`created`<=?)) AND {pre}invoices.`orderid`={pre}orders.`orderid`',
$from,
$to,
$from,
$to);
}
while($row = $res->FetchArray(MYSQLI_ASSOC))
{
$invFP = fopen($invTempFileName, 'w+');
fprintf($invFP, '<meta http-equiv="content-type" content="text/html; charset=%s" />',
$currentCharset);
fprintf($invFP, '<title>%s</title>', BMPayment::InvoiceNo($row['orderid']));
fwrite($invFP, $row['invoice']);
fclose($invFP);
$zip->AddFile($invTempFileName, sprintf('%s.html', BMPayment::InvoiceNo($row['orderid'])));
}
$res->Free();
// finish
$size = $zip->Finish();
// headers
header('Pragma: public');
header('Content-Disposition: attachment; filename="invoices.zip"');
header('Content-Type: application/zip');
header(sprintf('Content-Length: %d',
$size));
// send
while(is_resource($fp) && !feof($fp))
{
$block = fread($fp, 4096);
echo $block;
}
// clean up
fclose($fp);
ReleaseTempFile(0, $tempFileID);
ReleaseTempFile(0, $invTempID);
exit();
}
}
/**
* show invoice
*/
else if($_REQUEST['action'] == 'showInvoice'
&& isset($_REQUEST['orderID']))
{
$res = $db->Query('SELECT `invoice` FROM {pre}invoices WHERE `orderid`=?',
$_REQUEST['orderID']);
if($res->RowCount() == 0)
die('Invoice not found');
list($invoice) = $res->FetchArray(MYSQLI_NUM);
$res->Free();
printf('<title>%s</title>', BMPayment::InvoiceNo($_REQUEST['orderID']));
echo($invoice);
exit();
}
/**
* activate payment RPC
*/
else if($_REQUEST['action'] == 'activatePayment'
&& isset($_REQUEST['vkCode'])
&& isset($_REQUEST['amount']))
{
if(!empty($_REQUEST['vkCode']) && !empty($_REQUEST['amount']) && BMPayment::ActivateOrderWithVKCode($_REQUEST['vkCode'], round((float)str_replace(',', '.', $_REQUEST['amount'])*100, 0)))
printf('OK:%s', $lang_admin['activate_ok']);
else
printf('ERROR:%s', $lang_admin['activate_err']);
exit();
}
$tpl->assign('tabs', $tabs);
$tpl->assign('title', $lang_admin['usersgroups'] . ' &raquo; ' . $lang_admin['payments']);
$tpl->display('page.tpl');
?>

52
src/admin/plugin.page.php Normal file
View file

@ -0,0 +1,52 @@
<?php
/*
* b1gMail
* Copyright (c) 2021 Patrick Schlangen et al
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
include('../serverlib/admin.inc.php');
RequestPrivileges(PRIVILEGES_ADMIN);
if(!isset($_REQUEST['plugin']) || !isset($plugins->_plugins[$_REQUEST['plugin']])
|| !$plugins->getParam('admin_pages', $_REQUEST['plugin']))
{
DisplayError(0x14, 'Invalid plugin page call',
'The requested plugin cannot be found or does not support plugin pages.',
isset($_REQUEST['plugin']) ? sprintf("Plugin:\n%s", $_REQUEST['plugin']) : '',
__FILE__,
__LINE__);
die();
}
if(!($adminRow['type']==0 || (isset($adminRow['privileges']['plugins']) && isset($adminRow['privileges']['plugins'][$_REQUEST['plugin']]))))
{
DisplayError(0x02, 'Unauthorized', 'You are not authrized to view or change this dataset or page. Possible reasons are too few permissions or an expired session.',
sprintf("Requested privileges:\n%s",
$priv),
__FILE__,
__LINE__);
exit();
}
$plugins->callFunction('AdminHandler', $_REQUEST['plugin']);
$tpl->assign('title', $lang_admin['plugins']
. ' &raquo; '
. $plugins->getParam('admin_page_title', $_REQUEST['plugin']));
$tpl->display('page.tpl');
?>

389
src/admin/plugins.php Normal file
View file

@ -0,0 +1,389 @@
<?php
/*
* b1gMail
* Copyright (c) 2021 Patrick Schlangen et al
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
include('../serverlib/admin.inc.php');
RequestPrivileges(PRIVILEGES_ADMIN);
AdminRequirePrivilege('pluginsadmin');
if(!isset($_REQUEST['action']))
$_REQUEST['action'] = 'plugins';
$tabs = array(
0 => array(
'title' => $lang_admin['plugins'],
'relIcon' => 'plugin32.png',
'link' => 'plugins.php?',
'active' => $_REQUEST['action'] == 'plugins'
),
1 => array(
'title' => $lang_admin['widgets'],
'relIcon' => 'wlayout_add32.png',
'link' => 'plugins.php?action=widgets&',
'active' => $_REQUEST['action'] == 'widgets'
),
2 => array(
'title' => $lang_admin['updates'],
'relIcon' => 'updates.png',
'link' => 'plugins.php?action=updates&',
'active' => $_REQUEST['action'] == 'updates'
),
3 => array(
'title' => $lang_admin['install'],
'relIcon' => 'plugin_add.png',
'link' => 'plugins.php?action=install&',
'active' => $_REQUEST['action'] == 'install'
)
);
/**
* plugins/widgets
*/
if($_REQUEST['action'] == 'plugins'
|| $_REQUEST['action'] == 'widgets')
{
if(isset($_REQUEST['do']) && $_REQUEST['do'] == 'activatePlugin'
&& isset($_REQUEST['plugin']) && isset($plugins->_inactivePlugins[$_REQUEST['plugin']]))
{
$plugins->activatePlugin($_REQUEST['plugin']);
$tpl->assign('reloadMenu', true);
}
else if(isset($_REQUEST['do']) && $_REQUEST['do'] == 'deactivatePlugin'
&& isset($_REQUEST['plugin']) && isset($plugins->_plugins[$_REQUEST['plugin']]))
{
$plugins->deactivatePlugin($_REQUEST['plugin']);
$tpl->assign('reloadMenu', true);
}
else if(isset($_REQUEST['do']) && $_REQUEST['do'] == 'pausePlugin'
&& isset($_REQUEST['plugin']) && isset($plugins->_plugins[$_REQUEST['plugin']]))
{
$plugins->pausePlugin($_REQUEST['plugin']);
$tpl->assign('reloadMenu', true);
}
else if(isset($_REQUEST['do']) && $_REQUEST['do'] == 'unpausePlugin'
&& isset($_REQUEST['plugin']) && isset($plugins->_inactivePlugins[$_REQUEST['plugin']]))
{
$plugins->unpausePlugin($_REQUEST['plugin']);
$tpl->assign('reloadMenu', true);
}
else if(isset($_REQUEST['do']) && $_REQUEST['do'] == 'deletePackage'
&& isset($_REQUEST['package']) && strlen($_REQUEST['package']) == 32)
{
BMPluginPackage::Uninstall($_REQUEST['package']);
$tpl->assign('reloadMenu', true);
}
$pluginList = array();
// build plugin list
foreach($plugins->_plugins as $className=>$pluginInfo)
{
if(($_REQUEST['action'] == 'plugins' && ($plugins->getParam('type', $className) == BMPLUGIN_DEFAULT
|| $plugins->getParam('type', $className) == BMPLUGIN_FILTER))
|| ($_REQUEST['action'] == 'widgets' && $plugins->getParam('type', $className) == BMPLUGIN_WIDGET))
{
if(!isset($pluginList[$pluginInfo['signature']]))
$pluginList[$pluginInfo['signature']] = array(
'name' => $pluginInfo['packageName'],
'plugins' => array()
);
$pluginList[$pluginInfo['signature']]['plugins'][] = array(
'name' => $className,
'title' => $plugins->getParam('name', $className),
'version' => $plugins->getParam('version', $className),
'author' => $plugins->getParam('author', $className),
'type' => $pluginTypeTable[$plugins->getParam('type', $className)],
'installed' => $plugins->getParam('installed', $className),
'paused' => $plugins->getParam('paused', $className)
);
}
}
foreach($plugins->_inactivePlugins as $className=>$pluginInfo)
{
if(($_REQUEST['action'] == 'plugins' && ($pluginInfo['type'] == BMPLUGIN_DEFAULT
|| $pluginInfo['type'] == BMPLUGIN_FILTER))
|| ($_REQUEST['action'] == 'widgets' && $pluginInfo['type'] == BMPLUGIN_WIDGET))
{
if(!isset($pluginList[$pluginInfo['signature']]))
$pluginList[$pluginInfo['signature']] = array(
'name' => $pluginInfo['packageName'],
'plugins' => array()
);
$pluginList[$pluginInfo['signature']]['plugins'][] = array(
'name' => $className,
'title' => $pluginInfo['name'],
'version' => $pluginInfo['version'],
'author' => $pluginInfo['author'],
'type' => $pluginTypeTable[$pluginInfo['type']],
'installed' => $pluginInfo['installed'],
'paused' => $pluginInfo['paused']
);
}
}
function __PluginSort($a, $b)
{
return(strcasecmp(($a['installed'] ? '0' : '1') . $a['title'], ($b['installed'] ? '0' : '1') . $b['title']));
}
function __PluginListSort($a, $b)
{
return(strcasecmp($a['name'], $b['name']));
}
foreach($pluginList as $key=>$val)
uasort($pluginList[$key]['plugins'], '__PluginSort');
uasort($pluginList, '__PluginListSort');
$tpl->assign('action', $_REQUEST['action']);
$tpl->assign('plugins', $pluginList);
$tpl->assign('page', 'plugins.list.tpl');
}
/**
* update check page
*/
else if($_REQUEST['action'] == 'updates')
{
$pluginList = array();
// build plugin list
foreach($plugins->_plugins as $className=>$pluginInfo)
{
if(!isset($pluginList[$pluginInfo['signature']]))
$pluginList[$pluginInfo['signature']] = array(
'name' => $pluginInfo['packageName'],
'plugins' => array()
);
$pluginList[$pluginInfo['signature']]['plugins'][] = array(
'name' => $className,
'title' => $plugins->getParam('name', $className),
'version' => $plugins->getParam('version', $className),
'author' => $plugins->getParam('author', $className),
'website' => $plugins->getParam('website', $className),
'type' => $pluginTypeTable[$plugins->getParam('type', $className)],
'installed' => true
);
}
$tpl->assign('plugins', $pluginList);
$tpl->assign('page', 'plugins.updates.tpl');
}
/**
* perform update check
*/
else if($_REQUEST['action'] == 'updateCheck'
&& isset($_REQUEST['plugin']))
{
$latestVersion = '';
$resultCode = $plugins->callFunction('CheckForUpdates', $_REQUEST['plugin'], false, array(&$latestVersion));
printf('%s;%d;%s;%s',
$_REQUEST['plugin'],
$resultCode,
$latestVersion,
$plugins->getParam('website', $_REQUEST['plugin']));
exit();
}
/**
* install
*/
else if($_REQUEST['action'] == 'install')
{
//
// form
//
if(!isset($_REQUEST['do']))
{
$tpl->assign('page', 'plugins.install.tpl');
}
//
// upload
//
else if(isset($_REQUEST['do']) && $_REQUEST['do'] == 'uploadPlugin')
{
$formatError = true;
if(isset($_FILES['package']) && $_FILES['package']['error'] == 0
&& $_FILES['package']['size'] > 0)
{
// request temp file
$tempFileID = RequestTempFile(0);
$tempFileName = TempFileName($tempFileID);
// move file
$fileName = $_FILES['package']['name'];
move_uploaded_file($_FILES['package']['tmp_name'], $tempFileName);
// open file
$package = _new('BMPluginPackage', array($fp = fopen($tempFileName, 'rb')));
if($package->ParseFile())
{
$meta = $package->metaInfo;
foreach($meta as $key=>$val)
if(is_string($val))
$meta[$key] = CharsetDecode($val, FALLBACK_CHARSET);
$formatError = false;
$tpl->assign('id', $tempFileID);
$tpl->assign('meta', $meta);
$tpl->assign('signature', $package->signature);
$tpl->assign('versionsMatch', $package->metaInfo['for_b1gmail'] == B1GMAIL_VERSION);
$tpl->assign('b1gmailVersion', B1GMAIL_VERSION);
$tpl->assign('page', 'plugin.install.info.tpl');
}
// close file
fclose($fp);
}
// invalid file => message
if($formatError)
{
$tpl->assign('msgTitle', $lang_admin['install']);
$tpl->assign('msgText', $lang_admin['plugin_formaterr']);
$tpl->assign('msgIcon', 'error32');
$tpl->assign('backLink', 'plugins.php?action=install&');
$tpl->assign('page', 'msg.tpl');
}
}
//
// check signature
//
else if(isset($_REQUEST['do']) && $_REQUEST['do'] == 'checkSignature'
&& isset($_REQUEST['signature']) && strlen($_REQUEST['signature']) == 32)
{
$result = BMPluginPackage::VerifySignature($_REQUEST['signature']);
if($result === false)
{
$tpl->assign('icon', 'error32');
$tpl->assign('title', $lang_admin['sigfailed']);
$tpl->assign('text', $lang_admin['sigfailed_desc']);
}
else if($result == SIGNATURE_OFFICIAL)
{
$tpl->assign('icon', 'sig_ok');
$tpl->assign('title', $lang_admin['sigofficial']);
$tpl->assign('text', $lang_admin['sigofficial_desc']);
}
else if($result == SIGNATURE_VERIFIED)
{
$tpl->assign('icon', 'sig');
$tpl->assign('title', $lang_admin['sigver']);
$tpl->assign('text', $lang_admin['sigver_desc']);
}
else if($result == SIGNATURE_UNKNOWN)
{
$tpl->assign('icon', 'sig_unknown');
$tpl->assign('title', $lang_admin['sigunknown']);
$tpl->assign('text', $lang_admin['sigunknown_desc']);
}
else if($result == SIGNATURE_MALICIOUS)
{
$tpl->assign('icon', 'sig_mal');
$tpl->assign('title', $lang_admin['sigmal']);
$tpl->assign('text', $lang_admin['sigmal_desc']);
}
$tpl->display('plugin.install.signature.tpl');
exit();
}
//
// install
//
else if(isset($_REQUEST['do']) && $_REQUEST['do'] == 'installPlugin'
&& isset($_REQUEST['id']) && ValidTempFile(0, (int)$_REQUEST['id']))
{
if(isset($_REQUEST['step']))
$step = max(1, min(2, (int)$_REQUEST['step']));
else
$step = 1;
$id = (int)$_REQUEST['id'];
$tempFileName = TempFileName($id);
// open file
$package = _new('BMPluginPackage', array($fp = fopen($tempFileName, 'rb')));
if($package->ParseFile())
{
if($step == 1)
{
if($package->InstallStep1())
{
$url = sprintf('plugins.php?action=install&do=installPlugin&id=%d&step=2&sid=%s',
$id,
session_id());
header('Location: ' . $url);
fclose($fp);
exit();
}
else
{
$tpl->assign('msgTitle', $lang_admin['install']);
$tpl->assign('msgText', $lang_admin['plugin_insterr']);
$tpl->assign('msgIcon', 'error32');
$tpl->assign('backLink', 'plugins.php?action=install&');
$tpl->assign('page', 'msg.tpl');
fclose($fp);
ReleaseTempFile(0, $id);
}
}
else if($step == 2)
{
if($package->InstallStep2())
{
$tpl->assign('reloadMenu', true);
$tpl->assign('msgTitle', $lang_admin['install']);
$tpl->assign('msgText', $lang_admin['plugin_installed']);
$tpl->assign('msgIcon', 'info32');
$tpl->assign('backLink', 'plugins.php?');
$tpl->assign('page', 'msg.tpl');
}
else
{
$tpl->assign('msgTitle', $lang_admin['install']);
$tpl->assign('msgText', $lang_admin['plugin_insterr']);
$tpl->assign('msgIcon', 'error32');
$tpl->assign('backLink', 'plugins.php?action=install&');
$tpl->assign('page', 'msg.tpl');
}
// close and release file
fclose($fp);
ReleaseTempFile(0, $id);
}
}
}
}
$tpl->assign('tabs', $tabs);
$tpl->assign('title', $lang_admin['plugins'] . ' &raquo; ' . $lang_admin['plugins']);
$tpl->display('page.tpl');
?>

103
src/admin/prefs.abuse.php Normal file
View file

@ -0,0 +1,103 @@
<?php
/*
* b1gMail
* Copyright (c) 2021 Patrick Schlangen et al
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
include('../serverlib/admin.inc.php');
RequestPrivileges(PRIVILEGES_ADMIN);
AdminRequirePrivilege('prefs.abuse');
if(!isset($_REQUEST['action']))
$_REQUEST['action'] = 'prefs';
$tabs = array(
0 => array(
'title' => $lang_admin['abuseprotect'],
'relIcon' => 'abuse32.png',
'link' => 'prefs.abuse.php?',
'active' => $_REQUEST['action'] == 'prefs'
)
);
/**
* activity
*/
if($_REQUEST['action'] == 'prefs')
{
if(isset($_REQUEST['save']) && isset($_POST['types']) && is_array($_POST['types']))
{
$db->Query('UPDATE {pre}prefs SET `ap_medium_limit`=?,`ap_hard_limit`=?,`ap_expire_time`=?,`ap_expire_mode`=?,`ap_autolock`=?,`ap_autolock_notify`=?,`ap_autolock_notify_to`=?',
max(1, $_POST['ap_medium_limit']),
max(1, $_POST['ap_hard_limit']),
$_POST['ap_expire_time'] * TIME_ONE_HOUR,
$_POST['ap_expire_mode'],
isset($_POST['ap_autolock']) ? 'yes' : 'no',
isset($_POST['ap_autolock_notify']) ? 'yes' : 'no',
EncodeEMail($_POST['ap_autolock_notify_to']));
ReadConfig();
foreach($_POST['types'] as $type=>$details)
{
if(!isset($details['points']))
continue;
$prefs = array();
if(isset($details['prefs']) && is_array($details['prefs']))
{
foreach($details['prefs'] as $key=>$val)
$prefs[] = $key . '=' . str_replace(';', '\\;', str_replace('\\', '\\\\', $val));
}
$prefs = implode(';', $prefs);
$db->Query('REPLACE INTO {pre}abuse_points_config(`type`,`points`,`prefs`) VALUES(?,?,?)',
$type,
$details['points'],
$prefs);
}
}
$types = GetAbuseTypes();
foreach($types as $type=>$info)
{
$prefs = GetAbuseTypePrefs($type);
foreach($prefs as $key=>$val)
if(isset($types[$type]['prefs'][$key]))
$types[$type]['prefs'][$key]['value'] = $val;
$types[$type]['points'] = $types[$type]['defaultPoints'];
}
$res = $db->Query('SELECT `type`,`points`,`prefs` FROM {pre}abuse_points_config');
while($row = $res->FetchArray(MYSQLI_ASSOC))
{
if(!isset($types[$row['type']]))
continue;
$types[$row['type']]['points'] = $row['points'];
}
$res->Free();
$tpl->assign('apTypes', $types);
$tpl->assign('page', 'prefs.abuse.tpl');
}
$tpl->assign('bm_prefs', $bm_prefs);
$tpl->assign('tabs', $tabs);
$tpl->assign('title', $lang_admin['prefs'] . ' &raquo; ' . $lang_admin['abuseprotect']);
$tpl->display('page.tpl');

172
src/admin/prefs.ads.php Normal file
View file

@ -0,0 +1,172 @@
<?php
/*
* b1gMail
* Copyright (c) 2021 Patrick Schlangen et al
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
include('../serverlib/admin.inc.php');
RequestPrivileges(PRIVILEGES_ADMIN);
AdminRequirePrivilege('prefs.ads');
if(!isset($_REQUEST['action']))
$_REQUEST['action'] = 'banners';
$tabs = array(
0 => array(
'title' => $lang_admin['banners'],
'relIcon' => 'ad32.png',
'link' => 'prefs.ads.php?',
'active' => $_REQUEST['action'] == 'banners'
)
);
/**
* banners
*/
if($_REQUEST['action'] == 'banners')
{
if(!isset($_REQUEST['do']))
$_REQUEST['do'] = 'list';
//
// list
//
if($_REQUEST['do'] == 'list')
{
// add
if(isset($_REQUEST['add']))
{
$db->Query('INSERT INTO {pre}ads(code,weight,paused,category,`comments`) VALUES(?,?,?,?,?)',
$_REQUEST['code'],
max(1, min($_REQUEST['weight'], 100)),
isset($_REQUEST['paused']) ? 'yes' : 'no',
$_REQUEST['category'],
$_REQUEST['comments']);
}
// delete
if(isset($_REQUEST['delete']))
{
$db->Query('DELETE FROM {pre}ads WHERE id=?',
(int)$_REQUEST['delete']);
}
// reset stats
if(isset($_REQUEST['reset']))
{
$db->Query('UPDATE {pre}ads SET `views`=0 WHERE id=?',
(int)$_REQUEST['reset']);
}
// activate
if(isset($_REQUEST['activate']))
{
$db->Query('UPDATE {pre}ads SET paused=? WHERE id=?',
'no',
(int)$_REQUEST['activate']);
}
// deactivate
if(isset($_REQUEST['deactivate']))
{
$db->Query('UPDATE {pre}ads SET paused=? WHERE id=?',
'yes',
(int)$_REQUEST['deactivate']);
}
// mass action
if(isset($_REQUEST['executeMassAction']))
{
// get ad IDs
$adIDs = array();
foreach($_POST as $key=>$val)
if(substr($key, 0, 3) == 'ad_')
$adIDs[] = (int)substr($key, 3);
if(count($adIDs) > 0)
{
if($_REQUEST['massAction'] == 'delete')
{
// delete row
$db->Query('DELETE FROM {pre}ads WHERE id IN(' . implode(',', $adIDs) . ')');
}
else if($_REQUEST['massAction'] == 'pause')
{
$db->Query('UPDATE {pre}ads SET paused=? WHERE id IN(' . implode(',', $adIDs) . ')',
'yes');
}
else if($_REQUEST['massAction'] == 'continue')
{
$db->Query('UPDATE {pre}ads SET paused=? WHERE id IN(' . implode(',', $adIDs) . ')',
'no');
}
}
}
// fetch
$ads = array();
$res = $db->Query('SELECT id,code,views,paused,weight,category FROM {pre}ads ORDER BY paused DESC, views DESC');
while($row = $res->FetchArray(MYSQLI_ASSOC))
{
$row['paused'] = $row['paused'] == 'yes';
$ads[$row['id']] = $row;
}
$res->Free();
// assign
$tpl->assign('ads', $ads);
$tpl->assign('page', 'prefs.ads.tpl');
}
//
// edit
//
else if($_REQUEST['do'] == 'edit')
{
// save?
if(isset($_REQUEST['save']))
{
$db->Query('UPDATE {pre}ads SET code=?, weight=?, paused=?, category=?, `comments`=? WHERE id=?',
$_REQUEST['code'],
max(1, min($_REQUEST['weight'], 100)),
isset($_REQUEST['paused']) ? 'yes' : 'no',
$_REQUEST['category'],
$_REQUEST['comments'],
(int)$_REQUEST['id']);
header('Location: prefs.ads.php?sid=' . session_id());
exit();
}
// fetch
$res = $db->Query('SELECT id,code,paused,weight,category,comments FROM {pre}ads WHERE id=?',
(int)$_REQUEST['id']);
assert('$res->RowCount() != 0');
$ad = $res->FetchArray(MYSQLI_ASSOC);
$ad['paused'] = $ad['paused'] == 'yes';
$res->Free();
// assign
$tpl->assign('ad', $ad);
$tpl->assign('page', 'prefs.ads.edit.tpl');
}
}
$tpl->assign('tabs', $tabs);
$tpl->assign('title', $lang_admin['prefs'] . ' &raquo; ' . $lang_admin['ads']);
$tpl->display('page.tpl');
?>

532
src/admin/prefs.common.php Normal file
View file

@ -0,0 +1,532 @@
<?php
/*
* b1gMail
* Copyright (c) 2021 Patrick Schlangen et al
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
include('../serverlib/admin.inc.php');
RequestPrivileges(PRIVILEGES_ADMIN);
AdminRequirePrivilege('prefs.common');
if(!isset($_REQUEST['action']))
$_REQUEST['action'] = 'common';
$tabs = array(
array(
'title' => $lang_admin['common'],
'relIcon' => 'ico_prefs_common.png',
'link' => 'prefs.common.php?',
'active' => $_REQUEST['action'] == 'common'
),
array(
'title' => $lang_admin['domains'],
'relIcon' => 'domain32.png',
'link' => 'prefs.common.php?action=domains&',
'active' => $_REQUEST['action'] == 'domains'
),
array(
'title' => $lang_admin['caching'],
'relIcon' => 'cache.png',
'link' => 'prefs.common.php?action=caching&',
'active' => $_REQUEST['action'] == 'caching'
),
array(
'title' => $lang_admin['safecode'],
'relIcon' => 'captcha32.png',
'link' => 'prefs.common.php?action=captcha&',
'active' => $_REQUEST['action'] == 'captcha'
),
array(
'title' => $lang_admin['signup'],
'relIcon' => 'ico_prefs_signup.png',
'link' => 'prefs.common.php?action=signup&',
'active' => $_REQUEST['action'] == 'signup'
),
array(
'title' => $lang_admin['lockedusernames'],
'relIcon' => 'lockedusername32.png',
'link' => 'prefs.common.php?action=lockedusernames&',
'active' => $_REQUEST['action'] == 'lockedusernames'
),
array(
'title' => $lang_admin['taborder'],
'relIcon' => 'tab_order32.png',
'link' => 'prefs.common.php?action=taborder&',
'active' => $_REQUEST['action'] == 'taborder'
)
);
/**
* common
*/
if($_REQUEST['action'] == 'common')
{
if(isset($_REQUEST['save'])
&& isset($_POST['titel'])
&& isset($_POST['language']))
{
// trailing slashes
if(substr($_POST['selfurl'], -1) != '/')
$_POST['selfurl'] .= '/';
if(substr($_POST['mobile_url'], -1) != '/')
$_POST['mobile_url'] .= '/';
if(substr($_POST['selffolder'], -1) != '/')
$_POST['selffolder'] .= '/';
if(substr($_POST['datafolder'], -1) != '/')
$_POST['datafolder'] .= '/';
if(trim($_POST['ssl_url']) != ''
&& substr($_POST['ssl_url'], -1) != '/')
$_POST['ssl_url'] .= '/';
if($_POST['language'] != $bm_prefs['language'])
setcookie('bm_language', $_POST['language'], time()+TIME_ONE_YEAR);
$db->Query('UPDATE {pre}prefs SET titel=?, b1gmta_host=?, selffolder=?, selfurl=?, mobile_url=?, search_engine=?, datafolder=?, language=?, std_land=?, datumsformat=?, ordner_proseite=?, gut_regged=?, autocancel=?, wartung=?, structstorage=?, cron_interval=?, logouturl=?, contact_history=?, ip_lock=?, cookie_lock=?, domain_combobox=?, ssl_url=?, ssl_login_option=?, ssl_login_enable=?, ssl_signup_enable=?, auto_tz=?, compress_pages=?, redirect_mobile=?, calendar_defaultviewmode=?, '
. 'logs_autodelete=?, logs_autodelete_days=?, logs_autodelete_archive=?, hotkeys_default=?, contactform=?, contactform_to=?, contactform_name=?, notify_interval=?, notify_lifetime=?, mail_groupmode=?',
$_POST['titel'],
$_POST['b1gmta_host'],
$_POST['selffolder'],
$_POST['selfurl'],
$_POST['mobile_url'],
$_POST['search_engine'],
$_POST['datafolder'],
$_POST['language'],
$_POST['std_land'],
$_POST['datumsformat'],
$_POST['ordner_proseite'],
isset($_POST['gut_regged']) ? 'yes' : 'no',
isset($_POST['autocancel']) ? 'yes' : 'no',
isset($_POST['wartung']) ? 'yes' : 'no',
isset($_POST['structstorage']) ? 'yes' : 'no',
$_POST['cron_interval'],
$_POST['logouturl'],
isset($_POST['contact_history']) ? 'yes' : 'no',
isset($_POST['ip_lock']) ? 'yes' : 'no',
isset($_POST['cookie_lock']) ? 'yes' : 'no',
isset($_POST['domain_combobox']) ? 'yes' : 'no',
$_POST['ssl_url'],
isset($_POST['ssl_login_option']) ? 'yes' : 'no',
isset($_POST['ssl_login_enable']) ? 'yes' : 'no',
isset($_POST['ssl_signup_enable']) ? 'yes' : 'no',
isset($_POST['auto_tz']) ? 'yes' : 'no',
isset($_POST['compress_pages']) ? 'yes' : 'no',
isset($_POST['redirect_mobile']) ? 'yes' : 'no',
$_REQUEST['calendar_defaultviewmode'],
isset($_POST['logs_autodelete']) ? 'yes' : 'no',
max(1, (int)$_POST['logs_autodelete_days']),
isset($_POST['logs_autodelete_archive']) ? 'yes' : 'no',
isset($_POST['hotkeys_default']) ? 'yes' : 'no',
isset($_POST['contactform']) ? 'yes' : 'no',
EncodeEMail($_POST['contactform_to']),
isset($_POST['contactform_name']) ? 'yes' : 'no',
max(1, $_REQUEST['notify_interval']),
max(1, $_REQUEST['notify_lifetime']),
$_POST['mail_groupmode']);
ReadConfig();
$_SESSION['bm_sessionToken'] = SessionToken();
}
// get available languages
$languages = GetAvailableLanguages();
$countries = CountryList();
// assign
$tpl->assign('safemode', ini_get('safe_mode'));
$tpl->assign('languages', $languages);
$tpl->assign('countries', CountryList());
$tpl->assign('page', 'prefs.common.tpl');
}
/**
* caching
*/
else if($_REQUEST['action'] == 'caching')
{
if(isset($_REQUEST['save']))
{
$serversArray = explode("\n", $_REQUEST['memcache_servers']);
foreach($serversArray as $key=>$val)
if(($val = trim($val)) != '')
$serversArray[$key] = $val;
else
unset($serversArray[$key]);
$servers = implode(';', $serversArray);
$db->Query('UPDATE {pre}prefs SET cache_type=?, filecache_size=?, memcache_servers=?, memcache_persistent=?, cache_parseonly=?',
(int)$_REQUEST['cache_type'],
$_REQUEST['filecache_size']*1024*1024,
$servers,
isset($_REQUEST['memcache_persistent']) ? 'yes' : 'no',
isset($_REQUEST['cache_parseonly']) ? 'yes' : 'no');
ReadConfig();
}
// assign
$bm_prefs['memcache_servers'] = str_replace(';', "\n", $bm_prefs['memcache_servers']);
$tpl->assign('memcache', class_exists('Memcache') || class_exists('Memcached'));
$tpl->assign('page', 'prefs.caching.tpl');
}
/**
* captcha
*/
else if($_REQUEST['action'] == 'captcha')
{
if(!class_exists('BMCaptcha'))
include(B1GMAIL_DIR . 'serverlib/captcha.class.php');
$providers = BMCaptcha::getAvailableProviders();
if(isset($_REQUEST['save']) && isset($_POST['captcha_provider']))
{
$postPrefs = isset($_POST['prefs']) && is_array($_POST['prefs']) ? $_POST['prefs'] : array();
$config = array();
foreach($providers as $provKey=>$prov)
{
$provPrefs = array();
foreach($prov['configFields'] as $fieldKey=>$val)
{
switch($val['type'])
{
case FIELD_CHECKBOX:
$value = isset($postPrefs[$provKey][$fieldKey]) ? 1 : 0;
break;
default:
$value = $postPrefs[$provKey][$fieldKey];
break;
}
$provPrefs[$fieldKey] = $value;
}
if(count($provPrefs) > 0)
$config[$provKey] = $provPrefs;
}
$db->Query('UPDATE {pre}prefs SET `captcha_provider`=?,`captcha_config`=?',
$_POST['captcha_provider'],
serialize($config));
ReadConfig();
}
$config = @unserialize($bm_prefs['captcha_config']);
if(!is_array($config))
$config = array();
foreach($providers as $provKey=>$prov)
{
foreach($prov['configFields'] as $fieldKey=>$val)
{
if(isset($config[$provKey][$fieldKey]))
$providers[$provKey]['configFields'][$fieldKey]['value'] = $config[$provKey][$fieldKey];
else
$providers[$provKey]['configFields'][$fieldKey]['value'] = $val['default'];
}
}
$tpl->assign('defaultProvider', $bm_prefs['captcha_provider']);
$tpl->assign('providers', $providers);
$tpl->assign('page', 'prefs.captcha.tpl');
}
/**
* signup
*/
else if($_REQUEST['action'] == 'signup')
{
if(isset($_REQUEST['save']))
{
$lamArray = explode("\n", $_POST['locked_altmail']);
foreach($lamArray as $key=>$val)
if(($val = trim($val)) != '')
$lamArray[$key] = $val;
else
unset($lamArray[$key]);
$lockedAltMail = implode(':', $lamArray);
$dnsblArray = explode("\n", $_REQUEST['signup_dnsbl']);
foreach($dnsblArray as $key=>$val)
if(($val = trim($val)) != '')
$dnsblArray[$key] = $val;
else
unset($dnsblArray[$key]);
$signupDNSBL = implode(':', $dnsblArray);
$db->Query('UPDATE {pre}prefs SET regenabled=?, usr_status=?, std_gruppe=?, minuserlength=?, min_pass_length=?, notify_mail=?, welcome_mail=?, notify_to=?, f_strasse=?, f_telefon=?, f_fax=?, f_alternativ=?, f_mail2sms_nummer=?, f_safecode=?, reg_iplock=?, plz_check=?, alt_check=?, user_count_limit=?, reg_validation=?, reg_validation_max_resend_times=?, reg_validation_min_resend_interval=?, check_double_altmail=?, check_double_cellphone=?, f_anrede=?, locked_altmail=?, signup_dnsbl_enable=?, signup_dnsbl=?, signup_dnsbl_action=?, signup_suggestions=?, `nosignup_autodel`=?, `nosignup_autodel_days`=?',
isset($_REQUEST['regenabled']) ? 'yes' : 'no',
$_REQUEST['usr_status'],
$_REQUEST['std_gruppe'],
max(1, $_REQUEST['minuserlength']),
max(1, $_REQUEST['min_pass_length']),
isset($_REQUEST['notify_mail']) ? 'yes' : 'no',
isset($_REQUEST['welcome_mail']) ? 'yes' : 'no',
EncodeEMail($_REQUEST['notify_to']),
$_REQUEST['f_strasse'],
$_REQUEST['f_telefon'],
$_REQUEST['f_fax'],
$_REQUEST['f_alternativ'],
$_REQUEST['f_mail2sms_nummer'],
$_REQUEST['f_safecode'],
$_REQUEST['reg_iplock'],
isset($_REQUEST['plz_check']) ? 'yes' : 'no',
isset($_REQUEST['alt_check']) ? 'yes' : 'no',
isset($_REQUEST['user_count_limit_enable']) ? $_REQUEST['user_count_limit'] : 0,
$_REQUEST['reg_validation'],
(int)$_REQUEST['reg_validation_max_resend_times'],
(int)$_REQUEST['reg_validation_min_resend_interval'],
isset($_REQUEST['check_double_altmail']) ? 'yes' : 'no',
isset($_REQUEST['check_double_cellphone']) ? 'yes' : 'no',
$_REQUEST['f_anrede'],
$lockedAltMail,
isset($_REQUEST['signup_dnsbl_enable']) ? 'yes' : 'no',
$signupDNSBL,
$_REQUEST['signup_dnsbl_action'],
isset($_REQUEST['signup_suggestions']) ? 'yes' : 'no',
isset($_REQUEST['nosignup_autodel']) ? 'yes' : 'no',
max(1, $_REQUEST['nosignup_autodel_days']));
ReadConfig();
}
// assign
$bm_prefs['signup_dnsbl'] = str_replace(':', "\n", $bm_prefs['signup_dnsbl']);
$bm_prefs['locked_altmail'] = str_replace(':', "\n", $bm_prefs['locked_altmail']);
$tpl->assign('groups', BMGroup::GetSimpleGroupList());
$tpl->assign('page', 'prefs.signup.tpl');
}
/**
* locked usernames
*/
else if($_REQUEST['action'] == 'lockedusernames')
{
// delete?
if(isset($_REQUEST['delete']))
{
$db->Query('DELETE FROM {pre}locked WHERE id=?',
(int)$_REQUEST['delete']);
}
// add?
else if(isset($_REQUEST['add'])
&& trim($_REQUEST['benutzername']) != '')
{
$db->Query('INSERT INTO {pre}locked(typ,benutzername) VALUES(?,?)',
$_REQUEST['typ'],
$_REQUEST['benutzername']);
}
// mass action?
else if(isset($_REQUEST['executeMassAction']))
{
// get locked username IDs
$lockedIDs = array();
foreach($_POST as $key=>$val)
if(substr($key, 0, 7) == 'locked_')
$lockedIDs[] = (int)substr($key, 7);
if(count($lockedIDs) > 0)
{
if($_REQUEST['massAction'] == 'delete')
{
// delete row
$db->Query('DELETE FROM {pre}locked WHERE id IN(' . implode(',', $lockedIDs) . ')');
}
}
}
// fetch
$lockedUsernames = array();
$res = $db->Query('SELECT id,typ,benutzername FROM {pre}locked ORDER BY typ,benutzername ASC');
while($row = $res->FetchArray(MYSQLI_ASSOC))
{
$lockedUsernames[$row['id']] = array(
'id' => $row['id'],
'type' => $lockedTypeTable[$row['typ']],
'username' => $row['benutzername']
);
}
$res->Free();
// assign
$tpl->assign('lockedUsernames', $lockedUsernames);
$tpl->assign('lockedTypeTable', $lockedTypeTable);
$tpl->assign('page', 'prefs.lockedusernames.tpl');
}
/**
* domains
*/
else if($_REQUEST['action'] == 'domains')
{
// mass save?
if(isset($_POST['domains']) && is_array($_POST['domains']))
{
foreach($_POST['domains'] as $domain=>$info)
{
$db->Query('UPDATE {pre}domains SET `in_login`=?,`in_signup`=?,`in_aliases`=?,`pos`=? WHERE `domain`=?',
isset($info['in_login']) ? 1 : 0,
isset($info['in_signup']) ? 1 : 0,
isset($info['in_aliases']) ? 1 : 0,
(int)$info['pos'],
$domain);
}
}
// delete?
if(isset($_REQUEST['delete']))
{
$db->Query('DELETE FROM {pre}domains WHERE `domain`=?',
$_REQUEST['delete']);
}
// add?
else if(isset($_REQUEST['add'])
&& trim($_REQUEST['domain']) != '')
{
$db->Query('REPLACE INTO {pre}domains(`domain`,`in_login`,`in_signup`,`in_aliases`,`pos`) VALUES(?,?,?,?,?)',
EncodeDomain(trim($_REQUEST['domain'])),
isset($_REQUEST['in_login']) ? 1 : 0,
isset($_REQUEST['in_signup']) ? 1 : 0,
isset($_REQUEST['in_aliases']) ? 1 : 0,
(int)$_REQUEST['pos']);
}
// mass action?
else if(isset($_REQUEST['executeMassAction']) && isset($_POST['domains']) && is_array($_POST['domains']))
{
// get domains
$domains = array();
foreach($_POST['domains'] as $domain=>$prefs)
if(isset($prefs['del']))
$domains[] = $domain;
if(count($domains) > 0)
{
if($_REQUEST['massAction'] == 'delete')
{
// delete domain
$db->Query('DELETE FROM {pre}domains WHERE `domain` IN ?', $domains);
}
}
}
// fetch
$domains = array();
$lockedUsernames = array();
$res = $db->Query('SELECT `domain`,`in_login`,`in_signup`,`in_aliases`,`pos` FROM {pre}domains ORDER BY `pos` ASC, `domain` ASC');
while($row = $res->FetchArray(MYSQLI_ASSOC))
{
$row['urlDomain'] = urlencode($row['domain']);
$domains[$row['domain']] = $row;
}
$res->Free();
// assign
$tpl->assign('domains', $domains);
$tpl->assign('page', 'prefs.domains.tpl');
}
/**
* tab order
*/
else if($_REQUEST['action'] == 'taborder')
{
$pageTabs = array(
'start' => array(
'icon' => 'start',
'faIcon' => 'fa-home',
'order' => 100
),
'email' => array(
'icon' => 'email',
'faIcon' => 'fa-envelope-o',
'text' => $lang_user['email'],
'order' => 200
),
'sms' => array(
'icon' => 'sms',
'faIcon' => 'fa-comments',
'text' => $lang_user['sms'],
'order' => 300
),
'organizer' => array(
'icon' => 'organizer',
'faIcon' => 'fa-calendar',
'text' => $lang_user['organizer'],
'order' => 400
),
'webdisk' => array(
'icon' => 'webdisk',
'faIcon' => 'fa-cloud',
'text' => $lang_user['webdisk'],
'order' => 500
)
);
if(!isset($groupRow) || !is_array($groupRow))
$groupRow = array('id' => $bm_prefs['std_gruppe']);
$moduleResult = $plugins->callFunction('getUserPages', false, true, array(true));
foreach($moduleResult as $userPages)
$pageTabs = array_merge($pageTabs, $userPages);
$pageTabs = array_merge($pageTabs, array(
'prefs' => array(
'icon' => 'prefs',
'faIcon' => 'fa-cog',
'text' => $lang_user['prefs'],
'order' => 600
)));
// get tab order
$tabOrder = @unserialize($bm_prefs['taborder']);
if(!is_array($tabOrder))
$tabOrder = array();
// save?
if(isset($_REQUEST['save']) && isset($_REQUEST['order']) && is_array($_REQUEST['order']))
{
foreach($_REQUEST['order'] as $key=>$order)
$tabOrder[$key] = $order;
$db->Query('UPDATE {pre}prefs SET `taborder`=?',
serialize($tabOrder));
}
// assign tab order
foreach($tabOrder as $key=>$val)
if(isset($pageTabs[$key]))
$pageTabs[$key]['order'] = $val;
// sort by order
ModuleFunction('BeforePageTabsAssign', array(&$pageTabs));
uasort($pageTabs, 'TemplateTabSort');
$tpl->assign('usertpldir', B1GMAIL_REL . 'templates/' . $bm_prefs['template'] . '/');
$tpl->assign('pageTabs', $pageTabs);
$tpl->assign('page', 'prefs.taborder.tpl');
}
$tpl->assign('bm_prefs', $bm_prefs);
$tpl->assign('tabs', $tabs);
$tpl->assign('title', $lang_admin['prefs'] . ' &raquo; ' . $lang_admin['common']);
$tpl->display('page.tpl');
?>

View file

@ -0,0 +1,143 @@
<?php
/*
* b1gMail
* Copyright (c) 2021 Patrick Schlangen et al
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
include('../serverlib/admin.inc.php');
RequestPrivileges(PRIVILEGES_ADMIN);
AdminRequirePrivilege('prefs.countries');
if(!isset($_REQUEST['action']))
$_REQUEST['action'] = 'countries';
$tabs = array(
0 => array(
'title' => $lang_admin['countries'],
'relIcon' => 'country32.png',
'link' => 'prefs.countries.php?',
'active' => $_REQUEST['action'] == 'countries'
)
);
/**
* fields
*/
if($_REQUEST['action'] == 'countries')
{
if(!isset($_REQUEST['do']))
$_REQUEST['do'] = 'list';
//
// list
//
if($_REQUEST['do'] == 'list')
{
// add
if(isset($_REQUEST['add']))
{
$db->Query('INSERT INTO {pre}staaten(land) VALUES(?)',
HTMLFormat($_REQUEST['land']));
$cacheManager->Delete('countryList');
$cacheManager->Delete('countryListWithDetails');
}
// delete
if(isset($_REQUEST['delete']))
{
$db->Query('DELETE FROM {pre}staaten WHERE id=?',
(int)$_REQUEST['delete']);
$cacheManager->Delete('countryList');
$cacheManager->Delete('countryListWithDetails');
}
// mass action
if(isset($_REQUEST['executeMassAction']))
{
// get country IDs
$countryIDs = array();
foreach($_POST as $key=>$val)
if(substr($key, 0, 8) == 'country_')
$countryIDs[] = (int)substr($key, 8);
if(count($countryIDs) > 0)
{
if($_REQUEST['massAction'] == 'delete')
{
// delete row
$db->Query('DELETE FROM {pre}staaten WHERE id IN(' . implode(',', $countryIDs) . ')');
}
$cacheManager->Delete('countryList');
$cacheManager->Delete('countryListWithDetails');
}
}
// fetch
$countries = array();
$res = $db->Query('SELECT id,land,is_eu,vat FROM {pre}staaten ORDER BY id ASC');
while($row = $res->FetchArray(MYSQLI_ASSOC))
$countries[$row['id']] = array(
'id' => $row['id'],
'land' => $row['land'],
'is_eu' => $row['is_eu'] == 'yes',
'vat' => $row['vat'] ? sprintf('%.02f', $row['vat']) : '',
'plzDB' => file_exists(B1GMAIL_REL . 'plz/' . $row['id'] . '.plz')
);
$res->Free();
// assign
$tpl->assign('countries', $countries);
$tpl->assign('page', 'prefs.countries.tpl');
}
//
// edit
//
else if($_REQUEST['do'] == 'edit')
{
// save?
if(isset($_REQUEST['save']))
{
$db->Query('UPDATE {pre}staaten SET land=?,is_eu=?,vat=? WHERE id=?',
HTMLFormat($_REQUEST['land']),
isset($_REQUEST['is_eu']) ? 'yes' : 'no',
min(100, max(0, (double)str_replace(',', '.', $_REQUEST['vat']))),
(int)$_REQUEST['id']);
$cacheManager->Delete('countryList');
$cacheManager->Delete('countryListWithDetails');
header('Location: prefs.countries.php?sid=' . session_id());
exit();
}
// fetch
$res = $db->Query('SELECT id,land,is_eu,vat FROM {pre}staaten WHERE id=?',
(int)$_REQUEST['id']);
assert('$res->RowCount() != 0');
$country = $res->FetchArray(MYSQLI_ASSOC);
$res->Free();
// assign
$tpl->assign('country', $country);
$tpl->assign('page', 'prefs.countries.edit.tpl');
}
}
$tpl->assign('tabs', $tabs);
$tpl->assign('title', $lang_admin['prefs'] . ' &raquo; ' . $lang_admin['countries']);
$tpl->display('page.tpl');

199
src/admin/prefs.coupons.php Normal file
View file

@ -0,0 +1,199 @@
<?php
/*
* b1gMail
* Copyright (c) 2021 Patrick Schlangen et al
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
include('../serverlib/admin.inc.php');
RequestPrivileges(PRIVILEGES_ADMIN);
AdminRequirePrivilege('prefs.coupons');
if(!isset($_REQUEST['action']))
$_REQUEST['action'] = 'coupons';
$tabs = array(
0 => array(
'title' => $lang_admin['coupons'],
'relIcon' => 'coupon32.png',
'link' => 'prefs.coupons.php?',
'active' => $_REQUEST['action'] == 'coupons'
)
);
/**
* coupons
*/
if($_REQUEST['action'] == 'coupons')
{
if(!isset($_REQUEST['do']))
$_REQUEST['do'] = 'list';
//
// list
//
if($_REQUEST['do'] == 'list')
{
// add
if(isset($_REQUEST['add']))
{
// params
$count = (int)$_REQUEST['anzahl'];
$from = isset($_REQUEST['von_unlim']) ? -1 : SmartyDateTime('von');
$to = isset($_REQUEST['bis_unlim']) ? -1 : SmartyDateTime('bis');
// benefits
$benefits = array();
$benefits['sms'] = isset($_REQUEST['ver_credits']) ? (int)$_REQUEST['ver_credits_count'] : 0;
$benefits['gruppe'] = isset($_REQUEST['ver_gruppe']) ? (int)$_REQUEST['ver_gruppe_id'] : 0;
// add coupon codes
$codes = explode("\n", trim($_REQUEST['code']));
foreach($codes as $code)
if(($code = trim($code)) != '')
$db->Query('INSERT INTO {pre}codes(code,von,bis,anzahl,ver,valid_signup,valid_loggedin) VALUES(?,?,?,?,?,?,?)',
$code,
$from,
$to,
$count,
serialize($benefits),
isset($_REQUEST['valid_signup']) ? 'yes' : 'no',
isset($_REQUEST['valid_loggedin']) ? 'yes' : 'no');
}
// delete
if(isset($_REQUEST['delete']))
{
$db->Query('DELETE FROM {pre}codes WHERE id=?',
(int)$_REQUEST['delete']);
}
// mass action
if(isset($_REQUEST['executeMassAction']))
{
// get coupon IDs
$couponIDs = array();
foreach($_POST as $key=>$val)
if(substr($key, 0, 7) == 'coupon_')
$couponIDs[] = (int)substr($key, 7);
if(count($couponIDs) > 0)
{
if($_REQUEST['massAction'] == 'delete')
{
// delete row
$db->Query('DELETE FROM {pre}codes WHERE id IN(' . implode(',', $couponIDs) . ')');
}
}
}
// fetch
$coupons = array();
$res = $db->Query('SELECT id,code,von,bis,anzahl,ver,used,valid_loggedin,valid_signup FROM {pre}codes ORDER BY id ASC');
while($row = $res->FetchArray(MYSQLI_ASSOC))
{
$row['ver'] = unserialize($row['ver']);
$row['valid_loggedin'] = $row['valid_loggedin'] == 'yes';
$row['valid_signup'] = $row['valid_signup'] == 'yes';
$coupons[$row['id']] = $row;
}
$res->Free();
// assign
$tpl->assign('coupons', $coupons);
$tpl->assign('groups', BMGroup::GetSimpleGroupList());
$tpl->assign('page', 'prefs.coupons.tpl');
}
//
// edit
//
else if($_REQUEST['do'] == 'edit')
{
// save?
if(isset($_REQUEST['save']))
{
// params
$count = (int)$_REQUEST['anzahl'];
$from = isset($_REQUEST['von_unlim']) ? -1 : SmartyDateTime('von');
$to = isset($_REQUEST['bis_unlim']) ? -1 : SmartyDateTime('bis');
// benefits
$benefits = array();
$benefits['sms'] = isset($_REQUEST['ver_credits']) ? (int)$_REQUEST['ver_credits_count'] : 0;
$benefits['gruppe'] = isset($_REQUEST['ver_gruppe']) ? (int)$_REQUEST['ver_gruppe_id'] : 0;
// save
$db->Query('UPDATE {pre}codes SET code=?,von=?,bis=?,anzahl=?,ver=?,valid_loggedin=?,valid_signup=? WHERE id=?',
$_REQUEST['code'],
$from,
$to,
$count,
serialize($benefits),
isset($_REQUEST['valid_loggedin']) ? 'yes' : 'no',
isset($_REQUEST['valid_signup']) ? 'yes' : 'no',
$_REQUEST['id']);
header('Location: prefs.coupons.php?sid=' . session_id());
exit();
}
// fetch
$res = $db->Query('SELECT id,code,von,bis,anzahl,ver,usedby,valid_signup,valid_loggedin FROM {pre}codes WHERE id=?',
(int)$_REQUEST['id']);
assert('$res->RowCount() != 0');
$coupon = $res->FetchArray(MYSQLI_ASSOC);
$res->Free();
// used by...
$usedBy = array();
$usedByIDs = @unserialize($coupon['usedby']);
if(!is_array($usedByIDs))
$usedByIDs = array();
if(count($usedByIDs) > 0)
{
$res = $db->Query('SELECT id,email,vorname,nachname,strasse,hnr,plz,ort FROM {pre}users WHERE id IN(' . implode(',', $usedByIDs) . ') ORDER BY id ASC');
while($row = $res->FetchArray())
{
$aliases = array();
$aliasRes = $db->Query('SELECT email FROM {pre}aliase WHERE type=? AND user=? ORDER BY email ASC',
ALIAS_RECIPIENT|ALIAS_SENDER,
$row['id']);
while($aliasRow = $aliasRes->FetchArray())
$aliases[] = $aliasRow['email'];
$aliasRes->Free();
$row['aliases'] = count($aliases) > 0
? implode(', ', $aliases)
: '';
$usedBy[] = $row;
}
$res->Free();
}
// assign
$coupon['ver'] = unserialize($coupon['ver']);
$tpl->assign('coupon', $coupon);
$tpl->assign('usedBy', $usedBy);
$tpl->assign('groups', BMGroup::GetSimpleGroupList());
$tpl->assign('page', 'prefs.coupons.edit.tpl');
}
}
$tpl->assign('tabs', $tabs);
$tpl->assign('title', $lang_admin['prefs'] . ' &raquo; ' . $lang_admin['coupons']);
$tpl->display('page.tpl');
?>

576
src/admin/prefs.email.php Normal file
View file

@ -0,0 +1,576 @@
<?php
/*
* b1gMail
* Copyright (c) 2021 Patrick Schlangen et al
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
include('../serverlib/admin.inc.php');
include('../serverlib/zip.class.php');
RequestPrivileges(PRIVILEGES_ADMIN);
AdminRequirePrivilege('prefs.email');
if(!isset($_REQUEST['action']))
$_REQUEST['action'] = 'common';
$tabs = array(
0 => array(
'title' => $lang_admin['common'],
'relIcon' => 'ico_prefs_common.png',
'link' => 'prefs.email.php?',
'active' => $_REQUEST['action'] == 'common'
),
1 => array(
'title' => $lang_admin['receive'],
'relIcon' => 'ico_prefs_receiving.png',
'link' => 'prefs.email.php?action=receive&',
'active' => $_REQUEST['action'] == 'receive'
),
2 => array(
'title' => $lang_admin['send'],
'relIcon' => 'ico_prefs_sending.png',
'link' => 'prefs.email.php?action=send&',
'active' => $_REQUEST['action'] == 'send'
),
3 => array(
'title' => $lang_admin['antispam'],
'relIcon' => 'antispam.png',
'link' => 'prefs.email.php?action=antispam&',
'active' => $_REQUEST['action'] == 'antispam'
),
4 => array(
'title' => $lang_admin['antivirus'],
'relIcon' => 'antivirus.png',
'link' => 'prefs.email.php?action=antivirus&',
'active' => $_REQUEST['action'] == 'antivirus'
),
5 => array(
'title' => $lang_admin['smime'],
'relIcon' => 'cert32.png',
'link' => 'prefs.email.php?action=smime&',
'active' => $_REQUEST['action'] == 'smime'
)
);
/**
* common
*/
if($_REQUEST['action'] == 'common')
{
if(isset($_REQUEST['save']))
{
$db->Query('UPDATE {pre}prefs SET blobstorage_provider=?, blobstorage_compress=?, fts_bg_indexing=?',
$_REQUEST['blobstorage_provider'],
isset($_REQUEST['blobstorage_compress']) ? 'yes' : 'no',
isset($_REQUEST['fts_bg_indexing']) ? 'yes' : 'no');
ReadConfig();
}
// assign
$tpl->assign('bsUserDBAvailable', BMBlobStorage::createProvider(BMBLOBSTORAGE_USERDB)->isAvailable());
$tpl->assign('page', 'prefs.email.common.tpl');
}
/**
* receive
*/
else if($_REQUEST['action'] == 'receive')
{
if(isset($_REQUEST['save']))
{
$db->Query('UPDATE {pre}prefs SET receive_method=?,pop3_host=?,pop3_port=?,pop3_user=?,pop3_pass=?,fetchcount=?,errormail=?,failure_forward=?,mailmax=?,recipient_detection=?,detect_duplicates=?,returnpath_check=?',
$_REQUEST['receive_method'],
$_REQUEST['pop3_host'],
(int)$_REQUEST['pop3_port'],
$_REQUEST['pop3_user'],
$_REQUEST['pop3_pass'],
(int)$_REQUEST['fetchcount'],
$_REQUEST['errormail'],
isset($_REQUEST['failure_forward']) ? 'yes' : 'no',
(int)$_REQUEST['mailmax']*1024,
$_REQUEST['recipient_detection'],
isset($_REQUEST['detect_duplicates']) ? 'yes' : 'no',
isset($_REQUEST['returnpath_check']) ? 'yes' : 'no');
ReadConfig();
}
// assign
$tpl->assign('page', 'prefs.email.receive.tpl');
}
/**
* send
*/
else if($_REQUEST['action'] == 'send')
{
if(isset($_REQUEST['save']))
{
$blockedArray = explode("\n", $_REQUEST['blocked']);
foreach($blockedArray as $key=>$val)
if(($val = trim($val)) != '')
$blockedArray[$key] = trim($val);
else
unset($blockedArray[$key]);
$blocked = implode(':', $blockedArray);
$db->Query('UPDATE {pre}prefs SET send_method=?,smtp_host=?,smtp_port=?,smtp_auth=?,smtp_user=?,smtp_pass=?,blocked=?,sendmail_path=?,passmail_abs=?,einsch_life=?,write_xsenderip=?,min_draft_save_interval=?',
$_REQUEST['send_method'],
$_REQUEST['smtp_host'],
(int)$_REQUEST['smtp_port'],
isset($_REQUEST['smtp_auth']) ? 'yes' : 'no',
$_REQUEST['smtp_user'],
$_REQUEST['smtp_pass'],
$blocked,
$_REQUEST['sendmail_path'],
EncodeEMail($_REQUEST['passmail_abs']),
$_REQUEST['einsch_life']*TIME_ONE_DAY,
isset($_REQUEST['write_xsenderip']) ? 'yes' : 'no',
max(5, $_REQUEST['min_draft_save_interval']));
ReadConfig();
}
// assign
$bm_prefs['blocked'] = str_replace(':', "\n", $bm_prefs['blocked']);
$tpl->assign('page', 'prefs.email.send.tpl');
}
/**
* antispam
*/
else if($_REQUEST['action'] == 'antispam')
{
if(isset($_REQUEST['save']))
{
$dnsblArray = explode("\n", $_REQUEST['dnsbl']);
foreach($dnsblArray as $key=>$val)
if(($val = trim($val)) != '')
$dnsblArray[$key] = $val;
else
unset($dnsblArray[$key]);
$dnsbl = implode(':', $dnsblArray);
$db->Query('UPDATE {pre}prefs SET spamcheck=?,dnsbl=?,use_bayes=?,bayes_mode=?,dnsbl_requiredservers=?',
isset($_REQUEST['spamcheck']) ? 'yes' : 'no',
$dnsbl,
isset($_REQUEST['use_bayes']) ? 'yes' : 'no',
$_REQUEST['bayes_mode'],
$_REQUEST['dnsbl_requiredservers']);
ReadConfig();
}
if(isset($_REQUEST['resetBayesDB']))
{
$db->Query('TRUNCATE TABLE {pre}spamindex');
$db->Query('UPDATE {pre}prefs SET bayes_spam=0, bayes_nonspam=0');
$db->Query('UPDATE {pre}users SET bayes_spam=0, bayes_nonspam=0');
}
// bayes resetable?
$res = $db->Query('SELECT COUNT(*) FROM {pre}spamindex');
list($bayesWordCount) = $res->FetchArray(MYSQLI_NUM);
$res->Free();
// assign
$bm_prefs['dnsbl'] = str_replace(':', "\n", $bm_prefs['dnsbl']);
$tpl->assign('bayesWordCount', $bayesWordCount);
$tpl->assign('page', 'prefs.email.antispam.tpl');
}
/**
* antivirus
*/
else if($_REQUEST['action'] == 'antivirus')
{
if(isset($_REQUEST['save']))
{
$db->Query('UPDATE {pre}prefs SET use_clamd=?,clamd_host=?,clamd_port=?',
isset($_REQUEST['use_clamd']) ? 'yes' : 'no',
$_REQUEST['clamd_host'],
(int)$_REQUEST['clamd_port']);
ReadConfig();
}
// assign
$tpl->assign('page', 'prefs.email.antivirus.tpl');
}
/**
* s/mime
*/
else if($_REQUEST['action'] == 'smime')
{
// check for OpenSSL extension
if(!SMIME_SUPPORT)
{
$tpl->assign('msgTitle', $lang_admin['smime']);
$tpl->assign('msgText', $lang_admin['openssl_err']);
$tpl->assign('msgIcon', 'error32');
$tpl->assign('page', 'msg.tpl');
}
// extension is available
else
{
// prefs + rootcerts
if(!isset($_REQUEST['do']))
{
$stopIt = false;
// add
if(isset($_REQUEST['add']))
{
$success = false;
$error = 'format';
if(isset($_FILES['certfile'])
&& $_FILES['certfile']['error'] == 0
&& $_FILES['certfile']['size'] > 5)
{
// request temp file
$tempFileID = RequestTempFile(0);
$tempFileName = TempFileName($tempFileID);
// move uploaded file to temp file
if(move_uploaded_file($_FILES['certfile']['tmp_name'], $tempFileName))
{
// read file
$fp = fopen($tempFileName, 'rb');
$certData = fread($fp, filesize($tempFileName));
fclose($fp);
// parse
$cp = @openssl_x509_read($certData);
if($cp)
{
$certInfo = @openssl_x509_parse($cp, true);
openssl_x509_free($cp);
// exists?
$res = $db->Query('SELECT COUNT(*) FROM {pre}certificates WHERE `hash`=? AND `type`=? AND `userid`=?',
$certInfo['hash'],
CERTIFICATE_TYPE_ROOT,
0);
list($certCount) = $res->FetchArray(MYSQLI_NUM);
$res->Free();
if($certCount != 0)
{
$error = 'exists';
}
else
{
// check purpose
$signCA = $encryptCA = false;
foreach($certInfo['purposes'] as $purpose)
{
if($purpose[2] == 'smimeencrypt'
&& $purpose[1])
$encryptCA = true;
else if($purpose[2] == 'smimesign'
&& $purpose[1])
$signCA = true;
}
// s/mime CA?
if($encryptCA || $signCA)
{
$db->Query('INSERT INTO {pre}certificates(`type`,`userid`,`hash`,`cn`,`validfrom`,`validto`,`pemdata`) '
. 'VALUES(?,?,?,?,?,?,?)',
CERTIFICATE_TYPE_ROOT,
0,
$certInfo['hash'],
!isset($certInfo['subject']['CN'])
? ((is_array($certInfo['subject']['OU']) ? array_shift($certInfo['subject']['OU']) : $certInfo['subject']['OU']) . ' (' . $certInfo['subject']['O'] . ')')
: (is_array($certInfo['subject']['CN']) ? array_shift($certInfo['subject']['CN']) : $certInfo['subject']['CN']),
$certInfo['validFrom_time_t'],
$certInfo['validTo_time_t'],
$certData);
$success = true;
}
else
$error = 'noca';
}
}
}
// release temp file
ReleaseTempFile(0, $tempFileID);
// display result on error
if(!$success)
{
$tpl->assign('msgTitle', $lang_admin['error']);
$tpl->assign('msgText', $lang_admin['cert_err_'.$error]);
$tpl->assign('msgIcon', 'error32');
$tpl->assign('page', 'msg.tpl');
$stopIt = true;
}
}
}
// delete
if(isset($_REQUEST['delete']))
{
$db->Query('DELETE FROM {pre}certificates WHERE `certificateid`=? AND `type`=? AND `userid`=?',
(int)$_REQUEST['delete'],
CERTIFICATE_TYPE_ROOT,
0);
}
// export
if(isset($_REQUEST['export']))
{
$res = $db->Query('SELECT `hash`,`pemdata` FROM {pre}certificates WHERE `certificateid`=? AND `type`=? AND `userid`=?',
(int)$_REQUEST['export'],
CERTIFICATE_TYPE_ROOT,
0);
while($row = $res->FetchArray(MYSQLI_ASSOC))
{
header('Pragma: public');
header('Content-Type: application/x-pem-file');
header('Content-Length: ' . strlen($row['pemdata']));
header(sprintf('Content-Disposition: attachment; filename=cert-%s.pem',
$row['hash']));
echo $row['pemdata'];
exit();
}
$res->Free();
}
// mass action
if(isset($_REQUEST['massAction']) && isset($_REQUEST['certs'])
&& is_array($_REQUEST['certs']))
{
$certs = $_REQUEST['certs'];
if($_REQUEST['massAction'] == 'delete')
{
$db->Query('DELETE FROM {pre}certificates WHERE (`certificateid` IN ?) AND `type`=? AND `userid`=?',
$certs,
CERTIFICATE_TYPE_ROOT,
0);
}
else if($_REQUEST['massAction'] == 'export')
{
$tempFileID = RequestTempFile(0);
$tempFileName = TempFileName($tempFileID);
// create ZIP file
$fp = fopen($tempFileName, 'wb+');
$zip = _new('BMZIP', array($fp));
$res = $db->Query('SELECT `hash`,`pemdata` FROM {pre}certificates WHERE (`certificateid` IN ?) AND `type`=? AND `userid`=?',
$certs,
CERTIFICATE_TYPE_ROOT,
0);
while($row = $res->FetchArray(MYSQLI_ASSOC))
{
$certTempFileID = RequestTempFile(0);
$certTempFileName = TempFileName($certTempFileID);
$certFP = fopen($certTempFileName, 'wb');
fwrite($certFP, $row['pemdata']);
fclose($certFP);
$zip->AddFile($certTempFileName, 'cert-' . $row['hash'] . '.pem');
ReleaseTempFile(0, $certTempFileID);
}
$res->Free();
$size = $zip->Finish();
// headers
header('Pragma: public');
header('Content-Disposition: attachment; filename="certificates.zip"');
header('Content-Type: application/zip');
header(sprintf('Content-Length: %d',
$size));
// send
while(is_resource($fp) && !feof($fp))
{
$block = fread($fp, 4096);
echo $block;
}
// clean up
fclose($fp);
ReleaseTempFile(0, $tempFileID);
exit();
}
}
if(!$stopIt)
{
$certs = array();
$res = $db->Query('SELECT `certificateid`,`cn`,`validfrom`,`validto` FROM {pre}certificates WHERE `type`=? AND `userid`=? ORDER BY `cn` ASC',
CERTIFICATE_TYPE_ROOT, 0);
while($row = $res->FetchArray(MYSQLI_ASSOC))
{
$row['valid'] = $row['validfrom'] <= time() && $row['validto'] >= time();
$certs[$row['certificateid']] = $row;
}
$res->Free();
$tpl->assign('caAvailable', trim($bm_prefs['ca_cert']) != '' && trim($bm_prefs['ca_cert_pk']) != '');
$tpl->assign('now', time());
$tpl->assign('certs', $certs);
$tpl->assign('page', 'prefs.email.smime.tpl');
}
}
// edit CA
else if($_REQUEST['do'] == 'editca')
{
$stopIt = false;
if(isset($_REQUEST['set']))
{
$certData = $keyData = '';
// pem?
if(isset($_FILES['cert_ca_pem'])
&& $_FILES['cert_ca_pem']['error'] == 0
&& $_FILES['cert_ca_pem']['size'] > 5)
{
// request temp file
$tempFileID = RequestTempFile(0);
$tempFileName = TempFileName($tempFileID);
// move uploaded file to temp file
if(move_uploaded_file($_FILES['cert_ca_pem']['tmp_name'], $tempFileName))
$certData = getFileContents($tempFileName);
ReleaseTempFile(0, $tempFileID);
}
// key?
if(isset($_FILES['cert_ca_key'])
&& $_FILES['cert_ca_key']['error'] == 0
&& $_FILES['cert_ca_key']['size'] > 5)
{
// request temp file
$tempFileID = RequestTempFile(0);
$tempFileName = TempFileName($tempFileID);
// move uploaded file to temp file
if(move_uploaded_file($_FILES['cert_ca_key']['tmp_name'], $tempFileName))
$keyData = getFileContents($tempFileName);
ReleaseTempFile(0, $tempFileID);
}
$success = false;
$error = 'format';
if($certData && $keyData && strlen($certData) > 5 && strlen($keyData) > 5)
{
$certData = str_replace(' TRUSTED ', ' ', $certData);
$cert = @openssl_x509_read(trim($certData));
if($cert)
{
if(@openssl_x509_check_private_key($cert,
!empty($_REQUEST['cert_ca_pass'])
? array($keyData, $_REQUEST['cert_ca_pass'])
: $keyData))
{
$certInfo = openssl_x509_parse($cert);
// check purpose
$signCA = $encryptCA = false;
foreach($certInfo['purposes'] as $purpose)
{
if($purpose[2] == 'smimeencrypt'
&& $purpose[1])
$encryptCA = true;
else if($purpose[2] == 'smimesign'
&& $purpose[1])
$signCA = true;
}
if($signCA && $encryptCA)
{
$db->Query('UPDATE {pre}prefs SET ca_cert=?,ca_cert_pk=?,ca_cert_pk_pass=?',
$certData,
$keyData,
$_REQUEST['cert_ca_pass'] != '' ? base64_encode(CryptPKPassPhrase($_REQUEST['cert_ca_pass'])) : '');
$res = $db->Query('SELECT COUNT(*) FROM {pre}certificates WHERE `hash`=? AND `type`=? AND `userid`=?',
$certInfo['hash'],
CERTIFICATE_TYPE_ROOT,
0);
list($certCount) = $res->FetchArray(MYSQLI_NUM);
$res->Free();
if($certCount == 0)
$db->Query('INSERT INTO {pre}certificates(`type`,`userid`,`hash`,`cn`,`validfrom`,`validto`,`pemdata`) '
. 'VALUES(?,?,?,?,?,?,?)',
CERTIFICATE_TYPE_ROOT,
0,
$certInfo['hash'],
$certInfo['subject']['CN'],
$certInfo['validFrom_time_t'],
$certInfo['validTo_time_t'],
$certData);
ReadConfig();
$success = true;
}
else
$error = 'purpose';
}
else
$error = 'pkcheck';
openssl_x509_free($cert);
}
}
// display result on error
if(!$success)
{
$tpl->assign('msgTitle', $lang_admin['error']);
$tpl->assign('msgText', $lang_admin['cert_caerr_'.$error]);
$tpl->assign('msgIcon', 'error32');
$tpl->assign('page', 'msg.tpl');
$stopIt = true;
}
}
if(!$stopIt)
{
$certInfo = false;
$cert = @openssl_x509_read($bm_prefs['ca_cert']);
if($cert)
{
$certInfo = openssl_x509_parse($cert);
openssl_x509_free($cert);
}
$tpl->assign('validCert', $certInfo && $certInfo['validFrom_time_t'] <= time() && $certInfo['validTo_time_t'] >= time());
$tpl->assign('certInfo', postProcessCertInfo($certInfo));
$tpl->assign('page', 'prefs.email.smime.ca.tpl');
}
}
}
}
$tpl->assign('bm_prefs', $bm_prefs);
$tpl->assign('tabs', $tabs);
$tpl->assign('title', $lang_admin['prefs'] . ' &raquo; ' . $lang_admin['email']);
$tpl->display('page.tpl');

View file

@ -0,0 +1,182 @@
<?php
/*
* b1gMail
* Copyright (c) 2021 Patrick Schlangen et al
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
include('../serverlib/admin.inc.php');
RequestPrivileges(PRIVILEGES_ADMIN);
AdminRequirePrivilege('prefs.extensions');
if(!isset($_REQUEST['action']))
$_REQUEST['action'] = 'extensions';
$tabs = array(
0 => array(
'title' => $lang_admin['webdiskicons'],
'relIcon' => 'extension.png',
'link' => 'prefs.extensions.php?',
'active' => $_REQUEST['action'] == 'extensions'
)
);
/**
* extensions
*/
if($_REQUEST['action'] == 'extensions')
{
if(!isset($_REQUEST['do']))
$_REQUEST['do'] = 'list';
//
// list
//
if($_REQUEST['do'] == 'list')
{
// add
if(isset($_REQUEST['add']))
{
if(isset($_FILES['icon']) && $_FILES['icon']['error'] == 0 && $_FILES['icon']['size'] > 5)
{
$tempFileID = RequestTempFile(0);
$tempFileName = TempFileName($tempFileID);
if(move_uploaded_file($_FILES['icon']['tmp_name'], $tempFileName))
{
$iconData = base64_encode(getFileContents($tempFileName));
$db->Query('INSERT INTO {pre}extensions(ext,ctype,bild) VALUES(?,?,?)',
str_replace(array(' ', '.'), '', $_REQUEST['ext']),
$_FILES['icon']['type'],
$iconData);
}
ReleaseTempFile(0, $tempFileID);
}
}
// delete
if(isset($_REQUEST['delete']))
{
$db->Query('DELETE FROM {pre}extensions WHERE id=?',
(int)$_REQUEST['delete']);
}
// mass action
if(isset($_REQUEST['executeMassAction']))
{
// get extesion IDs
$extIDs = array();
foreach($_POST as $key=>$val)
if(substr($key, 0, 4) == 'ext_')
$extIDs[] = (int)substr($key, 4);
if(count($extIDs) > 0)
{
if($_REQUEST['massAction'] == 'delete')
{
// delete row
$db->Query('DELETE FROM {pre}extensions WHERE id IN(' . implode(',', $extIDs) . ')');
}
}
}
// fetch
$extensions = array();
$res = $db->Query('SELECT id,ext,ctype FROM {pre}extensions ORDER BY ext ASC');
while($row = $res->FetchArray(MYSQLI_ASSOC))
$extensions[$row['id']] = array(
'id' => $row['id'],
'ext' => $row['ext'],
'ctype' => $row['ctype']
);
$res->Free();
// assign
$tpl->assign('extensions', $extensions);
$tpl->assign('page', 'prefs.extensions.tpl');
}
//
// edit
//
else if($_REQUEST['do'] == 'edit')
{
// save?
if(isset($_REQUEST['save']))
{
// modified ext?
if(isset($_REQUEST['ext']))
$db->Query('UPDATE {pre}extensions SET ext=? WHERE id=?',
str_replace(array(' ', '.'), '', $_REQUEST['ext']),
$_REQUEST['id']);
// new icon?
if(isset($_FILES['icon']) && $_FILES['icon']['error'] == 0 && $_FILES['icon']['size'] > 5)
{
$tempFileID = RequestTempFile(0);
$tempFileName = TempFileName($tempFileID);
if(move_uploaded_file($_FILES['icon']['tmp_name'], $tempFileName))
{
$iconData = base64_encode(getFileContents($tempFileName));
$db->Query('UPDATE {pre}extensions SET ctype=?,bild=? WHERE id=?',
$_FILES['icon']['type'],
$iconData,
$_REQUEST['id']);
}
ReleaseTempFile(0, $tempFileID);
}
header('Location: prefs.extensions.php?sid=' . session_id());
exit();
}
// fetch
$res = $db->Query('SELECT id,ext FROM {pre}extensions WHERE id=?',
(int)$_REQUEST['id']);
assert('$res->RowCount() != 0');
$extension = $res->FetchArray(MYSQLI_ASSOC);
$res->Free();
// assign
$tpl->assign('extension', $extension);
$tpl->assign('page', 'prefs.extensions.edit.tpl');
}
}
/**
* display extension
*/
else if($_REQUEST['action'] == 'display'
&& isset($_REQUEST['id']))
{
$res = $db->Query('SELECT bild,ctype FROM {pre}extensions WHERE id=?',
(int)$_REQUEST['id']);
list($img, $ctype) = $res->FetchArray(MYSQLI_NUM);
$img = base64_decode($img);
header('Content-Type: ' . $ctype);
header('Content-Length: ' . strlen($img));
echo $img;
exit();
}
$tpl->assign('tabs', $tabs);
$tpl->assign('title', $lang_admin['prefs'] . ' &raquo; ' . $lang_admin['webdiskicons']);
$tpl->display('page.tpl');
?>

148
src/admin/prefs.faq.php Normal file
View file

@ -0,0 +1,148 @@
<?php
/*
* b1gMail
* Copyright (c) 2021 Patrick Schlangen et al
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
include('../serverlib/admin.inc.php');
RequestPrivileges(PRIVILEGES_ADMIN);
AdminRequirePrivilege('prefs.faq');
if(!isset($_REQUEST['action']))
$_REQUEST['action'] = 'faq';
$tabs = array(
0 => array(
'title' => $lang_admin['faq'],
'relIcon' => 'faq32.png',
'link' => 'prefs.faq.php?',
'active' => $_REQUEST['action'] == 'faq'
)
);
/**
* faq
*/
if($_REQUEST['action'] == 'faq')
{
if(!isset($_REQUEST['do']))
$_REQUEST['do'] = 'list';
//
// list
//
if($_REQUEST['do'] == 'list')
{
// add
if(isset($_REQUEST['add']))
{
$db->Query('INSERT INTO {pre}faq(frage,typ,lang,required,antwort) VALUES(?,?,?,?,?)',
HTMLFormat($_REQUEST['frage']),
$_REQUEST['typ'],
$_REQUEST['lang'],
$_REQUEST['required'],
$_REQUEST['antwort']);
}
// delete
if(isset($_REQUEST['delete']))
{
$db->Query('DELETE FROM {pre}faq WHERE id=?',
(int)$_REQUEST['delete']);
}
// mass action
if(isset($_REQUEST['executeMassAction']))
{
// get faq IDs
$faqIDs = array();
foreach($_POST as $key=>$val)
if(substr($key, 0, 4) == 'faq_')
$faqIDs[] = (int)substr($key, 4);
if(count($faqIDs) > 0)
{
if($_REQUEST['massAction'] == 'delete')
{
// delete row
$db->Query('DELETE FROM {pre}faq WHERE id IN(' . implode(',', $faqIDs) . ')');
}
}
}
// fetch
$languages = GetAvailableLanguages();
$faqs = array();
$res = $db->Query('SELECT id,typ,lang,frage,antwort,required FROM {pre}faq ORDER BY typ,lang,frage ASC');
while($row = $res->FetchArray(MYSQLI_ASSOC))
$faqs[$row['id']] = array(
'id' => $row['id'],
'typ' => $lang_admin[$row['typ']],
'lang' => $row['lang'] == ':all:' ? $lang_admin['all'] : $languages[$row['lang']]['title'],
'frage' => $row['frage'],
'antwort' => $row['antwort'],
'required' => $row['required']
);
$res->Free();
// assign
$tpl->assign('faqs', $faqs);
$tpl->assign('requirements', $faqRequirementTable);
$tpl->assign('languages', $languages);
$tpl->assign('page', 'prefs.faq.tpl');
}
//
// edit
//
else if($_REQUEST['do'] == 'edit')
{
// save?
if(isset($_REQUEST['save']))
{
$db->Query('UPDATE {pre}faq SET frage=?,typ=?,lang=?,required=?,antwort=? WHERE id=?',
HTMLFormat($_REQUEST['frage']),
$_REQUEST['typ'],
$_REQUEST['lang'],
$_REQUEST['required'],
$_REQUEST['antwort'],
(int)$_REQUEST['id']);
header('Location: prefs.faq.php?sid=' . session_id());
exit();
}
// fetch
$res = $db->Query('SELECT id,typ,lang,frage,antwort,required FROM {pre}faq WHERE id=?',
(int)$_REQUEST['id']);
assert('$res->RowCount() != 0');
$faq = $res->FetchArray(MYSQLI_ASSOC);
$res->Free();
// assign
$languages = GetAvailableLanguages();
$tpl->assign('faq', $faq);
$tpl->assign('requirements', $faqRequirementTable);
$tpl->assign('languages', $languages);
$tpl->assign('page', 'prefs.faq.edit.tpl');
}
}
$tpl->assign('usertpldir', B1GMAIL_REL . 'templates/' . $bm_prefs['template'] . '/');
$tpl->assign('tabs', $tabs);
$tpl->assign('title', $lang_admin['prefs'] . ' &raquo; ' . $lang_admin['faq']);
$tpl->display('page.tpl');

View file

@ -0,0 +1,178 @@
<?php
/*
* b1gMail
* Copyright (c) 2021 Patrick Schlangen et al
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
include('../serverlib/admin.inc.php');
RequestPrivileges(PRIVILEGES_ADMIN);
AdminRequirePrivilege('prefs.languages');
if(!isset($_REQUEST['action']))
$_REQUEST['action'] = 'languages';
$tabs = array(
0 => array(
'title' => $lang_admin['languages'],
'relIcon' => 'lang32.png',
'link' => 'prefs.languages.php?',
'active' => $_REQUEST['action'] == 'languages'
),
1 => array(
'title' => $lang_admin['customtexts'],
'relIcon' => 'phrases32.png',
'link' => 'prefs.languages.php?action=texts&',
'active' => $_REQUEST['action'] == 'texts'
)
);
/**
* fields
*/
if($_REQUEST['action'] == 'languages')
{
// add
if(isset($_REQUEST['add']))
{
if(isset($_FILES['langfile'])
&& $_FILES['langfile']['error'] == 0
&& $_FILES['langfile']['size'] > 5
&& strtolower(substr($_FILES['langfile']['name'], -9)) == '.lang.php')
{
$fileName = $_FILES['langfile']['name'];
$newFileName = B1GMAIL_DIR . 'languages/' . $fileName;
move_uploaded_file($_FILES['langfile']['tmp_name'], $newFileName);
@chmod($newFileName, 0777);
}
}
// delete
if(isset($_REQUEST['delete']))
{
$langID = str_replace(array('/', '\\'), '', $_REQUEST['delete']);
if(is_writeable(B1GMAIL_DIR . 'languages/' . $langID . '.lang.php'))
unlink(B1GMAIL_DIR . 'languages/' . $langID . '.lang.php');
}
// mass action
if(isset($_REQUEST['executeMassAction']))
{
// get country IDs
$langIDs = array();
foreach($_POST as $key=>$val)
if(substr($key, 0, 5) == 'lang_')
$langIDs[] = str_replace(array('/', '\\'), '', substr($key, 5));
if(count($langIDs) > 0)
{
if($_REQUEST['massAction'] == 'delete')
{
// delete lang files
foreach($langIDs as $langID)
{
if(is_writeable(B1GMAIL_DIR . 'languages/' . $langID . '.lang.php'))
unlink(B1GMAIL_DIR . 'languages/' . $langID . '.lang.php');
}
}
}
}
// get available languages
$languages = GetAvailableLanguages();
// assign
$tpl->assign('languages', $languages);
$tpl->assign('page', 'prefs.languages.tpl');
}
/**
* texts
*/
else if($_REQUEST['action'] == 'texts')
{
// language given?
$selectedLang = isset($_REQUEST['lang']) ? $_REQUEST['lang'] : $currentLanguage;
// get custom lang of lang file
function GetCustomLang($langfile)
{
$lang_client = $lang_user = $lang_admin = $lang_custom = array();
include(B1GMAIL_DIR . 'languages/' . $langfile . '.lang.php');
ModuleFunction('OnReadLang', array(&$lang_user, &$lang_client, &$lang_custom, &$lang_admin, $langfile));
return($lang_custom);
}
if($selectedLang)
$lang_custom = GetCustomLang($selectedLang);
// db texts
$dbTexts = array();
$res = $db->Query('SELECT `key`,`text` FROM {pre}texts WHERE language=?',
$selectedLang);
while($row = $res->FetchArray(MYSQLI_ASSOC))
$lang_custom[$row['key']] = $row['text'];
$res->Free();
// save?
if($selectedLang && isset($_REQUEST['save']))
{
foreach($_POST as $key=>$val)
{
if(substr($key, 0, 5) == 'text-' && trim($lang_custom[substr($key, 5)]) != trim($val))
{
$db->Query('REPLACE INTO {pre}texts(language,`key`,`text`) VALUES(?,?,?)',
$selectedLang,
substr($key, 5),
$val);
$lang_custom[substr($key, 5)] = $val;
}
}
$cacheManager->Delete('langCustom:' . $selectedLang);
}
// get available languages
$languages = GetAvailableLanguages();
// get texts
$texts = array();
if($selectedLang)
{
// lang texts
foreach($lang_custom as $key=>$val)
{
$texts[$key] = array(
'key' => $key,
'title' => $lang_admin['text_' . $key],
'text' => $val
);
}
}
// assign
$tpl->assign('usertpldir', B1GMAIL_REL . 'templates/' . $bm_prefs['template'] . '/');
$tpl->assign('customTextsHTML', $customTextsHTML);
$tpl->assign('languages', $languages);
$tpl->assign('selectedLang', $selectedLang);
$tpl->assign('texts', $texts);
$tpl->assign('page', 'prefs.languages.texts.tpl');
}
$tpl->assign('tabs', $tabs);
$tpl->assign('title', $lang_admin['prefs'] . ' &raquo; ' . $lang_admin['languages']);
$tpl->display('page.tpl');
?>

View file

@ -0,0 +1,274 @@
<?php
/*
* b1gMail
* Copyright (c) 2021 Patrick Schlangen et al
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
include('../serverlib/admin.inc.php');
RequestPrivileges(PRIVILEGES_ADMIN);
AdminRequirePrivilege('prefs.payments');
function fieldSort($a, $b)
{
return($a['pos'] - $b['pos']);
}
if(!isset($_REQUEST['action']))
$_REQUEST['action'] = 'common';
$tabs = array(
0 => array(
'title' => $lang_admin['common'],
'relIcon' => 'ico_prefs_payments.png',
'link' => 'prefs.payments.php?',
'active' => $_REQUEST['action'] == 'common'
),
1 => array(
'title' => $lang_admin['paymentmethods'],
'relIcon' => 'ico_pay_banktransfer.png',
'link' => 'prefs.payments.php?action=paymethods&',
'active' => $_REQUEST['action'] == 'paymethods'
),
2 => array(
'title' => $lang_admin['invoices'],
'relIcon' => 'ico_prefs_invoices.png',
'link' => 'prefs.payments.php?action=invoices&',
'active' => $_REQUEST['action'] == 'invoices'
)
);
/**
* common
*/
if($_REQUEST['action'] == 'common')
{
// sofortueberweisung.de return
if(isset($_REQUEST['do']) && $_REQUEST['do'] == 'suBack'
&& isset($_REQUEST['user_id'])
&& isset($_REQUEST['project_id'])
&& isset($_REQUEST['prjPass'])
&& isset($_REQUEST['notifyPass']))
{
echo '<script>' . "\n";
echo '<!--' . "\n";
printf(' try { window.opener.parent.frames[\'content\'].EBID(\'su_kdnr\').value=\'%s\';' . "\n",
addslashes($_REQUEST['user_id']));
printf(' window.opener.parent.frames[\'content\'].EBID(\'su_prjnr\').value=\'%s\';' . "\n",
addslashes($_REQUEST['project_id']));
printf(' window.opener.parent.frames[\'content\'].EBID(\'su_prjpass\').value=\'%s\';' . "\n",
addslashes($_REQUEST['prjPass']));
printf(' window.opener.parent.frames[\'content\'].EBID(\'su_notifypass\').value=\'%s\';' . "\n",
addslashes($_REQUEST['notifyPass']));
printf(' window.opener.parent.frames[\'content\'].EBID(\'su_enable\').checked = true;' . "\n");
printf(' window.opener.parent.frames[\'content\'].EBID(\'su_inputcheck\').checked = true;' . "\n");
printf(' window.opener.parent.frames[\'content\'].EBID(\'prefsForm\').submit();' . "\n");
echo ' } catch(e) { } window.close();' . "\n";
echo '//-->' . "\n";
echo '</script>' . "\n";
exit();
}
// save?
if(isset($_REQUEST['save']))
{
$db->Query('UPDATE {pre}prefs SET `currency`=?,`send_pay_notification`=?,`pay_notification_to`=?,`pay_emailfrom`=?,`pay_emailfromemail`=?,`mwst`=?,`enable_paypal`=?,`paypal_mail`=?,`enable_su`=?,`su_kdnr`=?,`su_prjnr`=?,`su_prjpass`=?,`su_notifypass`=?,`su_inputcheck`=?,`enable_vk`=?,`vk_kto_inh`=?,`vk_kto_nr`=?,`vk_kto_blz`=?,`vk_kto_inst`=?,`vk_kto_iban`=?,`vk_kto_bic`=?,`default_paymethod`=?,`enable_skrill`=?,`skrill_mail`=?,`skrill_secret`=?',
$_REQUEST['currency'],
isset($_REQUEST['send_pay_notification']) ? 'yes' : 'no',
$_REQUEST['pay_notification_to'],
$_REQUEST['pay_emailfrom'],
EncodeEMail($_REQUEST['pay_emailfromemail']),
$_REQUEST['mwst'],
isset($_REQUEST['enable_paypal']) ? 'yes' : 'no',
$_REQUEST['paypal_mail'],
isset($_REQUEST['enable_su']) ? 'yes' : 'no',
$_REQUEST['su_kdnr'],
$_REQUEST['su_prjnr'],
$_REQUEST['su_prjpass'],
$_REQUEST['su_notifypass'],
isset($_REQUEST['su_inputcheck']) ? 'yes' : 'no',
isset($_REQUEST['enable_vk']) ? 'yes' : 'no',
$_REQUEST['vk_kto_inh'],
$_REQUEST['vk_kto_nr'],
$_REQUEST['vk_kto_blz'],
$_REQUEST['vk_kto_inst'],
$_REQUEST['vk_kto_iban'],
$_REQUEST['vk_kto_bic'],
(int)$_REQUEST['default_paymethod'],
isset($_REQUEST['enable_skrill']) ? 'yes' : 'no',
$_REQUEST['skrill_mail'],
$_REQUEST['skrill_secret']);
ReadConfig();
}
// assign
$tpl->assign('prjPass', substr(GenerateRandomKey('sofortueberweisungProjectPassword'), 0, 20));
$tpl->assign('notifyPass', substr(GenerateRandomKey('sofortueberweisungNotifyPassword'), 0, 20));
$tpl->assign('page', 'prefs.payments.common.tpl');
$tpl->assign('title', $lang_admin['payments'] . ' &raquo; ' . $lang_admin['common']);
}
/**
* custom payment methods
*/
else if($_REQUEST['action'] == 'paymethods')
{
//
// list
//
if(!isset($_REQUEST['do']))
{
// delete?
if(isset($_REQUEST['delete']))
{
$db->Query('DELETE FROM {pre}paymethods WHERE `methodid`=?',
(int)$_REQUEST['delete']);
}
// mass delete?
if(isset($_REQUEST['massAction']) && $_REQUEST['massAction'] == 'delete')
{
$ids = array();
foreach($_POST as $key=>$val)
{
if(substr($key, 0, 7) == 'method_')
$ids[] = (int)substr($key, 7);
}
if(count($ids) > 0)
$db->Query('DELETE FROM {pre}paymethods WHERE `methodid` IN ?', $ids);
}
// enable?
if(isset($_REQUEST['enable']))
{
$db->Query('UPDATE {pre}paymethods SET `enabled`=1 WHERE `methodid`=?',
$_REQUEST['enable']);
}
// disable?
if(isset($_REQUEST['disable']))
{
$db->Query('UPDATE {pre}paymethods SET `enabled`=0 WHERE `methodid`=?',
$_REQUEST['disable']);
}
// add?
if(isset($_REQUEST['add']) && isset($_POST['title']))
{
$db->Query('INSERT INTO {pre}paymethods(`title`,`fields`) VALUES(?,?)',
$_POST['title'],
serialize(array()));
$id = $db->InsertId();
header('Location: prefs.payments.php?action=paymethods&do=edit&methodid='.$id.'&sid='.session_id());
exit();
}
$methods = array();
$res = $db->Query('SELECT `methodid`,`enabled`,`title` FROM {pre}paymethods ORDER BY `methodid` ASC');
while($row = $res->FetchArray(MYSQLI_ASSOC))
{
$methods[$row['methodid']] = $row;
}
$res->Free();
$tpl->assign('methods', $methods);
$tpl->assign('page', 'prefs.payments.methods.tpl');
$tpl->assign('title', $lang_admin['payments'] . ' &raquo; ' . $lang_admin['paymentmethods']);
}
//
// edit
//
else if($_REQUEST['do'] == 'edit' && isset($_REQUEST['methodid']))
{
$id = (int)$_REQUEST['methodid'];
$res = $db->Query('SELECT * FROM {pre}paymethods WHERE `methodid`=?', $id);
if($res->RowCount() != 1)
die('Payment method not found.');
$row = $res->FetchArray(MYSQLI_ASSOC);
$res->Free();
$fields = @unserialize($row['fields']);
if(!is_array($fields)) $fields = array();
uasort($fields, 'fieldSort');
if(isset($_REQUEST['save']) && isset($_POST['fields']) && is_array($_POST['fields']))
{
$fields = array();
// build new fields array
foreach($_POST['fields'] as $fieldID=>$fieldInfo)
{
if(isset($fieldInfo['delete']))
continue;
if($fieldID == 'new' && empty($fieldInfo['title']))
continue;
$fields[] = $fieldInfo;
}
$row['enabled'] = isset($_REQUEST['enabled']) ? 1 : 0;
$row['invoice'] = $_REQUEST['invoice'];
$row['title'] = $_REQUEST['title'];
$db->Query('UPDATE {pre}paymethods SET `title`=?,`fields`=?,`enabled`=?,`invoice`=? WHERE `methodid`=?',
$row['title'],
serialize($fields),
$row['enabled'],
$row['invoice'],
$id);
}
$tpl->assign('row', $row);
$tpl->assign('fields', $fields);
$tpl->assign('fieldTypeTable', $fieldTypeTable);
$tpl->assign('page', 'prefs.payments.methods.edit.tpl');
$tpl->assign('title', $lang_admin['payments'] . ' &raquo; ' . $lang_admin['paymentmethods']
. ' &raquo; ' . HTMLFormat($row['title']));
}
}
/**
* invoices
*/
else if($_REQUEST['action'] == 'invoices')
{
if(isset($_REQUEST['save']))
{
$db->Query('UPDATE {pre}prefs SET `sendrg`=?,`rgnrfmt`=?,`kdnrfmt`=?,`rgtemplate`=?',
isset($_REQUEST['sendrg']) ? 'yes' : 'no',
$_REQUEST['rgnrfmt'],
$_REQUEST['kdnrfmt'],
$_REQUEST['rgtemplate']);
ReadConfig();
}
// assign
$tpl->assign('usertpldir', B1GMAIL_REL . 'templates/' . $bm_prefs['template'] . '/');
$tpl->assign('page', 'prefs.payments.invoices.tpl');
$tpl->assign('title', $lang_admin['payments'] . ' &raquo; ' . $lang_admin['invoices']);
}
$tpl->assign('bm_prefs', $bm_prefs);
$tpl->assign('tabs', $tabs);
$tpl->display('page.tpl');
?>

View file

@ -0,0 +1,148 @@
<?php
/*
* b1gMail
* Copyright (c) 2021 Patrick Schlangen et al
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
include('../serverlib/admin.inc.php');
RequestPrivileges(PRIVILEGES_ADMIN);
AdminRequirePrivilege('prefs.profilefields');
if(!isset($_REQUEST['action']))
$_REQUEST['action'] = 'fields';
$tabs = array(
0 => array(
'title' => $lang_admin['profilefields'],
'relIcon' => 'field32.png',
'link' => 'prefs.profilefields.php?',
'active' => $_REQUEST['action'] == 'fields'
)
);
/**
* fields
*/
if($_REQUEST['action'] == 'fields')
{
if(!isset($_REQUEST['do']))
$_REQUEST['do'] = 'list';
//
// list
//
if($_REQUEST['do'] == 'list')
{
// add
if(isset($_REQUEST['add']))
{
$db->Query('INSERT INTO {pre}profilfelder(feld,typ,pflicht,rule,extra,show_signup,show_li) VALUES(?,?,?,?,?,?,?)',
$_REQUEST['feld'],
(int)$_REQUEST['typ'],
isset($_REQUEST['pflicht']) ? 'yes' : 'no',
$_REQUEST['rule'],
$_REQUEST['extra'],
isset($_REQUEST['show_signup']) ? 'yes' : 'no',
isset($_REQUEST['show_li']) ? 'yes' : 'no');
}
// delete
if(isset($_REQUEST['delete']))
{
$db->Query('DELETE FROM {pre}profilfelder WHERE id=?',
(int)$_REQUEST['delete']);
}
// mass action
if(isset($_REQUEST['executeMassAction']))
{
// get field IDs
$fieldIDs = array();
foreach($_POST as $key=>$val)
if(substr($key, 0, 6) == 'field_')
$fieldIDs[] = (int)substr($key, 6);
if(count($fieldIDs) > 0)
{
if($_REQUEST['massAction'] == 'delete')
{
// delete row
$db->Query('DELETE FROM {pre}profilfelder WHERE id IN(' . implode(',', $fieldIDs) . ')');
}
}
}
// fetch
$fields = array();
$res = $db->Query('SELECT id,feld,typ,pflicht,rule,extra FROM {pre}profilfelder ORDER BY id ASC');
while($row = $res->FetchArray(MYSQLI_ASSOC))
$fields[$row['id']] = array(
'id' => $row['id'],
'feld' => $row['feld'],
'typ' => $fieldTypeTable[$row['typ']],
'pflicht' => $row['pflicht'] == 'yes',
'rule' => $row['rule'],
'extra' => $row['extra']
);
$res->Free();
// assign
$tpl->assign('fields', $fields);
$tpl->assign('fieldTypeTable', $fieldTypeTable);
$tpl->assign('page', 'prefs.profilefields.tpl');
}
//
// edit
//
else if($_REQUEST['do'] == 'edit')
{
// save?
if(isset($_REQUEST['save']))
{
$db->Query('UPDATE {pre}profilfelder SET feld=?,typ=?,pflicht=?,rule=?,extra=?,show_signup=?,show_li=? WHERE id=?',
$_REQUEST['feld'],
(int)$_REQUEST['typ'],
isset($_REQUEST['pflicht']) ? 'yes' : 'no',
$_REQUEST['rule'],
$_REQUEST['extra'],
isset($_REQUEST['show_signup']) ? 'yes' : 'no',
isset($_REQUEST['show_li']) ? 'yes' : 'no',
(int)$_REQUEST['id']);
header('Location: prefs.profilefields.php?sid=' . session_id());
exit();
}
// fetch
$res = $db->Query('SELECT id,feld,typ,pflicht,rule,extra,show_signup,show_li FROM {pre}profilfelder WHERE id=?',
(int)$_REQUEST['id']);
assert('$res->RowCount() != 0');
$field = $res->FetchArray(MYSQLI_ASSOC);
$res->Free();
// assign
$tpl->assign('field', $field);
$tpl->assign('fieldTypeTable', $fieldTypeTable);
$tpl->assign('page', 'prefs.profilefields.edit.tpl');
}
}
$tpl->assign('tabs', $tabs);
$tpl->assign('title', $lang_admin['prefs'] . ' &raquo; ' . $lang_admin['profilefields']);
$tpl->display('page.tpl');
?>

View file

@ -0,0 +1,217 @@
<?php
/*
* b1gMail
* Copyright (c) 2021 Patrick Schlangen et al
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
include('../serverlib/admin.inc.php');
RequestPrivileges(PRIVILEGES_ADMIN);
AdminRequirePrivilege('prefs.recvrules');
if(!isset($_REQUEST['action']))
$_REQUEST['action'] = 'recvrules';
$tabs = array(
0 => array(
'title' => $lang_admin['recvrules'],
'relIcon' => 'rule32.png',
'link' => 'prefs.recvrules.php?',
'active' => $_REQUEST['action'] == 'recvrules'
)/*,
1 => array(
'title' => $lang_admin['autodetection'],
'link' => 'prefs.recvrules.php?action=autodetection&',
'active' => $_REQUEST['action'] == 'autodetection'
)*/
);
/**
* receive rules
*/
if($_REQUEST['action'] == 'recvrules')
{
if(!isset($_REQUEST['do']))
$_REQUEST['do'] = 'list';
//
// list
//
if($_REQUEST['do'] == 'list')
{
// add?
if(isset($_REQUEST['add']))
{
$db->Query('INSERT INTO {pre}recvrules(field,expression,action,value,type) VALUES(?,?,?,?,?)',
$_REQUEST['field'],
$_REQUEST['expression'],
(int)$_REQUEST['ruleAction'],
(int)$_REQUEST['value'],
(int)$_REQUEST['type']);
}
// delete
if(isset($_REQUEST['delete']))
{
$db->Query('DELETE FROM {pre}recvrules WHERE id=?',
(int)$_REQUEST['delete']);
}
// import
if(isset($_REQUEST['import']))
{
if(isset($_FILES['rulefile'])
&& $_FILES['rulefile']['error'] == 0
&& $_FILES['rulefile']['size'] > 5)
{
// request temp file
$tempFileID = RequestTempFile(0);
$tempFileName = TempFileName($tempFileID);
// move uploaded file to temp file
if(move_uploaded_file($_FILES['rulefile']['tmp_name'], $tempFileName))
{
// read file
$fp = fopen($tempFileName, 'rb');
$importData = fread($fp, filesize($tempFileName));
fclose($fp);
// try to unserialize
$importArray = @unserialize($importData);
// check format
if(is_array($importArray)
&& isset($importArray['type'])
&& $importArray['type'] = 'b1gMailRuleFile'
&& count($importArray['data']) > 0)
{
// import
foreach($importArray['data'] as $rule)
{
$db->Query('INSERT INTO {pre}recvrules(field,expression,action,value,type) VALUES(?,?,?,?,?)',
$rule['field'],
$rule['expression'],
$rule['action'],
$rule['value'],
$rule['type']);
}
}
}
// release temp file
ReleaseTempFile(0, $tempFileID);
}
}
// mass action
if(isset($_REQUEST['executeMassAction']))
{
// get rule IDs
$ruleIDs = array();
foreach($_POST as $key=>$val)
if(substr($key, 0, 5) == 'rule_')
$ruleIDs[] = (int)substr($key, 5);
if(count($ruleIDs) > 0)
{
if($_REQUEST['massAction'] == 'delete')
{
// delete row
$db->Query('DELETE FROM {pre}recvrules WHERE id IN(' . implode(',', $ruleIDs) . ')');
}
else if($_REQUEST['massAction'] == 'export')
{
// get rows
$exportArray = array();
$res = $db->Query('SELECT field,expression,action,value,type FROM {pre}recvrules WHERE id IN(' . implode(',', $ruleIDs) . ') ORDER BY id ASC');
while($row = $res->FetchArray(MYSQLI_ASSOC))
$exportArray[] = $row;
$res->Free();
// export as file
$exportData = serialize(array('type' => 'b1gMailRuleFile', 'data' => $exportArray));
header('Pragma: public');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=rules.bmrecvrules');
header('Content-Length: ' . strlen($exportData));
echo($exportData);
exit();
}
}
}
// retrieve rules
$rules = array();
$res = $db->Query('SELECT id,field,expression,action,value,type FROM {pre}recvrules ORDER BY type,action,id ASC');
while($row = $res->FetchArray(MYSQLI_ASSOC))
{
$rules[$row['id']] = array(
'id' => $row['id'],
'field' => $row['field'],
'expression' => $row['expression'],
'action' => $ruleActionTable[$row['action']],
'value' => $row['value'],
'type' => $ruleTypeTable[$row['type']]
);
}
$res->Free();
// assign
$tpl->assign('ruleActionTable', $ruleActionTable);
$tpl->assign('ruleTypeTable', $ruleTypeTable);
$tpl->assign('rules', $rules);
$tpl->assign('page', 'prefs.recvrules.tpl');
}
//
// edit
//
else if($_REQUEST['do'] == 'edit')
{
// save?
if(isset($_REQUEST['save']))
{
$db->Query('UPDATE {pre}recvrules SET field=?, expression=?, action=?, value=?, type=? WHERE id=?',
$_REQUEST['field'],
$_REQUEST['expression'],
(int)$_REQUEST['ruleAction'],
(int)$_REQUEST['value'],
(int)$_REQUEST['type'],
(int)$_REQUEST['id']);
header('Location: prefs.recvrules.php?sid=' . session_id());
exit();
}
// get rule data
$res = $db->Query('SELECT id,field,expression,action,value,type FROM {pre}recvrules WHERE id=?',
(int)$_REQUEST['id']);
assert('$res->RowCount() != 0');
$rule = $res->FetchArray(MYSQLI_ASSOC);
$res->Free();
// assign
$tpl->assign('rule', $rule);
$tpl->assign('ruleActionTable', $ruleActionTable);
$tpl->assign('ruleTypeTable', $ruleTypeTable);
$tpl->assign('page', 'prefs.recvrules.edit.tpl');
}
}
$tpl->assign('tabs', $tabs);
$tpl->assign('title', $lang_admin['prefs'] . ' &raquo; ' . $lang_admin['recvrules']);
$tpl->display('page.tpl');
?>

316
src/admin/prefs.sms.php Normal file
View file

@ -0,0 +1,316 @@
<?php
/*
* b1gMail
* Copyright (c) 2021 Patrick Schlangen et al
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
include('../serverlib/admin.inc.php');
RequestPrivileges(PRIVILEGES_ADMIN);
AdminRequirePrivilege('prefs.sms');
if(!isset($_REQUEST['action']))
$_REQUEST['action'] = 'common';
$tabs = array(
0 => array(
'title' => $lang_admin['common'],
'relIcon' => 'ico_prefs_common.png',
'link' => 'prefs.sms.php?',
'active' => $_REQUEST['action'] == 'common'
),
1 => array(
'title' => $lang_admin['gateways'],
'relIcon' => 'gateway32.png',
'link' => 'prefs.sms.php?action=gateways&',
'active' => $_REQUEST['action'] == 'gateways'
),
2 => array(
'title' => $lang_admin['types'],
'relIcon' => 'type32.png',
'link' => 'prefs.sms.php?action=types&',
'active' => $_REQUEST['action'] == 'types'
)
);
/**
* common
*/
if($_REQUEST['action'] == 'common')
{
// save?
if(isset($_REQUEST['save']))
{
$db->Query('UPDATE {pre}prefs SET sms_gateway=?, clndr_sms_abs=?, mail2sms_abs=?, smsreply_abs=?, charge_min_amount=?, clndr_sms_type=?, mail2sms_type=?, smsvalidation_type=?, sms_enable_charge=?',
$_REQUEST['sms_gateway'],
$_REQUEST['clndr_sms_abs'],
$_REQUEST['mail2sms_abs'],
$_REQUEST['smsreply_abs'],
(double)str_replace(',', '.', $_REQUEST['charge_min_amount']) * 100,
$_REQUEST['clndr_sms_type'],
$_REQUEST['mail2sms_type'],
$_REQUEST['smsvalidation_type'],
isset($_REQUEST['sms_enable_charge']) ? 'yes' : 'no');
ReadConfig();
}
// fetch gateways
$gateways = array();
$res = $db->Query('SELECT id,titel FROM {pre}smsgateways ORDER BY titel ASC');
while($row = $res->FetchArray(MYSQLI_ASSOC))
$gateways[$row['id']] = $row;
$res->Free();
// fetch types
$types = array();
$res = $db->Query('SELECT id,titel FROM {pre}smstypen ORDER BY titel ASC');
while($row = $res->FetchArray(MYSQLI_ASSOC))
$types[$row['id']] = $row;
$res->Free();
// prepare values
$bm_prefs['charge_min_amount'] = sprintf('%.02f', $bm_prefs['charge_min_amount']/100);
// assign
$tpl->assign('prjPass', substr(GenerateRandomKey('sofortueberweisungProjectPassword'), 0, 16));
$tpl->assign('gateways', $gateways);
$tpl->assign('types', $types);
$tpl->assign('page', 'prefs.sms.common.tpl');
}
/**
* gateways
*/
else if($_REQUEST['action'] == 'gateways')
{
if(!isset($_REQUEST['do']))
$_REQUEST['do'] = 'list';
//
// list
//
if($_REQUEST['do'] == 'list')
{
// delete?
if(isset($_REQUEST['delete']))
{
$db->Query('DELETE FROM {pre}smsgateways WHERE id=?',
$_REQUEST['delete']);
}
// mass action
if(isset($_REQUEST['executeMassAction']))
{
// get gateway IDs
$gatewayIDs = array();
foreach($_POST as $key=>$val)
if(substr($key, 0, 8) == 'gateway_')
$gatewayIDs[] = (int)substr($key, 8);
if(count($gatewayIDs) > 0)
{
if($_REQUEST['massAction'] == 'delete')
{
// delete row
$db->Query('DELETE FROM {pre}smsgateways WHERE id IN(' . implode(',', $gatewayIDs) . ')');
}
}
}
// add?
if(isset($_REQUEST['add']))
{
$db->Query('INSERT INTO {pre}smsgateways(titel,getstring,success,`user`,`pass`) VALUES(?,?,?,?,?)',
$_REQUEST['titel'],
$_REQUEST['getstring'],
$_REQUEST['success'],
$_REQUEST['user'],
$_REQUEST['pass']);
}
// fetch
$gateways = array();
$res = $db->Query('SELECT id,titel FROM {pre}smsgateways ORDER BY titel ASC');
while($row = $res->FetchArray(MYSQLI_ASSOC))
{
$row['default'] = $bm_prefs['sms_gateway'] == $row['id'];
$gateways[$row['id']] = $row;
}
$res->Free();
// assign
$tpl->assign('gateways', $gateways);
$tpl->assign('lang', $currentLanguage);
$tpl->assign('page', 'prefs.sms.gateways.tpl');
}
//
// edit
//
else if($_REQUEST['do'] == 'edit'
&& isset($_REQUEST['id']))
{
// save?
if(isset($_REQUEST['save']))
{
$db->Query('UPDATE {pre}smsgateways SET titel=?, getstring=?, success=?, `user`=?, `pass`=? WHERE id=?',
$_REQUEST['titel'],
$_REQUEST['getstring'],
$_REQUEST['success'],
$_REQUEST['user'],
$_REQUEST['pass'],
$_REQUEST['id']);
header('Location: prefs.sms.php?action=gateways&sid=' . session_id());
exit();
}
// fetch
$res = $db->Query('SELECT id,titel,getstring,success,`user`,`pass` FROM {pre}smsgateways WHERE id=?',
$_REQUEST['id']);
$gateway = $res->FetchArray(MYSQLI_ASSOC);
$res->Free();
// assign
$tpl->assign('gateway', $gateway);
$tpl->assign('page', 'prefs.sms.gateways.edit.tpl');
}
}
/**
* types
*/
else if($_REQUEST['action'] == 'types')
{
if(!isset($_REQUEST['do']))
$_REQUEST['do'] = 'list';
// fetch gateways
$gateways = array();
$res = $db->Query('SELECT id,titel FROM {pre}smsgateways ORDER BY titel ASC');
while($row = $res->FetchArray(MYSQLI_ASSOC))
$gateways[$row['id']] = $row;
$res->Free();
//
// list
//
if($_REQUEST['do'] == 'list')
{
// delete?
if(isset($_REQUEST['delete']))
{
$db->Query('DELETE FROM {pre}smstypen WHERE id=?',
$_REQUEST['delete']);
}
// set default
if(isset($_REQUEST['setDefault']))
{
$db->Query('UPDATE {pre}smstypen SET std=(id=?)',
(int)$_REQUEST['setDefault']);
}
// mass action
if(isset($_REQUEST['executeMassAction']))
{
// get type IDs
$typeIDs = array();
foreach($_POST as $key=>$val)
if(substr($key, 0, 5) == 'type_')
$typeIDs[] = (int)substr($key, 5);
if(count($typeIDs) > 0)
{
if($_REQUEST['massAction'] == 'delete')
{
// delete row
$db->Query('DELETE FROM {pre}smstypen WHERE id IN(' . implode(',', $typeIDs) . ')');
}
}
}
// add?
if(isset($_REQUEST['add']))
{
$res = $db->Query('SELECT COUNT(*) FROM {pre}smstypen WHERE std=1');
list($stdCount) = $res->FetchArray();
$res->Free();
$db->Query('INSERT INTO {pre}smstypen(titel,typ,price,gateway,std,flags,maxlength) VALUES(?,?,?,?,?,?,?)',
$_REQUEST['titel'],
$_REQUEST['typ'],
$_REQUEST['price'],
$_REQUEST['gateway'],
$stdCount == 0 ? 1 : 0,
isset($_REQUEST['flags']) ? array_sum(array_keys($_REQUEST['flags'])) : 0,
(int)$_REQUEST['maxlength']);
}
// fetch
$types = array();
$res = $db->Query('SELECT id,titel,typ,std,price,maxlength FROM {pre}smstypen ORDER BY titel ASC');
while($row = $res->FetchArray(MYSQLI_ASSOC))
{
$types[$row['id']] = $row;
}
$res->Free();
// assign
$tpl->assign('types', $types);
$tpl->assign('gateways', $gateways);
$tpl->assign('page', 'prefs.sms.types.tpl');
}
//
// edit
//
else if($_REQUEST['do'] == 'edit'
&& isset($_REQUEST['id']))
{
// save?
if(isset($_REQUEST['save']))
{
$db->Query('UPDATE {pre}smstypen SET titel=?, typ=?, price=?, gateway=?, flags=?, maxlength=? WHERE id=?',
$_REQUEST['titel'],
$_REQUEST['typ'],
$_REQUEST['price'],
$_REQUEST['gateway'],
isset($_REQUEST['flags']) ? array_sum(array_keys($_REQUEST['flags'])) : 0,
(int)$_REQUEST['maxlength'],
$_REQUEST['id']);
header('Location: prefs.sms.php?action=types&sid=' . session_id());
exit();
}
// fetch
$res = $db->Query('SELECT id,titel,typ,std,price,gateway,flags,maxlength FROM {pre}smstypen WHERE id=?',
$_REQUEST['id']);
$type = $res->FetchArray(MYSQLI_ASSOC);
$res->Free();
// assign
$tpl->assign('type', $type);
$tpl->assign('gateways', $gateways);
$tpl->assign('page', 'prefs.sms.types.edit.tpl');
}
}
$tpl->assign('bm_prefs', $bm_prefs);
$tpl->assign('tabs', $tabs);
$tpl->assign('title', $lang_admin['prefs'] . ' &raquo; ' . $lang_admin['sms']);
$tpl->display('page.tpl');
?>

View file

@ -0,0 +1,112 @@
<?php
/*
* b1gMail
* Copyright (c) 2021 Patrick Schlangen et al
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
include('../serverlib/admin.inc.php');
RequestPrivileges(PRIVILEGES_ADMIN);
AdminRequirePrivilege('prefs.templates');
if(!isset($_REQUEST['action']))
$_REQUEST['action'] = 'templates';
$tabs = array(
0 => array(
'title' => $lang_admin['templates'],
'relIcon' => 'template32.png',
'link' => 'prefs.templates.php?',
'active' => $_REQUEST['action'] == 'templates'
)
);
/**
* templates
*/
if($_REQUEST['action'] == 'templates')
{
if(!isset($_REQUEST['do']))
$_REQUEST['do'] = 'list';
$templates = GetAvailableTemplates();
//
// list
//
if($_REQUEST['do'] == 'list')
{
if(isset($_REQUEST['save']) && isset($_POST['template'])
&& isset($templates[$_POST['template']]))
{
$db->Query('UPDATE {pre}prefs SET `template`=?',
$_POST['template']);
ReadConfig();
}
// assign
$tpl->assign('defaultTemplate', $bm_prefs['template']);
$tpl->assign('templates', $templates);
$tpl->assign('page', 'prefs.templates.tpl');
}
//
// edit
//
else if($_REQUEST['do'] == 'prefs' && isset($_REQUEST['template'])
&& isset($templates[$_REQUEST['template']]))
{
$prefsMeta = $templates[$_REQUEST['template']]['prefs'];
if(isset($_POST['save']))
{
foreach($prefsMeta as $key=>$info)
{
switch($info['type'])
{
case FIELD_CHECKBOX:
$value = isset($_POST['prefs'][$key]) ? 1 : 0;
break;
default:
$value = $_POST['prefs'][$key];
break;
}
$db->Query('REPLACE INTO {pre}templateprefs(`template`,`key`,`value`) VALUES(?,?,?)',
$_REQUEST['template'],
$key,
$value);
}
}
$prefsValues = GetTemplatePrefs($_REQUEST['template']);
foreach($prefsValues as $key=>$val)
if(isset($prefsMeta[$key]))
$prefsMeta[$key]['value'] = $val;
$tpl->assign('template', $_REQUEST['template']);
$tpl->assign('templateInfo', $templates[$_REQUEST['template']]);
$tpl->assign('meta', $prefsMeta);
$tpl->assign('page', 'prefs.templates.prefs.tpl'); // yo dawg
}
}
$tpl->assign('tabs', $tabs);
$tpl->assign('title', $lang_admin['prefs'] . ' &raquo; ' . $lang_admin['templates']);
$tpl->display('page.tpl');
?>

247
src/admin/prefs.webdisk.php Normal file
View file

@ -0,0 +1,247 @@
<?php
/*
* b1gMail
* Copyright (c) 2021 Patrick Schlangen et al
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
include('../serverlib/admin.inc.php');
RequestPrivileges(PRIVILEGES_ADMIN);
AdminRequirePrivilege('prefs.webdisk');
if(!isset($_REQUEST['action']))
$_REQUEST['action'] = 'common';
$tabs = array(
0 => array(
'title' => $lang_admin['common'],
'relIcon' => 'ico_disk.png',
'link' => 'prefs.webdisk.php?',
'active' => $_REQUEST['action'] == 'common'
),
1 => array(
'title' => $lang_admin['limits'],
'relIcon' => 'filetype.png',
'link' => 'prefs.webdisk.php?action=limits&',
'active' => $_REQUEST['action'] == 'limits'
),
2 => array(
'title' => $lang_admin['webdiskicons'],
'relIcon' => 'extension.png',
'link' => 'prefs.webdisk.php?action=extensions&',
'active' => $_REQUEST['action'] == 'extensions'
)
);
/**
* common
*/
if($_REQUEST['action'] == 'common')
{
if(isset($_REQUEST['save']))
{
$db->Query('UPDATE {pre}prefs SET blobstorage_provider_webdisk=?, blobstorage_webdisk_compress=?',
$_REQUEST['blobstorage_provider_webdisk'],
isset($_REQUEST['blobstorage_webdisk_compress']) ? 'yes' : 'no');
ReadConfig();
}
// assign
$tpl->assign('bsUserDBAvailable', BMBlobStorage::createProvider(BMBLOBSTORAGE_USERDB)->isAvailable());
$tpl->assign('page', 'prefs.webdisk.common.tpl');
}
/**
* webdisk
*/
else if($_REQUEST['action'] == 'limits')
{
if(isset($_REQUEST['save']))
{
$forbiddenExtensionsArray = explode("\n", $_REQUEST['forbidden_extensions']);
foreach($forbiddenExtensionsArray as $key=>$val)
if(($val = trim($val)) != '')
$forbiddenExtensionsArray[$key] = ($val[0]!='.'?'.':'') . $val;
else
unset($forbiddenExtensionsArray[$key]);
$forbiddenExtensions = implode(':', $forbiddenExtensionsArray);
$forbiddenMIMETypesArray = explode("\n", $_REQUEST['forbidden_mimetypes']);
foreach($forbiddenMIMETypesArray as $key=>$val)
if(($val = trim($val)) != '')
$forbiddenMIMETypesArray[$key] = $val;
else
unset($forbiddenMIMETypesArray[$key]);
$forbiddenMIMETypes = implode(':', $forbiddenMIMETypesArray);
$db->Query('UPDATE {pre}prefs SET forbidden_extensions=?,forbidden_mimetypes=?',
$forbiddenExtensions,
$forbiddenMIMETypes);
ReadConfig();
}
$bm_prefs['forbidden_extensions'] = str_replace(':', "\n", $bm_prefs['forbidden_extensions']);
$bm_prefs['forbidden_mimetypes'] = str_replace(':', "\n", $bm_prefs['forbidden_mimetypes']);
$tpl->assign('page', 'prefs.webdisk.limits.tpl');
}
/**
* extensions
*/
else if($_REQUEST['action'] == 'extensions')
{
if(!isset($_REQUEST['do']))
$_REQUEST['do'] = 'list';
//
// list
//
if($_REQUEST['do'] == 'list')
{
// add
if(isset($_REQUEST['add']))
{
if(isset($_FILES['icon']) && $_FILES['icon']['error'] == 0 && $_FILES['icon']['size'] > 5)
{
$tempFileID = RequestTempFile(0);
$tempFileName = TempFileName($tempFileID);
if(move_uploaded_file($_FILES['icon']['tmp_name'], $tempFileName))
{
$iconData = base64_encode(getFileContents($tempFileName));
$db->Query('INSERT INTO {pre}extensions(ext,ctype,bild) VALUES(?,?,?)',
str_replace(array(' ', '.'), '', $_REQUEST['ext']),
$_FILES['icon']['type'],
$iconData);
}
ReleaseTempFile(0, $tempFileID);
}
}
// delete
if(isset($_REQUEST['delete']))
{
$db->Query('DELETE FROM {pre}extensions WHERE id=?',
(int)$_REQUEST['delete']);
}
// mass action
if(isset($_REQUEST['executeMassAction']))
{
// get extesion IDs
$extIDs = array();
foreach($_POST as $key=>$val)
if(substr($key, 0, 4) == 'ext_')
$extIDs[] = (int)substr($key, 4);
if(count($extIDs) > 0)
{
if($_REQUEST['massAction'] == 'delete')
{
// delete row
$db->Query('DELETE FROM {pre}extensions WHERE id IN(' . implode(',', $extIDs) . ')');
}
}
}
// fetch
$extensions = array();
$res = $db->Query('SELECT id,ext,ctype FROM {pre}extensions ORDER BY ext ASC');
while($row = $res->FetchArray(MYSQLI_ASSOC))
$extensions[$row['id']] = array(
'id' => $row['id'],
'ext' => $row['ext'],
'ctype' => $row['ctype']
);
$res->Free();
// assign
$tpl->assign('extensions', $extensions);
$tpl->assign('page', 'prefs.webdisk.extensions.tpl');
}
//
// edit
//
else if($_REQUEST['do'] == 'edit')
{
// save?
if(isset($_REQUEST['save']))
{
// modified ext?
if(isset($_REQUEST['ext']))
$db->Query('UPDATE {pre}extensions SET ext=? WHERE id=?',
str_replace(array(' ', '.'), '', $_REQUEST['ext']),
$_REQUEST['id']);
// new icon?
if(isset($_FILES['icon']) && $_FILES['icon']['error'] == 0 && $_FILES['icon']['size'] > 5)
{
$tempFileID = RequestTempFile(0);
$tempFileName = TempFileName($tempFileID);
if(move_uploaded_file($_FILES['icon']['tmp_name'], $tempFileName))
{
$iconData = base64_encode(getFileContents($tempFileName));
$db->Query('UPDATE {pre}extensions SET ctype=?,bild=? WHERE id=?',
$_FILES['icon']['type'],
$iconData,
$_REQUEST['id']);
}
ReleaseTempFile(0, $tempFileID);
}
header('Location: prefs.webdisk.php?action=extensions&sid=' . session_id());
exit();
}
// fetch
$res = $db->Query('SELECT id,ext FROM {pre}extensions WHERE id=?',
(int)$_REQUEST['id']);
assert('$res->RowCount() != 0');
$extension = $res->FetchArray(MYSQLI_ASSOC);
$res->Free();
// assign
$tpl->assign('extension', $extension);
$tpl->assign('page', 'prefs.webdisk.extensions.edit.tpl');
}
}
/**
* display extension
*/
else if($_REQUEST['action'] == 'displayExt'
&& isset($_REQUEST['id']))
{
$res = $db->Query('SELECT bild,ctype FROM {pre}extensions WHERE id=?',
(int)$_REQUEST['id']);
list($img, $ctype) = $res->FetchArray(MYSQLI_NUM);
$img = base64_decode($img);
header('Content-Type: ' . $ctype);
header('Content-Length: ' . strlen($img));
echo $img;
exit();
}
$tpl->assign('bm_prefs', $bm_prefs);
$tpl->assign('tabs', $tabs);
$tpl->assign('title', $lang_admin['prefs'] . ' &raquo; ' . $lang_admin['webdisk']);
$tpl->display('page.tpl');
?>

View file

@ -0,0 +1,146 @@
<?php
/*
* b1gMail
* Copyright (c) 2021 Patrick Schlangen et al
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
include('../serverlib/admin.inc.php');
RequestPrivileges(PRIVILEGES_ADMIN);
AdminRequirePrivilege('prefs.widgetlayouts');
if(!class_exists('BMDashboard'))
include(B1GMAIL_DIR . 'serverlib/dashboard.class.php');
function getWidgetArray($type, $widgetOrder)
{
global $plugins;
$widgetList = explode(',', str_replace(';', ',', $widgetOrder));
$tplWidgets = array();
$widgets = $plugins->getWidgetsSuitableFor($type);
foreach($widgets as $widget)
{
if(in_array($widget, $widgetList))
{
$tplWidgets[$widget] = array(
'title' => $plugins->getParam('widgetTitle', $widget)
);
}
}
return($tplWidgets);
}
if(!isset($_REQUEST['action']))
$_REQUEST['action'] = 'start';
$tabs = array(
0 => array(
'title' => $lang_admin['startwidgets'],
'relIcon' => 'start32.png',
'link' => 'prefs.widgetlayouts.php?',
'active' => $_REQUEST['action'] == 'start'
),
1 => array(
'title' => $lang_admin['organizerwidgets'],
'relIcon' => 'organizer32.png',
'link' => 'prefs.widgetlayouts.php?action=organizer&',
'active' => $_REQUEST['action'] == 'organizer'
)
);
if($_REQUEST['action'] == 'start')
{
$widgetType = BMWIDGET_START;
$orderKey = 'widget_order_start';
}
else if($_REQUEST['action'] == 'organizer')
{
$widgetType = BMWIDGET_ORGANIZER;
$orderKey = 'widget_order_organizer';
}
else
die('Invalid action');
$dashboard = _new('BMDashboard', array($widgetType));
//
// overview
//
if(!isset($_REQUEST['do']))
{
// save order?
if(isset($_REQUEST['saveOrder'])
&& isset($_REQUEST['order']))
{
$widgetOrder = trim($_REQUEST['order']);
if($dashboard->checkWidgetOrder($widgetOrder))
{
$db->Query('UPDATE {pre}prefs SET ' . $orderKey . '=?',
$widgetOrder);
$bm_prefs[$orderKey] = $widgetOrder;
}
}
// reset order?
if(isset($_REQUEST['resetOrder'])
&& isset($_REQUEST['groups'])
&& is_array($_REQUEST['groups']))
{
$db->Query('UPDATE {pre}userprefs SET `value`=? WHERE `key`=? AND `userid` IN (SELECT `id` FROM {pre}users WHERE `gruppe` IN ?)',
$bm_prefs[$orderKey],
$orderKey == 'widget_order_start' ? 'widgetOrderStart' : 'widgetOrderOrganizer',
$_REQUEST['groups']);
}
$widgetOrder = $bm_prefs[$orderKey];
$widgets = getWidgetArray($widgetType, $widgetOrder);
$tpl->assign('groups', BMGroup::GetSimpleGroupList());
$tpl->assign('widgetOrder', $widgetOrder);
$tpl->assign('widgets', $widgets);
$tpl->assign('page', 'prefs.widgetlayouts.layout.tpl');
}
//
// add/remove
//
else if($_REQUEST['do'] == 'addremove')
{
$widgetOrder = $bm_prefs[$orderKey];
// save?
if(isset($_REQUEST['save']))
{
$widgetOrder = $dashboard->generateOrderStringFromPostForm($widgetOrder);
$db->Query('UPDATE {pre}prefs SET ' . $orderKey . '=?',
$widgetOrder);
header('Location: prefs.widgetlayouts.php?action=' . $_REQUEST['action'] . '&sid=' . session_id());
exit();
}
$tpl->assign('possibleWidgets', $dashboard->getPossibleWidgets($widgetOrder));
$tpl->assign('page', 'prefs.widgetlayouts.addremove.tpl');
}
$tpl->assign('action', $_REQUEST['action']);
$tpl->assign('tabs', $tabs);
$tpl->assign('title', $lang_admin['prefs'] . ' &raquo; ' . $lang_admin['widgetlayouts']);
$tpl->display('page.tpl');
?>

230
src/admin/stats.php Normal file
View file

@ -0,0 +1,230 @@
<?php
/*
* b1gMail
* Copyright (c) 2021 Patrick Schlangen et al
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
include('../serverlib/admin.inc.php');
include('../serverlib/barchart.class.php');
include('../serverlib/chart.class.php');
RequestPrivileges(PRIVILEGES_ADMIN);
AdminRequirePrivilege('stats');
if(!isset($_REQUEST['action']))
$_REQUEST['action'] = 'common';
$tabs = array(
0 => array(
'title' => $lang_admin['commonstats'],
'relIcon' => 'stats32.png',
'link' => 'stats.php?',
'active' => $_REQUEST['action'] == 'common'
),
1 => array(
'title' => $lang_admin['emailstats'],
'relIcon' => 'ico_email.png',
'link' => 'stats.php?action=email&',
'active' => $_REQUEST['action'] == 'email'
),
2 => array(
'title' => $lang_admin['spaceusage'],
'relIcon' => 'ico_data.png',
'link' => 'stats.php?action=usage&',
'active' => $_REQUEST['action'] == 'usage'
)
);
/**
* common-/email-stats - basically the same, but seperated for the user
*/
if($_REQUEST['action'] == 'common'
|| $_REQUEST['action'] == 'email')
{
// show chart?
if(isset($_REQUEST['do']) && $_REQUEST['do']=='showChart'
&& isset($_REQUEST['statType']) && isset($_REQUEST['time']))
{
$statTypeItem = $_REQUEST['statType'];
$time = (int)$_REQUEST['time'];
$rawData = GetStatData($statTypeItem, $time);
$data = array();
foreach($rawData as $key=>$val)
$data[$key] = array_pop($val);
$chart = new BMChart(sprintf('%s (%d/%d)', $lang_admin['stat_'.$statTypeItem], date('m', $time), date('Y', $time)),
520,
280);
$chart->SetData($data);
$chart->Display();
exit();
}
// time?
if(!isset($_REQUEST['timeMonth']))
$time = mktime(0, 0, 0, date('m'), 1, date('Y'));
else
$time = mktime(0, 0, 0, $_REQUEST['timeMonth'], 1, $_REQUEST['timeYear']);
// common stats
if($_REQUEST['action'] == 'common')
{
$mode = 'common';
$statTypes = array('login', 'signup', 'sms', 'wd');
}
// email stats
else
{
$mode = 'email';
$statTypes = array('receive', 'send', 'sysmail');
}
// stat type
$statType = isset($_REQUEST['statType'])
? $_REQUEST['statType']
: $statTypes[0];
// special types
$statsSpecial = array(
'login' => array('login', 'mobile_login'),
'send' => array('send', 'send_intern', 'send_extern'),
'wd' => array('wd_down', 'wd_up'),
'receive' => array('receive', 'infected', 'spam')
);
if(isset($statsSpecial[$statType]))
$statTypeList = $statsSpecial[$statType];
else
$statTypeList = array($statType);
// build stats
$stats = array();
foreach($statTypeList as $statTypeItem)
{
$statData = GetStatData($statTypeItem, $time);
$maxVal = $sum = 0;
foreach($statData as $val)
{
if($val[$statTypeItem] > $maxVal)
$maxVal = $val[$statTypeItem];
$sum += $val[$statTypeItem];
}
if($maxVal%10 != 0)
$maxVal += (10-$maxVal%10);
$heights = array();
foreach($statData as $day=>$val)
{
$theVal = $val[$statTypeItem];
if($maxVal <= 0)
$heights[$day] = 0;
else
$heights[$day] = round(($theVal/$maxVal)*240, 0);
}
$yScale = array();
for($i=10; $i>0; $i--)
{
$scale = $maxVal == 0 ? '' : round($maxVal*$i/10, 1);
$yScale[$i] = $scale;
}
$stats[] = array(
'title' => sprintf('%s (%d/%d)', $lang_admin['stat_'.$statTypeItem], date('m', $time), date('Y', $time)),
'key' => $statTypeItem,
'maxVal' => $maxVal,
'yScale' => $yScale,
'heights' => $heights,
'data' => $statData,
'count' => count($statData),
'sum' => $sum
);
}
// assign
$tpl->assign('stats', $stats);
$tpl->assign('time', $time);
$tpl->assign('modeTitle', $lang_admin[$mode.'stats']);
$tpl->assign('statType', $statType);
$tpl->assign('statTypes', $statTypes);
$tpl->assign('mode', $mode);
$tpl->assign('page', 'stats.view.tpl');
}
/**
* space usage
*/
else if($_REQUEST['action'] == 'usage')
{
// get data
$byCategory = GetCategorizedSpaceUsage();
$byGroup = GetGroupSpaceUsage();
// get user count
$res = $db->Query('SELECT COUNT(*) FROM {pre}users');
list($userCount) = $res->FetchArray(MYSQLI_NUM);
$res->Free();
// image output?
if(isset($_REQUEST['do']) && $_REQUEST['do'] == 'showSpaceByCategory')
{
$data = array();
foreach($byCategory as $key=>$val)
$data[$lang_admin[$key]] = $val;
$chart = _new('BMBarChart', array($lang_admin['usagebycategory'], 500, 90));
$chart->SetData($data);
$chart->Display();
exit();
}
else if(isset($_REQUEST['do']) && $_REQUEST['do'] == 'showSpaceByGroup')
{
$data = array();
foreach($byGroup as $val)
$data[$val['title']] = $val['size'];
$chart = _new('BMBarChart', array($lang_admin['usagebygroup'], 500, 90));
$chart->SetData($data);
$chart->Display();
exit();
}
else if(isset($_REQUEST['do']) && $_REQUEST['do'] == 'showSpaceAverageByGroup')
{
$data = array();
foreach($byGroup as $val)
$data[$val['title']] = (int)round($val['size']/max(1, $val['users']), 0);
$chart = _new('BMBarChart', array($lang_admin['usagebygroup'] . ' (' . $lang_admin['useraverage'] . ')', 500, 90));
$chart->SetData($data);
$chart->Display();
exit();
}
// assign
$tpl->assign('userCount', $userCount);
$tpl->assign('byCategory', $byCategory);
$tpl->assign('byGroup', $byGroup);
$tpl->assign('page', 'stats.usage.tpl');
}
$tpl->assign('tabs', $tabs);
$tpl->assign('title', $lang_admin['tools'] . ' &raquo; ' . $lang_admin['stats']);
$tpl->display('page.tpl');
?>

View file

@ -0,0 +1,22 @@
<p align="center">
<img src="{$tpldir}images/about_logo.png" width="242" height="171" border="0" alt="" />
</p>
<p align="center">
<br />
<b>b1gMail</b><br />
<i>
{lng p="version"} {$version}
</i>
</p>
<p align="center">
Copyright &copy; 2002-2021 Patrick Schlangen, 2022 <a target="_blank" href="https://www.b1gmail.eu" rel="noreferrer">b1gMail.eu Project</a>
</p>
<p align="center">
<small>
{lng p="acpiconsfrom"} <a href="http://www.fatcow.com/free-icons" target="_blank" rel="noreferrer">FatCow Web Hosting</a><br />
{lng p="acpbgfrom"} <a href="http://subtlepatterns.com" target="_blank" rel="noreferrer">subtlepatterns.com</a>
</small>
</p>

View file

@ -0,0 +1,76 @@
<form action="abuse.php?sid={$sid}" method="post" onsubmit="spin(this)" name="f1">
<input type="hidden" name="page" id="page" value="{$pageNo}" />
<input type="hidden" name="sortBy" id="sortBy" value="{$sortBy}" />
<input type="hidden" name="sortOrder" id="sortOrder" value="{$sortOrder}" />
<input type="hidden" name="singleAction" id="singleAction" value="" />
<input type="hidden" name="singleID" id="singleID" value="" />
<fieldset>
<legend>{lng p="users"}</legend>
<table class="list">
<tr>
<th width="20">&nbsp;</th>
<th width="25" style="text-align:center;"><a href="javascript:invertSelection(document.forms.f1,'users[]');"><img src="{$tpldir}images/dot.png" border="0" alt="" width="10" height="8" /></a></th>
<th width="60"><a href="javascript:updateSort('id');">{lng p="id"}
{if $sortBy=='id'}<img src="{$tpldir}images/sort_{$sortOrder}.png" border="0" alt="" width="7" height="6" align="absmiddle" />{/if}</a></th>
<th><a href="javascript:updateSort('email');">{lng p="email"}
{if $sortBy=='email'}<img src="{$tpldir}images/sort_{$sortOrder}.png" border="0" alt="" width="7" height="6" align="absmiddle" />{/if}</a></th>
<th width="80"><a href="javascript:updateSort('pointsum');">{lng p="points"}
{if $sortBy=='pointsum'}<img src="{$tpldir}images/sort_{$sortOrder}.png" border="0" alt="" width="7" height="6" align="absmiddle" />{/if}</a></th>
<th width="120">&nbsp;</th>
</tr>
{foreach from=$users item=user}
{cycle name=class values="td1,td2" assign=class}
<tr class="{$class}">
<td align="center"><img src="{$tpldir}images/user_{$user.statusImg}.png" border="0" width="16" height="16" alt="" /></td>
<td align="center"><input type="checkbox" name="users[]" value="{$user.id}" /></td>
<td>{$user.id}</td>
<td><a href="abuse.php?do=show&userid={$user.id}&sid={$sid}">{email value=$user.email cut=30}</a></td>
<td><img src="templates/images/indicator_{$user.indicator}.png" border="0" alt="" align="absmiddle" />
<a href="abuse.php?do=show&userid={$user.id}&sid={$sid}">
{$user.pointsum}
</a></td>
<td>
<a href="abuse.php?do=show&userid={$user.id}&sid={$sid}" title="{lng p="show"}"><img src="{$tpldir}images/view.png" border="0" alt="{lng p="show"}" width="16" height="16" /></a>
<a href="users.php?do=edit&id={$user.id}&sid={$sid}"><img src="{$tpldir}images/edit.png" border="0" alt="{lng p="edit"}" width="16" height="16" /></a>
<a href="javascript:singleAction('{if $user.gesperrt=='no'}lock{elseif $user.gesperrt=='yes'}unlock{elseif $user.gesperrt=='locked'}activate{elseif $user.gesperrt=='delete'}recover{/if}', '{$user.id}');"><img src="{$tpldir}images/{if $user.gesperrt=='no'}lock{elseif $user.gesperrt=='yes'}unlock{elseif $user.gesperrt=='locked'}unlock{elseif $user.gesperrt=='delete'}recover{/if}.png" border="0" alt="{if $user.gesperrt=='no'}{lng p="lock"}{elseif $user.gesperrt=='yes'}{lng p="unlock"}{elseif $user.gesperrt=='locked'}{lng p="activate"}{elseif $user.gesperrt=='delete'}{lng p="recover"}{/if}" width="16" height="16" /></a>
<a href="javascript:singleAction('delete', '{$user.id}');"><img src="{$tpldir}images/{if $user.gesperrt=='delete'}delete{else}trash{/if}.png" border="0" alt="{lng p="delete"}" width="16" height="16" /></a>
<a href="users.php?do=login&id={$user.id}&sid={$sid}" target="_blank" onclick="return confirm('{lng p="loginwarning"}');"><img src="{$tpldir}images/login.png" border="0" alt="{lng p="login"}" width="16" height="16" /></a>
</td>
</tr>
{/foreach}
<tr>
<td class="footer" colspan="6">
<div style="float:left;">
{lng p="action"}: <select name="massAction" class="smallInput">
<option value="-">------------</option>
<optgroup label="{lng p="actions"}">
<option value="delete">{lng p="delete"}</option>
<option value="lock">{lng p="lock"}</option>
<option value="unlock">{lng p="unlock"}</option>
<option value="restore">{lng p="restore"}</option>
<!--<option value="mail">{lng p="sendmail"}</option>-->
</optgroup>
<optgroup label="{lng p="move"}">
{foreach from=$groups item=group key=groupID}
<option value="moveto_{$groupID}">{lng p="moveto"} &quot;{text value=$group.title cut=25}&quot;</option>
{/foreach}
</optgroup>
</select>&nbsp;
</div>
<div style="float:left;">
<input type="submit" name="executeMassAction" value=" {lng p="execute"} " class="smallInput" />
</div>
<div style="float:right;padding-top:3px;">
{lng p="pages"}: {pageNav page=$pageNo pages=$pageCount on=" <span class=\"pageNav\"><b>[.t]</b></span> " off=" <span class=\"pageNav\"><a href=\"javascript:updatePage(.s);\">.t</a></span> "}&nbsp;
</div>
</td>
</tr>
</table>
</fieldset>
</form>

View file

@ -0,0 +1,63 @@
<form action="abuse.php?action=prefs&do=save&sid={$sid}" method="post" onsubmit="spin(this)">
<input type="hidden" name="save" value="true" />
<fieldset>
<legend>{lng p="common"}</legend>
</fieldset>
{foreach from=$configGroups key=groupName item=group}
<fieldset>
<legend>{$group.title}</legend>
<img src="{$tpldir}images/{if $group.icon}{$group.icon}{else}ico_prefs_common{/if}.png" border="0" alt="" width="32" height="32" style="float:left;" />
<table style="float:left;margin-left:1em;width:80%;">
{foreach from=$group.options key=fieldKey item=fieldInfo}
<tr>
<td class="td1" width="180">{$fieldInfo.title}</td>
<td class="td2">
{if $fieldInfo.type==64}
<p>
<table>
<tr>
<td><input type="radio" name="prefs[{$groupName}][{$fieldKey}][mode]" value="keep" checked="checked" id="keepRadio_{$groupName}_{$fieldKey}" /></td>
<td><label for="keepRadio_{$groupName}_{$fieldKey}">{lng p="keepcurrentimg"}</label> &nbsp;
<small>[ <a href="toolbox.php?do=editVersionConfig&versionid={$versionID}&showImage=true&group={$groupName}&key={$fieldKey}&sid={$sid}" target="_blank">{lng p="show"}</a> ]</small></td>
</tr>
<tr>
<td><input type="radio" name="prefs[{$groupName}][{$fieldKey}][mode]" value="upload" id="uploadRadio_{$groupName}_{$fieldKey}" /></td>
<td><label for="uploadRadio_{$groupName}_{$fieldKey}"><input type="file" name="prefs[{$groupName}][{$fieldKey}][file]" /></label>
<small>PNG, {$fieldInfo.imgSize} px</small></td>
</tr>
</table>
</p>
{elseif $fieldInfo.type==16}
<textarea style="width:100%;height:80px;" name="prefs[{$groupName}][{$fieldKey}]">{text value=$fieldInfo.value allowEmpty=true}</textarea></td>
{elseif $fieldInfo.type==8}
{foreach from=$fieldInfo.options item=optionValue key=optionKey}
<input type="radio" name="prefs[{$groupName}][{$fieldKey}]" id="{$fieldKey}_{$optionKey}" value="{$optionKey}"{if $fieldInfo.value==$optionKey} checked="checked"{/if} />
<label for="{$fieldKey}_{$optionKey}">{text value=$optionValue}</label>
{/foreach}
{elseif $fieldInfo.type==4}
<select name="prefs[{$groupName}][{$fieldKey}]">
{foreach from=$fieldInfo.options item=optionValue key=optionKey}
<option value="{$optionKey}"{if $fieldInfo.value==$optionKey} selected="selected"{/if}>{text value=$optionValue}</option>
{/foreach}
</select>
{elseif $fieldInfo.type==2}
<input type="checkbox" name="prefs[{$groupName}][{$fieldKey}]" value="1"{if $fieldInfo.value} checked="checked"{/if} />
{elseif $fieldInfo.type==1}
<input type="text" style="width:85%;" name="prefs[{$groupName}][{$fieldKey}]" value="{text value=$fieldInfo.value allowEmpty=true}" />
{/if}
</td>
</tr>
{/foreach}
</table>
</fieldset>
{/foreach}
<p>
<div style="float:right;" class="buttons">
<input class="button" type="submit" value=" {lng p="save"} " />
</div>
</p>
</form>

View file

@ -0,0 +1,212 @@
<fieldset>
<legend>{lng p="user"}: {email value=$userRow.email}</legend>
<form action="abuse.php?do=show&userid={$userID}&sid={$sid}" method="post">
<table width="100%">
<tr>
<td class="td1">{lng p="status"}:</td>
<td class="td2"><img src="{$tpldir}images/user_{$userStatusImg}.png" border="0" width="16" height="16" alt="" align="absmiddle" />
{if $userRow.gesperrt=='no'}{lng p="active"}
{elseif $userRow.gesperrt=='yes'}{lng p="locked"}
{elseif $userRow.gesperrt=='locked'}{lng p="notactivated"}
{elseif $userRow.gesperrt=='delete'}{lng p="deleted"}{/if}
</td>
<td class="td1">{lng p="group"}:</td>
<td class="td2"><img src="{$tpldir}images/ico_group.png" border="0" width="16" height="16" alt="" align="absmiddle" />
<a href="groups.php?do=edit&id={$groupRow.id}&sid={$sid}">{text value=$groupRow.titel}</a></td>
</tr>
<tr>
<td class="td1">{lng p="email"}:</td>
<td class="td2">
<small>{$emailMails} {lng p="emails"}, {$emailFolders} {lng p="folders"}</small>
{progressBar value=$userRow.mailspace_used max=$groupRow.storage width=200}
<small>{size bytes=$userRow.mailspace_used} / {size bytes=$groupRow.storage} {lng p="used"}</small>
</td>
<td class="td1">{lng p="receivedmails"}:<br />{lng p="sentmails"}:</td>
<td class="td2">{$userRow.received_mails}<br />{$userRow.sent_mails}</td>
</tr>
<tr>
<td class="td1" width="120">{lng p="webdisk"}:</td>
<td class="td2">
<small>{$diskFiles} {lng p="files"}, {$diskFolders} {lng p="folders"}</small>
{progressBar value=$userRow.diskspace_used max=$groupRow.webdisk width=200}
<small>{size bytes=$userRow.diskspace_used} / {size bytes=$groupRow.webdisk} {lng p="used"}</small>
</td>
<td class="td1" width="120">{lng p="wdtraffic"}:</td>
<td class="td2">
{if $groupRow.traffic>0}{progressBar value=$userRow.traffic_down+$userRow.traffic_up max=$groupRow.traffic width=200}{/if}
<small>{size bytes=$userRow.traffic_down+$userRow.traffic_up}{if $groupRow.traffic>0} / {size bytes=$groupRow.traffic}{/if} {lng p="used2"}</small>
</td>
</tr>
{if $groupRow.sms_monat>0}
<tr>
<td class="td1">{lng p="monthasset"}:</td>
<td class="td2">
{progressBar value=$usedMonthSMS max=$groupRow.sms_monat width=200}
<small>{$usedMonthSMS} / {$groupRow.sms_monat} {lng p="credits"} {lng p="used2"}</small>
</td>
<td colspan="2"></td>
</tr>
{/if}
<tr>
<td class="td1">{lng p="lastlogin"}:</td>
<td class="td2">{date timestamp=$userRow.lastlogin nice=true nozero=true}</td>
<td class="td1">{lng p="ip"}:</td>
<td class="td2">{text value=$userRow.ip}</td>
</tr>
<tr>
<td class="td1">{lng p="regdate"}:</td>
<td class="td2">{date timestamp=$userRow.reg_date nice=true nozero=true}</td>
<td class="td1">{lng p="ip"}:</td>
<td class="td2">{text value=$userRow.reg_ip}</td>
</tr>
<tr>
<td class="td1">{lng p="lastpop3"}:</td>
<td class="td2">{date timestamp=$userRow.last_pop3 nice=true nozero=true}</td>
<td class="td1">{lng p="lastsmtp"}:</td>
<td class="td2">{date timestamp=$userRow.last_smtp nice=true nozero=true}</td>
</tr>
<tr>
<td class="td1">{lng p="lastimap"}:</td>
<td class="td2">{date timestamp=$userRow.last_imap nice=true nozero=true}</td>
<td colspan="2"></td>
</tr>
<tr>
<td class="td1">{lng p="notes"}:</td>
<td class="td2" colspan="3">
<textarea style="width:100%;height:80px;" name="notes">{text value=$userRow.notes allowEmpty=true}</textarea>
</td>
</tr>
</table>
<div align="center" style="margin-top:0.5em;">
<button class="button" type="submit" name="save"><img src="{$tpldir}images/ico_save.png" align="absmiddle" border="0" alt="" width="16" height="16" />
{lng p="save"}</button>
<button class="button" onclick="document.location.href='users.php?do=edit&id={$userID}&sid={$sid}';return(false);"><img src="{$tpldir}images/user_action.png" align="absmiddle" border="0" alt="" width="16" height="16" />
{lng p="profile"}</button>
<button class="button" onclick="window.singleAction('{if $userRow.gesperrt=='no'}lock{elseif $userRow.gesperrt=='yes'}unlock{elseif $userRow.gesperrt=='locked'}activate{elseif $userRow.gesperrt=='delete'}recover{/if}User', '{$userRow.id}');return(false);"><img src="{$tpldir}images/{if $userRow.gesperrt=='no'}lock{elseif $userRow.gesperrt=='yes'}unlock{elseif $userRow.gesperrt=='locked'}unlock{elseif $userRow.gesperrt=='delete'}recover{/if}.png" align="absmiddle" border="0" alt="" width="16" height="16" />
{if $userRow.gesperrt=='no'}{lng p="lock"}{elseif $userRow.gesperrt=='yes'}{lng p="unlock"}{elseif $userRow.gesperrt=='locked'}{lng p="activate"}{elseif $userRow.gesperrt=='delete'}{lng p="recover"}{/if}</button>
<button class="button" onclick="window.singleAction('deleteUser', '{$userRow.id}');return(false);"><img src="{$tpldir}images/{if $userRow.gesperrt=='delete'}delete{else}trash{/if}.png" align="absmiddle" border="0" alt="" width="16" height="16" />
{lng p="delete"}</button>
<button class="button" onclick="if(confirm('{lng p="loginwarning"}')) window.open('users.php?do=login&id={$userID}&sid={$sid}');return(false);"><img src="{$tpldir}images/login.png" align="absmiddle" border="0" alt="" width="16" height="16" />
{lng p="login"}</button>
</div>
</form>
</fieldset>
{if $sendStats}
<fieldset class="collapsed">
<legend><a href="javascript:;" onclick="toggleFieldset(this)">{lng p="sendstats"}</a> ({lng p="last7d"})</legend>
<div class="content">
<table class="list" id="sendStatsTable">
<tr>
<th>{lng p="timeframe"}</th>
<th width="20%">{lng p="mails"}</th>
<th width="20%">&sum; {lng p="recipients"}</th>
</tr>
{foreach from=$sendStats item=stat}
{cycle name=class values="td1,td2" assign=class}
<tr class="{$class}" data-time-stamp="{$stat.timeStamp}">
<td><i class="fa fa-chevron-right" style="font-size:10px;" id="sendStats_{$stat.timeStamp}_chevron"></i>
<a href="javascript:void(0);" onclick="expandStatsDay('send', {$userID}, {$stat.timeStamp});">
{date timestamp=$stat.timeStamp dayonly=true}
</a></td>
<td>{$stat.mails}</td>
<td>{$stat.recipients}</td>
</tr>
<tbody id="sendStats_{$stat.timeStamp}" style="display:none;"></tbody>
{/foreach}
</table>
</div>
</fieldset>
{/if}
{if $recvStats}
<fieldset class="collapsed">
<legend><a href="javascript:;" onclick="toggleFieldset(this)">{lng p="recvstats"}</a> ({lng p="last7d"})</legend>
<div class="content">
<table class="list" id="sendStatsTable">
<tr>
<th>{lng p="timeframe"}</th>
<th width="20%">{lng p="mails"}</th>
<th width="20%">&sum; {lng p="size"}</th>
</tr>
{foreach from=$recvStats item=stat}
{cycle name=class values="td1,td2" assign=class}
<tr class="{$class}" data-time-stamp="{$stat.timeStamp}">
<td><i class="fa fa-chevron-right" style="font-size:10px;" id="recvStats_{$stat.timeStamp}_chevron"></i>
<a href="javascript:void(0);" onclick="expandStatsDay('recv', {$userID}, {$stat.timeStamp});">
{date timestamp=$stat.timeStamp dayonly=true}
</a></td>
<td>{$stat.mails}</td>
<td>{size bytes=$stat.size}</td>
</tr>
<tbody id="recvStats_{$stat.timeStamp}" style="display:none;"></tbody>
{/foreach}
</table>
</div>
</fieldset>
{/if}
<form action="abuse.php?do=show&userid={$userID}&sid={$sid}" method="post" onsubmit="spin(this)" name="f1">
<input type="hidden" name="page" id="page" value="{$pageNo}" />
<input type="hidden" name="singleAction" id="singleAction" value="" />
<input type="hidden" name="singleID" id="singleID" value="" />
<fieldset>
<legend>{lng p="points"}</legend>
<table class="list">
<tr>
<th width="22">&nbsp;</th>
<th width="25" style="text-align:center;"><a href="javascript:invertSelection(document.forms.f1,'entries[]');"><img src="{$tpldir}images/dot.png" border="0" alt="" width="10" height="8" /></a></th>
<th width="80">{lng p="points"}</th>
<th>{lng p="type"}</th>
<th>{lng p="comment"}</th>
<th width="150">{lng p="date"}
<img src="{$tpldir}images/sort_desc.png" border="0" alt="" width="7" height="6" align="absmiddle" /></th>
<th width="80">{lng p="sum"}</th>
<th width="32">&nbsp;</th>
</tr>
{foreach from=$points item=entry}
{cycle name=class values="td1,td2" assign=class}
<tr class="{$class}"{if $entry.expired} style="text-decoration:line-through;"{/if}>
<td align="center"><img src="{$tpldir}images/indicator_{$entry.indicator}.png" border="0" width="16" height="16" alt="" /></td>
<td align="center"><input type="checkbox" name="entries[]" value="{$entry.entryid}" /></td>
<td>{$entry.points}</td>
<td>{$entry.typeText}</td>
<td>{text value=$entry.comment}</td>
<td>{date timestamp=$entry.date nice=true}</td>
<td>{$entry.sum}</td>
<td>
<a href="javascript:singleAction('delete', '{$entry.entryid}');" title="{lng p="delete"}"><img src="{$tpldir}images/delete.png" border="0" alt="{lng p="delete"}" width="16" height="16" /></a>
</td>
</tr>
{/foreach}
<tr>
<td class="footer" colspan="8">
<div style="float:left;">
{lng p="action"}: <select name="massAction" class="smallInput">
<option value="-">------------</option>
<optgroup label="{lng p="actions"}">
<option value="delete">{lng p="delete"}</option>
</optgroup>
</select>&nbsp;
</div>
<div style="float:left;">
<input type="submit" name="executeMassAction" value=" {lng p="execute"} " class="smallInput" />
</div>
<div style="float:right;padding-top:3px;">
{lng p="pages"}: {pageNav page=$pageNo pages=$pageCount on=" <span class=\"pageNav\"><b>[.t]</b></span> " off=" <span class=\"pageNav\"><a href=\"javascript:updatePage(.s);\">.t</a></span> "}&nbsp;
</div>
</td>
</tr>
</table>
</fieldset>
</form>

View file

@ -0,0 +1,85 @@
<form action="activity.php?sid={$sid}" method="post" onsubmit="spin(this)" name="f1">
<input type="hidden" name="page" id="page" value="{$pageNo}" />
<input type="hidden" name="sortBy" id="sortBy" value="{$sortBy}" />
<input type="hidden" name="sortOrder" id="sortOrder" value="{$sortOrder}" />
<input type="hidden" name="singleAction" id="singleAction" value="" />
<input type="hidden" name="singleID" id="singleID" value="" />
<fieldset>
<legend>{lng p="users"}</legend>
<table class="list">
<tr>
<th width="20">&nbsp;</th>
<th width="25" style="text-align:center;"><a href="javascript:invertSelection(document.forms.f1,'user_');"><img src="{$tpldir}images/dot.png" border="0" alt="" width="10" height="8" /></a></th>
<th><a href="javascript:updateSort('id');">{lng p="id"}
{if $sortBy=='id'}<img src="{$tpldir}images/sort_{$sortOrder}.png" border="0" alt="" width="7" height="6" align="absmiddle" />{/if}</a></th>
<th><a href="javascript:updateSort('email');">{lng p="email"}
{if $sortBy=='email'}<img src="{$tpldir}images/sort_{$sortOrder}.png" border="0" alt="" width="7" height="6" align="absmiddle" />{/if}</a></th>
<th width="80"><a href="javascript:updateSort('mailspace_used');">{lng p="email"}
{if $sortBy=='mailspace_used'}<img src="{$tpldir}images/sort_{$sortOrder}.png" border="0" alt="" width="7" height="6" align="absmiddle" />{/if}</a></th>
<th width="80"><a href="javascript:updateSort('diskspace_used');">{lng p="webdisk"}
{if $sortBy=='diskspace_used'}<img src="{$tpldir}images/sort_{$sortOrder}.png" border="0" alt="" width="7" height="6" align="absmiddle" />{/if}</a></th>
<th width="80"><a href="javascript:updateSort('traffic');">{lng p="wdtrafficshort"}
{if $sortBy=='traffic'}<img src="{$tpldir}images/sort_{$sortOrder}.png" border="0" alt="" width="7" height="6" align="absmiddle" />{/if}</a></th>
<th width="80"><a href="javascript:updateSort('received_mails');">{lng p="receivedmails"}
{if $sortBy=='received_mails'}<img src="{$tpldir}images/sort_{$sortOrder}.png" border="0" alt="" width="7" height="6" align="absmiddle" />{/if}</a></th>
<th width="80"><a href="javascript:updateSort('sent_mails');">{lng p="sentmails"}
{if $sortBy=='sent_mails'}<img src="{$tpldir}images/sort_{$sortOrder}.png" border="0" alt="" width="7" height="6" align="absmiddle" />{/if}</a></th>
<th width="110">&nbsp;</th>
</tr>
{foreach from=$users item=user}
{cycle name=class values="td1,td2" assign=class}
<tr class="{$class}">
<td align="center"><img src="{$tpldir}images/user_{$user.statusImg}.png" border="0" width="16" height="16" alt="" /></td>
<td align="center"><input type="checkbox" name="user_{$user.id}" /></td>
<td>{$user.id}</td>
<td><a href="users.php?do=edit&id={$user.id}&sid={$sid}">{email value=$user.email cut=30}</a></td>
<td>{progressBar value=$user.mailspace_used max=$user.mailspace_max width=75}</td>
<td>{progressBar value=$user.diskspace_used max=$user.diskspace_max width=75}</td>
<td>{progressBar value=$user.traffic max=$user.traffic_max width=75}</td>
<td>{$user.received_mails}</td>
<td>{$user.sent_mails}</td>
<td>
<a href="users.php?do=edit&id={$user.id}&sid={$sid}"><img src="{$tpldir}images/edit.png" border="0" alt="{lng p="edit"}" width="16" height="16" /></a>
<a href="javascript:singleAction('{if $user.gesperrt=='no'}lock{elseif $user.gesperrt=='yes'}unlock{elseif $user.gesperrt=='locked'}activate{elseif $user.gesperrt=='delete'}recover{/if}', '{$user.id}');"><img src="{$tpldir}images/{if $user.gesperrt=='no'}lock{elseif $user.gesperrt=='yes'}unlock{elseif $user.gesperrt=='locked'}unlock{elseif $user.gesperrt=='delete'}recover{/if}.png" border="0" alt="{if $user.gesperrt=='no'}{lng p="lock"}{elseif $user.gesperrt=='yes'}{lng p="unlock"}{elseif $user.gesperrt=='locked'}{lng p="activate"}{elseif $user.gesperrt=='delete'}{lng p="recover"}{/if}" width="16" height="16" /></a>
<a href="javascript:singleAction('delete', '{$user.id}');"><img src="{$tpldir}images/{if $user.gesperrt=='delete'}delete{else}trash{/if}.png" border="0" alt="{lng p="delete"}" width="16" height="16" /></a>
<!--<a href="javascript:singleAction('mail', '{$user.id}');"><img src="{$tpldir}images/ico_sendmail.png" border="0" alt="{lng p="sendmail"}" width="16" height="16" /></a>-->
<a href="users.php?do=login&id={$user.id}&sid={$sid}" target="_blank" onclick="return confirm('{lng p="loginwarning"}');"><img src="{$tpldir}images/login.png" border="0" alt="{lng p="login"}" width="16" height="16" /></a>
</td>
</tr>
{/foreach}
<tr>
<td class="footer" colspan="10">
<div style="float:left;">
{lng p="action"}: <select name="massAction" class="smallInput">
<option value="-">------------</option>
<optgroup label="{lng p="actions"}">
<option value="delete">{lng p="delete"}</option>
<option value="lock">{lng p="lock"}</option>
<option value="unlock">{lng p="unlock"}</option>
<option value="restore">{lng p="restore"}</option>
<!--<option value="mail">{lng p="sendmail"}</option>-->
</optgroup>
<optgroup label="{lng p="move"}">
{foreach from=$groups item=group key=groupID}
<option value="moveto_{$groupID}">{lng p="moveto"} &quot;{text value=$group.title cut=25}&quot;</option>
{/foreach}
</optgroup>
</select>&nbsp;
</div>
<div style="float:left;">
<input type="submit" name="executeMassAction" value=" {lng p="execute"} " class="smallInput" />
</div>
<div style="float:right;padding-top:3px;">
{lng p="pages"}: {pageNav page=$pageNo pages=$pageCount on=" <span class=\"pageNav\"><b>[.t]</b></span> " off=" <span class=\"pageNav\"><a href=\"javascript:updatePage(.s);\">.t</a></span> "}&nbsp;
</div>
</td>
</tr>
</table>
</fieldset>
</form>

View file

@ -0,0 +1,44 @@
<form action="admins.php?changePassword=true&sid={$sid}" method="post" onsubmit="spin(this)" autocomplete="off">
<fieldset>
<legend>{lng p="loggedinas"}</legend>
<table>
<tr>
<td width="40" valign="top" rowspan="3"><img src="{$tpldir}images/ico_users.png" border="0" alt="" width="32" height="32" /></td>
<td class="td1" width="220">{lng p="username"}:</td>
<td class="td2">{text value=$adminRow.username}</td>
</tr>
<tr>
<td class="td1">{lng p="name"}:</td>
<td class="td2">{text value=$adminRow.firstname}
{text value=$adminRow.lastname}</td>
</tr>
<tr>
<td class="td1">{lng p="status"}:</td>
<td class="td2">{if $adminRow.type==0}{lng p="superadmin"}{else}{lng p="admin"}{/if}</td>
</tr>
</table>
</fieldset>
<fieldset>
<legend>{lng p="password"}</legend>
<table>
<tr>
<td width="40" valign="top" rowspan="2"><img src="{$tpldir}images/ico_prefs_login.png" border="0" alt="" width="32" height="32" /></td>
<td class="td1" width="220">{lng p="newpassword"}:</td>
<td class="td2"><input type="password" name="newpw1" size="36" /></td>
</tr>
<tr>
<td class="td1">{lng p="newpassword"} ({lng p="repeat"}):</td>
<td class="td2"><input type="password" name="newpw2" size="36" /></td>
</tr>
</table>
</fieldset>
<p>
<div style="float:right" class="buttons">
<input class="button" type="submit" value=" {lng p="save"} " />
</div>
</p>
</form>

View file

@ -0,0 +1,90 @@
<fieldset>
<legend>{lng p="admins"}</legend>
<form action="admins.php?action=admins&sid={$sid}" name="f1" method="post" onsubmit="spin(this)">
<table class="list">
<tr>
<th width="20">&nbsp;</th>
<th width="25" style="text-align:center;"><a href="javascript:invertSelection(document.forms.f1,'admin_');"><img src="{$tpldir}images/dot.png" border="0" alt="" width="10" height="8" /></a></th>
<th>{lng p="name"}</th>
<th width="140">{lng p="status"}</th>
<th width="60">&nbsp;</th>
</tr>
{foreach from=$admins item=admin}
{cycle name=class values="td1,td2" assign=class}
<tr class="{$class}">
<td align="center"><img src="{$tpldir}images/user_active.png" border="0" alt="" width="16" height="16" /></td>
<td align="center">{if $admin.adminid!=1}<input type="checkbox" name="admin_{$admin.adminid}" />{/if}</td>
<td>{text value=$admin.username}<br />
<small>{text value=$admin.firstname} {text value=$admin.lastname}</small></td>
<td>
{if $admin.type==0}{lng p="superadmin"}{else}{lng p="admin"}{/if}
</td>
<td>
<a href="admins.php?action=admins&do=edit&id={$admin.adminid}&sid={$sid}"><img src="{$tpldir}images/edit.png" border="0" alt="{lng p="edit"}" width="16" height="16" /></a>
{if $admin.adminid!=1}<a href="admins.php?action=admins&delete={$admin.adminid}&sid={$sid}" onclick="return confirm('{lng p="realdel"}');"><img src="{$tpldir}images/delete.png" border="0" alt="{lng p="delete"}" width="16" height="16" /></a>{/if}
</td>
</tr>
{/foreach}
<tr>
<td class="footer" colspan="5">
<div style="float:left;">
{lng p="action"}: <select name="massAction" class="smallInput">
<option value="-">------------</option>
<optgroup label="{lng p="actions"}">
<option value="delete">{lng p="delete"}</option>
</optgroup>
</select>&nbsp;
</div>
<div style="float:left;">
<input type="submit" name="executeMassAction" value=" {lng p="execute"} " class="smallInput" />
</div>
</td>
</tr>
</table>
</form>
</fieldset>
<fieldset>
<legend>{lng p="addadmin"}</legend>
<form action="admins.php?action=admins&add=true&sid={$sid}" method="post" onsubmit="spin(this)">
<table width="100%">
<tr>
<td width="40" valign="top" rowspan="6"><img src="{$tpldir}images/ico_users.png" border="0" alt="" width="32" height="32" /></td>
<td class="td1" width="150">{lng p="username"}:</td>
<td class="td2"><input type="text" size="28" id="username" name="username" value="" /></td>
</tr>
<tr>
<td class="td1">{lng p="firstname"}:</td>
<td class="td2"><input type="text" size="36" id="firstname" name="firstname" value="" /></td>
</tr>
<tr>
<td class="td1">{lng p="lastname"}:</td>
<td class="td2"><input type="text" size="36" id="lastname" name="lastname" value="" /></td>
</tr>
<tr>
<td class="td1">{lng p="password"}:</td>
<td class="td2"><input type="password" size="28" id="pw1" name="pw1" value="" /></td>
</tr>
<tr>
<td class="td1">{lng p="password"} ({lng p="repeat"}):</td>
<td class="td2"><input type="password" size="28" id="pw2" name="pw2" value="" /></td>
</tr>
<tr>
<td class="td1">{lng p="type"}:</td>
<td class="td2"><select name="type">
<option value="1">{lng p="admin"}</option>
<option value="0">{lng p="superadmin"}</option>
</select></td>
</tr>
</table>
<p align="right">
<input class="button" type="submit" value=" {lng p="add"} " />
</p>
</form>
</fieldset>

View file

@ -0,0 +1,78 @@
<form action="admins.php?action=admins&do=edit&id={$admin.adminid}&save=true&sid={$sid}" method="post" onsubmit="spin(this)">
<fieldset>
<legend>{lng p="editadmin"}: {text value=$admin.username}</legend>
<table width="100%">
<tr>
<td width="40" valign="top" rowspan="6"><img src="{$tpldir}images/ico_users.png" border="0" alt="" width="32" height="32" /></td>
<td class="td1" width="220">{lng p="username"}:</td>
<td class="td2"><input type="text" size="28" id="username" name="username" value="{text value=$admin.username}" /></td>
</tr>
<tr>
<td class="td1">{lng p="firstname"}:</td>
<td class="td2"><input type="text" size="36" id="firstname" name="firstname" value="{text value=$admin.firstname allowEmpty=true}" /></td>
</tr>
<tr>
<td class="td1">{lng p="lastname"}:</td>
<td class="td2"><input type="text" size="36" id="lastname" name="lastname" value="{text value=$admin.lastname allowEmpty=true}" /></td>
</tr>
<tr>
<td class="td1">{lng p="type"}:</td>
<td class="td2"><select name="type"{if $admin.adminid==1} disabled="disabled"{/if} onclick="EBID('perms').style.display=this.value==0?'none':'';">
<option value="1"{if $admin.type==1} selected="selected"{/if}>{lng p="admin"}</option>
<option value="0"{if $admin.type==0} selected="selected"{/if}>{lng p="superadmin"}</option>
</select></td>
</tr>
</table>
</fieldset>
<fieldset id="perms" style="display:{if $admin.type==0}none{/if};">
<legend>{lng p="permissions"}</legend>
<table width="100%">
<tr>
<td width="40" valign="top" rowspan="2"><img src="{$tpldir}images/ico_prefs_validation.png" border="0" alt="" width="32" height="32" /></td>
<td class="td1" width="220">{lng p="areas"}:</td>
<td class="td2">
{foreach from=$permsTable item=permTitle key=permName}
<input type="checkbox" name="perms[{$permName}]" value="1" id="perm_{$permName}"{if $admin.perms.$permName} checked="checked"{/if} />
<label for="perm_{$permName}" style="font-weight:bold;">{$permTitle}</label><br />
{/foreach}
</td>
</tr>
<tr>
<td class="td1">{lng p="plugins"}:</td>
<td class="td2">
{foreach from=$pluginList item=pluginTitle key=pluginName}
<input type="checkbox" name="perms[plugins][{$pluginName}]" value="1" id="plugin_{$pluginName}"{if $admin.perms.plugins.$pluginName} checked="checked"{/if} />
<label for="plugin_{$pluginName}" style="font-weight:bold;">{text value=$pluginTitle}</label><br />
{/foreach}
</td>
</tr>
</table>
</fieldset>
<fieldset>
<legend>{lng p="password"}</legend>
<table>
<tr>
<td width="40" valign="top" rowspan="2"><img src="{$tpldir}images/ico_prefs_login.png" border="0" alt="" width="32" height="32" /></td>
<td class="td1" width="220">{lng p="newpassword"}:</td>
<td class="td2"><input type="password" name="newpw1" size="36" /></td>
</tr>
<tr>
<td class="td1">{lng p="newpassword"} ({lng p="repeat"}):</td>
<td class="td2"><input type="password" name="newpw2" size="36" /></td>
</tr>
</table>
</fieldset>
<p>
<div style="float:right" class="buttons">
<input class="button" type="submit" value=" {lng p="save"} " />
</div>
</p>
</form>

View file

@ -0,0 +1,13 @@
<fieldset>
<legend>{lng p="createbackup"}</legend>
{lng p="creatingbackup"}
<script>
<!--
var backupTables = [{foreach from=$sequence item=table}'{$table}',
{/foreach}''];
//-->
</script>
</fieldset>

View file

@ -0,0 +1,37 @@
<fieldset>
<legend>{lng p="createbackup"}</legend>
<form action="backup.php?sid={$sid}&do=createBackup" method="post">
<table>
<tr>
<td align="left" rowspan="3" valign="top" width="40"><img src="{$tpldir}images/backup32.png" border="0" alt="" width="32" height="32" /></td>
<td>
{lng p="backupitems"}:
<blockquote>
<input type="checkbox" name="backup_prefs" id="backupPrefs" checked="checked" />
<label for="backupPrefs"><b>{lng p="prefs"}</b></label> ({lng p="approx"} {size bytes=$sizes.prefs})<br />
<input type="checkbox" name="backup_stats" id="backupStats" checked="checked" />
<label for="backupStats"><b>{lng p="statsdata"}</b></label> ({lng p="approx"} {size bytes=$sizes.stats})<br />
<input type="checkbox" name="backup_users" id="backupUsers" checked="checked" />
<label for="backupUsers"><b>{lng p="userdata"}</b></label> ({lng p="approx"} {size bytes=$sizes.users})<br />
<input type="checkbox" name="backup_organizer" id="backupOrganizer" checked="checked" />
<label for="backupOrganizer"><b>{lng p="organizerdata"}</b></label> ({lng p="approx"} {size bytes=$sizes.organizer})<br />
<input type="checkbox" name="backup_mails" id="backupMails" checked="checked" />
<label for="backupMails"><b>{lng p="maildata"}</b></label> ({lng p="approx"} {size bytes=$sizes.mails})<br />
<input type="checkbox" name="backup_webdisk" id="backupWebdisk" checked="checked" />
<label for="backupWebdisk"><b>{lng p="webdiskdata"}</b></label> ({lng p="approx"} {size bytes=$sizes.webdisk})<br />
</blockquote>
</td>
</tr>
</table>
<p>
<div style="float:left;" class="buttons">
<img src="{$tpldir}images/warning.png" border="0" alt="" width="16" height="16" align="absmiddle" />
{lng p="backupwarn"}
</div>
<div style="float:right;" class="buttons">
<input class="button" type="submit" value=" {lng p="createbackup"} " />
</div>
</p>
</form>
</fieldset>

8
src/admin/templates/cache/.htaccess vendored Normal file
View file

@ -0,0 +1,8 @@
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Deny from all
</IfModule>

0
src/admin/templates/cache/index.html vendored Normal file
View file

View file

@ -0,0 +1,33 @@
<form action="groups.php?do=realDelete&sid={$sid}" method="post">
<fieldset>
<legend>{lng p="deletegroup"}</legend>
{lng p="groupdeletedesc"}
<p>
<div>
<table>
{foreach from=$groupsToDelete item=dGroupTitle key=dGroupID}
<tr>
<td>{text value=$dGroupTitle}</td>
<td><b>&nbsp;&raquo;&nbsp;</b></td>
<td>
<select name="groups[{$dGroupID}]">
{foreach from=$groups key=groupID item=groupTitle}
<option value="{$groupID}">{text value=$groupTitle}</option>
{/foreach}
</select>
</td>
</tr>
{/foreach}
</table>
</div>
</p>
</fieldset>
<p>
<div style="float:right" class="buttons">
<input class="button" type="submit" value=" {lng p="move"} &amp; {lng p="delete"} " />
</div>
</p>
</form>

View file

@ -0,0 +1,291 @@
<form method="post" action="groups.php?{if $create}action=create&create=true{else}do=edit&id={$group.id}&save=true{/if}&sid={$sid}" onsubmit="spin(this)">
<table width="100%" cellspacing="2" cellpadding="0">
<tr>
<td valign="top" width="50%">
<fieldset>
<legend>{lng p="common"}</legend>
<table width="100%">
<tr>
<td class="td1" width="160">{lng p="title"}:</td>
<td class="td2"><input type="text" name="titel" value="{text value=$group.titel allowEmpty=true}" style="width:85%;" /></td>
</tr>
<tr>
<td class="td1">{lng p="htmlview"}?</td>
<td class="td2"><input type="checkbox" name="soforthtml"{if $group.soforthtml=='yes'} checked="checked"{/if} /></td>
</tr>
<tr>
<td class="td1">{lng p="monthasset"}:</td>
<td class="td2"><input type="text" name="sms_monat" value="{$group.sms_monat}" size="8" /> {lng p="credits"}</td>
</tr>
</table>
</fieldset>
<fieldset>
<legend>{lng p="storage"}</legend>
<table width="100%">
<tr>
<td class="td1" width="160">{lng p="email"}:</td>
<td class="td2"><input type="text" name="storage" value="{$group.storage/1024/1024}" size="8" /> MB</td>
</tr>
<tr>
<td class="td1">{lng p="webdisk"}:</td>
<td class="td2"><input type="text" name="webdisk" value="{$group.webdisk/1024/1024}" size="8" /> MB</td>
</tr>
</table>
</fieldset>
<fieldset>
<legend>{lng p="limits"}</legend>
<table width="100%">
<tr>
<td class="td1" width="160">{lng p="emailin"}:</td>
<td class="td2"><input type="text" name="maxsize" value="{$group.maxsize/1024}" size="8" /> KB</td>
</tr>
<tr>
<td class="td1">{lng p="emailout"}:</td>
<td class="td2"><input type="text" name="anlagen" value="{$group.anlagen/1024}" size="8" /> KB</td>
</tr>
<tr>
<td class="td1">{lng p="wdtraffic"}:</td>
<td class="td2"><input type="text" name="traffic" value="{if $group.traffic>0}{$group.traffic/1024/1024}{else}{$group.traffic}{/if}" size="8" /> MB</td>
</tr>
<tr>
<td class="td1">{lng p="wdspeed"}:</td>
<td class="td2"><input type="text" name="wd_member_kbs" value="{$group.wd_member_kbs}" size="8" /> KB/s</td>
</tr>
<tr>
<td class="td1">{lng p="sharespeed"}:</td>
<td class="td2"><input type="text" name="wd_open_kbs" value="{$group.wd_open_kbs}" size="8" /> KB/s</td>
</tr>
<tr>
<td class="td1" width="220">{lng p="maxrecps"}:</td>
<td class="td2"><input type="text" name="max_recps" value="{$group.max_recps}" size="8" /></td>
</tr>
<tr>
<td class="td1">{lng p="sendlimit"}:</td>
<td class="td2"><input type="text" name="send_limit_count" value="{$group.send_limit_count}" size="8" />
{lng p="emailsin"}
<input type="text" name="send_limit_time" value="{$group.send_limit_time}" size="8" />
{lng p="minutes"}</td>
</tr>
<tr>
<td class="td1">{lng p="ownpop3"}:</td>
<td class="td2"><input type="text" name="ownpop3" value="{$group.ownpop3}" size="8" /></td>
</tr>
<tr>
<td class="td1">{lng p="ownpop3interval"}:</td>
<td class="td2"><input type="text" name="ownpop3_interval" value="{$group.ownpop3_interval}" size="8" /> {lng p="seconds"}</td>
</tr>
<tr>
<td class="td1">{lng p="selfpop3_check"}?</td>
<td class="td2"><input type="checkbox" name="selfpop3_check"{if $group.selfpop3_check=='yes'} checked="checked"{/if} /></td>
</tr>
<tr>
<td class="td1">{lng p="aliases"}:</td>
<td class="td2"><input type="text" name="aliase" value="{$group.aliase}" size="8" /></td>
</tr>
<tr>
<td class="td1">{lng p="smspre"}:</td>
<td class="td2">
<textarea style="width:100%;height:80px;" name="sms_pre">{text value=$group.sms_pre allowEmpty=true}</textarea>
<small>{lng p="sepby"}</small>
</td>
</tr>
<tr>
<td class="td1">{lng p="smsvalidation"}?</td>
<td class="td2"><input type="checkbox" name="smsvalidation"{if $group.smsvalidation=='yes'} checked="checked"{/if} /></td>
</tr>
<tr>
<td class="td1">{lng p="allownewsoptout"}?</td>
<td class="td2"><input name="allow_newsletter_optout"{if $group.allow_newsletter_optout=='yes'} checked="checked"{/if} type="checkbox" /></td>
</tr>
<tr>
<td class="td1">{lng p="mail_send_code"}?</td>
<td class="td2"><input name="mail_send_code"{if $group.mail_send_code=='yes'} checked="checked"{/if} type="checkbox" /></td>
</tr>
<tr>
<td class="td1">{lng p="sms_send_code"}?</td>
<td class="td2"><input name="sms_send_code"{if $group.sms_send_code=='yes'} checked="checked"{/if} type="checkbox" /></td>
</tr>
<tr>
<td class="td1">{lng p="abuseprotect"}?</td>
<td class="td2"><input name="abuseprotect"{if $group.abuseprotect=='yes'} checked="checked"{/if} type="checkbox" /></td>
</tr>
</table>
</fieldset>
</td>
<td valign="top">
<fieldset>
<legend>{lng p="services"}</legend>
<table width="100%">
<tr>
<td class="td1" width="150">{lng p="autoresponder"}?</td>
<td class="td2"><input type="checkbox" name="responder"{if $group.responder=='yes'} checked="checked"{/if} /></td>
<td class="td1" width="150">{lng p="forward"}?</td>
<td class="td2"><input type="checkbox" name="forward"{if $group.forward=='yes'} checked="checked"{/if} /></td>
</tr>
<tr>
<td class="td1">{lng p="ads"}?</td>
<td class="td2"><input type="checkbox" name="ads"{if $group.ads=='yes'} checked="checked"{/if} /></td>
<td class="td2" colspan="2">&nbsp;</td>
</tr>
<tr>
<td class="td1">{lng p="mail2sms"}?</td>
<td class="td2"><input type="checkbox" name="mail2sms"{if $group.mail2sms=='yes'} checked="checked"{/if} /></td>
<td class="td1">{lng p="ownfrom"}?</td>
<td class="td2"><input type="checkbox" name="sms_ownfrom"{if $group.sms_ownfrom=='yes'} checked="checked"{/if} /></td>
</tr>
<tr>
<td class="td1">{lng p="mobileaccess"}?</td>
<td class="td2"><input type="checkbox" name="wap"{if $group.wap=='yes'} checked="checked"{/if} /></td>
<td class="td1">{lng p="sync"}?</td>
<td class="td2"><input type="checkbox" name="syncml"{if $group.syncml=='yes'} checked="checked"{/if} /></td>
</tr>
<tr>
<td class="td1">{lng p="wdshare"}?</td>
<td class="td2"><input type="checkbox" name="share"{if $group.share=='yes'} checked="checked"{/if} /></td>
<td class="td1">{lng p="webdav"}?</td>
<td class="td2"><input type="checkbox" name="webdav"{if !$davSupport} disabled="disabled"{else}{if $group.webdav=='yes'} checked="checked"{/if}{/if} /></td>
</tr>
<tr>
<td class="td1">{lng p="organizerdav"}?</td>
<td class="td2"><input type="checkbox" name="organizerdav"{if !$davSupport} disabled="disabled"{else}{if $group.organizerdav=='yes'} checked="checked"{/if}{/if} /></td>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td class="td1">{lng p="smtp"}?</td>
<td class="td2"><input type="checkbox" name="smtp"{if $group.smtp=='yes'} checked="checked"{/if} /></td>
<td class="td1">{lng p="pop3"}?</td>
<td class="td2"><input type="checkbox" name="pop3"{if $group.pop3=='yes'} checked="checked"{/if} /></td>
</tr>
<tr>
<td class="td1">{lng p="imap"}?</td>
<td class="td2"><input type="checkbox" name="imap"{if $group.imap=='yes'} checked="checked"{/if} /></td>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td class="td1">{lng p="smime"}?</td>
<td class="td2"><input type="checkbox" name="smime"{if !$smimeSupport} disabled="disabled"{else}{if $group.smime=='yes'} checked="checked"{/if}{/if} /></td>
<td class="td1">{lng p="issue_certificates"}?</td>
<td class="td2"><input type="checkbox" name="issue_certificates"{if !$smimeSupport} disabled="disabled"{else}{if $group.issue_certificates=='yes'} checked="checked"{/if}{/if} /></td>
</tr>
<tr>
<td class="td1">{lng p="upload_certificates"}?</td>
<td class="td2"><input type="checkbox" name="upload_certificates"{if !$smimeSupport} disabled="disabled"{else}{if $group.upload_certificates=='yes'} checked="checked"{/if}{/if} /></td>
<td class="td1">{lng p="sender_aliases"}?</td>
<td class="td2"><input type="checkbox" name="sender_aliases"{if $group.sender_aliases=='yes'} checked="checked"{/if} /></td>
</tr>
<tr>
<td class="td1">{lng p="ftsearch"}?</td>
<td class="td2"><input type="checkbox" name="ftsearch"{if !$ftsSupport} disabled="disabled"{else}{if $group.ftsearch=='yes'} checked="checked"{/if}{/if} /></td>
<td class="td1">{lng p="notifications"}?</td>
<td class="td2"><input type="checkbox" name="notifications"{if $group.notifications=='yes'} checked="checked"{/if} /></td>
</tr>
<tr>
<td class="td1">{lng p="deliverystatus"}?</td>
<td class="td2"><input type="checkbox" name="maildeliverystatus"{if $group.maildeliverystatus=='yes'} checked="checked"{/if} /></td>
<td class="td1">{lng p="auto_save_drafts"}?</td>
<td class="td2"><input type="checkbox" name="auto_save_drafts"{if $group.auto_save_drafts=='yes'} checked="checked"{/if} /></td>
</tr>
</table>
</fieldset>
<fieldset>
<legend>{lng p="bmtoolbox"}</legend>
<table width="100%">
<tr>
<td class="td1" width="150">{lng p="tbx_enable"}?</td>
<td class="td2"><input type="checkbox" name="checker"{if $group.checker=='yes'} checked="checked"{/if} /></td>
<td class="td2" width="150">&nbsp;</td>
<td class="td2">&nbsp;</td>
</tr>
<tr>
<td class="td1">{lng p="tbx_webdisk"}?</td>
<td class="td2"><input type="checkbox" name="tbx_webdisk"{if $group.tbx_webdisk=='yes'} checked="checked"{/if} /></td>
<td class="td1">{lng p="tbx_smsmanager"}?</td>
<td class="td2"><input type="checkbox" name="tbx_smsmanager"{if $group.tbx_smsmanager=='yes'} checked="checked"{/if} /></td>
</tr>
</table>
</fieldset>
<fieldset>
<legend>{lng p="aliasdomains"}</legend>
<textarea style="width:100%;height:80px;" name="saliase">{text value=$group.saliase allowEmpty=true}</textarea>
<small>{lng p="sepby"}</small>
</fieldset>
<fieldset>
<legend>{lng p="misc"}</legend>
<table width="100%">
<tr>
<td class="td1" width="160">{lng p="creditprice"}:</td>
<td class="td2"><input type="text" name="sms_price_per_credit" value="{$group.sms_price_per_credit}" size="6" /> (1/100 {$currency})</td>
</tr>
<tr>
<td class="td1" width="160">{lng p="smsfrom"}:</td>
<td class="td2"><input type="text" name="sms_from" value="{text value=$group.sms_from allowEmpty=true}" style="width:85%;" /></td>
</tr>
<tr>
<td class="td1">{lng p="smssig"}:</td>
<td class="td2"><input type="text" name="sms_sig" value="{text value=$group.sms_sig allowEmpty=true}" style="width:85%;" /></td>
</tr>
<tr>
<td class="td1">{lng p="mailsig"}:</td>
<td class="td2"><textarea style="width:100%;height:80px;" name="signatur">{text value=$group.signatur allowEmpty=true}</textarea></td>
</tr>
{foreach from=$groupOptions key=fieldKey item=fieldInfo}
<tr>
<td class="td1">{$fieldInfo.desc}</td>
<td class="td2">
{if $fieldInfo.type==16}
<textarea style="width:100%;height:80px;" name="{$fieldKey}">{text value=$fieldInfo.value allowEmpty=true}</textarea></td>
{elseif $fieldInfo.type==8}
{foreach from=$fieldInfo.options item=optionValue key=optionKey}
<input type="radio" name="{$fieldKey}" id="{$fieldKey}_{$optionKey}" value="{$optionKey}"{if $fieldInfo.value==$optionKey} checked="checked"{/if} />
<label for="{$fieldKey}_{$optionKey}">{text value=$optionValue}</label>
{/foreach}
{elseif $fieldInfo.type==4}
<select name="{$fieldKey}">
{foreach from=$fieldInfo.options item=optionValue key=optionKey}
<option value="{$optionKey}"{if $fieldInfo.value==$optionKey} selected="selected"{/if}>{text value=$optionValue}</option>
{/foreach}
</select>
{elseif $fieldInfo.type==2}
<input type="checkbox" name="{$fieldKey}" value="1"{if $fieldInfo.value} checked="checked"{/if} />
{elseif $fieldInfo.type==1}
<input type="text" style="width:85%;" name="{$fieldKey}" value="{text value=$fieldInfo.value allowEmpty=true}" />
{/if}
</tr>
{/foreach}
</table>
</fieldset>
</td>
</tr>
</table>
<p>
{if !$create}<div style="float:left" class="buttons">
&nbsp;{lng p="action"}:
<select name="groupAction" id="groupAction">
<optgroup label="{lng p="actions"}">
<option value="newsletter.php?toGroup={$group.id}&sid={$sid}">{lng p="sendmail"}</option>
<option value="groups.php?singleAction=delete&singleID={$group.id}&sid={$sid}">{lng p="delete"}</option>
</optgroup>
</select>
</div>
<div style="float:left">
<input class="button" type="button" value=" {lng p="ok"} " onclick="executeAction('groupAction');" />
</div>{/if}
<div style="float:right" class="buttons">
<input class="button" type="submit" value=" {lng p="save"} " />
</div>
</p>
</form>
<br /><br />

View file

@ -0,0 +1,44 @@
<fieldset>
<legend>{lng p="groups"}</legend>
<form name="f1" action="groups.php?sid={$sid}" method="post">
<table class="list">
<tr>
<th width="20">&nbsp;</th>
<th width="25" style="text-align:center;"><a href="javascript:invertSelection(document.forms.f1,'group_');"><img src="{$tpldir}images/dot.png" border="0" alt="" width="10" height="8" /></a></th>
<th>{lng p="title"}</th>
<th width="70">&nbsp;</th>
</tr>
{foreach from=$groups item=group}
{cycle name=class values="td1,td2" assign=class}
<tr class="{$class}">
<td align="center"><img src="{$tpldir}images/ico_group{if $group.default}_default{/if}.png" border="0" width="16" height="16" alt="" /></td>
<td align="center"><input type="checkbox" name="group_{$group.id}" /></td>
<td><a href="groups.php?do=edit&id={$group.id}&sid={$sid}">{text value=$group.titel}</a><br /><small><a href="users.php?onlyGroup={$group.id}&sid={$sid}">{$group.members} {lng p="members"}</a></small></td>
<td>
<a href="groups.php?do=edit&id={$group.id}&sid={$sid}"><img src="{$tpldir}images/edit.png" border="0" alt="{lng p="edit"}" width="16" height="16" /></a>
{if !$group.default}<a href="groups.php?do=delete&id={$group.id}&sid={$sid}" onclick="return confirm('{lng p="realdel"}');"><img src="{$tpldir}images/delete.png" border="0" alt="{lng p="delete"}" width="16" height="16" /></a>{/if}
</td>
</tr>
{/foreach}
<tr>
<td class="footer" colspan="4">
<div style="float:left;">
{lng p="action"}: <select name="massAction" class="smallInput">
<option value="-">------------</option>
<optgroup label="{lng p="actions"}">
<option value="delete">{lng p="delete"}</option>
</optgroup>
</select>&nbsp;
</div>
<div style="float:left;">
<input type="submit" name="executeMassAction" value=" {lng p="execute"} " class="smallInput" />
</div>
</td>
</tr>
</table>
</form>
</fieldset>

View file

@ -0,0 +1,71 @@
This license is applied to the Admin Icons, which are from FatCow Web Hosting: http://www.fatcow.com/free-icons
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM ITS USE.
License
THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.
1. Definitions
"Adaptation" means a work based upon the Work, or upon the Work and other pre-existing works, such as a translation, adaptation, derivative work, arrangement of music or other alterations of a literary or artistic work, or phonogram or performance and includes cinematographic adaptations or any other form in which the Work may be recast, transformed, or adapted including in any form recognizably derived from the original, except that a work that constitutes a Collection will not be considered an Adaptation for the purpose of this License. For the avoidance of doubt, where the Work is a musical work, performance or phonogram, the synchronization of the Work in timed-relation with a moving image ("synching") will be considered an Adaptation for the purpose of this License.
"Collection" means a collection of literary or artistic works, such as encyclopedias and anthologies, or performances, phonograms or broadcasts, or other works or subject matter other than works listed in Section 1(f) below, which, by reason of the selection and arrangement of their contents, constitute intellectual creations, in which the Work is included in its entirety in unmodified form along with one or more other contributions, each constituting separate and independent works in themselves, which together are assembled into a collective whole. A work that constitutes a Collection will not be considered an Adaptation (as defined above) for the purposes of this License.
"Distribute" means to make available to the public the original and copies of the Work or Adaptation, as appropriate, through sale or other transfer of ownership.
"Licensor" means the individual, individuals, entity or entities that offer(s) the Work under the terms of this License.
"Original Author" means, in the case of a literary or artistic work, the individual, individuals, entity or entities who created the Work or if no individual or entity can be identified, the publisher; and in addition (i) in the case of a performance the actors, singers, musicians, dancers, and other persons who act, sing, deliver, declaim, play in, interpret or otherwise perform literary or artistic works or expressions of folklore; (ii) in the case of a phonogram the producer being the person or legal entity who first fixes the sounds of a performance or other sounds; and, (iii) in the case of broadcasts, the organization that transmits the broadcast.
"Work" means the literary and/or artistic work offered under the terms of this License including without limitation any production in the literary, scientific and artistic domain, whatever may be the mode or form of its expression including digital form, such as a book, pamphlet and other writing; a lecture, address, sermon or other work of the same nature; a dramatic or dramatico-musical work; a choreographic work or entertainment in dumb show; a musical composition with or without words; a cinematographic work to which are assimilated works expressed by a process analogous to cinematography; a work of drawing, painting, architecture, sculpture, engraving or lithography; a photographic work to which are assimilated works expressed by a process analogous to photography; a work of applied art; an illustration, map, plan, sketch or three-dimensional work relative to geography, topography, architecture or science; a performance; a broadcast; a phonogram; a compilation of data to the extent it is protected as a copyrightable work; or a work performed by a variety or circus performer to the extent it is not otherwise considered a literary or artistic work.
"You" means an individual or entity exercising rights under this License who has not previously violated the terms of this License with respect to the Work, or who has received express permission from the Licensor to exercise rights under this License despite a previous violation.
"Publicly Perform" means to perform public recitations of the Work and to communicate to the public those public recitations, by any means or process, including by wire or wireless means or public digital performances; to make available to the public Works in such a way that members of the public may access these Works from a place and at a place individually chosen by them; to perform the Work to the public by any means or process and the communication to the public of the performances of the Work, including by public digital performance; to broadcast and rebroadcast the Work by any means including signs, sounds or images.
"Reproduce" means to make copies of the Work by any means including without limitation by sound or visual recordings and the right of fixation and reproducing fixations of the Work, including storage of a protected performance or phonogram in digital form or other electronic medium.
2. Fair Dealing Rights. Nothing in this License is intended to reduce, limit, or restrict any uses free from copyright or rights arising from limitations or exceptions that are provided for in connection with the copyright protection under copyright law or other applicable laws.
3. License Grant. Subject to the terms and conditions of this License, Licensor hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the duration of the applicable copyright) license to exercise the rights in the Work as stated below:
to Reproduce the Work, to incorporate the Work into one or more Collections, and to Reproduce the Work as incorporated in the Collections;
to create and Reproduce Adaptations provided that any such Adaptation, including any translation in any medium, takes reasonable steps to clearly label, demarcate or otherwise identify that changes were made to the original Work. For example, a translation could be marked "The original work was translated from English to Spanish," or a modification could indicate "The original work has been modified.";
to Distribute and Publicly Perform the Work including as incorporated in Collections; and,
to Distribute and Publicly Perform Adaptations.
For the avoidance of doubt:
Non-waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme cannot be waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by You of the rights granted under this License;
Waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme can be waived, the Licensor waives the exclusive right to collect such royalties for any exercise by You of the rights granted under this License; and,
Voluntary License Schemes. The Licensor waives the right to collect royalties, whether individually or, in the event that the Licensor is a member of a collecting society that administers voluntary licensing schemes, via that society, from any exercise by You of the rights granted under this License.
The above rights may be exercised in all media and formats whether now known or hereafter devised. The above rights include the right to make such modifications as are technically necessary to exercise the rights in other media and formats. Subject to Section 8(f), all rights not expressly granted by Licensor are hereby reserved.
4. Restrictions. The license granted in Section 3 above is expressly made subject to and limited by the following restrictions:
You may Distribute or Publicly Perform the Work only under the terms of this License. You must include a copy of, or the Uniform Resource Identifier (URI) for, this License with every copy of the Work You Distribute or Publicly Perform. You may not offer or impose any terms on the Work that restrict the terms of this License or the ability of the recipient of the Work to exercise the rights granted to that recipient under the terms of the License. You may not sublicense the Work. You must keep intact all notices that refer to this License and to the disclaimer of warranties with every copy of the Work You Distribute or Publicly Perform. When You Distribute or Publicly Perform the Work, You may not impose any effective technological measures on the Work that restrict the ability of a recipient of the Work from You to exercise the rights granted to that recipient under the terms of the License. This Section 4(a) applies to the Work as incorporated in a Collection, but this does not require the Collection apart from the Work itself to be made subject to the terms of this License. If You create a Collection, upon notice from any Licensor You must, to the extent practicable, remove from the Collection any credit as required by Section 4(b), as requested. If You create an Adaptation, upon notice from any Licensor You must, to the extent practicable, remove from the Adaptation any credit as required by Section 4(b), as requested.
If You Distribute, or Publicly Perform the Work or any Adaptations or Collections, You must, unless a request has been made pursuant to Section 4(a), keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing: (i) the name of the Original Author (or pseudonym, if applicable) if supplied, and/or if the Original Author and/or Licensor designate another party or parties (e.g., a sponsor institute, publishing entity, journal) for attribution ("Attribution Parties") in Licensor's copyright notice, terms of service or by other reasonable means, the name of such party or parties; (ii) the title of the Work if supplied; (iii) to the extent reasonably practicable, the URI, if any, that Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work; and (iv) , consistent with Section 3(b), in the case of an Adaptation, a credit identifying the use of the Work in the Adaptation (e.g., "French translation of the Work by Original Author," or "Screenplay based on original Work by Original Author"). The credit required by this Section 4 (b) may be implemented in any reasonable manner; provided, however, that in the case of a Adaptation or Collection, at a minimum such credit will appear, if a credit for all contributing authors of the Adaptation or Collection appears, then as part of these credits and in a manner at least as prominent as the credits for the other contributing authors. For the avoidance of doubt, You may only use the credit required by this Section for the purpose of attribution in the manner set out above and, by exercising Your rights under this License, You may not implicitly or explicitly assert or imply any connection with, sponsorship or endorsement by the Original Author, Licensor and/or Attribution Parties, as appropriate, of You or Your use of the Work, without the separate, express prior written permission of the Original Author, Licensor and/or Attribution Parties.
Except as otherwise agreed in writing by the Licensor or as may be otherwise permitted by applicable law, if You Reproduce, Distribute or Publicly Perform the Work either by itself or as part of any Adaptations or Collections, You must not distort, mutilate, modify or take other derogatory action in relation to the Work which would be prejudicial to the Original Author's honor or reputation. Licensor agrees that in those jurisdictions (e.g. Japan), in which any exercise of the right granted in Section 3(b) of this License (the right to make Adaptations) would be deemed to be a distortion, mutilation, modification or other derogatory action prejudicial to the Original Author's honor and reputation, the Licensor will waive or not assert, as appropriate, this Section, to the fullest extent permitted by the applicable national law, to enable You to reasonably exercise Your right under Section 3(b) of this License (right to make Adaptations) but not otherwise.
5. Representations, Warranties and Disclaimer
UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU.
6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
7. Termination
This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License. Individuals or entities who have received Adaptations or Collections from You under this License, however, will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any termination of this License.
Subject to the above terms and conditions, the license granted here is perpetual (for the duration of the applicable copyright in the Work). Notwithstanding the above, Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time; provided, however that any such election will not serve to withdraw this License (or any other license that has been, or is required to be, granted under the terms of this License), and this License will continue in full force and effect unless terminated as stated above.
8. Miscellaneous
Each time You Distribute or Publicly Perform the Work or a Collection, the Licensor offers to the recipient a license to the Work on the same terms and conditions as the license granted to You under this License.
Each time You Distribute or Publicly Perform an Adaptation, Licensor offers to the recipient a license to the original Work on the same terms and conditions as the license granted to You under this License.
If any provision of this License is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this License, and without further action by the parties to this agreement, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
No term or provision of this License shall be deemed waived and no breach consented to unless such waiver or consent shall be in writing and signed by the party to be charged with such waiver or consent.
This License constitutes the entire agreement between the parties with respect to the Work licensed here. There are no understandings, agreements or representations with respect to the Work not specified here. Licensor shall not be bound by any additional provisions that may appear in any communication from You. This License may not be modified without the mutual written agreement of the Licensor and You.
The rights granted under, and the subject matter referenced, in this License were drafted utilizing the terminology of the Berne Convention for the Protection of Literary and Artistic Works (as amended on September 28, 1979), the Rome Convention of 1961, the WIPO Copyright Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996 and the Universal Copyright Convention (as revised on July 24, 1971). These rights and subject matter take effect in the relevant jurisdiction in which the License terms are sought to be enforced according to the corresponding provisions of the implementation of those treaty provisions in the applicable national law. If the standard suite of rights granted under applicable copyright law includes additional rights not granted under this License, such additional rights are deemed to be included in the License; this License is not intended to restrict the license of any rights under applicable law.
Creative Commons Notice
Creative Commons is not a party to this License, and makes no warranty whatsoever in connection with the Work. Creative Commons will not be liable to You or any party on any legal theory for any damages whatsoever, including without limitation any general, special, incidental or consequential damages arising in connection to this license. Notwithstanding the foregoing two (2) sentences, if Creative Commons has expressly identified itself as the Licensor hereunder, it shall have all rights and obligations of Licensor.
Except for the limited purpose of indicating to the public that the Work is licensed under the CCPL, Creative Commons does not authorize the use by either party of the trademark "Creative Commons" or any related trademark or logo of Creative Commons without the prior written consent of Creative Commons. Any permitted use will be in compliance with Creative Commons' then-current trademark usage guidelines, as may be published on its website or otherwise made available upon request from time to time. For the avoidance of doubt, this trademark restriction does not form part of this License.
Creative Commons may be contacted at https://creativecommons.org/.

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 674 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 795 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 885 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 705 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 749 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 427 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 758 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 910 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 644 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 712 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 790 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 727 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 474 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 732 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 989 B

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