initial commit of file from CVS for smeserver-awstats on Sat Sep 7 20:09:28 AEST 2024

This commit is contained in:
Trevor Batley 2024-09-07 20:09:28 +10:00
parent 2ac31e7de4
commit 4e37dd65ac
29 changed files with 3907 additions and 2 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*.rpm
*.log
*spec-20*
*.tar.gz

21
Makefile Normal file
View File

@ -0,0 +1,21 @@
# Makefile for source rpm: smeserver-awstats
# $Id: Makefile,v 1.1 2020/10/19 15:36:37 brianr Exp $
NAME := smeserver-awstats
SPECFILE = $(firstword $(wildcard *.spec))
define find-makefile-common
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
endef
MAKEFILE_COMMON := $(shell $(find-makefile-common))
ifeq ($(MAKEFILE_COMMON),)
# attept a checkout
define checkout-makefile-common
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
endef
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
endif
include $(MAKEFILE_COMMON)

View File

@ -1,3 +1,16 @@
# smeserver-awstats # <img src="https://www.koozali.org/images/koozali/Logo/Png/Koozali_logo_2016.png" width="25%" vertical="auto" style="vertical-align:bottom"> smeserver-awstats
SMEServer Koozali developed git repo for smeserver-awstats smecontribs SMEServer Koozali developed git repo for smeserver-awstats smecontribs
## Wiki
<br />https://wiki.koozali.org/AWStats
<br />https://wiki.koozali.org/Qmail_Statistics_(AWStats)
## Bugzilla
Show list of outstanding bugs: [here](https://bugs.koozali.org/buglist.cgi?component=smeserver-awstats&product=SME%20Contribs&query_format=advanced&limit=0&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=CONFIRMED)
## Description
<br />*This description has been generated by an LLM AI system and cannot be relied on to be fully correct.*
*Once it has been checked, then this comment will be deleted*
<br />

340
additional/COPYING Normal file
View File

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

BIN
additional/neddix.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 870 B

1
contriborbase Normal file
View File

@ -0,0 +1 @@
contribs10

41
createlinks Normal file
View File

@ -0,0 +1,41 @@
#!/usr/bin/perl -w
use esmith::Build::CreateLinks qw(:all);
use File::Basename;
use File::Path;
my $event;
panel_link("awstats", 'manager');
for my $event (qw( ip-change awstats-update smeserver-awstats-update console-save post-upgrade remoteaccess-update )) {
templates2events("/etc/e-smith/web/panels/manager/cgi-bin/.awstats/awstats.conf", $event );
templates2events("/etc/e-smith/web/panels/manager/cgi-bin/.awstats/awstats.ftp.conf", $event );
templates2events("/etc/e-smith/web/panels/manager/cgi-bin/.awstats/awstats.mail.conf", $event );
}
$event="ip-change";
event_link("awstats-run", $event , "04");
$event="awstats-update";
event_link("navigation-conf", $event, "50");
event_link("awstats-run", "awstats-update", "20");
templates2events("/etc/crontab", $event );
$event= "smeserver-awstats-update";
event_link("navigation-conf", $event, "50");
templates2events("/etc/crontab", $event );
event_link("awstats-upgrade", $event, "02");
# for smeserver-manager (in smeserver-awstats-update)
safe_symlink('restart', "root/etc/e-smith/events/$event/services2adjust/smanager");
event_link('navigation2-conf', "$event", '80');
event_link('routes2-conf', "$event", '80');
event_link('locales2-conf', "$event", '80');
safe_symlink("/usr/share/awstats/wwwroot/icon" , 'root/usr/share/smanager/themes/default/public/images/awstats/icon');
use esmith::Build::Backup qw(:all);
backup_includes("smeserver-awstats", qw(
/etc/e-smith/web/panels/manager/cgi-bin/.awstats/
));
# archive in /home/e-smith/files/users/admin are already backuped

View File

@ -0,0 +1 @@
enabled

View File

@ -0,0 +1 @@
status

View File

@ -0,0 +1,63 @@
#!/usr/bin/perl -w
#----------------------------------------------------------------------
# copyright (C) 2001 neddix, stuttgart
#
# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#----------------------------------------------------------------------
package esmith;
use strict;
use Errno;
use esmith::config;
use esmith::util;
use esmith::db;
#------------------------------------------------------------
# run the awstats logfile pre-processor
#------------------------------------------------------------
my $event = $ARGV [0];
my $configDB = esmith::ConfigDB->open or die("can't open Config DB");
my $status = $configDB->get_prop( "AWStats", "status" );
if (defined $status && $status eq "enabled")
{
my $awconfpath="/etc/e-smith/web/panels/manager/cgi-bin/.awstats";
my $mtime;
my $prev_mtime=0;
(undef,undef,undef,undef,undef,undef,undef,undef,undef,$mtime)=stat("$awconfpath/awstats.conf");
exit 0 if (!defined $mtime);
while ($mtime != $prev_mtime) {
open (IN, "$awconfpath/awstats.conf") or die "\nCould not open $awconfpath/awstats.conf\n";
open (OUT, ">$awconfpath/awstats.conf.$$") or die "\nCould not open $awconfpath/awstats.conf.$$\n";
while (<IN>) {
print OUT $_;
}
close (IN);
close (OUT);
(undef,undef,undef,undef,undef,undef,undef,undef,undef,$prev_mtime)=stat("$awconfpath/awstats.conf");
}
esmith::util::backgroundCommand (1, "/sbin/e-smith/awstats-pp", "-c$awconfpath/awstats.conf.$$");
}
exit (0);

View File

@ -0,0 +1,29 @@
#!/bin/bash
if [[ -d /var/www/awstats/ ]]; then
cp -a /var/www/awstats/icon/* /etc/e-smith/web/panels/manager/html/awstats/icon
cp -a /var/www/awstats/awstats.pl /etc/e-smith/web/panels/manager/cgi-bin/.awstats
cp -a /var/www/awstats/lang /etc/e-smith/web/panels/manager/cgi-bin/.awstats
cp -a /var/www/awstats/lib /etc/e-smith/web/panels/manager/cgi-bin/.awstats
cp -a /var/www/awstats/plugins /etc/e-smith/web/panels/manager/cgi-bin/.awstats
else
rootdir='/usr/share/awstats/'
cp -a $rootdir/wwwroot/icon/* /etc/e-smith/web/panels/manager/html/awstats/icon
cp -a $rootdir/wwwroot/cgi-bin/awstats.pl /etc/e-smith/web/panels/manager/cgi-bin/.awstats
cp -a $rootdir/lang /etc/e-smith/web/panels/manager/cgi-bin/.awstats
cp -a $rootdir/lib /etc/e-smith/web/panels/manager/cgi-bin/.awstats
cp -a $rootdir/plugins /etc/e-smith/web/panels/manager/cgi-bin/.awstats
fi
chmod -R 770 /etc/e-smith/web/panels/manager/cgi-bin/.awstats
#cd /etc/e-smith/web/panels/manager/html/awstats/
ln -sf /etc/e-smith/web/panels/manager/html/awstats/icon/os /etc/e-smith/web/panels/manager/html/awstats/os
ln -sf /etc/e-smith/web/panels/manager/html/awstats/icon/flags /etc/e-smith/web/panels/manager/html/awstats/flags
ln -sf /etc/e-smith/web/panels/manager/html/awstats/icon/browser /etc/e-smith/web/panels/manager/html/awstats/browser
ln -sf /etc/e-smith/web/panels/manager/html/awstats/icon/clock /etc/e-smith/web/panels/manager/html/awstats/clock
ln -sf /etc/e-smith/web/panels/manager/html/awstats/icon/mime /etc/e-smith/web/panels/manager/html/awstats/mime
ln -sf /etc/e-smith/web/panels/manager/html/awstats/icon/other /etc/e-smith/web/panels/manager/html/awstats/other
echo "AWStats upgrade complete"

View File

@ -0,0 +1,50 @@
{
use esmith::config;
use esmith::db;
$OUT = "\n# AWStats Advanced Web Statistics, RPM provided by www.neddix.de\n";
local %services;
$services{'AWStats'} = $AWStats;
my $status = db_get_prop(\%services, "AWStats", "status");
if (defined $status && $status eq "enabled")
{
my $cmd="/bin/nice /sbin/e-smith/awstats-pp -s -n";
my $freq = db_get_prop(\%services, "AWStats", 'Freq');
if ($freq eq '5m') {
$OUT .= "*/5 * * * * root $cmd\n";
}
elsif ($freq eq '10m') {
$OUT .= "*/10 * * * * root $cmd\n";
}
elsif ($freq eq '15m') {
$OUT .= "*/15 * * * * root $cmd\n";
}
elsif ($freq eq '30m') {
$OUT .= "*/30 * * * * root $cmd\n";
}
elsif ($freq eq '1h') {
$OUT .= "13 * * * * root $cmd\n";
}
elsif ($freq eq '2h') {
$OUT .= "13 */2 * * * root $cmd\n";
}
elsif ($freq eq '4h') {
$OUT .= "13 */4 * * * root $cmd\n";
}
elsif ($freq eq '8h') {
$OUT .= "13 */8 * * * root $cmd\n";
}
elsif ($freq eq '12h') {
$OUT .= "13 */12 * * * root $cmd\n";
} else {
$OUT .= "# Parameter Freq not vaild, using default\n";
$OUT .= "*/15 * * * * root $cmd\n";
}
} else {
$OUT .= "#disabled";
}
}

View File

@ -0,0 +1,6 @@
{
return "# awstats-mail is disabled\n" unless ($AWStats{mailstatus} || 'disabled') eq 'enabled';
my $cmd="/etc/e-smith/web/panels/manager/cgi-bin/.awstats/awstats.pl";
$OUT .= "45 * * * * root $cmd -update -config=mail >/dev/null\n";
}

View File

@ -0,0 +1,7 @@
{
return "# awstats-ftp is disabled\n" unless ($AWStats{ftpstatus} || 'disabled') eq 'enabled';
my $cmd="/etc/e-smith/web/panels/manager/cgi-bin/.awstats/awstats.pl";
$OUT .= "35 * * * * root $cmd -update -config=ftp >/dev/null\n";
}

View File

