Index: /debian/alternc.cron
===================================================================
--- /debian/alternc.cron	(revision 266)
+++ /debian/alternc.cron	(revision 266)
@@ -0,0 +1,10 @@
+# Every day at 4am, produce raw statistics
+0 4 * * *	www-data	/usr/lib/alternc/rawstat.daily
+
+# Every day at 5am and every week at 4am, make requested SQL backups
+0 5 * * *	www-data	/usr/lib/alternc/sqlbackup/bck.daily.sh
+0 4 * * 0	www-data	/usr/lib/alternc/sqlbackup/bck.weekly.sh
+
+# Every 5 minutes, spool waiting domain changes
+*/5 * * * *	root		/usr/lib/alternc/system/do_domaines.sh
+
Index: /debian/rules
===================================================================
--- /debian/rules	(revision 254)
+++ /debian/rules	(revision 266)
@@ -53,7 +53,4 @@
 	install -o root -g www-data -m0750 \
 		install/etc/alternc/alternc.conf debian/tmp/etc/alternc/
-	install -o www-data -g www-data -d debian/tmp/etc/webalizer
-	install -o www-data -g www-data -m0755 \
-		install/etc/webalizer/template.conf debian/tmp/etc/webalizer/
 	# les scripts d'install
 # TODO laisser les scripts dans /usr/share et faire des liens
@@ -66,7 +63,6 @@
 # installation de sqlbackup
 	cp -r sqlbackup debian/tmp/usr/lib/alternc/
-# installation de webalizer
-	cp -r webalizer debian/tmp/usr/lib/alternc/
 
