Commit c1e59f6e authored by Axel ROGER's avatar Axel ROGER

adding a FOURTH Debian Package : alternc-awstats

parent 1af9bcd8
......@@ -13,6 +13,25 @@ aide/index.sgml -text
aide/sommaire.sgml -text
aide/stats.sgml -text
aide/test.sgml -text
awstats/Makefile -text
awstats/alternc-awstats -text
awstats/awstats.cache.php -text
awstats/awstats.sql -text
awstats/awstats.template.conf -text
awstats/awstats_alternc.png -text
awstats/bureau/admin/aws_add.php -text
awstats/bureau/admin/aws_del.php -text
awstats/bureau/admin/aws_doadd.php -text
awstats/bureau/admin/aws_doedit.php -text
awstats/bureau/admin/aws_edit.php -text
awstats/bureau/admin/aws_list.php -text
awstats/bureau/admin/aws_pass.php -text
awstats/bureau/admin/aws_useradd.php -text
awstats/bureau/admin/aws_userdel.php -text
awstats/bureau/admin/aws_users.php -text
awstats/bureau/admin/menu_aws.php -text
awstats/bureau/class/m_aws.php -text
awstats/logresolvemerge.pl -text
bureau/admin/about.php -text
bureau/admin/adm_add.php -text
bureau/admin/adm_authip_whitelist.php -text
......@@ -372,6 +391,11 @@ bureau/locales/pt_BR/LC_MESSAGES/messages.po -text
debian/.svnignore -text
debian/NEWS -text
debian/README.Debian -text
debian/alternc-awstats.dirs -text
debian/alternc-awstats.lintian-override -text
debian/alternc-awstats.postinst -text
debian/alternc-awstats.postrm -text
debian/alternc-awstats.preinst -text
debian/alternc-slave.config -text
debian/alternc-slave.dirs -text
debian/alternc-slave.install -text
......
# ----------------------------------------------------------------------
# LICENSE
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License (GPL)
# 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.
#
# To read the license please visit http://www.gnu.org/copyleft/gpl.html
# ----------------------------------------------------------------------
# Purpose of file: Install the files of alternc-awstats packages
# ----------------------------------------------------------------------
install:
install -m 0644 -g root -o root alterncawstats.conf $(DESTDIR)/etc/alternc/
install -m 0755 -g root -o root logresolvemerge.pl $(DESTDIR)/usr/lib/alternc/
install -m 0644 -g www-data -o www-data awstats_alternc.png $(DESTDIR)/usr/share/awstats/icon/other/
install -m 0755 -g www-data -o www-data alternc-awstats $(DESTDIR)/usr/lib/alternc/
install -m 0755 -g www-data -o www-data awstats.cache.php $(DESTDIR)/usr/lib/alternc/
install -m 0644 awstats.sql $(DESTDIR)/usr/share/alternc/
install -m 0644 -g www-data -o www-data awstats.template.conf $(DESTDIR)/etc/alternc/templates/awstats/
install -m 0644 -g www-data -o www-data awstats.alternc.generic.conf $(DESTDIR)/etc/alternc/
#install -m 0444 lintian-override $(DESTDIR)/usr/share/lintian/overrides/alternc-awstats
#!/bin/bash
# Appelé seul, lance les stats AWStats du jour.
# Appelé avec "all" lance les stats avec tous les fichiers .gz situés dans /var/log/apache
# Appelé avec un nom de domaine en paramètre, rescanne tous les fichiers .gz pour ce domaine uniquement.
# Include some usefull functions
. /usr/lib/alternc/functions.sh
# Regenerate the awstat etc cache files :
if [ -x ./awstats.cache.php ]
then
./awstats.cache.php
fi
# FIXME : set this var in local.sh
LOG_DIR="/var/alternc/logs"
CACHEDIR="/var/cache/awstats" # Dans la sarge par defaut les données awstats sont stockées dans /var/lib/awstats ...
mkdir -p $CACHEDIR
function searchdomain {
U_ID=$(mysql_query "SELECT uid FROM aws WHERE hostname='$1'" | grep -v "^uid")
U_LOGIN=$(mysql_query "SELECT login FROM membres WHERE uid='$U_ID'" |grep -v "^login")
DOM_DIR="$LOG_DIR/$U_ID-$U_LOGIN"
echo $(find -P "$DOM_DIR" -mindepth 1 -maxdepth 2 -type f -iname "*.log" -print0 | xargs -0)
}
function dostatgz {
read DOM
while [ "$DOM" ]
do
LOGAPACHE=$(searchdomain $DOM)
echo "processing $DOM (for access files in $LOGAPACHE )"
/usr/lib/cgi-bin/awstats.pl -config=$DOM -update -LogFile="/usr/lib/alternc/logresolvemerge.pl $LOGAPACHE* |"
read DOM
done
}
function dostat {
read DOM
while [ "$DOM" ]
do
echo "processing $DOM"
LOGAPACHE=$(searchdomain $DOM)
/usr/lib/cgi-bin/awstats.pl -config=$DOM -LogFile="/usr/lib/alternc/logresolvemerge.pl $LOGAPACHE | "
read DOM
done
}
if [ -z "$1" ]
then
mysql_query "SELECT hostname FROM aws" |grep -v "^hostname" | dostat
else
if [ "$1" = "all" ]
then
mysql_query "SELECT hostname FROM aws" |grep -v "^hostname" | dostatgz
else
echo "$1" | dostatgz
fi
fi
#!/usr/bin/php -q
<?php
include("/var/alternc/bureau/class/config_nochk.php");
$db->query("SELECT id,hostname FROM aws;");
while ($db->next_record()) {
$d[]=$db->Record;
}
foreach ($d as $r) {
$aws->_createconf($r[0],1);
}
?>
\ No newline at end of file
# --------------------------------------------------------
CREATE TABLE IF NOT EXISTS `aws` (
`id` int(10) unsigned NOT NULL auto_increment,
`uid` int(10) unsigned NOT NULL default '0',
`hostname` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM COMMENT='Statistiques web par Awstats';
# --------------------------------------------------------
CREATE TABLE IF NOT EXISTS `aws_users` (
`uid` int(10) unsigned NOT NULL,
`login` varchar(128) NOT NULL,
`pass` varchar(38) NOT NULL,
PRIMARY KEY (`login`),
INDEX (`uid`)
) COMMENT = 'Comptes pouvant accder aux stats awstats.';
# --------------------------------------------------------
CREATE TABLE IF NOT EXISTS `aws_access` (
`id` int(10) unsigned NOT NULL,
`uid` int(10) unsigned NOT NULL,
`login` varchar(128) NOT NULL,
INDEX (`id`)
) COMMENT = 'Qui peut accder aux stats awstats ';
ALTER TABLE `aws` ADD `public` INT(1) unsigned NOT NULL DEFAULT '1';
ALTER TABLE `aws` ADD `hostaliases` TEXT ;
Include "/etc/alternc/awstats.alternc.generic.conf"
Include "/etc/awstats/awstats.conf.local"
Include "/etc/alternc/awstats.log.alternc.conf"
SiteDomain="%%HOSTNAME%%"
HostAliases="%%HOSTALIASES%%"
DirData="/var/cache/awstats/%%HOSTNAME%%"
AllowAccessFromWebToFollowingAuthenticatedUsers="admin %%USERS%%"
AllowAccessFromWebToAuthenticatedUsersOnly=%%PUBLIC%%
AllowFullYearView=3
<?php
/*
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2000-2012 by the AlternC Development Team.
https://alternc.org/
----------------------------------------------------------------------
LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
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.
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Purpose of file: Create a new awstat statistic set.
----------------------------------------------------------------------
*/
require_once("../class/config.php");
$fields = array (
"id" => array ("request", "integer", 0),
);
getFields($fields);
if (!$id && !$quota->cancreate("aws")) {
$error=_("You cannot add any new statistics, your quota is over.");
}
include_once("head.php");
?>
<h3><?php if (!$id) { __("New Statistics"); } else { __("Edit Statistics"); } ?></h3>
<hr id="topbar"/>
<br />
<?php
if (isset($error) && $error) {
echo "<p class=\"error\">$error</p></body></html>";
}
?>
<form method="post" action="<?php if (!$id) echo "aws_doadd.php"; else echo "aws_doedit.php"; ?>" id="main" name="main">
<table class="tedit">
<tr><th><input type="hidden" name="id" value="<?php echo $id ?>" />
<label for="hostname"><?php __("Domain name"); ?></label></th><td>
<?php if (!$id) { ?>
<select class="inl" name="hostname" id="hostname"><?php $aws->select_host_list($hostname); ?></select>
<?php } else { ?>
<code><?php echo $hostname; ?></code>
<?php } ?>
</td></tr>
<tr><th><?php __("Hostaliases"); ?></th><td>
<?php // TODO : put them on 2 columns (at least)
$hl=$aws->host_list();
$hatab=$aws->get_hostaliases($id);
foreach ($hl as $ho) {
echo "<input type=\"checkbox\" name=\"hostaliases[]\" id=\"ha_$ho\" value=\"$ho\"";
if (in_array($ho,explode(" ",$hatab[0]))) echo " checked=\"checked\"";
echo " /><label for=\"ha_$ho\">$ho</label><br />\n";
}
?>
</td></tr>
<tr><th><?php __("Allowed Users"); ?></th><td>
<?php
// List the users (and check allowed ones) :
$r=$aws->list_allowed_login($id);
if (is_array($r)) {
?>
<?php
foreach($r as $v) {
echo "<input type=\"checkbox\" name=\"awsusers[]\" class=\"int\" id=\"u_".htmlentities($v["login"])."\" value=\"".htmlentities($v["login"])."\" ";
if ($v["selected"]) echo " checked=\"checked\"";
echo "><label for=\"u_".htmlentities($v["login"])."\">".$v["login"]."</label><br />\n";
}
?>
<?php
} else {
__("No users currently defined, you must create login with the 'Manage allowed users' accounts' menu.");
}
?></td></tr>
<tr><th><?php __("View public"); ?></th><td>
<select class="inl" name="public" id="public">
<?php
// Public ?
$pub=$aws->get_view_public($id);
if($pub == 0) {
echo "<option selected=\"selected\" value=\"0\">"._("Yes")."</option><option value=\"1\">"._("No")."</option>";
} else {
echo "<option selected=\"selected\" value=\"1\">"._("No")."</option><option value=\"0\">"._("Yes")."</option>";
}
?>
</select>
</td></tr>
<tr class="trbtn"><td colspan="2">
<input type="submit" class="inb" name="submit" value="<?php if (!$id) __("Create those statistics"); else __("Edit those statistics"); ?>" />
<input type="button" class="inb" name="cancel" value="<?php __("Cancel"); ?>" onclick="document.location='aws_list.php'"/>
</td></tr>
</table>
</form>
<?php include_once("foot.php"); ?>
<?php
/*
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2000-2012 by the AlternC Development Team.
https://alternc.org/
----------------------------------------------------------------------
LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
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.
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Purpose of file: Delete requested awstats statistics.
----------------------------------------------------------------------
*/
require_once("../class/config.php");
$error="";
// On parcours les POST_VARS et on repere les del_.
reset($_POST);
$found=false;
while (list($key,$val)=each($_POST)) {
if (substr($key,0,4)=="del_") {
// Effacement du jeu de stats $val
$r=$aws->delete_stats($val);
$found=true;
if (!$r) {
$error.=$err->errstr()."<br />";
} else {
$error.=sprintf(_("The statistics %s has been successfully deleted"),$r)."<br />";
}
}
}
if (!$found) {
$error.=_("Please check the statistics set you want to delete");
}
include("aws_list.php");
exit();
?>
<?php
/*
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2000-2012 by the AlternC Development Team.
https://alternc.org/
----------------------------------------------------------------------
LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
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.
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Purpose of file:
----------------------------------------------------------------------
*/
require_once("../class/config.php");
$fields = array (
"hostname" => array ("post", "string", ""),
"awsusers" => array ("post", "array", ""),
"hostaliases" => array ("post", "array", ""),
"public" => array ("post", "integer", "")
);
getFields($fields);
$r=$aws->add_stats($hostname,$awsusers,$hostaliases,$public);
if (!$r) {
$error=$err->errstr();
include("aws_add.php");
exit();
} else {
$error=_("The statistics has been successfully created");
include("aws_list.php");
exit();
}
?>
<?php
/*
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2000-2012 by the AlternC Development Team.
https://alternc.org/
----------------------------------------------------------------------
LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
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.
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Purpose of file: Edit a statistic set
----------------------------------------------------------------------
*/
require_once("../class/config.php");
$fields = array (
"id" => array ("request", "integer", 0),
"awsusers" => array ("post", "array", ""),
"hostaliases" => array ("post", "array", ""),
"public" => array ("post", "integer", "")
);
getFields($fields);
if (!$id) {
$error=_("No Statistics selected!");
} else {
$ha ="";
foreach($hostaliases as $ho)
$ha .= "$ho ";
$r=$aws->put_stats_details($id,$awsusers,$ha,$public);
if (!$r) {
$error=$err->errstr();
include("aws_edit.php");
exit();
} else {
$error=_("The Statistics has been successfully changed");
include("aws_list.php");
exit();
}
}
?>
<?php
/*
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2000-2012 by the AlternC Development Team.
https://alternc.org/
----------------------------------------------------------------------
LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
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.
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Purpose of file: Edit a statistic set
----------------------------------------------------------------------
*/
require_once("../class/config.php");
$fields = array (
"id" => array ("request", "integer", 0),
);
getFields($fields);
if (!$id) {
$error=_("No Statistics selected!");
} else {
$r=$aws->get_stats_details($id);
if (!$r) {
$error=$err->errstr();
}
}
$id=$r["id"];
$hostname=$r["hostname"];
$awsusers=$r["users"];
$hostaliases=$r["hostaliases"];
$public=$r["public"];
include("aws_add.php");
exit();
?>
<?php
/*
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2000-2012 by the AlternC Development Team.
https://alternc.org/
----------------------------------------------------------------------
LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
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.
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Purpose of file: List awstats statistics and manage them.
----------------------------------------------------------------------
*/
require_once("../class/config.php");
include_once("head.php");
$nosta=false;
if (!$r=$aws->get_list()) {
$error=$err->errstr();
$nosta=true;
}
?>
<h3><?php __("Statistics List"); ?></h3>
<hr id="topbar"/>
<br />
<p>
<span class="ina"><a href="aws_users.php"><?php __("Manage allowed users' accounts"); ?></a></span><br /><br />
<?php
if ($quota->cancreate("aws")) { ?>
<span class="ina"><a href="aws_add.php"><?php __("Create new Statistics"); ?></a></span><br />
<?php }
?>
</p>
<?php
if (isset($error) && $error) {
echo "<p class=\"error\">$error</p>";
}
if (!$nosta) {
?>
<form method="post" action="aws_del.php">
<table cellspacing="0" cellpadding="4">
<tr><th colspan="2"><?php __("Action"); ?></th><th><?php __("Domain name"); ?></th><th><?php __("Allowed Users"); ?></th><th><?php __("View the statistics"); ?></th></tr>
<?php
reset($r);
$col=1;
while (list($key,$val)=each($r))
{
$col=3-$col;
?>
<tr class="lst<?php echo $col; ?>">
<td><input type="checkbox" class="inc" id="del_<?php echo $val["id"]; ?>" name="del_<?php echo $val["id"]; ?>" value="<?php echo $val["id"]; ?>" /></td>
<td><div class="ina"><a href="aws_edit.php?id=<?php echo $val["id"] ?>"><img src="images/edit.png" alt="<?php __("Edit"); ?>" title="<?php __("Edit"); ?>" /><?php __("Edit"); ?></a></div></td>
<td><label for="del_<?php echo $val["id"]; ?>"><?php echo $val["hostname"] ?></label></td>
<td><?php echo $val["users"] ?></td>
<td><div class="ina"><img src="images/stat.png" alt="<?php __("View the statistics"); ?>" /><a href="/cgi-bin/awstats.pl?config=<?php echo $val["hostname"]; ?>"><?php __("View the statistics"); ?></a></div></td>
</tr>
<?php
}
?>
<tr><td colspan="5"><input type="submit" class="inb" name="submit" value="<?php __("Delete the checked Statistics"); ?>" /></td></tr>
</table>
</form>
<?php
}
?>
<?php include_once("foot.php"); ?>
<?php
/*
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2000-2012 by the AlternC Development Team.
https://alternc.org/
----------------------------------------------------------------------
LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
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.
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Purpose of file: Change a user's password.
----------------------------------------------------------------------
*/
require_once("../class/config.php");