@ -0,0 +1,927 @@
# AWStats configure file
#------------------------------------------------------------------------
# Copy this file into awstats.www.myserver.mydomain.conf or awstats.conf
# and edit this new file to setup AWStats (This config file must be in
# same directory than awstats.pl).
# If you don't understand what is a parameter, keep default value.
#------------------------------------------------------------------------
# Main setup section (Required to make AWStats working)
#------------------------------------------------------------------------
# Web server logfile to analyze, with full path
# Example: "/var/logs/httpd/myserver_access.log"
# or relative path from awstats.pl directory.
# Example: "../logs/mycombinedlog.log"
# You can also use %YY %MM %DD or %HH in filename, AWStats will
# replace those tags with current year month day or hour.
# Example: "C:/WINNT/system32/LogFiles/W3SVC1/ex%YY%MM%DD.log"
LogFile="/var/log/httpd/access_log"
# Put here your log format (it depends on your web server).
# Possible values:
# 1 - Apache combined log format
# 2 - IIS extended W3C log format
#
# for e-smith 1 must be used, awstats-run converts the e-mith combined_virtual to combined
LogFormat=1
# Set this to a directory where you want AWStats to save its working files.
# Need write permissions by web server user (user "nobody" with Unix OS).
# Example: "/tmp"
# Example: "../data"
# Example: "C:/awstats_working_dir"
# Default: "." (means same directory as awstats.pl)
DirData="/home/e-smith/files/users/admin/home/awstats"
# Relative or absolute web URL of your awstats.pl directory.
# Used only when AWStats is used from command line.
# Default: "/cgi-bin" (means awstats.pl is in "/mywwwroot/cgi-bin")
#
DirCgi="/cgi-bin"
# Relative or absolute web URL of all icons subdirectories.
# Default: "/icon" (means you must copy icon directories in "/mywwwroot/icon")
#
DirIcons="../../awstats"
# "SiteDomain" must contain the main domain name or the main intranet web
# server name used to reach the web site.
# If you share the same log file for several virtual web servers, this
# parameter is used to tell AWStats to filter record that contains records for
# this virtual host name only (So check that this virtual hostname can be
# found in your log file and use a personalized log format that include the
# %virtualname tag).
# But for multi hosting a better solution is to have one log file for each
# virtual web server. In this case, this parameter is only used to generate
# full URL's links when ShowLinksOnUrl option is set to 1.
# Example: "www.mydomain.com"
# Example: "user.mydomain.com"
# Example: "myintranetserver"
#
{
use warnings;
use esmith::ConfigDB;
my $configDB = esmith::ConfigDB->open or die("can't open Config DB");
my $domain = $configDB->get( 'DomainName' )->value;
$OUT = "SiteDomain=\"www." . $domain . "\"";
}
# If you want to have hosts reported by name instead of ip address, AWStats
# need to make reverse DNS lookups (if not already done in your log file).
# With DNSLookup to 0, all hosts will be reported by their IP addresses and
# not by the full hostname of visitors.
# If you want to set DNSLookup to 1, don't forget that this will reduce
# dramatically AWStats update process speed. Do not use on large web sites.
# Note: Reverse DNS lookup is done on IPv4 only.
# Note: Country detection can works without reverse DNS lookup if plugin
# 'geoip' is enabled (faster and more accurate than reverse DNS lookup).
# Possible values:
# 0 - No DNS Lookup
# 1 - DNS Lookup is fully enabled
# 2 - DNS Lookup is made only from DNS cache files (if exist)
# Default: 2
#
DNSLookup=1
# AWStats can purge log after processing it. By this way, the next time you
# launch AWStats, log file will be smaller and processing time will be better.
# IMPORTANT !!!
# AWStats is able to detect new lines in log files, to process only new lines,
# so you can launch it as soon as you want, even with this parameter set to 0.
# This parameter doesn't work with IIS (This web server doesn't let its log
# file to be purged).
# The purge of the log file is made only when awstats is runned so you must
# keep your standard scheduler/crontab to purge your log file frequently.
# Possible values: 1 or 0
# Default: 0 (but if you can, set this to 1 to increase speed)
#
# must set to 0 for AWStats on e-smith. DO NO PLAY WITH THIS OPTION
PurgeLogFile=0
# When PurgeLogFile is setup to 1, AWStats will clean your log file after
# processing it. You can however keep an archive file (saved in "DirData") of
# all processed log records by setting this to 1 (For example if you want to
# use another log analyzer).
# This parameter is not used if PurgeLogFile=0
# Possible values: 1 or 0
# Default: 0
#
ArchiveLogRecords=0
#extra config for 6.3
AllowFullYearView=3
# Optionnal setup section (Not required but increase AWStats features)
#------------------------------------------------------------------------
# Set your primary language.
# Possible value:
# 0=English, 1=French, 2=Dutch, 3=Spanish, 4=Italian, 5=German
# 6=Polish, 7=Greek, 8=Czech, 9=Portuguese
# Default: 0
#
Lang=0
# Index page name for your web server.
# Example: "default.htm"
# Default: "index.html"
#
DefaultFile="index.html"
### SkipHosts=
# Do not include access from clients that match following IP address.
# You can also put partial host names but this requires that reverse DNS
# lookup is already done in your server log file.
# Use space between each value and put a backslash before each dot.
# Example: "55\.55\.55\.55 222\.222\.222\.222 abcxyz"
# Default: ""
#
### HostAliases=
# Put here all possible domain names, addresses or virtual host aliases
# someone can use to access your site. Try to keep only the minimum number of
# possible names/adresses to have the best performances.
# Use space between each value and put a backslash before each dot.
# This parameter is used to analyze referer field in log file and to help
# AWStats to know if a referer URL is a local URL of same site or an URL of
# another site.
# Example: "www\.myserver\.com x\.y\.z\.w localhost 127\.0\.0\.1"
#
{
###############################################################
# SkipHosts
# This section could probably be cleaned up/made faster
sub mip ($$);
use warnings;
use esmith::ConfigDB;
my $configDB = esmith::ConfigDB->open or die("can't open Config DB");
my $networkDB = esmith::ConfigDB->open('networks') or die("can't open Networks DB");
my $skipHosts = $configDB->get_prop( "AWStats", "SkipHosts" ) || '';
my $allIPs = "";
$OUT = "SkipHosts=\"";
# local IP
#
my $localip = $configDB->get_prop( 'InternalInterface', 'IPAddress' );
my $localnetmask = $configDB->get_prop( 'InternalInterface', 'Netmask' );
my $ipskipLocalIP = $configDB->get_prop( "AWStats", "SkipLocalIP" );
if ( defined $ipskipLocalIP && $ipskipLocalIP ne "no" ) { # in Beta1 SkipLocalIP="mask" was possible
my $return = mip( $localip, $localnetmask );
$allIPs .= "REGEX[^$return] ";
}
# local networks
#
my $ipskipLocalNet = $configDB->get_prop( "AWStats", "SkipLocalNetworks" );
if ( defined $ipskipLocalNet && $ipskipLocalNet eq "yes" ) {
my @networks = $networkDB->keys;
foreach my $network (@networks) {
my $type = $networkDB->get_prop( $network, 'type' );
my $system = $networkDB->get_prop( $network, 'SystemLocalNetwork' ) || '';
if ( $type eq 'network' && $system ne 'yes') {
my $properties = $networkDB->get_prop( $network, 'Mask' );
my $return = mip( $network, $properties );
$allIPs .= "REGEX[^$return] ";
}
}
}
# Escape full stops e.g. \.co\.uk ; for REGEX only
$allIPs =~ s/\./\\./g;
# external IP
#
my $externalstatus = $configDB->get_prop( 'ExternalInterface', 'Configuration' ) || 'disabled';
my $externalip = $configDB->get_prop( 'ExternalInterface', 'IPAddress' ) || '';
my $externalnetmask = $configDB->get_prop( 'ExternalInterface', 'Netmask' ) || '';
if ( $externalstatus ne 'disabled' ) {
my $ipskipExtIP = $configDB->get_prop( "AWStats", "SkipExternalIP" );
# If Skip ExternalIP is set to mask
if ( defined $ipskipExtIP && $ipskipExtIP eq "mask" ) {
my $return = mip( $externalip, $externalnetmask );
#Escape full stops e.g. \.co\.uk ; for REGEX only
$return =~ s/\./\\./g;
$allIPs .= "REGEX[^$return] ";
}
# If Skip ExternalIP is set to yes then just specific IP
elsif ( defined $ipskipExtIP && $ipskipExtIP eq "yes" ) {
$allIPs .= "$externalip ";
}
}
$OUT .= "127.0.0.1 $skipHosts $allIPs";
$OUT .= '"' . "\n";
###############################################################
# HostAliases
my $domainsDB = esmith::ConfigDB->open('domains') or die("can't open Domains DB");
$OUT .= 'HostAliases="localhost 127.0.0.1';
# push( @aliases, $DynDnsHostname ) if defined $DynDnsHostname;
# Need to find DynDnsHostname if it exists
my @domains = $domainsDB->keys;
foreach (@domains) {
# Escape full stops e.g. \.co\.uk
s/\./\\./g;
$OUT .= " REGEX[$_\$]";
}
# needed for IE6 beta
if ( defined $ipskipExtIP && $ipskipExtIP eq "mask" ) {
$externalip = mip( $externalip, $externalnetmask );
#$externalip =~ s/\./\\./g;
$OUT .= " " . $externalip;
}
elsif ( defined $ipskipExtIP && $ipskipExtIP eq "yes" ) {
#$externalip =~ s/\./\\./g;
$OUT .= " " . $externalip;
}
# Close the HostAliases line
$OUT .= '"' . "\n";
###############################################################
sub mip ($$) {
my ( $ip, $msk ) = @_;
( my @mask ) = split( "[\.]", $msk );
my $i;
# AWStats connot handle non-standard netmasks!
for ( $i = 0; $i < 4; $i++ ) {
if ( $mask[$i] ne "255" ) {
if ( $i == 1 ) {
$ip =~ s/[0-9]*\.[0-9]*\.[0-9]*$//;
}
elsif ( $i == 2 ) {
$ip =~ s/[0-9]*\.[0-9]*$//;
}
elsif ( $i == 3 ) {
$ip =~ s/[0-9]*$//;
}
last;
}
}
return $ip;
}
}
# Do not include access to URLs that match following entries.
# If you don't want to include users homepage in your stats, add "/~".
# You can also, if you want, add list of not important frame pages (like
# menus, etc...) to exclude them from statistics.
# Use space between each value and put a backslash before each dot.
# Do not remove default values.
# Example: "\.css \.js \.class robots\.txt dir/badpage\.html /~"
# Default: "\.css \.js \.class robots\.txt"
#
SkipFiles="\.css \.js \.class"
# Include in stats, only accesses from hosts that match one of following
# entries. For example, if you want AWStats to filter access to keep only
# stats for visits from particular hosts, you can add thoose hosts names
# in this parameter.
# If DNS lookup is already done in your log file, you must enter here hostname
# criteria, else enter ip address criteria.
# The opposite parameter of "OnlyHosts" is "SkipHosts".
# Note: This parameter is not case sensitive.
# Note: Use space between each value.
# Note: ^xxx means hosts starting with xxx.
# Note: xxx$ means hosts ending with xxx.
# Example: "^123.123.123.123$ ^10.0."
# Default: ""
#
OnlyHosts=""
# Include in stats, only accesses to URLs that match one of following entries.
# For example, if you want AWStats to filter access to keep only stats that
# match a particular string, like a particular directory, you can add this
# directory name in this parameter.
# The opposite parameter of "OnlyFiles" is "SkipFiles".
# Note: This parameter is not case sensitive.
# Note: Use space between each value and do not remove default values
# Note: ^xxx means url starting with xxx.
# Note: xxx$ means url ending with xxx.
# Example: "marketing_directory"
# Default: ""
#
OnlyFiles=""
# Add here a list of kind of url (file extension) that must be counted as
# "Hit only" and not as a "Hit" and "Page/Download". You can set here all
# images extensions as they are hit downloaded that must be counted but they
# are not viewed pages. URLs with such extensions are not included in the TOP
# Pages/URL report.
# Note: If you want to exclude your own URLs from stats (No Pages and no Hits
# reported), you should use SkipFiles parameter instead.
# Example: ""
# Example: "css js class gif jpg jpeg png bmp zip arj gz z wav mp3 wma mpg"
# Default: "css js class gif jpg jpeg png bmp"
#
NotPageList="css js class gif jpg jpeg png bmp"
# By default, AWStats considers that records found in web log file are
# successful hits if HTTP code returned by server is a valid HTTP code (200
# and 304). Any other code are reported in HTTP error chart.
# However in some specific environment, with web server HTTP redirection,
# you can choose to also accept other codes.
# Example: "200 304 302 305"
# Default: "200 304"
#
ValidHTTPCodes="200 304"
# By default, AWStats considers that records found in mail log file are
# successful mail transfers if code saved in log file is a valid code (1 for
# sendmail, 0 for postfix).
# Example: "1"
# Example: "0"
# Default: "1"
#
ValidSMTPCodes="1"
# Some web servers on some Operating systems (IIS-Windows) considers that two
# URLs with same value but different case are the same URL. To tell AWStats to
# also considers them as one, set this parameter to 1.
# Possible values: 0 or 1
# Default: 0
#
URLNotCaseSensitive=0
# In URL links, "?" char is used to add parameter's list in URLs. Syntax is:
# /mypage.html?param1=value1
# However, some servers/sites have also others chars to isolate dynamic part of
# their URLs. You can complete this list with all such characters.
# Example: "?;,"
# Default: "?;"
#
URLQuerySeparators="?;"
# Keep or remove the query string to the URL in the statistics for individual
# pages. This is primarily used to differentiate between the URLs of dynamic
# pages. If set to 1, mypage.html?id=x and mypage.html?id=y are counted as two
# different pages.
# Warning, when set to 1, memory required to run AWStats is dramatically
# increased if you have a lot of changing URLs (for example URLs with a random
# id inside). Such web sites should not set this option to 1 or use seriously
# the next parameter URLWithQueryWithoutFollowingParameters.
# Possible values:
# 0 - URLs are cleaned from the query string (ie: "/mypage.html")
# 1 - Full URL with query string is used (ie: "/mypage.html?p=x&q=y")
# Default: 0
#
URLWithQuery=1
# When URLWithQuery is on, you will get the full URL with all parameters in
# URL reports. But among thoose parameters, sometimes you don't need a
# particular parameter because it does not identify the page or because it's
# a random ID changing for each access even if URL points to same page. In
# such cases, it is higly recommanded to ask AWStats to remove such parameters
# from the URL before counting, manipulating and storing it. Enter here list
# of all non wanted parameters. For example if you enter "id", one hit on
# /mypage.cgi?p=abc&id=Yo4UomP9d and /mypage.cgi?p=abc&id=Mu8fdxl3r
# will be reported as 2 hits on /mypage.cgi?p=abc
# This parameter is not used when URLWithQuery is 0.
# Example: "PHPSESSID jsessionid"
# Default: ""
#
URLWithQueryWithoutFollowingParameters=""
# Keep or remove the query string to the referrer URL in the statistics for
# external referrer pages. This is used to differentiate between the URLs of
# dynamic referrer pages. If set to 1, mypage.html?id=x and mypage.html?id=y
# are counted as two different referrer pages.
# Possible values:
# 0 - Referrer URLs are cleaned from the query string (ie: "/mypage.html")
# 1 - Full URL with query string is used (ie: "/mypage.html?p=x&q=y")
# Default: 0
#
URLReferrerWithQuery=0
# AWStats can detect setup problems or show you important informations to have
# a better use. Keep this to 1, except if AWStats says you can change it.
# Possible values: 0 or 1
# Default: 1
#
WarningMessages=1
# When an error occurs, AWStats output a message related to errors. If you
# want (in most cases for security reasons) to have no error messages, you
# can set this parameter to your personalized generic message.
# Example: "An error occured. Contact your Administrator"
# Default: ""
#
ErrorMessages=""
# AWStat can be run with debug=x parameter to ouput various informations
# to help in debugging or solving troubles. If you wand (in most cases for
# security reasons) to disable debugging, set this parameter to 0.
# Possible values: 0 or 1
# Default: 1
#
DebugMessages=1
# To help you to detect if your log format is good, AWStats report an error
# if all the first NbOfLinesForCorruptedLog lines have a format that does not
# match the LogFormat parameter.
# However, some worm virus attack on your web server can result in a very high
# number of corrupted lines in your log. So if you experience awstats stop
# because of bad virus records at the beginning of your log file, you can
# increase this parameter (very rare).
# Default: 50
#
NbOfLinesForCorruptedLog=50
# For some particular integration needs, you may want to have CGI links to
# point to another script than awstats.pl.
# Use the name of this script in WrapperScript parameter.
# Example: "awstatslauncher.pl"
# Default: ""
#
WrapperScript=""
# DecodeUA must be set to 1 if you use Roxen web server. This server converts
# all spaces in user agent field into %20. This make the AWStats robots, os
# and browsers detection fail in some cases. Just change it to 1 if and only
# if your web server is Roxen.
# Possible values: 0 or 1
# Default: 0
#
DecodeUA=0
#-----------------------------------------------------------------------------
# OPTIONAL ACCURACY SETUP SECTION (Not required but increase AWStats features)
#-----------------------------------------------------------------------------
# Following values allows you to disable/enable some AWStats features.
# Possible values: 0, 1 (or 2 for LevelForRobotsDetection)
# Default: 1 (2 for LevelForRobotsDetection)
#
LevelForRobotsDetection=2 # 0 will increase AWStats speed by 1%.
LevelForBrowsersDetection=1 # 0 disables Browsers detection. No speed gain.
LevelForOSDetection=1 # 0 disables OS detection. No speed gain.
LevelForRefererAnalyze=1 # 0 will increase AWStats speed by 5%.
#-----------------------------------------------------------------------------
# OPTIONAL APPEARANCE SETUP SECTION (Not required but increase AWStats features)
#-----------------------------------------------------------------------------
# When you use AWStats as a CGI, you can have the reports shown in HTML frames.
# Frames are only available for report viewed dynamically. When you build
# pages from command line, this option is not used and no frames are built.
# Possible values: 0 or 1
# Default: 0
#
{
$frames = $AWStats{UseFramesWhenCGI};
$OUT = "UseFramesWhenCGI=" . ( $frames ne "yes" ? 0 : 1 ) . "\n";
}
# This parameter ask your browser to open detailed reports into a different
# window than the main page.
# Possible values:
# 0 - Open all in same browser window
# 1 - Open detailed reports in another window except if using frames
# 2 - Open always in a different window even if reports are framed
# Default: 1
#
DetailedReportsOnNewWindows=1
# You can add in the HTML report page a delay to force browsers to not use cache
# if page is loaded a second time after this delay (in seconds).
# This parameter is not used when report are built with -staticlinks option.
# Example: 3600
# Default: 0
#
Expires=0
# To avoid too large web pages, you can ask AWStats to limit number of rows of
# all reported charts to this number when no other limit apply.
# Default: 1000
#
MaxRowsInHTMLOutput=1000
# Each URL shown in stats page are links you can click.
# Possible values: 1 or 0
# Default: 1
#
# 0 is recommended for e-smith, since AWStats is invoked over port 980.
# clickable URL are rooted to http://yourdomain.tld:980/, which won't work
#
ShowLinksOnUrl=1
# Flags with link to other languages translation are visible.
# Possible values: 1 or 0
# Default: 1
#
# e-smith: lanuage option offered in the configuration panel
ShowFlagLinks=""
# Search engines keywords reported are full search string or separate keywords
# Possible values:
# 0 - Search keywords reported are full search string (ie: "town maps")
# r - Search keywords reported are separated words (ie: "town" and "maps")
# Default: 0
#
SplitSearchString=0
# You can put here HTML code that will be added at the end of AWStats reports.
# Great to add advert ban.
# Default: ""
#
HTMLEndSection="<table border=0 cellpadding=3 cellspacing=0><tr><td valign=center><font size=-1>contributed rpm by neddix.de dungog.net</font></td></tr></table>"
# Value of maximum bar width/heigth for horizontal/vertical graphics bar
# Default: 260/220
#
{
$BarSize = $AWStats{BarSize};
if ( $BarSize eq "small" ) {
$OUT = "BarWidth = 160\nBarHeight = 120\n";
}
elsif ( $BarSize eq "large" ) {
$OUT = "BarWidth = 360\nBarHeight = 320\n";
}
else {
$OUT = "BarWidth = 260\nBarHeight = 220\n";
}
}
# This value can be used to choose maximum number of lines shown for each
# particular reporting.
#
# Stats by domains
# NO checks made for these SME keys !!!
{
$OUT = '';
$OUT .= "MaxNbOfDomain= " . $AWStats{MaxNbOfDomain} . "\n";
$OUT .= "MaxNbOfHostsShown= " . $AWStats{MaxNbOfHostsShown} . "\n";
$OUT .= "MinHitHost= " . $AWStats{MinHitHost} . "\n";
$OUT .= "MaxNbOfRobotShown= " . $AWStats{MaxNbOfRobotShown} . "\n";
$OUT .= "MinHitRobot= " . $AWStats{MinHitRobot} . "\n";
$OUT .= "MaxNbOfPageShown= " . $AWStats{MaxNbOfPageShown} . "\n";
$OUT .= "MinHitFile= " . $AWStats{MinHitFile} . "\n";
$OUT .= "MaxNbOfRefererShown= " . $AWStats{MaxNbOfRefererShown} . "\n";
$OUT .= "MinHitRefer= " . $AWStats{MinHitRefer} . "\n";
$OUT .= "MaxNbOfKeywordsShown= " . $AWStats{MaxNbOfKeywordsShown} . "\n";
$OUT .= "MinHitKeyword= " . $AWStats{MinHitKeyword} . "\n";
}
# You choose here which reports you want to see in the main page and what you
# want to see in those reports.
# Possible values:
# 0 - Topic is not shown at all
# 1 - Report is shown with default informations
# XYZ - Report is shown with only informations defined by code X,Y,Z
# X,Y,Z are code letters among the following:
# U = Unique visitors
# V = Visits
# P = Number of pages
# H = Number of hits
# B = Bandwith
# L = Last access date
# E = Entry pages
# X = Exit pages
# C = Web compression (mod_gzip)
# M = Average mail size (mail logs)
#
# Show AWStats head title and icon
# Default: 1, Possible codes: None
ShowHeader=0
# Show menu header with links on detailed reports
# Default: 1, Possible codes: None
ShowMenu=1
# Show monthly and daily chart
# Default: UVPHB, Possible codes: UVPHB
ShowMonthDayStats=UVPHB
# Show days of week chart
# Default: PHB, Possible codes: PHB
ShowDaysOfWeekStats=PHB
# Show hourly chart
# Default: PHB, Possible codes: PHB
ShowHoursStats=PHB
# Show domains/country chart
# Default: PHB, Possible codes: PHB
ShowDomainsStats=PHB
# Show hosts chart
# Default: PHBL, Possible codes: PHBL
ShowHostsStats=PHBL
# Show authenticated users chart
# Default: 0, Possible codes: PHBL
ShowAuthenticatedUsers=1
# Show robots chart
# Default: HBL, Possible codes: HBL
ShowRobotsStats=HBL
# Show EMail senders chart (For use when analyzing mail log files)
# Default: 0, Possible codes: HBML
ShowEMailSenders=0
# Show EMail receiver chart (For use when analyzing mail log files)
# Default: 0, Possible codes: HBML
ShowEMailReceivers=0
# Show session chart
# Default: 1, Possible codes: None
ShowSessionsStats=1
# Show pages-url chart.
# Default: PBEX, Possible codes: PBEX
ShowPagesStats=PBEX
# Show file types chart.
# Default: HB, Possible codes: HBC
ShowFileTypesStats=HBC
# Show file size chart (Not yet available)
# Default: 1, Possible codes: None
ShowFileSizesStats=0
# Show browsers chart
# Default: 1, Possible codes: None
ShowBrowsersStats=1
# Show Operating systems chart
# Default: 1, Possible codes: None
ShowOSStats=1
# Show Origin chart
# Default: PH, Possible codes: PH
ShowOriginStats=PH
# Show keyphrases chart
# Default: 1, Possible codes: None
ShowKeyphrasesStats=1
# Show keywords chart
# Default: 1, Possible codes: None
ShowKeywordsStats=1
# Show HTTP errors chart
# Default: 1, Possible codes: None
ShowHTTPErrorsStats=1
# You can set this to use your own logo.
# Logo file must be in $DirIcons/other directory
# Default: "awstats_logo1.png"
#
Logo="awstats_logo1.png"
# Colors used on AWStats report page.
# Example: color_name="RRGGBB" # RRGGBB is RedGreenBlue components in Hex
#
color_TableBGTitle="CCCCDD" # Background color for table title (Default = "CCCCDD")
color_TableTitle="000000" # Table title font color (Default = "000000")
color_TableBG="CCCCDD" # Background color for table (Default = "CCCCDD")
color_TableRowTitle="FFFFFF" # Table row title font color (Default = "FFFFFF")
color_TableBGRowTitle="ECECEC" # Background color for row title (Default = "ECECEC")
color_TableBorder="ECECEC" # Table border color (Default = "ECECEC")
color_text="000000" # Color of main body text (Default = "000000")
color_titletext="000000" # Color of text title within colored Title Rows (Default = "000000")
color_weekend="EAEAEA" # Color for week-end days
color_link="0011BB" # Color of HTML links (Default = "0011BB")
color_hover="605040" # Color of HTML on-mouseover links (Default = "605040")
color_v="F3F300" # Background color for number of visites (Default = "F3F300")
color_w="FF9933" # Background color for number of unique visitors (Default = "FF9933")
color_p="4477DD" # Background color for number of pages (Default = "4477DD")
color_h="66F0FF" # Background color for number of hits (Default = "66F0FF")
color_k="339944" # Background color for number of bytes (Default = "339944")
color_s="8888DD" # Background color for number of search (Default = "8888DD")
# Set here the link used to point to Internet WhoIs database for hostnames.
# This parameter is not used if plugin hostinfo is not enabled.
# Default: "http://www.whois.net/search.cgi2?str="
# Example: "http://www.ripe.net/perl/whois?form_type=simple&searchtext="
# Example: "http://ws.arin.net/cgi-bin/whois.pl?queryinput="
#
LinksToWhoIs="http://www.whois.net/search.cgi2?query_type=right&str="
# Set here the link used to point to Internet WhoIs database for ip addresses.
# This parameter is not used if plugin hostinfo is not enabled.
# Default: "http://ws.arin.net/cgi-bin/whois.pl?queryinput="
# Example: "http://ws.arin.net/cgi-bin/whois.pl?queryinput="
#
LinksToIPWhoIs="http://ws.arin.net/cgi-bin/whois.pl?queryinput="
#-----------------------------------------------------------------------------
# PLUGINS
#-----------------------------------------------------------------------------
# Add here all plugins file you want to load.
# Plugin files must be .pm files stored in 'plugins' directory.
# Uncomment LoadPlugin lines to enable a plugin after checking that perl
# modules required by the plugin are installed.
# Plugin: Tooltips
# Perl modules required: None
# Add some tooltips help on HTML report pages.
# Note that enabled this kind of help will increased HTML report pages size,
# so server load and bandwidth.
#
#LoadPlugin="tooltips"
# Plugin: IPv6
# Perl modules required: Net::IP and Net::DNS
# This plugin gives AWStats capability to make reverse DNS lookup on IPv6
# addresses.
# Note: If you are interesting in having country report, you should use the
# geoipfree or geoip plugin instead of enabled reverse DNS lookup.
#
#LoadPlugin="ipv6"
# Plugin: HashFiles
# Perl modules required: Storable
# AWStats DNS cache files are read/saved as native hash files. This increase
# DNS cache files loading speed, above all for very large web sites.
#
#LoadPlugin="hashfiles"
# Plugin: GeoIPfree
# Perl modules required: Geo::IPfree version 0.2+ (from Graciliano M.P.)
# Country chart is built from an Internet IP-Country database.
# This plugin is useless for intranet only log files.
# Note: You must choose between using this plugin (need Perl Geo::IPfree module)
# or the GeoIP plugin (need Perl Geo::IP module from Maxmind).
# This plugin reduces AWStats speed of 10% !
#
#LoadPlugin="geoipfree"
# Plugin: GeoIP
# Perl modules required: Geo::IP or Geo::IP::PurePerl (from Maxmind)
# Country chart is built from an Internet IP-Country database.
# This plugin is useless for intranet only log files.
# Note: You must choose between using this plugin (need Perl Geo::IP module
# from Maxmind) or the GeoIPfree plugin (need Perl Geo::IPfree module).
# This plugin reduces AWStats speed of 10% !
#
#LoadPlugin="geoip"
# Plugin: UserInfo
# Perl modules required: None
# Add a text (Firtname, Lastname, Office Department, ...) in authenticated user
# reports for each login value.
# A text file called userinfo.myconfig.txt, with two fields (first is login,
# second is text to show) separated by a tab char. must be created in plugins
# directory.
#
#LoadPlugin="userinfo"
# Plugin: HostInfo
# Perl modules required: None
# Add a column into host chart with a clickable link to a popup that show WhoIs
# info, on a popup window.
#
{
my $hostinfo = $AWStats{Hostinfo};
if ( defined $hostinfo && $hostinfo eq "yes" ) {
$OUT = "LoadPlugin=\"hostinfo\"\n";
}
}
# Plugin: UrlAliases
# Perl modules required: None
# Add a text (Page title, description...) in URL reports after URL value.
# A text file called urlalias.myconfig.txt, with two fields (first is URL,
# second is text to show) separated by a tab char. must be created in plugins
# directory.
#
#LoadPlugin="urlalias"
# Plugin: TimeHiRes
# Perl modules required: Time::HiRes
# Time reported by -showsteps option is in millisecond. For debug purpose.
#
#LoadPlugin="timehires"
# Plugin: TimeZone
# Perl modules required: Time::Local
# Allow AWStats to correct a bad timezone for user of some IIS that use
# GMT date in its log instead of local server time.
# This module is useless for Apache and most IIS version.
# This plugin reduces AWStats speed of 40% !!!!!!!
#
#LoadPlugin="timezone +2"
# Plugin: Rawlog
# Perl modules required: None
# This plugin adds a form in AWStats main page to allow users to see raw
# content of current log files. A filter is also available.
#
{
my $rawlog = $AWStats{Rawlog};
if ( defined $rawlog && $rawlog eq "yes" ) {
$OUT = "LoadPlugin=\"rawlog\"\n";
}
}
# Plugin: Graph3D
# Perl modules required: None
# Supported charts are built by a nice 3D graphic applet.
#
#LoadPlugin="graph3d" # !!! NOT YET AVAILABLE !!!
#-----------------------------------------------------------------------------
# EXTRA SECTION
#-----------------------------------------------------------------------------
# WARNING: Extra sections are experimental feature not stable yet !!!
# You can define your own charts, you choose here what are rows and columns
# keys. This feature is particularly usefull for marketing purpose, tracking
# products orders for example.
# For this, edit all parameters of Extra section. Each set of parameter is a
# different chart. For several charts, duplicate section changing the number.
# Note that each Extra section reduces AWStats speed by 10%.
#
# WARNING: A wrong setup of Extra section can result in a too large arrays
# that will consume all your memory, making AWStats unusable after several
# updates, so be sure to setup it correctly.
# In most cases, you don't need this feature.
#
# ExtraSectionNameX is title of your personalized chart.
# ExtraSectionConditionalX are conditions on URL and/or QUERY_STRING and/or
# REFERER you can use to count or not the hit. Use "|" for "OR".
# ExtraSectionFirstColumnTitleX is the first column title of the chart.
# ExtraSectionFirstColumnValuesX is a Regex string to tell AWStats how to
# extract the value used for first column. Each different value found will
# be a different row. Be sure that list of different values is "limited" to
# avoid "not enough memory" problems !
# ExtraSectionStatTypesX are things you want to count. You can use standard
# code letters (P for pages,H for hits,B for bandwidth,L for last access).
# MaxNbOfExtraX is maximum number of rows shown in chart.
# MinHitExtraX is minimum number of hits required to be shown in chart.
#
# Example to report the 20 products the most ordered by "order.cgi" script
#ExtraSectionName1="Product orders"
#ExtraSectionCondition1="URL,/cgi-bin/order.cgi"
#ExtraSectionFirstColumnTitle1="Product ID"
#ExtraSectionFirstColumnValues1="QUERY_STRING,productid=([^&]+)"
#ExtraSectionStatTypes1=PL
#MaxNbOfExtra1=20
#MinHitExtra1=1
#-----------------------------------------------------------------------------
# INCLUDES
#-----------------------------------------------------------------------------
# You can include other config files using the directive with the name of the
# config file (like Apache, so you must keep the '#' before 'include').
# This is particularly usefull for users who have a lot of virtual servers, so
# a lot of config files and want to maintain common values in only one file.
# Note that when a variable is defined both in a config file and in an
# included file, AWStats will use the last value read.
#
#include ""