+	cp rawstat.daily debian/tmp/usr/lib/alternc/
 	cp -r dns/* debian/tmp/usr/lib/alternc/system/
 
Index: /bureau/class/m_sta2.php
===================================================================
--- /bureau/class/m_sta2.php	(revision 266)
+++ /bureau/class/m_sta2.php	(revision 266)
@@ -0,0 +1,279 @@
+<?php
+/*
+ $Id: m_sta2.php,v 1.1 2004/05/24 15:28:42 anonymous Exp $
+ ----------------------------------------------------------------------
+ AlternC - Web Hosting System
+ Copyright (C) 2002 by the AlternC Development Team.
+ http://alternc.org/
+ ----------------------------------------------------------------------
+ Based on:
+ Valentin Lacambre's web hosting softwares: http://altern.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
+ ----------------------------------------------------------------------
+ Original Author of file: Benjamin Sonntag
+ Purpose of file: Gestion des statistiques web par Webalizer.
+ ----------------------------------------------------------------------
+*/
+/**
+* Classe de gestion des statistiques web webalizer / apache des hébergés
+* 
+* Cette classe permet de gérer les statistiques web générées par webalizer
+* dans la langue de votre choix, ainsi que les fichiers logs bruts d'apache.<br />
+* Copyleft {@link http://alternc.net/ AlternC Team}
+* 
+* @copyright    AlternC-Team 2002-11-01 http://alternc.net/
+* 
+*/
+class m_sta2 {
+
+  /* ----------------------------------------------------------------- */
+  /**
+   * Constructeur
+   */
+  function m_sta2() {
+  }
+
+  /* ----------------------------------------------------------------- */
+  /**
+   * Nom du quota
+   */
+  function alternc_quota_names() {
+    return "sta2";
+  } 
+
+
+  /* ----------------------------------------------------------------- */
+  /** Retourne la liste des domaines / sous-domaines autorisés pour le membre.
+   * 
+   * @return array retourne un tableau indexé des domaines / sous-domaines utilisables.
+   */
+  function host_list() {
+    global $db,$err,$cuid;
+    $r=array();
+    $db->query("SELECT domaine,sub FROM sub_domaines WHERE compte='$cuid' ORDER BY domaine,sub;");
+    while ($db->next_record()) {
+      if ($db->f("sub")) {
+	$r[]=$db->f("sub").".".$db->f("domaine");
+      } else {
+	$r[]=$db->f("domaine");
+      }
+    }
+    return $r;
+  }
+
+  /* ----------------------------------------------------------------- */
+  /** 
+   * Affiche des options select de la liste des noms de domaines autorisés pour
+   * le membre. sous forme de champs d'options (select)
+   */
+  function select_host_list($current) {
+    $r=$this->host_list();
+    reset($r);
+    while (list($key,$val)=each($r)) {
+      if ($current==$val) $c=" selected=\"selected\""; else $c="";
+      echo "<option$c>$val</option>";
+    }
+    return true;
+  }
+
+  function alternc_del_member() {
+    global $db,$quota,$err,$cuid;
+    $err->log("sta2","del_member");
+    $db->query("DELETE FROM stats2 WHERE mid='$cuid';");
+    return true;
+  }
+
+  /* ----------------------------------------------------------------- */
+  /** 
+   * Fonction appellée par m_dom lorsqu'un domaine est supprimé.
+   * @param string $dom est le domaine à supprimer.
+   */
+  function alternc_del_domain($dom) {
+    global $db,$quota,$err,$cuid;
+    $err->log("sta2","del_dom",$dom);
+    // Suppression des stats apache brutes : 
+    $db->query("SELECT * FROM stats2 WHERE mid='$cuid' AND hostname like '%$dom'");
+    $cnt=0;
+    $t=array();
+    while ($db->next_record()) {
+      $cnt++;
+      $t[]=$db->f("hostname");
+    }
+    $r=$quota->getquota("sta2");
+    $quota->setquota("sta2",$r["u"]-$cnt,1);
+    // on détruit les jeux de stats associés au préfixe correspondant :
+    for($i=0;$i<cnt;$i++) {
+      $db->query("DELETE FROM stats2 WHERE mid='$cuid' AND hostname='".$t[$i]."';");
+    }
+    return true;
+  }
+
+  /* ----------------------------------------------------------------- */
+  /** 
+   * Recalcule le quota complet de l'utilisateur courant, ou de l'utilisateur $id
+   * @param integer $id Numéro de l'utilisateur (facultatif)
+   */
+  function alternc_quota_check() {
+    global $db,$err,$quota,$cuid;
+    $err->log("sta2","checkquota");
+    $db->query("SELECT COUNT(*) AS cnt FROM stats2 WHERE mid='$cuid'");
+    $db->next_record();
+    $ss+=intval($db->f("cnt"));
+    $quota->setquota("sta2",$ss,1);
+    return true;
+  }
+
+  /* ----------------------------------------------------------------- */
+  /** Retourne un tableau contenant les jeux de stats APACHE 
+   * d'un membre. Le tableau est de la forme
+   * $r[0-n]["id"] = numéros du jeu
+   * $r[0-n]["hostname"]= domaine concerné
+   * $r[0-n]["folder"]= Répertoire destination (dans le dossier du membre)
+   * 
+   * @return array Tableau de résultat, ou FALSE si une erreur est survenue
+   */
+  function get_list_raw() {
+    global $db,$err,$cuid;
+    $err->log("stats","get_list_raw");
+    $r=array();
+    $db->query("SELECT id, hostname, folder FROM stats2 WHERE mid='$cuid' ORDER BY hostname;");
+    if ($db->num_rows()) {
+      while ($db->next_record()) {
+	// On passe /var/alternc/html/u/user
+	preg_match("/^\/var\/alternc\/html\/.\/[^\/]*\/(.*)/", $db->f("folder"),$match);
+	$r[]=array(
+		   "id"=>$db->f("id"),
+		   "hostname"=>$db->f("hostname"),
+		   "folder"=>$match[1]
+		   );
+      }
+      return $r;
+    } else {
+      $err->raise("stats",7);
+      return false;
+    }
+  }
+
+  /* ----------------------------------------------------------------- */
+  /** 
+   * retourne un tableau contenant les details d'un
+   * jeu de statistiques apache brut géré par le membre.
+   * $id est un id de jeu de stats. Retourne un tableau associatif sous la forme :
+   * "id" = numéro du jeu
+   * "hostname"= domaine concerné
+   * "folder"= Répertoire destination (dans le dossier du membre)
+   * @param string $id Numéro du jeu de stats brutes dont on veut les détails
+   * @return array Tableau contenant les détails du jeu, ou FALSE en cas d'erreur
+   */
+  function get_stats_details_raw($id) {
+    global $db,$err,$cuid;
+    $err->log("stats","get_stats_details_raw",$id);
+    $r=array();
+    $db->query("SELECT id, hostname, folder FROM stats2 WHERE mid='$cuid' AND id='$id';");
+    if ($db->num_rows()) {
+      $db->next_record();
+      // On passe /var/alternc/html/u/user
+      preg_match("/^\/var\/alternc\/html\/.\/[^\/]*\/(.*)/", $db->f("folder"),$match);
+      return array(
+		   "id"=>$db->f("id"),
+		   "hostname"=> $db->f("hostname"),
+		   "folder"=>$match[1]
+		   );
+    } else {
+      $err->raise("stats",8);
+      return false;
+    }
+  }
+
+  /* ----------------------------------------------------------------- */
+  /** 
+   * Modifie un jeu de statistiques apache brutes existant
+   * $id est le numéro du jeu de statistiques
+   * $folder est un chemin relatif à "/var/alternc/html/u/user"
+   * @param integer $id Numéro du jeu de stats brutes à modifier 
+   * @param string $folder Dossier destination des stats
+   * @return boolean TRUE si le jeu a été modifié, FALSE sinon.
+   */
+  function put_stats_details_raw($id,$folder) {
+    global $db,$err,$bro,$mem,$cuid;
+    $err->log("stats","put_stats_details_raw",$id);
+    $db->query("SELECT count(*) AS cnt FROM stats2 WHERE id='$id' and mid='$cuid';");
+    $db->next_record();
+    if (!$db->f("cnt")) {
+      $err->raise("stats",8);
+      return false;
+    }
+    // TODO : replace with ,1 on convertabsolute call, and delete "/Var/alternc.../" at the query.
+    $folder=$bro->convertabsolute($folder);
+    if (substr($folder,0,1)=="/") {
+      $folder=substr($folder,1);
+    }
+    $lo=$mem->user["login"];
+    $l=substr($lo,0,1);
+    $db->query("UPDATE stats2 SET folder='/var/alternc/html/$l/$lo/$folder', mid='$cuid' WHERE id='$id';");
+    return true;
+  }
+
+  /* ----------------------------------------------------------------- */
+  /** 
+   * Efface un jeu de statistiques apache brut existant
+   * @param integer $id est un id de jeu de statistiques
+   * @return boolean TRUE si le jeu a été effacé, FALSE sinon.
+   */
+  function delete_stats_raw($id) {
+    global $db,$err,$quota,$cuid;
+    $err->log("stats","delete_stats_raw",$id);
+    $db->query("SELECT hostname FROM stats2 WHERE id='$id' and mid='$cuid';");
+    if (!$db->num_rows()) {
+      $err->raise("stats",8);
+      return false;
+    }
+    $db->next_record();
+    $db->query("DELETE FROM stats2 WHERE id='$id'");
+    $quota->dec("stats");
+    return true;
+  }
+
+  /* ----------------------------------------------------------------- */
+  /** 
+   * Crée un nouveau jeu de statistiques brutes apache.
+   * @param string $hostname est le domaine concerné
+   * @param string $dir est le chemin d'accès racine des stats dans le compte
+   * @return boolean TRUE si le jeu a été créé, FALSE si un erreur est survenue
+   */
+  function add_stats_raw($hostname,$dir) {
+    global $db,$err,$quota,$bro,$mem,$cuid;
+    $err->log("stats","add_stats_raw",$hostname);
+    // TODO : utiliser le second param de convertabsolute pour simplification.
+    $dir=$bro->convertabsolute($dir);
+    if (substr($dir,0,1)=="/") {
+      $dir=substr($dir,1);
+    }
+    $lo=$mem->user["login"];
+    $l=substr($lo,0,1);
+    if ($quota->cancreate("stats")) {
+      $quota->inc("stats");
+      $db->query("INSERT INTO stats2 (hostname,folder,mid) VALUES ('$hostname','/var/alternc/html/$l/$lo/$dir','$cuid')");
+      return true;
+    } else {
+      $err->raise("stats",5);
+      return false;
+    }
+  }
+
+} /* CLASSE m_sta2 */
+
+?>
Index: /bureau/admin/menu_sta2.php
===================================================================
--- /bureau/admin/menu_sta2.php	(revision 266)
+++ /bureau/admin/menu_sta2.php	(revision 266)
@@ -0,0 +1,39 @@
+<?php
+/*
+ $Id: menu_sta2.php,v 1.1 2004/05/24 15:28:42 anonymous Exp $
+ ----------------------------------------------------------------------
+ AlternC - Web Hosting System
+ Copyright (C) 2002 by the AlternC Development Team.
+ http://alternc.org/
+ ----------------------------------------------------------------------
+ Based on:
+ Valentin Lacambre's web hosting softwares: http://altern.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
+ ----------------------------------------------------------------------
+ Original Author of file:
+ Purpose of file:
+ ----------------------------------------------------------------------
+*/
+
+/* ############# STATS ############# */
+$q=$quota->getquota("sta2");
+$r=$quota->getquota("dom");
+if ($q["t"]>0 && $r["u"]>0) {
+?>
+<tr><td nowrap="nowrap">
+<a href="sta2_list.php"><?php __("Raw web statistics"); ?></a><br />
+</td></tr>
+<?php    }    ?>
Index: reau/admin/sta_del.php
===================================================================
--- /bureau/admin/sta_del.php	(revision 102)
+++ 	(revision )
@@ -1,49 +1,0 @@
-<?php
-/*
- $Id: sta_del.php,v 1.2 2003/06/10 06:45:16 root Exp $
- ----------------------------------------------------------------------
- AlternC - Web Hosting System
- Copyright (C) 2002 by the AlternC Development Team.
- http://alternc.org/
- ----------------------------------------------------------------------
- Based on:
- Valentin Lacambre's web hosting softwares: http://altern.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
- ----------------------------------------------------------------------
- Original Author of file:
- Purpose of file:
- ----------------------------------------------------------------------
-*/
-require_once("../class/config.php");
-
-$error="";
-// On parcours les POST_VARS et on repere les del_.
-reset($_POST);
-while (list($key,$val)=each($_POST)) {
-	if (substr($key,0,4)=="del_") {
-		// Effacement du jeu de stats $val
-		$r=$stats->delete_stats($val);
-		if (!$r) {
-			$error.=$err->errstr()."<br />";
-		} else {
-			$error.=sprintf(_("The statistics %s has been successfully deleted (the stats files must be manually deleted)"),$r)."<br />";
-		}
-	}
-}
-
-include("sta_list.php");
-exit();
-?>
Index: reau/admin/sta_add.php
===================================================================
--- /bureau/admin/sta_add.php	(revision 142)
+++ 	(revision )
@@ -1,67 +1,0 @@
-<?php
-/*
- $Id: sta_add.php,v 1.4 2003/08/19 19:07:09 root Exp $
- ----------------------------------------------------------------------
- AlternC - Web Hosting System
- Copyright (C) 2002 by the AlternC Development Team.
- http://alternc.org/
- ----------------------------------------------------------------------
- Based on:
- Valentin Lacambre's web hosting softwares: http://altern.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
- ----------------------------------------------------------------------
- Original Author of file:
- Purpose of file:
- ----------------------------------------------------------------------
-*/
-require_once("../class/config.php");
-
-if (!$quota->cancreate("stats")) {
-	$error=_("You cannot add any new statistics, your quota is over.");
-}
-
-include("head.php");
-?>
-</head>
-<body>
-<h3><?php __("New Statistics"); ?></h3>
-<?php
-	if ($error) {
-		echo "<p class=\"error\">$error</p></body></html>";
-		exit();
-	}
-?>
-<form method="post" action="sta_doadd.php" id="main" name="main">
-<table border="1" cellspacing="0" cellpadding="4">
-<tr><th><input type="hidden" name="id" value="<?php echo $id ?>" />
-        <label for="hostname"><?php __("Domain name"); ?></label></th><td>
-	<select class="inl" name="hostname" id="hostname"><?php $stats->select_host_list($hostname); ?></select>
-</td></tr>
-<tr><th><label for="stalang"><?php __("Language"); ?></label></th><td><select class="inl" name="stalang" id="stalang"><?php $stats->select_lang_list($lang) ?></select></td></tr>
-<tr><th><label for="dir"><?php __("Folder"); ?></label></th><td><input type="text" class="int" name="dir" id="dir" value="<?php echo $dir; ?>" size="20" maxlength="255" />
-<script type="text/javascript">
-<!--
-  document.write("&nbsp;<input type=\"button\" name=\"bff\" onclick=\"browseforfolder('main.dir');\" value=\" ... \" class=\"inb\" />");
-//  -->
-</script>
-</td></tr>
-<tr><td colspan="2"><input type="submit" class="inb" name="submit" value="<?php __("Create those statistics"); ?>" /></td></tr>
-</table>
-</form>
-<?php $mem->show_help("sta_add"); ?>
-
-</body>
-</html>
Index: reau/admin/sta_edit_raw.php
===================================================================
--- /bureau/admin/sta_edit_raw.php	(revision 107)
+++ 	(revision )
@@ -1,70 +1,0 @@
-<?php
-/*
- $Id: sta_edit_raw.php,v 1.3 2003/06/10 11:18:27 root Exp $
- ----------------------------------------------------------------------
- AlternC - Web Hosting System
- Copyright (C) 2002 by the AlternC Development Team.
- http://alternc.org/
- ----------------------------------------------------------------------
- Based on:
- Valentin Lacambre's web hosting softwares: http://altern.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
- ----------------------------------------------------------------------
- Original Author of file:
- Purpose of file:
- ----------------------------------------------------------------------
-*/
-require_once("../class/config.php");
-
-if (!$id) {
-	$error=_("No Statistics selected!");
-} else {
-	$r=$stats->get_stats_details_raw($id);
-	if (!$r) {
-		$error=$err->errstr();
-	}
-}
-
-include("head.php");
-?>
-</head>
-<body>
-<h3><?php __("Change the Raw Statistics"); ?></h3>
-<?php
-	if ($error) {
-		echo "<p class=\"error\">$error</p></body></html>";
-		exit();
-	}
-?>
-<form method="post" action="sta_doedit_raw.php" id="main">
-<table border="1" cellspacing="0" cellpadding="4">
-<tr><th><input type="hidden" name="id" value="<?php echo $id ?>" />
-        <?php __("Domain name"); ?></th><td>
-	<?php echo $r["hostname"]; ?>
-</td></tr>
-<tr><th><label for="folder"><?php __("Folder"); ?></label></th><td><input type="text" class="int" name="folder" id="folder" value="<?php echo $r["folder"]; ?>" size="20" maxlength="255" />
-<script type="text/javascript">
-<!--
-  document.write("&nbsp;<input type=\"button\" name=\"bff\" onclick=\"browseforfolder('main.folder');\" value=\" ... \" class=\"inb\" />");
-//  -->
-</script>
-</td></tr>
-<tr><td colspan="2"><input type="submit" class="inb" name="submit" value="<?php __("Change those Raw Statistics."); ?>" /></td></tr>
-</table>
-</form>
-
-</body>
-</html>
Index: reau/admin/menu_stats.php
===================================================================
--- /bureau/admin/menu_stats.php	(revision 101)
+++ 	(revision )
@@ -1,39 +1,0 @@
-<?php
-/*
- $Id: menu_stats.php,v 1.2 2003/06/10 06:42:25 root Exp $
- ----------------------------------------------------------------------
- AlternC - Web Hosting System
- Copyright (C) 2002 by the AlternC Development Team.
- http://alternc.org/
- ----------------------------------------------------------------------
- Based on:
- Valentin Lacambre's web hosting softwares: http://altern.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
- ----------------------------------------------------------------------
- Original Author of file:
- Purpose of file:
- ----------------------------------------------------------------------
-*/
-
-/* ############# STATS ############# */
-$q=$quota->getquota("stats");
-$r=$quota->getquota("dom");
-if ($q["t"]>0 && $r["u"]>0) {
-?>
-<tr><td nowrap="nowrap">
-<a href="sta_list.php"><?php __("Web Statistics"); ?></a><br />
-</td></tr>
-<?php    }    ?>
Index: reau/admin/sta_edit.php
===================================================================
--- /bureau/admin/sta_edit.php	(revision 150)
+++ 	(revision )
@@ -1,71 +1,0 @@
-<?php
-/*
- $Id: sta_edit.php,v 1.4 2003/08/20 14:36:58 root Exp $
- ----------------------------------------------------------------------
- AlternC - Web Hosting System
- Copyright (C) 2002 by the AlternC Development Team.
- http://alternc.org/
- ----------------------------------------------------------------------
- Based on:
- Valentin Lacambre's web hosting softwares: http://altern.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
- ----------------------------------------------------------------------
- Original Author of file:
- Purpose of file:
- ----------------------------------------------------------------------
-*/
-require_once("../class/config.php");
-
-if (!$id) {
-	$error=_("No Statistics selected!");
-} else {
-	$r=$stats->get_stats_details($id);
-	if (!$r) {
-		$error=$err->errstr();
-	}
-}
-
-include("head.php");
-?>
-</head>
-<body>
-<h3><?php __("Change the Statistics"); ?></h3>
-<?php
-	if ($error) {
-		echo "<p class=\"error\">$error</p></body></html>";
-		exit();
-	}
-?>
-<form method="post" action="sta_doedit.php" id="main" name="main">
-<table border="1" cellspacing="0" cellpadding="4">
-<tr><th><input type="hidden" name="id" value="<?php echo $id ?>" />
-        <?php __("Domain name"); ?></th><td>
-	<?php echo $r["hostname"]; ?>
-</td></tr>
-<tr><th><label for="stalang"><?php __("Language"); ?></label></th><td><select class="inl" name="stalang" id="stalang"><?php $stats->select_lang_list($r["lang"]) ?></select></td></tr>
-<tr><th><label for="dir"><?php __("Folder"); ?></label></th><td><input type="text" class="int" name="dir" id="dir" value="<?php echo $r["dir"]; ?>" size="20" maxlength="255" />
-<script type="text/javascript">
-<!--
-  document.write("&nbsp;<input type=\"button\" name=\"bff\" onclick=\"browseforfolder('main.dir');\" value=\" ... \" class=\"inb\" />");
-//  -->
-</script>
-</td></tr>
-<tr><td colspan="2"><input type="submit" class="inb" name="submit" value="<?php __("Change those Statistics."); ?>" /></td></tr>
-</table>
-</form>
-
-</body>
-</html>
Index: reau/admin/sta_doedit.php
===================================================================
--- /bureau/admin/sta_doedit.php	(revision 1)
+++ 	(revision )
@@ -1,46 +1,0 @@
-<?php
-/*
- $Id: sta_doedit.php,v 1.1.1.1 2003/03/26 17:41:29 root Exp $
- ----------------------------------------------------------------------
- AlternC - Web Hosting System
- Copyright (C) 2002 by the AlternC Development Team.
- http://alternc.org/
- ----------------------------------------------------------------------
- Based on:
- Valentin Lacambre's web hosting softwares: http://altern.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
- ----------------------------------------------------------------------
- Original Author of file:
- Purpose of file:
- ----------------------------------------------------------------------
-*/
-require_once("../class/config.php");
-
-if (!$id) {
-	$error=_("No Statistics selected!");
-} else {
-	$r=$stats->put_stats_details($id,$dir,$stalang);
-	if (!$r) {
-		$error=$err->errstr();
-		include("sta_edit.php");
-		exit();
-	} else {
-		$error=_("The Statistics has been successfully changed");
-		include("sta_list.php");
-		exit();
-	}
-}
-?>
Index: reau/admin/sta_list.php
===================================================================
--- /bureau/admin/sta_list.php	(revision 150)
+++ 	(revision )
@@ -1,134 +1,0 @@
-<?php
-/*
- $Id: sta_list.php,v 1.7 2003/08/20 14:36:58 root Exp $
- ----------------------------------------------------------------------
- AlternC - Web Hosting System
- Copyright (C) 2002 by the AlternC Development Team.
- http://alternc.org/
- ----------------------------------------------------------------------
- Based on:
- Valentin Lacambre's web hosting softwares: http://altern.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
- ----------------------------------------------------------------------
- Original Author of file:
- Purpose of file:
- ----------------------------------------------------------------------
-*/
-require_once("../class/config.php");
-
-$nosta=false;
-if (!$r=$stats->get_list()) {
-	$error=$err->errstr();
-	$nosta=true;
-}
-
-include("head.php");
-?>
-</head>
-<body>
-<h3><?php __("Statistics List"); ?></h3>
-<?php
-	if ($quota->cancreate("stats")) { ?>
-<p>
-		- <a href="sta_add.php"><?php __("Create new Statistics"); ?></a><br />
-		- <a href="sta_add_raw.php"><?php __("Create new Raw Statistics (apache)"); ?></a>
-</p>
-<?php  	}
-
-	if ($error) {
-		echo "<p class=\"error\">$error</p>";
-	}
-
-if (!$nosta) {
-?>
-
-<p>
-<?php __("help_sta_list"); ?>
-</p>
-<form method="post" action="sta_del.php">
-<table cellspacing="0" cellpadding="4">
-<tr><th colspan="2">&nbsp;</th><th><?php __("Domain name"); ?></th><th><?php __("Language"); ?></th><th><?php __("Folder"); ?></th><th><?php __("View"); ?></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><a href="sta_edit.php?id=<?php echo $val["id"] ?>"><?php __("Edit"); ?></a></td>
-		<td><label for="del_<?php echo $val["id"]; ?>"><?php echo $val["hostname"] ?></label></td>
-		<td><?php echo _($stats->langname[$val["lang"]]); ?></td>
-		<td><code>/<?php echo $val["dir"] ?></code></td>
-		<td><?php
-	if ($uv=$bro->viewurl($val["dir"],"")) echo "<a href=\"$uv\">"._("View")."</a>";
-?>&nbsp;</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 $mem->show_help("sta_list"); 
-
-}
-
-if (!$r=$stats->get_list_raw()) {
-        $error=$err->errstr();
-	echo "<p class=\"error\">$error</p>";
-} else {
-
-?>
-
-<form method="post" action="sta_del_raw.php">
-<table cellspacing="0" cellpadding="4">
-<tr><th colspan="2">&nbsp;</th><th><?php __("Domain name"); ?></th><th><?php __("Folder"); ?></th><th><?php __("View"); ?></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" name="del_<?php echo $val["id"]; ?>" value="<?php echo $val["id"]; ?>" /></td>
-                <td><a href="sta_edit_raw.php?id=<?php echo $val["id"] ?>"><?php __("Edit"); ?></a></td>
-                <td><?php echo $val["hostname"] ?></td>
-                <td><code>/<?php echo $val["folder"] ?></code></td>
-                <td><?php
-        if ($uv=$bro->viewurl($val["dir"]."/".$val["hostname"],"")) echo "<a href=\"$uv\">"._("View")."</a>";
-?>&nbsp;</td>
-        </tr>
-<?php
-        }
-
-?>
-
-<tr><td colspan="5"><input type="submit" class="inb" name="submit" value="<?php __("Delete the checked Raw Statistics (apache)"); ?>" /></td></tr>
-</table>
-</form>
-
-
-<?php
-}
- ?>
-</body>
-</html>
Index: reau/admin/sta_del_raw.php
===================================================================
--- /bureau/admin/sta_del_raw.php	(revision 102)
+++ 	(revision )
@@ -1,49 +1,0 @@
-<?php
-/*
- $Id: sta_del_raw.php,v 1.2 2003/06/10 06:45:16 root Exp $
- ----------------------------------------------------------------------
- AlternC - Web Hosting System
- Copyright (C) 2002 by the AlternC Development Team.
- http://alternc.org/
- ----------------------------------------------------------------------
- Based on:
- Valentin Lacambre's web hosting softwares: http://altern.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
- ----------------------------------------------------------------------
- Original Author of file:
- Purpose of file:
- ----------------------------------------------------------------------
-*/
-require_once("../class/config.php");
-
-$error="";
-// On parcours les POST_VARS et on repere les del_.
-reset($_POST);
-while (list($key,$val)=each($_POST)) {
-	if (substr($key,0,4)=="del_") {
-		// Effacement du jeu de stats $val
-		$r=$stats->delete_stats_raw($val);
-		if (!$r) {
-			$error.=$err->errstr()."<br />";
-		} else {
-			$error.=sprintf(_("The statistics %s has been successfully deleted (the stats files must be manually deleted)"),$r)."<br />";
-		}
-	}
-}
-
-include("sta_list.php");
-exit();
-?>
Index: reau/admin/sta_add_raw.php
===================================================================
--- /bureau/admin/sta_add_raw.php	(revision 107)
+++ 	(revision )
@@ -1,66 +1,0 @@
-<?php
-/*
- $Id: sta_add_raw.php,v 1.3 2003/06/10 11:18:27 root Exp $
- ----------------------------------------------------------------------
- AlternC - Web Hosting System
- Copyright (C) 2002 by the AlternC Development Team.
- http://alternc.org/
- ----------------------------------------------------------------------
- Based on:
- Valentin Lacambre's web hosting softwares: http://altern.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
- ----------------------------------------------------------------------
- Original Author of file:
- Purpose of file:
- ----------------------------------------------------------------------
-*/
-require_once("../class/config.php");
-
-if (!$quota->cancreate("stats")) {
-	$error=_("You cannot add any new statistics, your quota is over.");
-}
-
-include("head.php");
-?>
-</head>
-<body>
-<h3><?php __("New Raw Statistics (apache)"); ?></h3>
-<?php
-	if ($error) {
-		echo "<p class=\"error\">$error</p></body></html>";
-		exit();
-	}
-?>
-<form method="post" action="sta_doadd_raw.php" id="main">
-<table border="1" cellspacing="0" cellpadding="4">
-<tr><th><input type="hidden" name="id" value="<?php echo $id ?>" />
-        <label for="hostname"><?php __("Domain name"); ?></label></th><td>
-	<select class="inl" name="hostname" id="hostname"><?php $stats->select_host_list($hostname); ?></select>
-</td></tr>
-<tr><th><label for="folder"><?php __("Folder"); ?></label></th><td><input type="text" class="int" name="folder" id="folder" value="<?php echo $folder; ?>" size="20" maxlength="255" />
-<script type="text/javascript">
-<!--
-  document.write("&nbsp;<input type=\"button\" name=\"bff\" onclick=\"browseforfolder('main.folder');\" value=\" ... \" class=\"inb\" />");
-//  -->
-</script>
-</td></tr>
-<tr><td colspan="2"><input type="submit" class="inb" name="submit" value="<?php __("Create those raw statistics"); ?>" /></td></tr>
-</table>
-</form>
-<?php $mem->show_help("sta_add"); ?>
-
-</body>
-</html>
Index: reau/admin/sta_doedit_raw.php
===================================================================
--- /bureau/admin/sta_doedit_raw.php	(revision 1)
+++ 	(revision )
@@ -1,46 +1,0 @@
-<?php
-/*
- $Id: sta_doedit_raw.php,v 1.1.1.1 2003/03/26 17:41:29 root Exp $
- ----------------------------------------------------------------------
- AlternC - Web Hosting System
- Copyright (C) 2002 by the AlternC Development Team.
- http://alternc.org/
- ----------------------------------------------------------------------
- Based on:
- Valentin Lacambre's web hosting softwares: http://altern.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
- ----------------------------------------------------------------------
- Original Author of file:
- Purpose of file:
- ----------------------------------------------------------------------
-*/
-require_once("../class/config.php");
-
-if (!$id) {
-	$error=_("No Statistics selected!");
-} else {
-	$r=$stats->put_stats_details_raw($id,$folder);
-	if (!$r) {
-		$error=$err->errstr();
-		include("sta_edit_raw.php");
-		exit();
-	} else {
-		$error=_("The Statistics has been successfully changed");
-		include("sta_list.php");
-		exit();
-	}
-}
-?>
Index: /rawstat.daily
===================================================================
--- /rawstat.daily	(revision 266)
+++ /rawstat.daily	(revision 266)
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+. /etc/alternc/local.sh
+if [ -z "$MYSQL_HOST" ]
+then
+    MYSQL_HOST="localhost"
+fi
+
+function rawstats {
+    read FOLD DOM
+    while [ "$DOM" ]
+    do
+	echo "Generating Raw Statistics of apache for domain $DOM in folder $FOLD"
+	grep " $DOM$" /var/log/apache/access.log.1 >>"$FOLD/$DOM.log"
+	read FOLD DOM
+    done
+}
+
+cd /usr/lib/alternc/webalizer
+
+mysql -h"$MYSQL_HOST" -p"$MYSQL_PASS" -u"$MYSQL_USER" "$MYSQL_DATABASE" -B -e "SELECT folder,hostname FROM stats2" |grep -v "^folder" | rawstats
+
Index: /install/scripts/mysql.sql
===================================================================
--- /install/scripts/mysql.sql	(revision 264)
+++ /install/scripts/mysql.sql	(revision 266)
@@ -1,4 +1,4 @@
 #
