Changeset 1046

Show
Ignore:
Timestamp:
09/08/04 22:12:06 (4 years ago)
Author:
anonymous
Message:

- ajout changement de pass
- creation du dossier cache
- ajout de l'alias apache awstats-icons

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/alternc-awstats

    r1037 r1046  
    22. /etc/alternc/local.sh 
    33 
    4 #if [ -e /etc/alternc/webalizer.conf ] 
    5 #then 
    6 #    . /etc/alternc/webalizer.conf 
    7 #fi 
     4# This file specify a different ACCESSLOG when there is apachemerge in the server. 
     5if [ -e /etc/alternc/webalizer.conf ] 
     6then 
     7    . /etc/alternc/webalizer.conf 
     8fi 
    89 
    910if [ -z "$ACCESSLOG" ]  
     
    1819 
    1920CACHEDIR="/var/cache/awstats" 
    20 TMPDNS=`mktemp -p /tmp` 
    21 TMPLOG=`mktemp -p /tmp` 
     21TMPLOG=`/tmp/awstats.apache.log` 
    2222mkdir -p $CACHEDIR 
    2323trap cleanup 1 2 15 
    2424 
    2525function cleanup { 
    26     rm -f $TMPDNS 
    2726    rm -f $TMPLOG 
    28 #    rm -rf $CACHEDIR/* 
    2927} 
    3028 
     
    3331    while [ "$DOM" ] 
    3432    do     
    35       #export LC_ALL="$LANG" 
    36       #export LC_MESSAGES="$LANG" 
    37       #export LANG 
    3833      echo "processing $DOM" 
    39       # first run: resolve IPs in cache 
    40       #grep -h " $DOM$" $ACCESSLOG | /usr/bin/webalizer -c $CACHEDIR/$DOM.conf -N 5 -D $TMPDNS - &>/dev/null 
    41       # second run: process the stats 
     34      grep -h " $DOM$" $ACCESSLOG >$TMPLOG 2>/dev/null 
    4235      /usr/lib/cgi-bin/awstats.pl -config=$DOM  
    4336      read DOM 
     
    4538} 
    4639 
    47 # Clear the cache dir 
    48 # DONT do it ! it looses all previously computed data !  
    49 #rm -rf $CACHEDIR/*  
    50 # Fill the cache dir (/etc dir) 
    51 # not required: m_aws.php build it properly 
    52 # /usr/lib/alternc/awstats.cache.php 
    53  
    5440# Launch the stat 
    5541mysql -h"$MYSQL_HOST" -p"$MYSQL_PASS" -u"$MYSQL_USER" "$MYSQL_DATABASE" -B -e "SELECT hostname FROM aws" |grep -v "^hostname" | dostat 
  • trunk/awstats.template.conf

    r1035 r1046  
    3434# Example: "C:/WINNT/system32/LogFiles/W3SVC1/ex%YY-24%MM-24%DD-24.log" 
    3535# 
    36 LogFile="/var/log/apache/access.log" 
     36LogFile="/tmp/awstats.access.log" 
    3737 
    3838# Put here your log format (Must match your web server config. See setup 
  • trunk/bureau/admin/aws_users.php

    r1042 r1046  
    7575        <tr class="lst<?php echo $col; ?>"> 
    7676                <td align="center"><input type="checkbox" class="inc" id="del_<?php echo $val; ?>" name="del_<?php echo $val; ?>" value="<?php echo $val; ?>" /></td> 
    77                 <td><a href="aws_pass?login=<?php echo $val ?>"><?php __("Change password"); ?></a></td> 
     77                <td><a href="aws_pass.php?login=<?php echo $val ?>"><?php __("Change password"); ?></a></td> 
    7878                <td><label for="del_<?php echo $val; ?>"><?php echo $val ?></label></td> 
    7979        </tr> 
  • trunk/bureau/class/m_aws.php

    r1045 r1046  
    280280      } 
    281281      $this->_createconf($hostname); 
     282      mkdir($CACHEDIR."/".$hostname,0777); 
    282283      return true; 
    283284    } else { 
     
    353354    } 
    354355    if (!($this->login_exists($login,0))) { 
    355       $err->raise("aws",5); // Login does not exists 
    356       return false; 
    357     } 
    358     $db->query("SELECT login FROM aws_users WHERE login='$login';"); 
    359     if ($db->next_record()) { 
    360       $err->raise("aws",7); // Login already exists. 
     356      $err->raise("aws",7); // Login already not exists 
    361357      return false; 
    362358    } 
    363359    $pass=_md5cr($pass); 
    364360    $db->query("INSERT INTO aws_users (uid,login,pass) VALUES ('$cuid','$login','$pass');"); 
     361    return true; 
     362  } 
     363 
     364  /* ----------------------------------------------------------------- */ 
     365  function change_pass($login,$pass) { 
     366    global $db,$err,$cuid; 
     367    $err->log("aws","change_pass"); 
     368 
     369    if (!($login=$this->_check($login))) { 
     370      $err->raise("aws",6); // Login incorrect  
     371      return false;       
     372    } 
     373    if (!($this->login_exists($login))) { 
     374      $err->raise("aws",5); // Login does not exists 
     375      return false; 
     376    } 
     377    $pass=_md5cr($pass); 
     378    $db->query("UPDATE aws_users SET pass='$pass' WHERE login='$login';"); 
    365379    return true; 
    366380  } 
  • trunk/debian/postinst

    r1041 r1046  
    33# Debian alternc-awstats postinst 
    44# Benjamin Sonntag <benjamin@alternc.org> 
     5 
     6# Cette fonction regarde si un fichier de config ($1) a déjà reçu une modif 
     7# de config, et sinon, lui ajoute la ligne voulue là où la balise le demande. 
     8function configure { 
     9    if grep -vqs "\*\*\*AWSTATS\*\*\*" $1 
     10        then 
     11    # 1. on déplace le fichier 
     12        rm -f $1.alternc_awstats 
     13        sed -e "s/\*\*\*ALTERNC_ALIASES\*\*\*/&\\ 
     14            # ***AWSTATS*** \\ 
     15        Alias \/awstats-icons\/ \/usr\/share\/awstats\/icons\/ " <$1 >$1.alternc_awstats 
     16        mv -f $1.alternc_awstats $1 
     17    fi 
     18} 
     19 
     20 
    521 
    622# Uses debconf 
     
    2440 
    2541    # Compile the po files :  
     42    echo "Configuring apache" 
     43    configure /etc/apache/httpd.conf 
     44    echo "Configuring apache-ssl" 
     45    configure /etc/apache-ssl/httpd.conf 
    2646    /usr/share/alternc/install/dopo.sh || true 
    2747    /etc/init.d/apache reload || true 
     
    3454    then 
    3555        echo "menu_aws.php" >>/var/alternc/bureau/admin/menulist.txt 
     56        echo "you may move menu_aws.php to a better place in /var/alternc/bureau/admin/menulist.txt" 
    3657    fi 
    3758 
  • trunk/debian/postrm

    r1030 r1046  
    33# Debian alternc-awstats prerm 
    44# Benjamin Sonntag <benjamin@alternc.org> 
     5# Cette fonction regarde si un fichier de config ($1) a déjà reçu une modif 
     6# de config, et si oui, lui enleve les lignes voulues 
     7function unconfigure { 
     8    if grep -qs "\*\*\*AWSTATS\*\*\*" $1 
     9        then 
     10        # 1. on déplace le fichier 
     11        rm -f $1.alternc_awstats 
     12        cat $1 | grep -v "\*\*\*AWSTATS\*\*\*" | grep -v "      Alias /awstats-icon/"  >$1.alternc_awstats 
     13        mv -f $1.alternc_awstats $1  
     14    fi 
     15} 
    516 
    617case "$1" in 
     
    1425    # Remove any quota  
    1526    /usr/lib/alternc/quota_delete aws 
     27    unconfigure /etc/apache/httpd.conf 
     28    unconfigure /etc/apache-ssl/httpd.conf 
     29    unconfigure /usr/share/alternc/1.0/install/etc/apache/httpd.conf 
     30    unconfigure /usr/share/alternc/1.0/install/etc/apache-ssl/httpd.conf 
    1631 
    1732    # Remove the config files