View File

@ -0,0 +1,56 @@
{
# ftp : proftpd
use warnings;
use esmith::ConfigDB;
my $configDB = esmith::ConfigDB->open or die("can't open Config DB");
my $domain = $configDB->get( 'DomainName' )->value;
my $DNREG = ($domain =~ s|\.|\\.|r);
$OUT =<<HERE
LogFile="/var/log/xferlog"
LogType=F
LogFormat="%time3 %other %host %bytesd %url %other %other %method %other %logname %other %code %other %other"
LogSeparator="\\s"
NotPageList=""
SiteDomain="ftp.$domain"
HostAliases="localhost 127.0.0.1 REGEX[${DNREG}\$]"
LevelForBrowsersDetection=0
LevelForOSDetection=0
LevelForRefererAnalyze=0
LevelForRobotsDetection=0
LevelForWormsDetection=0
LevelForSearchEnginesDetection=0
UseFramesWhenCGI=0
#DirData="/home/e-smith/awstats"
DirData="/home/e-smith/files/users/admin/home/awstats"
DirCgi="/cgi-bin"
DirIcons="../../awstats"
ShowLinksOnUrl=0
ShowMenu=1
ShowSummary=UVHB
ShowMonthStats=UVHB
ShowDaysOfMonthStats=HB
ShowDaysOfWeekStats=HB
ShowHoursStats=HB
ShowDomainsStats=HB
ShowHostsStats=HBL
ShowAuthenticatedUsers=HBL
ShowRobotsStats=0
ShowEMailSenders=0
ShowEMailReceivers=0
ShowSessionsStats=1
ShowPagesStats=PBEX
ShowFileTypesStats=HB
ShowFileSizesStats=0
ShowBrowsersStats=0
ShowOSStats=0
ShowOriginStats=0
ShowKeyphrasesStats=0
ShowKeywordsStats=0
ShowMiscStats=0
ShowHTTPErrorsStats=0
ShowSMTPErrorsStats=0
HERE
}