-# $Id: mysql.sql,v 1.17 2004/05/24 14:55:38 anonymous Exp $
+# $Id: mysql.sql,v 1.18 2004/05/24 15:28:42 anonymous Exp $
 # ----------------------------------------------------------------------
 # AlternC - Web Hosting System
@@ -202,18 +202,4 @@
   ip int(10) unsigned NOT NULL default '0'		# Adresse IP de la connexion
 ) TYPE=MyISAM COMMENT='Session actives sur le bureau';
-
-#
-# Structure de la table `stats`
-#
-# Jeux de statistiques des membres
-
-CREATE TABLE IF NOT EXISTS stats (
-  id int(10) unsigned NOT NULL auto_increment,		# Numéro du jeu de statistiques
-  uid int(10) unsigned NOT NULL default '0',		# Numéro GID du membre concerné
-  hostname varchar(255) NOT NULL default '',		# Nom fqdn dont on sort les statistiques
-  dir varchar(255) NOT NULL default '',			# Répertoire dans lequel on stocke les statistiques
-  lang enum('FR','EN') NOT NULL default 'FR',		# Langue de sortie des statistiques
-  PRIMARY KEY  (id)
-) TYPE=MyISAM COMMENT='Statistiques web par Webalizer';
 
 #
Index: /install/scripts/upgrades/0.9.1.sh
===================================================================
--- /install/scripts/upgrades/0.9.1.sh	(revision 264)
+++ /install/scripts/upgrades/0.9.1.sh	(revision 266)
@@ -113,2 +113,3 @@
 
 
+# TODO : add a quota check for every account... (since sta2/stats are now separated.
Index: /install/scripts/alternc.install
===================================================================
--- /install/scripts/alternc.install	(revision 219)
+++ /install/scripts/alternc.install	(revision 266)
@@ -152,8 +152,4 @@
          "local.php" => "[General] Fichier de configuration general du Bureau virtuel",
 
