From f40811c559800f6b6a104d9b3011dc63f7b0b013 Mon Sep 17 00:00:00 2001 From: Nahuel Angelinetti Date: Mon, 21 Oct 2013 10:00:40 +0000 Subject: [PATCH] =?UTF-8?q?Sp=C3=A9cifier=20le=20bon=20chemin=20vers=20le?= =?UTF-8?q?=20accesslog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- awstats/awstats.template.conf | 1 + awstats/bureau/class/m_aws.php | 26 ++++++++++++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/awstats/awstats.template.conf b/awstats/awstats.template.conf index 5d424302..a57a9b6a 100644 --- a/awstats/awstats.template.conf +++ b/awstats/awstats.template.conf @@ -1,6 +1,7 @@ Include "/etc/alternc/awstats.alternc.generic.conf" Include "/etc/awstats/awstats.conf.local" Include "/etc/alternc/awstats.log.alternc.conf" +LogFile="%%ALTERNC_LOGS%%/%%UID%%-%%USER%%/access.log" SiteDomain="%%HOSTNAME%%" HostAliases="%%HOSTALIASES%%" DirData="/var/cache/awstats/%%HOSTNAME%%" diff --git a/awstats/bureau/class/m_aws.php b/awstats/bureau/class/m_aws.php index 1cf19dc6..29827ae5 100644 --- a/awstats/bureau/class/m_aws.php +++ b/awstats/bureau/class/m_aws.php @@ -691,7 +691,7 @@ class m_aws { * @access private */ function _createconf($id,$nochk=0) { - global $db,$err,$cuid; + global $db,$err,$cuid,$L_ALTERNC_LOGS; $s=@implode("",file($this->TEMPLATEFILE)); if (!$s) { $err->raise("aws",_("Problem to create the configuration")); @@ -707,23 +707,37 @@ class m_aws { return false; } $db->next_record(); + $uid = $db->f('uid'); $hostname=$db->f("hostname"); $hostaliases=$db->f("hostaliases"); $public=$db->f("public"); + $db->query("SELECT login FROM membres WHERE uid = '$uid'"); + $db->next_record(); + $username = $db->f('login'); $db->query("SELECT login FROM aws_access WHERE id='$id';"); $users=""; while ($db->next_record()) { $users.=$db->f("login")." "; } - $s=str_replace("%%HOSTNAME%%",$hostname,$s); - $s=str_replace("%%PUBLIC%%",$public,$s); - $s=str_replace("%%HOSTALIASES%%",$hostaliases,$s); - $s=str_replace("%%USERS%%",$users,$s); + + $replace_vars = array( + '%%UID%%' => $uid, + '%%USER%%' => $username, + '%%ALTERNC_LOGS%%' => $L_ALTERNC_LOGS, + '%%PUBLIC%%' => $public, + '%%HOSTNAME%%' => $hostname, + '%%HOSTALIASES%%' => $hostaliases, + '%%USERS%%' => $users, + ); + foreach ($replace_vars as $k=>$v){ + $s=str_replace($k,$v,$s); + } + $f=fopen($this->CONFDIR."/awstats.".$hostname.".conf","wb"); fputs($f,$s,strlen($s)); fclose($f); - return true; + return true; }