View File

@ -0,0 +1,174 @@
{
############################
# Config file for Qmail
############################
use warnings;
use esmith::ConfigDB;
my $configDB = esmith::ConfigDB->open or die("can't open Config DB");
my $domain = $configDB->get( 'DomainName' )->value;
my $DNREG = ($domain =~ s|\.|\\.|r);
$OUT =<<HERE
#LogFile="/home/e-smith/awstats/qmail-preprocessor.sh|"
LogFile="/etc/e-smith/web/panels/manager/cgi-bin/.awstats/qmail-preprocessor.sh|"
LogType=M
LogFormat="%time2 %email %email_r %host %host_r %method %url %code %bytesd"
LogSeparator=" "
SiteDomain="mail.$domain"
HostAliases="localhost 127.0.0.1 REGEX[${DNREG}\$]"
DNSLookup=2
#DirData="/home/e-smith/awstats"
DirData="/home/e-smith/files/users/admin/home/awstats"
DirCgi="/cgi-bin"
DirIcons="../../awstats"
UseFramesWhenCGI=0
AllowToUpdateStatsFromBrowser=0
AllowFullYearView=3
EnableLockForUpdate=0
DNSStaticCacheFile="dnscache.txt"
DNSLastUpdateCacheFile="dnscachelastupdate.txt"
SkipDNSLookupFor=""
AllowAccessFromWebToAuthenticatedUsersOnly=0
AllowAccessFromWebToFollowingAuthenticatedUsers=""
AllowAccessFromWebToFollowingIPAddresses=""
CreateDirDataIfNotExists=0
BuildHistoryFormat=text
BuildReportFormat=html
SaveDatabaseFilesWithPermissionsForEveryone=0
PurgeLogFile=0
ArchiveLogRecords=0
KeepBackupOfHistoricFiles=0
DefaultFile="index.html"
SkipHosts=""
SkipUserAgents=""
SkipFiles=""
SkipReferrersBlackList=""
OnlyHosts=""
OnlyUserAgents=""
OnlyFiles=""
NotPageList="css js class gif jpg jpeg png bmp ico swf"
ValidHTTPCodes="200 304"
ValidSMTPCodes="1 250"
AuthenticatedUsersNotCaseSensitive=0
URLNotCaseSensitive=0
URLWithAnchor=0
URLQuerySeparators="?;"
URLWithQuery=0
URLWithQueryWithOnlyFollowingParameters=""
URLWithQueryWithoutFollowingParameters=""
URLReferrerWithQuery=0
WarningMessages=1
ErrorMessages=""
DebugMessages=0
NbOfLinesForCorruptedLog=50
WrapperScript=""
DecodeUA=0
MiscTrackerUrl="/js/awstats_misc_tracker.js"
LevelForBrowsersDetection=2
LevelForOSDetection=2
LevelForRefererAnalyze=2
LevelForRobotsDetection=2
LevelForSearchEnginesDetection=2
LevelForKeywordsDetection=2
LevelForFileTypesDetection=2
LevelForWormsDetection=0
DetailedReportsOnNewWindows=1
Expires=0
MaxRowsInHTMLOutput=1000
Lang="auto"
DirLang="./lang"
ShowMenu=1
ShowSummary=HBM
ShowMonthStats=HBM
ShowDaysOfMonthStats=HBM
ShowDaysOfWeekStats=HBM
ShowHoursStats=HBM
ShowDomainsStats=0
ShowHostsStats=HBL
ShowAuthenticatedUsers=0
ShowRobotsStats=0
ShowWormsStats=0
ShowEMailSenders=HBML
ShowEMailReceivers=HBML
ShowSessionsStats=0
ShowPagesStats=0
ShowFileTypesStats=0
ShowFileSizesStats=0
ShowOSStats=0
ShowBrowsersStats=0
ShowScreenSizeStats=0
ShowOriginStats=0
ShowKeyphrasesStats=0
ShowKeywordsStats=0
ShowMiscStats=0
ShowHTTPErrorsStats=0
ShowSMTPErrorsStats=1
ShowClusterStats=0
AddDataArrayMonthStats=1
AddDataArrayShowDaysOfMonthStats=1
AddDataArrayShowDaysOfWeekStats=1
AddDataArrayShowHoursStats=1
IncludeInternalLinksInOriginSection=0
MaxNbOfDomain = 10
MinHitDomain = 1
MaxNbOfHostsShown = 10
MinHitHost = 1
MaxNbOfLoginShown = 10
MinHitLogin = 1
MaxNbOfRobotShown = 10
MinHitRobot = 1
MaxNbOfPageShown = 10
MinHitFile = 1
MaxNbOfOsShown = 10
MinHitOs = 1
MaxNbOfBrowsersShown = 10
MinHitBrowser = 1
MaxNbOfScreenSizesShown = 5
MinHitScreenSize = 1
MaxNbOfWindowSizesShown = 5
MinHitWindowSize = 1
MaxNbOfRefererShown = 10
MinHitRefer = 1
MaxNbOfKeyphrasesShown = 10
MinHitKeyphrase = 1
MaxNbOfKeywordsShown = 10
MinHitKeyword = 1
MaxNbOfEMailsShown = 20
MinHitEMail = 1
FirstDayOfWeek=1
ShowFlagLinks=""
ShowLinksOnUrl=1
UseHTTPSLinkForUrl=""
MaxLengthOfShownURL=64
HTMLHeadSection=""
HTMLEndSection=""
Logo="awstats_logo6.png"
LogoLink="awstats.pl?config=mail"
BarWidth = 260
BarHeight = 90
StyleSheet=""
color_Background="FFFFFF"
color_TableBGTitle="CCCCDD"
color_TableTitle="000000"
color_TableBG="CCCCDD"
color_TableRowTitle="FFFFFF"
color_TableBGRowTitle="ECECEC"
color_TableBorder="ECECEC"
color_text="000000"
color_textpercent="606060"
color_titletext="000000"
color_weekend="EAEAEA"
color_link="0011BB"
color_hover="605040"
color_u="FFAA66"
color_v="F4F090"
color_p="4477DD"
color_h="66DDEE"
color_k="2EA495"
color_s="8888DD"
color_e="CEC2E8"
color_x="C1B2E2"
ExtraTrackedRowsLimit=500
HERE
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,14 @@
#!/bin/bash
# Qmail logfile preprocessor
/usr/bin/test $(/bin/ls -l /var/log/qmail/*.s 2>/dev/null | grep -v "^l" | wc -l) -eq 0 && /bin/touch /var/log/qmail/awstats_dummy.s
RR=$(/bin/ls -t /var/log/qmail/*.s|/usr/bin/head -n 1)
RR=$(/bin/basename $RR)
/usr/bin/test ! -f /var/log/qmail/.recent-rotated && SRC="/var/log/qmail/*.s" && echo $RR > /var/log/qmail/.recent-rotated
LR=$(/bin/cat /var/log/qmail/.recent-rotated)
echo "RR: $RR LR: $LR"
/usr/bin/test "$LR" != "$RR" && SRC="/var/log/qmail/$RR" && echo $RR > /var/log/qmail/.recent-rotated
/bin/cat $SRC /var/log/qmail/current | /usr/local/bin/tai64nlocal | /usr/bin/perl /usr/share/awstats/tools/maillogconvert.pl standard | /bin/grep -v ' alias-localdelivery-'
/bin/rm -f /var/log/qmail/awstats_dummy.s

View File

@ -0,0 +1,2 @@
awstats:install:/etc/e-smith/events/actions/awstats-upgrade
awstats:update:/etc/e-smith/events/actions/awstats-upgrade

View File

@ -0,0 +1,284 @@
#!/usr/bin/perl -w
# copyright (C) 2001 neddix, stuttgart
#
# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
# This program is part of the AWstats package for the e-smith Server and Gateway
#
use strict;
use Symbol;
use esmith::config;
use esmith::util;
use esmith::db;
sub fileinfo($);
sub write_runstat ($);
sub cleanup();
my $start_time=time();
my $httpdlog="/var/log/httpd";
my $awconfpath="/etc/e-smith/web/panels/manager/cgi-bin/.awstats";
my $awconf="$awconfpath/awstats.conf";
my $dirdata="/home/e-smith/files/users/admin/home/awstats";
my $lock="/var/lock/awstats";
my $logrotate_detected=0;
my $readlines=0;
my ($silent, $debug, $novoid);
(undef,undef,my $admin_uid)=getpwnam('admin');
(undef,undef,my $root_gid)=getgrnam('root');
my %conf;
tie %conf, 'esmith::config';
my $status=db_get_prop(\%conf, "AWStats", "status");
exit (0) if not defined $status || $status ne "enabled";
$debug=((db_get_prop(\%conf, "AWStats", "Debug") ||"no") eq "yes");
# primitive command line options parsing
foreach (@ARGV) {
$silent=1 if /-s/;
$debug=1 if /-d/; # enter debug mode
$novoid=1 if /-n/; # stop execution, if no new logs available
if (/^-c/) {
($awconf=$_) =~ s/^-c//;
}
}
print "using configuration file $awconf\n" if $debug;
# check lock
if (-f "$lock") {
open (LCK, "$lock");
print "Another instance of AWStats is already running at pid=".<LCK>." \n" if $debug or not $silent;
close (LCK);
exit(1);
}
$SIG{TERM}='cleanup';
$SIG{KILL}='cleanup';
$SIG{INT}='cleanup';
END{cleanup()};
# set lock
open (LCK, ">$lock") or die "Could not create $lock\n";
print LCK "$$";
print "Set lock. pid=$$\n" if $debug;
close (LCK);
write_runstat ("Currently running. Please be patient. (pid=$$)");
my $log="$httpdlog/access_log";
my $log_1="$httpdlog/access_log.1";
my $cur_log; # filename of the current logfile
my $awpos="$httpdlog/awstats_pos";
my (@fstat_cur, @fstat_log, @fstat_log_1); # file status information of log files
die "Fatal error: Apache logfile $log not found\nIs Apache running?\n" if not -f $log;
# read file status information
@fstat_log=fileinfo("$log"); # current apache log file
@fstat_log_1=fileinfo("$log_1"); # logrotated apache log file
# read current log file information
if (-f "$awpos") {
open (AWPOS,"$awpos") or die "Could not open file $awpos\n";
chomp($_=<AWPOS>);
@fstat_cur = split (":");
close (AWPOS);
} else {
@fstat_cur=@fstat_log; # use current log file
$fstat_cur[2]=-1; # size
print "$awpos not found.\n" if $debug;
}
# check if information from $awpos is outdated:
# dev/inode pair must point to an Apache logfile
if ( ($fstat_cur[0]!=$fstat_log[0] || $fstat_cur[1]!=$fstat_log[1]) &&
($fstat_cur[0]!=$fstat_log_1[0] || $fstat_cur[1]!=$fstat_log_1[1]) ) {
@fstat_cur=@fstat_log; # use current log file
$fstat_cur[2]=-1; # size
}
# find the filename and write size of logfile to current fstat
if ($fstat_cur[0]==$fstat_log[0] && $fstat_cur[1]==$fstat_log[1]) {
$cur_log=$log; # use current Apache log
$fstat_cur[2]=$fstat_log[2];
} elsif ($fstat_cur[0]==$fstat_log_1[0] && $fstat_cur[1]==$fstat_log_1[1]) {
$cur_log=$log_1; # use logrotated Apache log
$fstat_cur[2]=$fstat_log_1[2];
$logrotate_detected=1; # Flag: remove $awpos at exit
} else {
die "Fatal error: No Apache logfile found.\nIs Apache running?\n";
}
print "fstat=$fstat_cur[0]:$fstat_cur[1]:$fstat_cur[2]:$fstat_cur[3]\n" if $debug;
print "Current log filename: $cur_log\n" if $debug;
print "logrotated: " . ($logrotate_detected==1 ? "yes\n" : "no\n") if $debug;
mkdir ("$dirdata");
# check if anybody played with dirdata permissions, i.e. e-smith upgrade
{
(undef,undef,my $mode,undef,my $uid,my $gid)=stat($dirdata);
if (($mode &= 0777) != 0770 || $uid != $admin_uid || $gid != $root_gid) {
print "setting recursivly correct permissions for $dirdata\n" if $debug;
my @list=<$dirdata $dirdata/* $dirdata/*/*>;
chown ($admin_uid, $root_gid, @list);
chmod (0770, $root_gid, @list);
}
}
if ($fstat_cur[2]==$fstat_cur[3] && $novoid) {
print "Nix zu tun.\n" if $debug;
exit(0);
}
my $key;
my $value;
my %Domains;
# split main log into log for each domain
mkdir ("$httpdlog/awstats");
open (LOG, "$cur_log") or die "Could not open $cur_log\n";
seek (LOG, $fstat_cur[3], 0) or die "seek failed\n";
while (<LOG>) {
my $line=$_;
$line=~s/(^.*?) (.*)/$2/;
my $key=$1;
if (not defined $Domains{$key}) {
$Domains{$key}=gensym();
open ($Domains{$key}, ">$httpdlog/awstats/$key") or die "Could not open $httpdlog/awstats/$key\n";
}
# write in Apaches combined log format
print {$Domains{$key}} $line;
$readlines++;
}
print " startoffset=$fstat_cur[3]\n" if $debug;
$fstat_cur[3]=tell(LOG); # save the file offset
print " endoffset=$fstat_cur[3]\n" if $debug;
print " read $readlines lines\n" if $debug;
close (LOG);
# close log files for virt domains
while (($key,$value) = each %Domains) {
close ($Domains{$key});
}
# generate domain specific conf files for both
# newly scanned and historical ones
# must be done every run, since they could be deleted
# or default config might have been modified
my %ConfDomains=%Domains;
opendir (DIR, "$dirdata");
while (defined (my $d=readdir(DIR))) {
next if $d =~ /^\.\.?$/;
$ConfDomains{$d}=gensym() if not defined $ConfDomains{$d};
}
closedir (DIR);
while (($key,$value) = each %ConfDomains) {
# read default config file (built by using e-smith template mechanism)
open ($ConfDomains{$key}, ">$awconfpath/awstats.$key.conf") or die "Could not open $awconfpath/awstats.$key.conf\n";
# write domain specific config file
open (CONF, "$awconf") or die "Could not open $awconf\n";
while (<CONF>) {
if (/^DirData=/) {
mkdir ("$dirdata/$key"); # make dir for AWStats historical data
chown ($admin_uid,$root_gid, "$dirdata/$key");
chmod (0770,"$dirdata/$key");
$_="DirData=\"$dirdata/$key\"\n"; # path to history dir
}
if (/^SiteDomain=/) {
$_="SiteDomain=\"$key\"";
}
$_ =~ s/LogFile="\/var\/log\/httpd\/access_log"/LogFile="-"/;
print {$ConfDomains{$key}} $_;
}
close (CONF);
close ($ConfDomains{$key});
}
# launch AWStats for each domain, which has new logs
while (($key,$value) = each %Domains) {
my $ret;
my $cmd="/etc/e-smith/web/panels/manager/cgi-bin/.awstats/awstats.pl -config=$key < $httpdlog/awstats/$key > /dev/null";
print "Launching AWStats with logfile $httpdlog/awstats/$key (len="
.(-s "$httpdlog/awstats/$key") . " bytes)\n" if $debug;
$ret=system ("$cmd");
print "Command was: $cmd\n" if $ret!=0;
}
# save the status of the Apache log for the next run
open (AWPOS,">$awpos") or die "Could not open file $awpos for writing\n";
print AWPOS $fstat_cur[0].":".$fstat_cur[1].":".$fstat_cur[2].":".$fstat_cur[3]."\n";
print AWPOS "# THIS FILE IS NEEDED BY AWSTATS. DO NOT DELETE!\n";
close (AWPOS);
print "$awpos: $fstat_cur[0]:$fstat_cur[1]:$fstat_cur[2]:$fstat_cur[3]\n" if $debug;
exit (0);
# get dev, inode and size information of a file
sub fileinfo($) {
my ($file)=@_;
return (0,0,0,0) if not -f $file;
my @info; # 0-> device, 1-> inode, 2->size
($info[0],$info[1],undef,undef,undef,undef,undef,$info[2])=stat($file);;
$info[3]="0"; # default file pos offset
print "$file: $info[0]:$info[1]:$info[2]:$info[3]\n" if $debug;
return @info;
}
sub write_runstat ($) {
open (ST, ">$httpdlog/awstats_lr") or die "Could not open file $httpdlog/awstats_lr for writing\n";
print ST $_[0];
close (ST);
}
# invoked at exit, SIGTERM, SIGKILL and SIGINT
sub cleanup () {
my ($xtime, $min, $hour, $day, $month, $year);
(undef, $min, $hour, $day, $month, $year)=localtime($start_time);
$xtime=(time()-$start_time);
print "Program execution time: $xtime sec\n" if $debug;
print "Cleanup.\n" if $debug;
if (not $debug) {
while (($key,$value) = each %Domains) {
unlink ("$httpdlog/awstats/$key");
}
rmdir ("$httpdlog/awstats");
}
if ($logrotate_detected==1) {
unlink ("$awpos");
print "Logfile rotate detected. $awpos removed. Next run will process the new logfile\n" if $debug;
}
write_runstat (sprintf ("Updated on %02d/%02d/%d at %02d:%02d in %d secs. %d new logs processed.",
$month+1,$day,$year+1900,$hour,$min,$xtime, $readlines));
if (-f "$lock") {
open (LCK, "$lock");
my $pid=<LCK>;
close (LCK);
unlink ("$lock") if $$ == "$pid" or "$pid" eq "";
}
# remove temporary conf file
if ($awconf =~ /\.[0-9]*$/) {
unlink ("$awconf");
}
exit (0);
}