-         # Taches planifiees :
-         "etc/cron.d/domaines" => "[Cron] Gestion des domaines",
-         "etc/cron.d/webalizer" => "[Cron] Gestion des statistiques web",
-
          # Externalisation des mots de passe utilises dans les shells systeme :
          "etc/alternc/local.sh" => "[Pass] Mots de passe mysql utilisés par les shells systeme",
@@ -181,5 +177,4 @@
          "etc/mysql/my.cnf" => "[MySQL] Fichier de configuration du serveur de donnees",
          "etc/mysql/debian.cnf" => "[MySQL] Fichier de configuration Debian",
-         "etc/cron.d/bcksql" => "[MySQL] Cron de Backup quotidien / hebdomadaire",
 
          # PHP4 (Language server-side pour Apache)
@@ -221,5 +216,5 @@
         "etc/alternc", "etc/bind", "etc/bind/master", "etc/mysql", "etc/courier",
         "etc/php4",     "etc/php4/apache", "etc/apache-ssl", "etc/apache", "etc/ldap",
-        "etc/ldap/conf", "etc/init.d","etc/ldap/tmp","etc/postfix","etc/cron.d",
+        "etc/ldap/conf", "etc/init.d","etc/ldap/tmp","etc/postfix",
         "etc/logrotate.d", "etc/webalizer", "etc/squirrelmail", "etc/php4/cgi",
         "change_ldappass", "etc/pop-before-smtp"