View File

@ -0,0 +1,355 @@
package SrvMngr::Controller::Awstats;
#----------------------------------------------------------------------
# heading : Investigation
# description : Web statistics
# navigation : 6000 350
#
# menu : A
#
# name : awstats, method : get, url : /awstats, ctlact : awstats#main
# name : awstats2, method : get, url : /awstats2, ctlact : awstats#do_display
# name : awstatsc, method : post, url : /awstats, ctlact : awstats#do_display
# name : awstatsu, method : post, url : /awstats2, ctlact : awstats#do_update
# name : awstats3, method : get, url : /awstats3, ctlact : awstats#do_update
#
# routes : end
#----------------------------------------------------------------------
use strict;
use warnings;
use Mojo::Base 'Mojolicious::Controller';
use Locale::gettext;
use SrvMngr::I18N;
use SrvMngr qw(theme_list init_session);
use POSIX qw(strftime);
use esmith::DomainsDB;
use esmith::ConfigDB;
our $ddb = esmith::DomainsDB->open || die "Couldn't open domains db";
our $cdb = esmith::ConfigDB->open || die "Couldn't open configuration db";
our $awsdirdata="/home/e-smith/files/users/admin/home/awstats";
our $REGEXP_DOMAIN = qq([a-zA-Z0-9\-\.]+);
sub main {
my $c = shift;
$c->app->log->info($c->log_req);
my %aws_datas = ();
my $title = $c->l('aws_FORM_TITLE');
$aws_datas{trt} = 'LST';
my $rec = $cdb->get('AWStats');
$aws_datas{status} = $rec->prop('status')|| 'disabled';
$aws_datas{mailstatus} = ( $rec->prop('mailstatus') || 'disabled' );
$aws_datas{ftpstatus} = ( $rec->prop('ftpstatus') || 'disabled' );
$aws_datas{username} = $c->session->{username} || 'unknown';
my @domains;
# if ( $aws_datas->{status} ne 'enabled' ) {
for ($ddb->domains()) {
my $domain = $_->key;
next unless ( -d "$awsdirdata/$domain" );
my $ns = $_->prop('Nameservers') || 'internet';
$domain = $1 if ($domain =~ /^($REGEXP_DOMAIN)$/);
my $awstats = 'Empty';
if (system("/bin/ls $awsdirdata/$domain/ | /bin/grep '.txt' > /dev/null 2>&1") == 0 ) {
$awstats = 'Show';
}
my $status = 'active';
#if ( ????system == 0 ) { // T O D O inactive domains//
# $status = 'inactive';
#}
push @domains,
{ Domain => $_->key, $_->props,
Nameservers => $ns,
AWStats => $awstats,
Status => $status
}
}
if (open (ST, "/var/log/httpd/awstats_lr")) {
$aws_datas{logres} = <ST>;
close (ST);
}
# }
$c->stash( title => $title, aws_datas => \%aws_datas, domains => \@domains );
$c->render(template => 'awstats');
}
sub do_display {
my $c = shift;
$c->app->log->info($c->log_req);
my %aws_datas = ();
my $title = $c->l('aws_FORM_TITLE');
my $result;
my $trt = $c->param('trt') || 'LST';
my $domain = $c->param('Domain');
if ( $trt eq 'SHW' ) {
$aws_datas{periodrep} = 'month';
$aws_datas{monthrep} = strftime( "%m", localtime );
$aws_datas{yearrep} = strftime( "%Y", localtime );
$aws_datas{domain} = $domain;
$result = _get_awst( $c, \%aws_datas );
}
if ( $trt eq 'CNF' ) {
my $rec = $cdb->get('AWStats');
if ($rec) {
$aws_datas{status} = $rec->prop('status')|| 'disabled';
$aws_datas{mailstatus} = ( $rec->prop('mailstatus') || 'disabled' );
$aws_datas{ftpstatus} = ( $rec->prop('ftpstatus') || 'disabled' );
$aws_datas{freq} = $rec->prop('Freq')|| '5m';
$aws_datas{barSize} = $rec->prop('BarSize')|| 'medium';
$aws_datas{language} = $rec->prop('Language')|| 'auto';
$aws_datas{maxNbOfDomain} = $rec->prop('MaxNbOfDomain')|| '50';
$aws_datas{maxNbOfHosts} = $rec->prop('MaxNbOfHostsShown')|| '100';
$aws_datas{maxNbOfKeywords} = $rec->prop('MaxNbOfKeywordsShown')|| '50';
$aws_datas{maxNbOfPage} = $rec->prop('MaxNbOfPageShown')|| '200';
$aws_datas{maxNbOfReferer} = $rec->prop('MaxNbOfRefererShown')|| '50';
$aws_datas{maxNbOfRobot} = $rec->prop('MaxNbOfRobotShown')|| '25';
$aws_datas{minHitPage} = $rec->prop('MinHitFile')|| '1';
$aws_datas{minHitHost} = $rec->prop('MinHitHost')|| '1';
$aws_datas{minHitKeyword} = $rec->prop('MinHitKeyword')|| '1';
$aws_datas{minHitRefer} = $rec->prop('MinHitRefer')|| '1';
$aws_datas{minHitRobot} = $rec->prop('MinHitRobot')|| '1';
$aws_datas{rawlog} = $rec->prop('Rawlog')|| 'no';
$aws_datas{skipExternalIP} = $rec->prop('SkipExternalIP')|| 'yes';
$aws_datas{skipLocalIP} = $rec->prop('SkipLocalIP')|| 'yes';
$aws_datas{skipLocalNetworks} = $rec->prop('SkipLocalNetworks')|| 'no';
$aws_datas{userFramesWhenCGI} = $rec->prop('UserFramesWhenCGI')|| 'no';
$aws_datas{username} = $c->session->{username} || 'unknown';
}
}
$aws_datas{trt} = $trt;
$aws_datas{domain} = $domain;
$c->stash( title => $title .' '. $domain, aws_datas => \%aws_datas, modul => $result );
$c->render(template => 'awstats');
}
sub do_update {
my $c = shift;
$c->app->log->info($c->log_req);
my $rt = $c->current_route;
my $trt = $c->param('trt') || 'SHWP';
my $title = $c->l('aws_FORM_TITLE');
my %aws_datas = ();
$aws_datas{trt} = $trt;
my ($res, $result) = '';
if ( $trt eq 'UPD' ) {
my $status = $c->param('Status');
my $mailstatus = $c->param('Mailstatus');
my $ftpstatus = $c->param('Ftpstatus');
my $freq = $c->param('Freq');
my $skipLocalIP = $c->param('SkipLocalIP');
my $skipExternalIP = $c->param('SkipExternalIP');
my $skipLocalNetworks = $c->param('SkipLocalNetworks');
my $userFramesWhenCGI = $c->param('UserFramesWhenCGI');
my $language = $c->param('Language');
my $rawlog = $c->param('Rawlog');
my $barSize = $c->param('BarSize');
my $maxNbOfDomain = $c->param('MaxNbOfDomain');
my $maxNbOfHosts = $c->param('MaxNbOfHosts');
my $minHitHost = $c->param('MinHitHost');
my $maxNbOfPages = $c->param('MaxNbOfPages');
my $minHitPage = $c->param('MinHitPage');
my $maxNbOfRobot = $c->param('MaxNbOfRobot');
my $minHitRobot = $c->param('MinHitRobot');
my $maxNbOfReferer = $c->param('MaxNbOfReferer');
my $minHitRefer = $c->param('MinHitRefer');
my $maxNbOfKeywords = $c->param('MaxNbOfKeywords');
my $minHitKeyword = $c->param('MinHitKeyword');
#$result = 'blocked';
if ($maxNbOfDomain =~ /^([0-9]+)$/) {
$maxNbOfDomain = $1;
} else {
$result .= $c->l('FIELD_INVALID_CHARS') .' : '. $maxNbOfDomain .'<br>';
}
if ($maxNbOfHosts =~ /^([0-9]+)$/) {
$maxNbOfHosts = $1;
} else {
$result .= $c->l('FIELD_INVALID_CHARS') .' : '. $maxNbOfHosts .'<br>';
}
if ($minHitHost =~ /^([0-9]+)$/) {
$minHitHost = $1;
} else {
$result .= $c->l('FIELD_INVALID_CHARS') .' : '. $minHitHost .'<br>';
}
$maxNbOfDomain = 1 if $maxNbOfDomain < 1;
$maxNbOfHosts = 1 if $maxNbOfHosts < 1;
$minHitHost = 1 if $minHitHost < 1;
$maxNbOfPages = 1 if $maxNbOfPages < 1;
$minHitPage = 1 if $minHitPage < 1;
$maxNbOfRobot = 1 if $maxNbOfRobot < 1;
$minHitRobot = 1 if $minHitRobot < 1;
$maxNbOfReferer = 1 if $maxNbOfReferer < 1;
$minHitRefer = 1 if $minHitRefer < 1;
$maxNbOfKeywords = 1 if $maxNbOfKeywords < 1;
$minHitKeyword = 1 if $minHitKeyword < 1;
# controls
$res ='';
if ( ! $result ) {
my $rec = $cdb->get('AWStats');
if ($rec) {
$rec->set_prop('status', $status); ;
$rec->set_prop('mailstatus', $mailstatus); ;
$rec->set_prop('ftpstatus', $ftpstatus); ;
$rec->set_prop('Freq', $freq);
$rec->set_prop('BarSize',$barSize );
$rec->set_prop('Language', $language);
$rec->set_prop('MaxNbOfDomain', $maxNbOfDomain);
$rec->set_prop('MaxNbOfHostsShown', $maxNbOfHosts);
$rec->set_prop('MaxNbOfKeywordsShown', $maxNbOfKeywords);
$rec->set_prop('MaxNbOfPageShown', $maxNbOfPages);
$rec->set_prop('MaxNbOfRefererShown', $maxNbOfReferer);
$rec->set_prop('MaxNbOfRobotShown', $maxNbOfRobot);
$rec->set_prop('MinHitFile', $minHitPage);
$rec->set_prop('MinHitHost', $minHitHost);
$rec->set_prop('MinHitKeyword', $minHitKeyword);
$rec->set_prop('MinHitRefer', $minHitRefer);
$rec->set_prop('MinHitRobot', $minHitRobot);
$rec->set_prop('Rawlog', $rawlog);
$rec->set_prop('SkipExternalIP', $skipExternalIP);
$rec->set_prop('SkipLocalIP', $skipLocalIP);
$rec->set_prop('SkipLocalNetworks', $skipLocalNetworks);
$rec->set_prop('UserFramesWhenCGI', $userFramesWhenCGI);
}
if ( system( '/sbin/e-smith/signal-event awstats-update &' ) != 0 ) {
$result = ($c->l('aws_ERROR_CONFIG_UPDATE') . " $trt");
} else {
# sleep (2);
$res = 'OK';
$result = $c->l('aws_CONFIG_SUCCESSFULLY_MODIFIED');
}
}
}
if ( $trt eq 'SHWP' ) {
$aws_datas{periodrep} = $c->param('databasebreak');
$aws_datas{monthrep} = $c->param('month');
$aws_datas{yearrep} = $c->param('year');
$aws_datas{dayrep} = $c->param('day') || '';
$aws_datas{hourrep} = $c->param('hour') || ''; # does not exist (bug in awstats 7.8-3)
$aws_datas{domain} = $c->param('config') || 'None';
$result = _get_awst( $c, \%aws_datas );
$c->stash( title => $title .' '. $aws_datas{domain}, aws_datas => \%aws_datas, modul => $result );
return $c->render( 'awstats' );
}
# common parts
if ($res ne 'OK') {
$c->stash( error => $result );
$c->stash( title => $title, aws_datas => \%aws_datas );
return $c->render( 'awstats' );
}
# $cdb = esmith::ConfigDB->open();
my $message = "'AWStats configuration' update ($trt) DONE";
$c->app->log->info($message);
$c->flash( success => $result );
$c->redirect_to('/awstats');
}
sub _get_awst {
my ($c, $aws_datas) = @_;
my $periodrep = $aws_datas->{periodrep};
my $yearrep = $aws_datas->{yearrep};
my $monthrep = $aws_datas->{monthrep};
my $dayrep = $aws_datas->{dayrep};
my $hourrep = $aws_datas->{hourrep};
my $domain = $aws_datas->{domain};
my $res;
$domain = $1 if ($domain =~ /^($REGEXP_DOMAIN)$/);
$periodrep = $1 if ($periodrep =~ /^([A-Za-z]+)$/);
$monthrep = $1 if ($monthrep =~ /^([A-Za-z\-]+)$/);
$yearrep = $1 if ($yearrep =~ /^([0-9]+)$/);
$dayrep = $1 if ($dayrep and $dayrep =~ /^([0-9]+)$/);
$hourrep = $1 if ($hourrep and $hourrep =~ /^([0-9]+)$/);
# cli awstats.pl call
$res = `/etc/e-smith/web/panels/manager/cgi-bin/.awstats/awstats.pl -databasebreak=$periodrep -month=$monthrep -year=$yearrep -day=$dayrep -hour=$hourrep -config="${domain}" -lang=auto -output`;
# change awstats link for this controller
$res =~ s|action="/cgi-bin/awstats.pl?|action="/smanager/awstats3?trt=SHWP&|;
# change DirIcons for sm2 public one
$res =~ s|\.\./\.\./awstats|\./images/awstats/icon|g;
return $res;
}
sub freq_options_list {
my $c = shift;
return [[ '5 ' . $c->l('MINUTES') => '5m'],
[ '10 ' . $c->l('MINUTES') => '10m'],
[ '15 ' . $c->l('MINUTES') => '15m'],
[ '30 ' . $c->l('MINUTES') => '30m'],
[ '1 ' . $c->l('HOUR') => '1h'],
[ '2 ' . $c->l('HOURS') => '2h'],
[ '4 ' . $c->l('HOURS') => '4h'],
[ '8 ' . $c->l('HOURS') => '8h'],
[ '12 ' . $c->l('HOURS') => '12h']];
}
sub language_options_list {
my $c = shift;
return [[ 'Auto Detect' => 'auto' ],
['English' => 'en' ],
['French', => 'fr' ],
['Dutch' => 'nl' ],
['Spanish' => 'es' ],
['Italian' => 'it' ],
['German', => 'de' ],
['Polish', => 'pl' ],
['Greek' => 'gr' ],
['Czech' => 'cz' ],
['Portuguese' => 'pt' ]];
}
1

View File

@ -0,0 +1,37 @@
'aws_FORM_TITLE' => 'Show or Configure Awstats Statistics',
'aws_BUTTON_CONFIGURE' => 'Configure AWStats',
'aws_STATS_NOTE' => 'Note: A Domain is not shown in the list below until after midnight on the day statistics are available. To force the display sooner, browse to the website to create some stats, then resave awstats settings.',
'aws_DOMAINS_TITLE' => 'List of Domains viewable by admin',
'aws_DISABLED' => 'AWStats is disabled.',
'aws_UPDATED' => 'Updated on [_1] in [_2] secs. [_3] new logs processed.',
'aws_COPYRIGHT' => 'Copyright neddix.de, Stuttgart',
'aws_CONTENT' => 'Content',
'aws_CONFIG_TITLE' => 'Configure AWStats Sme version',
'aws_LABEL_STATUS' => 'State',
'aws_REPORTED' => 'Reported period',
'aws_STATUS' => 'status',
'aws_MAILSTATUS' => 'Awstats Mail status',
'aws_FTPSTATUS' => 'Awstats Ftp status',
'aws_FREQUENCY' => 'Launch frequency',
'aws_NO_LOCAL_IP' => 'Ignore hits from your local network',
'aws_NO_EXTERNAL_IP' => 'Ignore hits from your external IP or network',
'aws_YES_EXT_IP' => 'Yes, external IP',
'aws_YES_EXT_IP_MSK' => 'Yes, external IP/Netmask',
'aws_NO_LOCAL' => 'Ignore hits from local networks as defined in the \'Local networks\' panel',
'aws_FRAME' => 'Show report in HTML frames',
'aws_LANGUAGE' => 'Default language',
'aws_RAWLOG' => 'Enable plugin \'Rawlog\'',
'aws_MAX_DOMAINS' => 'Max. number of domains shown',
'aws_MAX_HOSTS' => 'Max. number of hosts shown',
'aws_MIN_HIT_HOSTS' => 'Only show hosts with at least these hits:',
'aws_MAX_PAGES' => 'Max. number of pages shown',
'aws_MIN_HIT_PAGES' => 'Only show pages with at least these hits:',
'aws_MAX_ROBOTS' => 'Max. number of robots shown',
'aws_MIN_HIT_ROBOT' => 'Only show robots with at least these hits:',
'aws_MAX_REFERER' => 'Max. number of referrers shown',
'aws_MIN_HIT_REFERER' => 'Only show referrers with at least these hits:',
'aws_MAX_KEYWORDS' => 'Max. number of keywords shown',
'aws_MIN_HIT_KEYWORDS' => 'Only show keywords with at least these hits:',
'aws_BAR_SIZE' => 'Graphics bar size',
'aws_CONFIG_SUCCESSFULLY_MODIFIED' => 'Configuration has been updated successfully.<br>Please note, that changed ignore-rules will only effect processing of future logs.',
'aws_ERROR_CONFIG_UPDATE' => 'Error: internal failure while updating awstats configuration.',

View File

@ -0,0 +1 @@
# link to original awstats icon directory for sm2

View File

@ -0,0 +1,34 @@
% layout 'default', title => "Sme server 2 - AWStats";
% content_for 'module' => begin
<div id='module' class='module awstats-panel'>
% if ($config->{debug} == 1) {
<p>
%= dumper $c->current_route
%= dumper $aws_datas
</p>
% }
% if ( stash 'warning' ) {
<br><div class=sme-warning>
%= $c->render_to_string(inline => stash 'warning')
</div>
%}
% if ( stash 'error' ) {
<br><div class=sme-error>
%= $c->render_to_string(inline => stash 'error')
</div>
%}
<h1><%= $title%></h1>
% if ($aws_datas->{trt} eq 'CNF') {
%= include 'partials/_aws_cnf'
%} elsif ($aws_datas->{trt} eq 'SHW' or $aws_datas->{trt} eq 'SHWP') {
%= include 'partials/_aws_shw'
%} elsif ($aws_datas->{trt} eq 'UPD') {
%= include 'partials/_aws_cnf'
%} else {
%= include 'partials/_aws_list'
%}
</div>
% end

View File

@ -0,0 +1,139 @@
<div id='aws_conf'>
%= form_for '/awstats2' => (method => 'POST') => begin
<h2><%=l 'aws_CONFIG_TITLE'%></h2>
<p><span class=label>
%=l 'aws_STATUS', class => 'label'
</span><span class=data>
% param 'Status' => $aws_datas->{status} unless param 'Status';
%= select_field 'Status' => [[(l 'ENABLED') => 'enabled'], [ (l 'DISABLED') => 'disabled']], class => 'input'
</span><span class=label2>
%=l 'aws_MAILSTATUS'
</span><span class=data>
% param 'Mailstatus' => $aws_datas->{mailstatus} unless param 'Mailstatus';
%= select_field 'Mailstatus' => [[(l 'ENABLED') => 'enabled'], [ (l 'DISABLED') => 'disabled']], class => 'input'
</span><span class=label2>
%=l 'aws_FTPSTATUS'
</span><span class=data>
% param 'Ftpstatus' => $aws_datas->{ftpstatus} unless param 'Ftpstatus';
%= select_field 'Ftpstatus' => [[(l 'ENABLED') => 'enabled'], [ (l 'DISABLED') => 'disabled']], class => 'input'
</span></p>
<p><span class=label>
%=l 'aws_FREQUENCY'
</span><span class=data>
% param 'Freq' => $aws_datas->{freq} unless param 'Freq';
%= select_field 'Freq', $c->freq_options_list(), class => 'input'
</span></p>
<p><span class=label>
%=l 'aws_NO_LOCAL_IP', class => 'label'
</span><span class=data>
% param 'SkipLocalIP' => $aws_datas->{skipLocalIP} unless param 'SkipLocalIP';
%= select_field 'SkipLocalIP' => [[ (l 'YES') => 'yes'], [ (l 'NO') => 'no']], class => 'input'
</span></p>
<p><span class=label>
%=l 'aws_NO_EXTERNAL_IP', class => 'label'
</span><span class=data>
% param 'SkipExternalIP' => $aws_datas->{skipExternalIP} unless param 'SkipExternalIP';
%= select_field 'SkipExternalIP' => [[(l 'NO') => 'no'], [(l 'aws_YES_EXT_IP') => 'yes'], [(l 'aws_YES_EXT_IP_MSK') => 'mask']], class => 'input'
</span></p>
<p><span class=label>
%=l 'aws_NO_LOCAL', class => 'label'
</span><span class=data>
% param 'SkipLocalNetworks' => $aws_datas->{skipLocalNetworks} unless param 'SkipLocalNetworks';
%= select_field 'SkipLocalNetworks' => [[ (l 'YES') => 'yes'], [ (l 'NO') => 'no']], class => 'input'
</span></p>
<p><span class=label>
%=l 'aws_FRAME', class => 'label'
</span><span class=data>
% param 'UserFramesWhenCGI' => $aws_datas->{userFramesWhenCGI} unless param 'UserFramesWhenCGI';
%= select_field 'UserFramesWhenCGI' => [[ (l 'YES') => 'yes'], [ (l 'NO') => 'no']], class => 'input'
</span></p>
<p><span class=label>
%=l 'aws_LANGUAGE'
</span><span class=data>
% param 'Language' => $aws_datas->{language} unless param 'Language';
%= select_field 'Language', $c->language_options_list(), class => 'input'
</span></p>
<p><span class=label>
%=l 'aws_RAWLOG', class => 'label'
</span><span class=data>
% param 'Rawlog' => $aws_datas->{rawlog} unless param 'Rawlog';
%= select_field 'Rawlog' => [[ (l 'YES') => 'yes'], [ (l 'NO') => 'no']], class => 'input'
</span></p>
<p><span class=label>
%=l 'aws_MAX_DOMAINS', class => 'label'
</span><span class=data>
% param 'MaxNbOfDomain' => $aws_datas->{maxNbOfDomain} unless param 'MaxNbOfDomain';
%= text_field 'MaxNbOfDomain' => size => '5', class => 'input'
</span></p>
<p><span class=label>
%=l 'aws_MAX_HOSTS', class => 'label'
</span><span class=data>
% param 'MaxNbOfHosts' => $aws_datas->{maxNbOfHosts} unless param 'MaxNbOfHosts';
%= text_field 'MaxNbOfHosts' => size => '5', class => 'input'
</span>
<span class=label>
%=l 'aws_MIN_HIT_HOSTS', class => 'label'
</span><span class=data>
% param 'MinHitHost' => $aws_datas->{minHitHost} unless param 'MinHitHost';
%= text_field 'MinHitHost' => size => '5', class => 'input'
</span></p>
<p><span class=label>
%=l 'aws_MAX_PAGES', class => 'label'
</span><span class=data>
% param 'MaxNbOfPages' => $aws_datas->{maxNbOfPage} unless param 'MaxNbOfPages';
%= text_field 'MaxNbOfPages' => size => '5', class => 'input'
</span>
<span class=label>
%=l 'aws_MIN_HIT_PAGES', class => 'label'
</span><span class=data>
% param 'MinHitPAge' => $aws_datas->{minHitPage} unless param 'MinHitPAge';
%= text_field 'MinHitPAge' => size => '5', class => 'input'
</span></p>
<p><span class=label>
%=l 'aws_MAX_ROBOTS', class => 'label'
</span><span class=data>
% param 'MaxNbOfRobot' => $aws_datas->{maxNbOfRobot} unless param 'MaxNbOfRobot';
%= text_field 'MaxNbOfRobot' => size => '5', class => 'input'
</span>
<span class=label>
%=l 'aws_MIN_HIT_ROBOT', class => 'label'
</span><span class=data>
% param 'MinHitRobot' => $aws_datas->{minHitRobot} unless param 'MinHitRobot';
%= text_field 'MinHitRobot' => size => '5', class => 'input'
</span></p>
<p><span class=label>
%=l 'aws_MAX_REFERER', class => 'label'
</span><span class=data>
% param 'MaxNbOfReferer' => $aws_datas->{maxNbOfReferer} unless param 'MaxNbOfReferer';
%= text_field 'MaxNbOfReferer' => size => '5', class => 'input'
</span>
<span class=label>
%=l 'aws_MIN_HIT_REFERER' => size => '5', class => 'label'
</span><span class=data>
% param 'MinHitRefer' => $aws_datas->{minHitRefer} unless param 'MinHitRefer';
%= text_field 'MinHitRefer' => size => '5', class => 'input'
</span></p>
<p><span class=label>
%=l 'aws_MAX_KEYWORDS', class => 'label'
</span><span class=data>
% param 'MaxNbOfKeywords' => $aws_datas->{maxNbOfKeywords} unless param 'MaxNbOfKeywords';
%= text_field 'MaxNbOfKeywords' => size => '5', class => 'input'
</span>
<span class=label>
%=l 'aws_MIN_HIT_KEYWORDS', class => 'label'
</span><span class=data>
% param 'MinHitKeyword' => $aws_datas->{minHitKeyword} unless param 'MinHitKeyword';
%= text_field 'MinHitKeyword' => size => '5', class => 'input'
</span></p>
<p><span class=label>
%=l 'aws_BAR_SIZE', class => 'label'
</span><span class=data>
% param 'BarSize' => $aws_datas->{barSize} unless param 'BarSize';
%= select_field 'BarSize' => [[(l 'MEDIUM') => 'medium'], [(l 'SMALL') => 'small'], [(l 'LARGE') => 'large']], class => 'input'
</span></p>
<div class='center'>
%= submit_button $c->l('SAVE'), class => 'action'
</div>
%= hidden_field 'trt' => 'UPD'
%end
</div>

View File

@ -0,0 +1,74 @@
<div id='aws_list'>
%= form_for '/awstats' => (method => 'POST') => begin
%= submit_button l('aws_BUTTON_CONFIGURE'), class => 'action'
%= hidden_field 'trt' => 'CNF'
<p>
% if ( $aws_datas->{status} ne 'enabled' ) {
<h4><%= $c->l('aws_DISABLED') %></h4>
% if ($aws_datas->{username} eq 'admin' and $aws_datas->{mailstatus} eq 'enabled') {
<br>No WEB stats but <b>MAIL stats</b> are available -> <a href='awstats2?CsrfDef=TOKEN&trt=SHW&Domain=mail'> Here...</a><br>
% }
% if ($aws_datas->{username} eq 'admin' and $aws_datas->{ftpstatus} eq 'enabled') {
<br>No WEB stats but <b>FTP stats</b> are available -> <a href='awstats2?CsrfDef=TOKEN&trt=SHW&Domain=ftp'> Here...</a><br>
% }
% } else {
<h2><%= $c->l('aws_DOMAINS_TITLE') %></h2>
%=l 'aws_STATS_NOTE'
<table class="sme-border"><tbody>
<tr><th class='sme-border'>
%=l 'DOMAIN_NAME'
</th><th class='sme-border'>
%=l 'DESCRIPTION_BRIEF'
</th><th class='sme-border'>
%=l 'aws_CONTENT'
</th><th class='sme-border'>AWStats</th>
<th class='sme-border'>
%=l 'aws_LABEL_STATUS'
</th></tr>
% foreach my $domain ( @$domains ) {
<tr>
%= t td => (class => 'sme-border') => $domain->{Domain}
%= t td => (class => 'sme-border') => $domain->{'Description'}
%= t td => (class => 'sme-border') => $domain->{'Content'}
% my $actionShow = l("$domain->{AWStats}");
% if ( $domain->{AWStats} eq 'Show' ) {
% $actionShow = "<a href='awstats2?CsrfDef=TOKEN&trt=SHW&Domain=" . $domain->{Domain} . "'>" . l("$domain->{AWStats}") . "</a>";
% }
<td class='sme-border'><%= $c->render_to_string(inline => $actionShow) %></td>
%= t td => (class => 'sme-border') => $domain->{'Status'}
</tr>
% }
% if ( $aws_datas->{mailstatus} eq 'enabled' ) {
<tr>
%= t td => (class => 'sme-border') => 'mail'
%= t td => (class => 'sme-border') => 'Qmail stats'
%= t td => (class => 'sme-border') => ''
% my $actionShow = "<a href='awstats2?CsrfDef=TOKEN&trt=SHW&Domain=mail'>Show...</a>";
<td class='sme-border'><%= $c->render_to_string(inline => $actionShow) %></td>
%= t td => (class => 'sme-border') => 'active'
</tr>
% }
% if ( $aws_datas->{ftpstatus} eq 'enabled' ) {
<tr>
%= t td => (class => 'sme-border') => 'ftp'
%= t td => (class => 'sme-border') => 'Ftp stats'
%= t td => (class => 'sme-border') => ''
% my $actionShow = "<a href='awstats2?CsrfDef=TOKEN&trt=SHW&Domain=ftp'>Show...</a>";
<td class='sme-border'><%= $c->render_to_string(inline => $actionShow) %></td>
%= t td => (class => 'sme-border') => 'active'
</tr>
% }
</tbody></table>
</p>
%}
% if ( $aws_datas->{logres} ) {
<p>Web stats: <%= $c->render_to_string(inline => $aws_datas->{logres}) %></p>
%}
<p><%= $c->l( 'aws_COPYRIGHT') %></p>
% end
</div>

View File

@ -0,0 +1,4 @@
<div id='aws_shw'>
%= $c->render_to_string(inline => $modul)
%=l 'aws_COPYRIGHT'
</div>

224
smeserver-awstats.spec Normal file
View File

@ -0,0 +1,224 @@
# $Id: smeserver-awstats.spec,v 1.12 2024/03/01 16:09:10 brianr Exp $
# Authority: dungog
# Name: Stephen Noble
%define realname smeserver-awstats
%define version 1.4
%define release 11
Summary: SME Server integration rpm for awstats
Name: %{realname}
Version: %{version}
Release: %{release}%{?dist}
License: GNU GPL (GNU General Public License)
Group: SMEserver/addon
Source: %{name}-%{version}.tar.xz
BuildRoot: /var/tmp/%{name}-%{version}
URL: https://wiki.koozali.org/AWStats
BuildArchitectures: noarch
BuildRequires: e-smith-devtools >= 1.13.1-03
Requires: e-smith-release >= 10
Requires: awstats >= 6.5
Requires: perl(POSIX)
AutoReqProv: no
%description
SME Server integration rpm for awstats.
%changelog
* Sat Sep 07 2024 cvs2git.sh aka Brian Read <brianr@koozali.org> 1.4-11.sme
- Roll up patches and move to git repo [SME: 12338]
* Sat Sep 07 2024 BogusDateBot
- Eliminated rpmbuild "bogus date" warnings due to inconsistent weekday,
by assuming the date is correct and changing the weekday.
* Fri Mar 01 2024 Brian Read <brianr@koozali.org> 1.4-10.sme
- Edit SM2 Menu entry to conform to new arrangements [SME: 12493]
* Fri Mar 24 2023 Michel Begue <mab974@misouk.com> 1.4-9.sme
- fix typo and Requires in .spec file [SME: 12324]
- (sm2) consider Daily and Hourly Reported Period
- (sm2) remove unnecessary file in templates directory
* Mon Mar 20 2023 Michel Begue <mab974@misouk.com> 1.4-8.sme
- Initial release for server-manager (sm2) [SME: 12324]
* Sun Feb 12 2023 Michel Begue <mab974@misouk.com> 1.4-7.sme
- add mail stats to panel (ftp stats too) [SME: 5925]
* Sat Jul 30 2022 Brian Read <brianr@bjsystems.co.uk> 1.4-6.sme
- Re-build and link to latest devtools [SME: 11997]
* Thu Jul 21 2022 Jean-Philippe Pialasse <tests@pialasse.com> 1.4-5.sme
- add to core backup [SME: 11998]
* Mon Feb 22 2021 Jean-Philipe Pialasse <tests@pialasse.com> 1.4-3.sme
- add update event for easy install [SME: 11045]
rewrite spec and createlinks to be more smeserver compliant
- run actions/awstats-upgrade on update of awstats or smeserver-awstats [SME: 10784]
* Tue Oct 20 2020 BogusDateBot
- Eliminated rpmbuild "bogus date" warnings due to inconsistent weekday,
by assuming the date is correct and changing the weekday.
Tue May 27 2001 --> Tue May 22 2001 or Sun May 27 2001 or Tue May 29 2001 or ....
* Mon Oct 19 2020 Brian Read <brianr@bjsystems.co.uk> 1.4-2.sme
- Initial import to SME10 tree [SME: 11045]
* Fri Jul 20 2018 John Crisp <jcrisp@safeandsounit.co.uk> 1.4-1.sme
- Fix SkipHosts incomplete entry [SME: 10160]
- Add SkipHosts db key
- Update some code to newer API
* Mon Sep 7 2015 stephane de Labrusse <stephdl@de-labrusse.fr> 1.3-3.sme
- added smeserver-awstats-1.3.bz8450.remove_ExternalIP-LocalIP.patch
- removed ExternalIP_LocalIP_ExternalNetmask [SME: 8450]
* Mon Jun 16 2014 JP Pialasse <tests@pialasse.com> 1.3-1.sme
- initial import to SME9 contribs [SME: 8435]
* Sat Sep 20 2008 Stephen Noble <support@dungog.net> 1.2-7
- clarify when domain is added to panel [sme 4543]
* Tue Jun 26 2007 Stephen Noble <support@dungog.net> 1.2-5
- awstats upgrade script modified [sme 3087]
* Tue Jun 26 2007 Stephen Noble <support@dungog.net> 1.2-4
- awstats upgrade triggers added [sme 2347]
* Mon Jan 8 2007 Stephen Noble <support@dungog.net>
- old database path fixed, awstats.conf/10conf [sme 2254]
- [1.2-3]
* Wed Apr 26 2006 Stephen Noble <support@dungog.net>
- symlinks to graphics fixed
- [1.2-2]
* Wed Apr 12 2006 Stephen Noble <support@dungog.net>
- update for sme7
- renamed smeserver-awstats
- split awstats out of rpm, so it can be updated independently
- [1.2-1]
* Mon Jan 31 2005 Stephen Noble <support@dungog.net>
- AllowFullYearView=3 added to awstats.conf
- hostinfo plugin option removed from panel
- # to enable
- # /sbin/e-smith/db /sbin/e-smith/configuration setprop AWStats Hostinfo yes
- # and install perl-Net-XWhois rpm
- [6.3-1]
* Sat Jan 29 2005 Stephen Noble <support@dungog.net>
- update to awstats 6.3
- [6.3-0]
* Sat Sep 13 2003 Stephen Noble <support@dungog.net>
- delegation defaults to admin
can also delegate to everyone, a group or a single user
- [2.3.4]
* Mon Aug 25 2003 Michael Weinberger
- based on AWStats 5.7
- [2.3.3]
* Tue Jul 29 2003 stephen noble <support@dungog.net>
- everyone options in options
- language fixs thanks Pascal Schirrmann
- [2.3.2]
* Fri Jul 18 2003 stephen noble <support@dungog.net>
- remove /sbin/e-smith/config and options link to non admin users
- [2.3.1]
* Thu Jul 17 2003 Michael Weinberger
- based on AWStats 5.6
- supports servermanager navigation of SME6
- [2.3.0]
* Tue Jul 15 2003 stephen noble <support@dungog.net>
- user-manager support
- restrict virtual domains shown to users
- [2.2.2]
* Tue Jan 07 2003 Michael Weinberger
- changed to new commandline syntax (-/sbin/e-smith/config)
* Mon Jan 06 2003 Michael Weinberger
- based on AWStats 5.3
* Mon Jan 06 2003 Michael Weinberger
- set DNSLookup=1 as default
* Sat Dec 21 2002 Michael Weinberger
- based on AWStats 5.2
* Thu Feb 28 2002 Michael Weinberger
- based on AWStats 4.0 BETA
* Thu Feb 28 2002 Michael Weinberger
- now based on AWStats 3.2
* Fri Oct 05 2001 Michael Weinberger
- missing icons issue solved. Path to icons changed.
* Thu Oct 04 2001 Michael Weinberger
- based on AWStats 2.32
RPM name changed
* Sun May 27 2001 Michael Weinberger
Tue May 27 2001 --> Tue May 22 2001 or Sun May 27 2001 or Tue May 29 2001 or ....
- problems when started by e-smith events
awstats pre-processor now runs in background
* Tue May 01 2001 Michael Weinberger
- owner=admin, group=root for /home/e-smith/files/users/admin/home/awstats and all
dirs below, rw for owner and group.
(after e-smith upgrade permission set to drwx------, reported by Michael Doerner)
awstats_run now checks permissons and correct them if needed.
- more /sbin/e-smith/configuration options added, incl. 5 and 10 minute freq.
- Warning "Another instance running" suppressed, when launched by cron (-s option)
- Warning in the panel removed
* Sun Apr 29 2001 Michael Weinberger
- awstats_pos was not removed after a log rotate of access_log
* Fri Apr 27 2001 Michael Weinberger
- beta 1 release
%prep
%setup -q -n %{realname}-%{version}
%build
perl createlinks
mkdir -p root/home/e-smith/files/users/admin/home/awstats
mkdir -p root/etc/e-smith/web/panels/manager/html/awstats/icon
mkdir -p root/etc/e-smith/web/panels/manager/cgi-bin/.awstats
#user-manager
mkdir -p root/etc/e-smith/web/panels/user/html/
mkdir -p root/etc/e-smith/web/panels/user/cgi-bin/
ln -fs /etc/e-smith/web/panels/manager/html/awstats root/etc/e-smith/web/panels/user/html/awstats
ln -fs /etc/e-smith/web/panels/manager/cgi-bin/.awstats root/etc/e-smith/web/panels/user/cgi-bin/.awstats
echo %{version}-%{release} > root/etc/e-smith/web/panels/manager/cgi-bin/.awstats/version
%install
rm -rf $RPM_BUILD_ROOT
(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT)
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \
--dir '/home/e-smith/files/users/admin/home/awstats' 'attr(40770,admin,root)' \
--dir '/etc/e-smith/web/panels/manager/cgi-bin/.awstats' 'attr(40770,root,root)' \
> %{name}-%{version}-filelist
echo "%doc " >> %{name}-%{version}-filelist
%clean
cd ..
rm -rf %{name}-%{version}
%pre
%post
if (systemctl list-unit-files |grep smanager) then
echo "Smanager restart in spec file"
/sbin/e-smith/signal-event smanager-refresh;
fi
%preun
%postun
if [ $1 = 0 ] ; then
/bin/rm -rf /etc/e-smith/web/panels/manager/html/awstats
/bin/rm -rf /etc/e-smith/web/panels/manager/cgi-bin/.awstats
/bin/rm -rf /etc/e-smith/web/panels/user/html/awstats
/bin/rm -rf /etc/e-smith/web/panels/user/cgi-bin/.awstats
/bin/rm -f /usr/share/smanager/themes/default/images/awstats/icon
/sbin/e-smith/config setprop AWStats status removed
/sbin/e-smith/expand-template /etc/crontab
fi
true
%files -f %{name}-%{version}-filelist
%defattr(-,root,root)