CVS: spip/ecrire engines-list.txt, 1.4, 1.5 inc_presentation.php3, 1.307, 1.308 inc_statistiques.php3, 1.72, 1.73 statistiques_visites.php3, 1.44, 1.45 statistiques_referers.php3, 1.18, NONE

Update of /home/spip-cvs/spip/ecrire
In directory miel:/tmp/cvs-serv11717

Modified Files:
  engines-list.txt inc_presentation.php3 inc_statistiques.php3
  statistiques_visites.php3
Removed Files:
  statistiques_referers.php3
Log Message:
Amélioration et simplification de l'affichage des referers

Index: engines-list.txt

RCS file: /home/spip-cvs/spip/ecrire/engines-list.txt,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- engines-list.txt 20 Sep 2003 14:39:19 -0000 1.4
+++ engines-list.txt 26 Sep 2003 23:48:15 -0000 1.5
@@ -10,6 +10,10 @@
# sort the list according your visits (see your referrers).
# -----------------------------------------------------------------------------

+[IP]
+rien=
+[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+
+
[Google]
q=
www\.google\.(.*)

Index: inc_presentation.php3

RCS file: /home/spip-cvs/spip/ecrire/inc_presentation.php3,v
retrieving revision 1.307
retrieving revision 1.308
diff -u -d -r1.307 -r1.308
--- inc_presentation.php3 25 Sep 2003 17:20:04 -0000 1.307
+++ inc_presentation.php3 26 Sep 2003 23:48:15 -0000 1.308
@@ -927,7 +927,7 @@
   $titre = textebrut(typo($titre));

   if (!$nom_site_spip) $nom_site_spip="SPIP";
- $charset = lire_meta('charset');
+ if (!$charset = lire_meta('charset')) $charset = 'utf-8';

   @Header("Expires: 0");
   @Header("Cache-Control: no-cache,no-store");
@@ -1064,7 +1064,7 @@
     if (lire_meta('multi_articles') == 'oui' OR lire_meta('multi_rubriques') == 'oui') onglet(_T('onglet_repartition_lang'), "statistiques_lang.php3", "replang", $onglet, "langues-24.gif");
     
     $activer_statistiques_ref = lire_meta("activer_statistiques_ref");
- if ($activer_statistiques_ref != "non") onglet(_T('onglet_origine_visites'), "statistiques_referers.php3", "referers", $onglet, "referers-24.gif");
+ if ($activer_statistiques_ref != "non") onglet(_T('onglet_origine_visites'), "statistiques_visites.php3?origine=oui", "referers", $onglet, "referers-24.gif");
   }

   if ($rubrique == "administration"){
@@ -2080,8 +2080,7 @@
   if ($titre=='AUTO')
     $titre=_T('info_installation_systeme_publication');

- if (!$charset = lire_meta('charset'))
- $charset = 'iso-8859-1';
+ if (!$charset = lire_meta('charset')) $charset = 'utf-8';
   @Header("Content-Type: text/html; charset=$charset");

   echo "<html><head>

Index: inc_statistiques.php3

RCS file: /home/spip-cvs/spip/ecrire/inc_statistiques.php3,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -d -r1.72 -r1.73
--- inc_statistiques.php3 21 Sep 2003 19:35:51 -0000 1.72
+++ inc_statistiques.php3 26 Sep 2003 23:48:15 -0000 1.73
@@ -62,7 +62,7 @@

   $url = parse_url( $kw_referer );
   $query = $url['query'];
- $host = $url['host'];
+ $host = strtolower($url['host']);
   $path = $url['path'];

   parse_str($query);
@@ -92,26 +92,23 @@
         include_ecrire('inc_charsets.php3');
         $keywords = unicode2charset(charset2unicode($keywords,'utf-8'));
       }
- $buffer["host"] = $kw_referer_host;
+ $buffer["hostname"] = $kw_referer_host;
     }
   }
- //$nom_url = ereg_replace("http://","", strip_tags($kw_referer_host));
- //if (strlen($nom_url) > 50) $nom_url = substr($nom_url, 0, 48) . "...";

- //if (strlen($nom_url) > 0) $buffer["host"] = $nom_url;
- if (!$buffer["host"]) $buffer["host"] = $host;
+ $buffer["host"] = $host;
+ if (!$buffer["hostname"])
+ $buffer["hostname"] = $host;
   
   $buffer["path"] = substr($path, 1, strlen($path));
   $buffer["query"] = $query;
- //$buffer = "&nbsp;<a href='".strip_tags($kw_referer)."'>".$nom_url."</a>\n";

   if ($keywords != '')
   {
     if (strlen($keywords) > 50) $keywords = substr($keywords, 0, 48);
- //$buffer .= "(<b>" .trim(htmlspecialchars(stripslashes($keywords)))."</b>)\n";
     $buffer["keywords"] = trim(htmlspecialchars(stripslashes($keywords)));
   }
-
+
   return $buffer;

}

Index: statistiques_visites.php3

RCS file: /home/spip-cvs/spip/ecrire/statistiques_visites.php3,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- statistiques_visites.php3 21 Sep 2003 20:34:03 -0000 1.44
+++ statistiques_visites.php3 26 Sep 2003 23:48:16 -0000 1.45
@@ -26,17 +26,28 @@

if($titre) $pourarticle = " "._T('info_pour')." &laquo; $titre &raquo;";

-debut_page(_T('titre_page_statistiques_visites').$pourarticle, "administration", "statistiques");
-
-echo "<br><br><br>";
-gros_titre(_T('titre_evolution_visite')."<html>".aide("confstat")."</html>");
-barre_onglets("statistiques", "evolution");
-
-if ($titre) gros_titre($titre);
+if ($origine) {
+ debut_page(_T('titre_page_statistiques_referers'), "administration", "statistiques");
+ echo "<br><br><br>";
+ gros_titre(_T('titre_liens_entrants'));
+ barre_onglets("statistiques", "referers");

-debut_gauche();
+ debut_gauche();
+ debut_boite_info();
+ echo "<FONT FACE='Verdana,Arial,Helvetica,sans-serif' SIZE=2>";
+ echo "<P align=left>"._T('info_gauche_statistiques_referers')."</P></FONT>";
+ fin_boite_info();
+
+ debut_droite();

+} else {
+ debut_page(_T('titre_page_statistiques_visites').$pourarticle, "administration", "statistiques");
+ echo "<br><br><br>";
+ gros_titre(_T('titre_evolution_visite')."<html>".aide("confstat")."</html>");
+ barre_onglets("statistiques", "evolution");
+ if ($titre) gros_titre($titre);

+ debut_gauche();

   echo "<p>";

@@ -125,24 +136,14 @@
     echo "</font>";
     echo "</div>";
   }
-
-
-
-
-

-
-
-
-
-
- // Par visites depuis le debut
+ // Par visites depuis le debut
   $query = "SELECT id_article, titre, popularite, visites FROM spip_articles WHERE statut='publie' AND popularite > 0 ORDER BY visites DESC LIMIT 0,30";
   $result = spip_query($query);
     
   if (spip_num_rows($result) > 0) {
- creer_colonne_droite();
+ creer_colonne_droite();

     echo "<p></p><div class='iconeoff' style='padding: 5px;'>";
     echo "<font face='Verdana,Arial,Helvetica,sans-serif' size=2>";
@@ -171,25 +172,23 @@
   }

+ //
+ // Afficher les boutons de creation d'article et de breve
+ //
+ if ($connect_statut == '0minirezo') {
+ debut_raccourcis();
+ if ($id_article > 0)
+ icone_horizontale(_T('icone_retour_article'), "articles.php3?id_article=$id_article", "article-24.gif","rien.gif");
+ icone_horizontale(_T('icone_forum_suivi'), "controle_forum.php3", "suivi-forum-24.gif", "rien.gif");
+ fin_raccourcis();
+ }

-//
-// Afficher les boutons de creation d'article et de breve
-//
-if ($connect_statut == '0minirezo') {
- debut_raccourcis();
-
- if ($id_article > 0){
- icone_horizontale(_T('icone_retour_article'), "articles.php3?id_article=$id_article", "article-24.gif","rien.gif");
- }
- icone_horizontale(_T('icone_forum_suivi'), "controle_forum.php3", "suivi-forum-24.gif", "rien.gif");
-
- fin_raccourcis();
-}

+ debut_droite();
+}

-debut_droite();

if ($connect_statut != '0minirezo') {
   echo _T('avis_non_acces_page');
@@ -202,162 +201,148 @@

//////

-if ($id_article) {
- $table = "spip_visites_articles";
- $table_ref = "spip_referers_articles";
- $where = "id_article=$id_article";
-}
-else {
- $table = "spip_visites";
- $table_ref = "spip_referers";
- $where = "1";
-}
-
-
-$query="SELECT UNIX_TIMESTAMP(date) AS date_unix, visites FROM $table ".
- "WHERE $where AND date > DATE_SUB(NOW(),INTERVAL 89 DAY) ORDER BY date";
-$result=spip_query($query);
+if (!$origine) {

-while ($row = spip_fetch_array($result)) {
- $date = $row['date_unix'];
- $visites = $row['visites'];
+ if ($id_article) {
+ $table = "spip_visites_articles";
+ $table_ref = "spip_referers_articles";
+ $where = "id_article=$id_article";
+ } else {
+ $table = "spip_visites";
+ $table_ref = "spip_referers";
+ $where = "1";
+ }

- $log[$date] = $visites;
- if ($i == 0) $date_debut = $date;
- $i++;
-}
+ $query="SELECT UNIX_TIMESTAMP(date) AS date_unix, visites FROM $table ".
+ "WHERE $where AND date > DATE_SUB(NOW(),INTERVAL 89 DAY) ORDER BY date";
+ $result=spip_query($query);

-// Visites du jour
-if ($id_article) {
- $query = "SELECT COUNT(DISTINCT ip) AS visites FROM spip_visites_temp WHERE type = 'article' AND id_objet = $id_article";
- $result = spip_query($query);
-}
-else {
- $query = "SELECT COUNT(DISTINCT ip) AS visites FROM spip_visites_temp";
- $result = spip_query($query);
-}
-if ($row = @spip_fetch_array($result)) {
- $visites_today = $row['visites'];
-}
-else
- $visites_today = 0;
+ while ($row = spip_fetch_array($result)) {
+ $date = $row['date_unix'];
+ $visites = $row['visites'];

-if (count($log)>0){
+ $log[$date] = $visites;
+ if ($i == 0) $date_debut = $date;
+ $i++;
+ }

- $max = max(max($log),$visites_today);
- $date_today = time();
+ // Visites du jour
+ if ($id_article) {
+ $query = "SELECT COUNT(DISTINCT ip) AS visites FROM spip_visites_temp WHERE type = 'article' AND id_objet = $id_article";
+ $result = spip_query($query);
+ } else {
+ $query = "SELECT COUNT(DISTINCT ip) AS visites FROM spip_visites_temp";
+ $result = spip_query($query);
+ }
+ if ($row = @spip_fetch_array($result))
+ $visites_today = $row['visites'];
+ else
+ $visites_today = 0;

- $nb_jours = floor(($date_today-$date_debut)/(3600*24));
+ if (count($log)>0) {
+ $max = max(max($log),$visites_today);
+ $date_today = time();
+ $nb_jours = floor(($date_today-$date_debut)/(3600*24));

+ $maxgraph = substr(ceil(substr($max,0,2) / 10)."000000000000", 0, strlen($max));
   
- $maxgraph = substr(ceil(substr($max,0,2) / 10)."000000000000", 0, strlen($max));
-
- if ($maxgraph < 10) $maxgraph = 10;
- if (1.1 * $maxgraph < $max) $maxgraph.="0";
-
- if (0.8*$maxgraph > $max) $maxgraph = 0.8 * $maxgraph;
-
- $rapport = 200 / $maxgraph;
+ if ($maxgraph < 10) $maxgraph = 10;
+ if (1.1 * $maxgraph < $max) $maxgraph.="0";
+ if (0.8*$maxgraph > $max) $maxgraph = 0.8 * $maxgraph;
+ $rapport = 200 / $maxgraph;

- if (count($log) < 420) $largeur = floor(450 / ($nb_jours+1));
- if ($largeur < 1) $largeur = 1;
- if ($largeur > 50) $largeur = 50;
+ if (count($log) < 420) $largeur = floor(450 / ($nb_jours+1));
+ if ($largeur < 1) $largeur = 1;
+ if ($largeur > 50) $largeur = 50;

- debut_cadre_relief("statistiques-24.gif");
- echo "<table cellpadding=0 cellspacing=0 border=0><tr><td background='img_pack/fond-stats.gif'>";
- echo "<table cellpadding=0 cellspacing=0 border=0><tr>";
+ debut_cadre_relief("statistiques-24.gif");
+ echo "<table cellpadding=0 cellspacing=0 border=0><tr><td background='img_pack/fond-stats.gif'>";
+ echo "<table cellpadding=0 cellspacing=0 border=0><tr>";

     echo "<td bgcolor='black'><img src='img_pack/rien.gif' width=1 height=200></td>";

- // Presentation graphique
- while (list($key, $value) = each($log)) {
- $n++;
+ // Presentation graphique
+ while (list($key, $value) = each($log)) {
+ $n++;
     
- if ($decal == 30) $decal = 0;
- $decal ++;
- $tab_moyenne[$decal] = $value;
+ if ($decal == 30) $decal = 0;
+ $decal ++;
+ $tab_moyenne[$decal] = $value;
     
- //inserer des jours vides si pas d'entrees
- if ($jour_prec > 0) {
- $ecart = floor(($key-$jour_prec)/(3600*24)-1);
+ //inserer des jours vides si pas d'entrees
+ if ($jour_prec > 0) {
+ $ecart = floor(($key-$jour_prec)/(3600*24)-1);
   
- for ($i=0; $i < $ecart; $i++){
- if ($decal == 30) $decal = 0;
- $decal ++;
- $tab_moyenne[$decal] = $value;
+ for ($i=0; $i < $ecart; $i++){
+ if ($decal == 30) $decal = 0;
+ $decal ++;
+ $tab_moyenne[$decal] = $value;

- reset($tab_moyenne);
- $moyenne = 0;
- while (list(,$val_tab) = each($tab_moyenne))
- $moyenne += $val_tab;
- $moyenne = $moyenne / count($tab_moyenne);
+ reset($tab_moyenne);
+ $moyenne = 0;
+ while (list(,$val_tab) = each($tab_moyenne))
+ $moyenne += $val_tab;
+ $moyenne = $moyenne / count($tab_moyenne);
   
- $hauteur_moyenne = round(($moyenne) * $rapport) - 1;
- echo "<td valign='bottom' width=$largeur>";
- $difference = ($hauteur_moyenne) -1;
- if ($difference > 0) {
- echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:#333333;'>";
- echo "<img src='img_pack/rien.gif' width=$largeur height=$hauteur_moyenne>";
+ $hauteur_moyenne = round(($moyenne) * $rapport) - 1;
+ echo "<td valign='bottom' width=$largeur>";
+ $difference = ($hauteur_moyenne) -1;
+ if ($difference > 0) {
+ echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:#333333;'>";
+ echo "<img src='img_pack/rien.gif' width=$largeur height=$hauteur_moyenne>";
+ }
+ echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:black;'>";
+ echo "</td>";
+ $n++;
         }
- echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:black;'>";
- echo "</td>";
- $n++;
       }
- }
- $total_loc = $total_loc + $value;
- reset($tab_moyenne);
+ $total_loc = $total_loc + $value;
+ reset($tab_moyenne);

- $moyenne = 0;
- while (list(,$val_tab) = each($tab_moyenne))
- $moyenne += $val_tab;
- $moyenne = $moyenne / count($tab_moyenne);
+ $moyenne = 0;
+ while (list(,$val_tab) = each($tab_moyenne))
+ $moyenne += $val_tab;
+ $moyenne = $moyenne / count($tab_moyenne);
     
- $hauteur_moyenne = round($moyenne * $rapport) - 1;
- $hauteur = round($value * $rapport) - 1;
- echo "<td valign='bottom' width=$largeur>";
+ $hauteur_moyenne = round($moyenne * $rapport) - 1;
+ $hauteur = round($value * $rapport) - 1;
+ echo "<td valign='bottom' width=$largeur>";
     
- if ($hauteur > 0){
- if ($hauteur_moyenne > $hauteur) {
- $difference = ($hauteur_moyenne - $hauteur) -1;
- echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:#333333;'>";
- echo "<img src='img_pack/rien.gif' width=$largeur height=$difference>";
- echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:$couleur_foncee;'>";
- if (date("w",$key) == "0"){ // Dimanche en couleur foncee
- echo "<img src='img_pack/rien.gif' width=$largeur height=$hauteur style='background-color:$couleur_foncee;'>";
- }
- else {
- echo "<img src='img_pack/rien.gif' width=$largeur height=$hauteur style='background-color:$couleur_claire;'>";
- }
- }
- else if ($hauteur_moyenne < $hauteur) {
- $difference = ($hauteur - $hauteur_moyenne) -1;
- echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:$couleur_foncee;'>";
- if (date("w",$key) == "0"){ // Dimanche en couleur foncee
- $couleur = $couleur_foncee;
- }
- else {
- $couleur = $couleur_claire;
- }
- echo "<img src='img_pack/rien.gif' width=$largeur height=$difference style='background-color:$couleur;'>";
- echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:#333333;'>";
- echo "<img src='img_pack/rien.gif' width=$largeur height=$hauteur_moyenne style='background-color:$couleur;'>";
- }
- else {
- echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:$couleur_foncee;'>";
- if (date("w",$key) == "0"){ // Dimanche en couleur foncee
- echo "<img src='img_pack/rien.gif' width=$largeur height=$hauteur style='background-color:$couleur_foncee;'>";
- }
- else {
- echo "<img src='img_pack/rien.gif' width=$largeur height=$hauteur style='background-color:$couleur_claire;'>";
+ if ($hauteur > 0){
+ if ($hauteur_moyenne > $hauteur) {
+ $difference = ($hauteur_moyenne - $hauteur) -1;
+ echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:#333333;'>";
+ echo "<img src='img_pack/rien.gif' width=$largeur height=$difference>";
+ echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:$couleur_foncee;'>";
+ if (date("w",$key) == "0") // Dimanche en couleur foncee
+ echo "<img src='img_pack/rien.gif' width=$largeur height=$hauteur style='background-color:$couleur_foncee;'>";
+ else
+ echo "<img src='img_pack/rien.gif' width=$largeur height=$hauteur style='background-color:$couleur_claire;'>";
+ } else if ($hauteur_moyenne < $hauteur) {
+ $difference = ($hauteur - $hauteur_moyenne) -1;
+ echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:$couleur_foncee;'>";
+ if (date("w",$key) == "0") // Dimanche en couleur foncee
+ $couleur = $couleur_foncee;
+ else
+ $couleur = $couleur_claire;
+ echo "<img src='img_pack/rien.gif' width=$largeur height=$difference style='background-color:$couleur;'>";
+ echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:#333333;'>";
+ echo "<img src='img_pack/rien.gif' width=$largeur height=$hauteur_moyenne style='background-color:$couleur;'>";
+ } else {
+ echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:$couleur_foncee;'>";
+ if (date("w",$key) == "0") // Dimanche en couleur foncee
+ echo "<img src='img_pack/rien.gif' width=$largeur height=$hauteur style='background-color:$couleur_foncee;'>";
+ else
+ echo "<img src='img_pack/rien.gif' width=$largeur height=$hauteur style='background-color:$couleur_claire;'>";
         }
       }
- }
- echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:black;'>";
- echo "</td>\n";
+ echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:black;'>";
+ echo "</td>\n";
     
- $jour_prec = $key;
- $val_prec = $value;
- }
+ $jour_prec = $key;
+ $val_prec = $value;
+ }
+
     // Dernier jour
     $hauteur = round($visites_today * $rapport) - 1;
     $total_absolu = $total_absolu + $visites_today;
@@ -369,13 +354,12 @@
     echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:black;'>";
     echo "</td>";
   
-
- echo "<td bgcolor='black'><img src='img_pack/rien.gif' width=1 height=1></td>";
- echo "</tr></table>";
- echo "</td>";
- echo "<td background='img_pack/fond-stats.gif' valign='bottom'><img src='img_pack/rien.gif' style='background-color:black;' width=3 height=1></td>";
- echo "<td><img src='img_pack/rien.gif' width=5 height=1></td>";
- echo "<td valign='top'><font face='Verdana,Arial,Helvetica,sans-serif' size=2>";
+ echo "<td bgcolor='black'><img src='img_pack/rien.gif' width=1 height=1></td>";
+ echo "</tr></table>";
+ echo "</td>";
+ echo "<td background='img_pack/fond-stats.gif' valign='bottom'><img src='img_pack/rien.gif' style='background-color:black;' width=3 height=1></td>";
+ echo "<td><img src='img_pack/rien.gif' width=5 height=1></td>";
+ echo "<td valign='top'><font face='Verdana,Arial,Helvetica,sans-serif' size=2>";
     echo "<table cellpadding=0 cellspacing=0 border=0>";
     echo "<tr><td height=15 valign='top'>";
     echo "<font face='arial,helvetica,sans-serif' size=1><b>".round($maxgraph)."</b></font>";
@@ -407,8 +391,8 @@
     
     echo "</table>";
- echo "</font></td>";
- echo "</td></tr></table>";
+ echo "</font></td>";
+ echo "</td></tr></table>";

     echo "<font face='arial,helvetica,sans-serif' size=1>"._T('texte_statistiques_visites')."</font>";
     echo "<p><table cellpadding=0 cellspacing=0 border=0 width='100%'><tr width='100%'>";
@@ -440,10 +424,9 @@
       echo "</font>";
     }
     echo "</td></tr></table>";
-
+ }
     
   if (count($log) > 80) {
-
     echo "<p>";
     echo "<font face='verdana,arial,helvetica,sans-serif' size='2'><b>"._T('info_visites_par_mois')."</b></font>";

@@ -478,8 +461,7 @@
     
     echo "<table cellpadding=0 cellspacing=0 border=0><tr><td background='img_pack/fond-stats.gif'>";
     echo "<table cellpadding=0 cellspacing=0 border=0><tr>";
-
- echo "<td bgcolor='black'><img src='img_pack/rien.gif' width=1 height=200></td>";
+ echo "<td bgcolor='black'><img src='img_pack/rien.gif' width=1 height=200></td>";
   
     // Presentation graphique
     $n = 0;
@@ -553,103 +535,118 @@
     echo "<td background='img_pack/fond-stats.gif' valign='bottom'><img src='img_pack/rien.gif' style='background-color:black;' width=3 height=1></td>";
     echo "<td><img src='img_pack/rien.gif' width=5 height=1></td>";
     echo "<td valign='top'><font face='Verdana,Arial,Helvetica,sans-serif' size=2>";
- echo "<table cellpadding=0 cellspacing=0 border=0>";
- echo "<tr><td height=15 valign='top'>";
- echo "<font face='arial,helvetica,sans-serif' size=1><b>".round($maxgraph)."</b></font>";
- echo "</td></tr>";
- echo "<tr><td height=25 valign='middle'>";
- echo "<font face='arial,helvetica,sans-serif' size=1 color='#999999'>".round(7*($maxgraph/8))."</font>";
- echo "</td></tr>";
- echo "<tr><td height=25 valign='middle'>";
- echo "<font face='arial,helvetica,sans-serif' size=1>".round(3*($maxgraph/4))."</font>";
- echo "</td></tr>";
- echo "<tr><td height=25 valign='middle'>";
- echo "<font face='arial,helvetica,sans-serif' size=1 color='#999999'>".round(5*($maxgraph/8))."</font>";
- echo "</td></tr>";
- echo "<tr><td height=25 valign='middle'>";
- echo "<font face='arial,helvetica,sans-serif' size=1><b>".round($maxgraph/2)."</b></font>";
- echo "</td></tr>";
- echo "<tr><td height=25 valign='middle'>";
- echo "<font face='arial,helvetica,sans-serif' size=1 color='#999999'>".round(3*($maxgraph/8))."</font>";
- echo "</td></tr>";
- echo "<tr><td height=25 valign='middle'>";
- echo "<font face='arial,helvetica,sans-serif' size=1>".round($maxgraph/4)."</font>";
- echo "</td></tr>";
- echo "<tr><td height=25 valign='middle'>";
- echo "<font face='arial,helvetica,sans-serif' size=1 color='#999999'>".round(1*($maxgraph/8))."</font>";
- echo "</td></tr>";
- echo "<tr><td height=10 valign='bottom'>";
- echo "<font face='arial,helvetica,sans-serif' size=1><b>0</b></font>";
- echo "</td>";
-
-
- echo "</tr></table>";
+ echo "<table cellpadding=0 cellspacing=0 border=0>";
+ echo "<tr><td height=15 valign='top'>";
+ echo "<font face='arial,helvetica,sans-serif' size=1><b>".round($maxgraph)."</b></font>";
+ echo "</td></tr>";
+ echo "<tr><td height=25 valign='middle'>";
+ echo "<font face='arial,helvetica,sans-serif' size=1 color='#999999'>".round(7*($maxgraph/8))."</font>";
+ echo "</td></tr>";
+ echo "<tr><td height=25 valign='middle'>";
+ echo "<font face='arial,helvetica,sans-serif' size=1>".round(3*($maxgraph/4))."</font>";
+ echo "</td></tr>";
+ echo "<tr><td height=25 valign='middle'>";
+ echo "<font face='arial,helvetica,sans-serif' size=1 color='#999999'>".round(5*($maxgraph/8))."</font>";
+ echo "</td></tr>";
+ echo "<tr><td height=25 valign='middle'>";
+ echo "<font face='arial,helvetica,sans-serif' size=1><b>".round($maxgraph/2)."</b></font>";
+ echo "</td></tr>";
+ echo "<tr><td height=25 valign='middle'>";
+ echo "<font face='arial,helvetica,sans-serif' size=1 color='#999999'>".round(3*($maxgraph/8))."</font>";
+ echo "</td></tr>";
+ echo "<tr><td height=25 valign='middle'>";
+ echo "<font face='arial,helvetica,sans-serif' size=1>".round($maxgraph/4)."</font>";
+ echo "</td></tr>";
+ echo "<tr><td height=25 valign='middle'>";
+ echo "<font face='arial,helvetica,sans-serif' size=1 color='#999999'>".round(1*($maxgraph/8))."</font>";
+ echo "</td></tr>";
+ echo "<tr><td height=10 valign='bottom'>";
+ echo "<font face='arial,helvetica,sans-serif' size=1><b>0</b></font>";
+ echo "</td>";
+
+ echo "</tr></table>";
     echo "</td></tr></table>";
     echo "</div>";
-
   }
   
   /////
     
-
-
-
-
-
   fin_cadre_relief();

}

-$activer_statistiques_ref = lire_meta("activer_statistiques_ref");
-if ($activer_statistiques_ref != "non"){
- // Affichage des referers

- if (!$arr_engines) {
- // Charger les moteurs de recherche
- $arr_engines = stats_load_engines();
+
+//
+// Affichage des referers
+//
+if (lire_meta("activer_statistiques_ref") != "non"){
+
+ // Charger les moteurs de recherche
+ $arr_engines = stats_load_engines();
+
+ // nombre de referers a afficher
+ $limit = intval($limit); //secu
+ if ($limit == 0)
+ $limit = 100;
+
+ // afficher quels referers ?
+ $vis = "visites";
+ if ($origine) {
+ $where = "visites_jour>0";
+ $vis = "visites_jour";
+ $table_ref = "spip_referers";
   }

- $query = "SELECT * FROM $table_ref WHERE $where ORDER BY visites DESC LIMIT 0,100";
+ $query = "SELECT * FROM $table_ref WHERE $where ORDER BY $vis DESC LIMIT 0,$limit";
   $result = spip_query($query);
   
   echo "<p><font face='Verdana,Arial,Helvetica,sans-serif' size=2>";
   while ($row = spip_fetch_array($result)) {
     $referer = $row['referer'];
- $visites = $row['visites'];
+ $visites = $row[$vis];
     $tmp = "";
     $aff = "";
     
     $buff = stats_show_keywords($referer, $referer);
-
- $numero = substr(md5($buff["host"]),0,8);
-
- $nbvisites[$numero] = $nbvisites[$numero] + $visites;

- if (strlen($buff["keywords"]) > 0) {
- $criteres = substr(md5($buff["keywords"]),0,8);
- if (!$lescriteres[$numero][$criteres])
- $tmp = "<a href='$referer'>&laquo;&nbsp;".$buff["keywords"]."&nbsp;&raquo;</a>";
- $lescriteres[$numero][$criteres] = true;
- } else {
- $aff = $buff["path"];
- if (strlen($buff["query"]) > 0) $aff .= "?".$buff['query'];
+ if ($buff["host"]) {
+ $numero = substr(md5($buff["hostname"]),0,8);
   
- if (strlen($aff) > 0) $tmp = "<a href='$referer'>".substr($aff, 0, 35)."</a>";
- else $tmp = "<a href='$referer'><b>racine</b></a>";
- }
-
+ $nbvisites[$numero] = $nbvisites[$numero] + $visites;

- if (strlen($tmp) > 0) $lesreferers[$numero][] = $tmp;
- $lesdomaines[$numero] = $buff["host"];
- $lesliens[$numero] = $referer;
+ if (strlen($buff["keywords"]) > 0) {
+ $criteres = substr(md5($buff["keywords"]),0,8);
+ if (!$lescriteres[$numero][$criteres])
+ $tmp = " &laquo;&nbsp;".$buff["keywords"]."&nbsp;&raquo;";
+ $lescriteres[$numero][$criteres] = true;
+ } else {
+ $tmp = $buff["path"];
+ if (strlen($buff["query"]) > 0) $tmp .= "?".$buff['query'];
     
+ if (strlen($tmp) > 30)
+ $tmp = "/".substr($tmp, 0, 27)."...";
+ else if (strlen($tmp) > 0)
+ $tmp = "/$tmp";
+ }
+
+ if ($tmp)
+ $lesreferers[$numero][] = "<a href='$referer'>$tmp</a>" . (($visites > 1)?" ($visites)":"");
+ else
+ $lesliensracine[$numero] += $visites;
+ $lesdomaines[$numero] = $buff["hostname"];
+ $lesurls[$numero] = $buff["host"];
+ $lesliens[$numero] = $referer;
+ }
   }
   
   if (count($nbvisites) > 0) {
     arsort($nbvisites);
-
+
     echo "<ul>";
     for (reset($nbvisites); $numero = key($nbvisites); next($nbvisites)) {
+ if ($lesdomaines[$numero] == '') next;
+
       $visites = pos($nbvisites);
       $ret = "\n<li>";
     
@@ -657,24 +654,31 @@
       else if ($visites > 1) $ret .= "$visites "._T('lnfo_liens')."&nbsp;";
       else $ret .= "<font color='#999999'>$visites "._T('info_lien')."&nbsp;</font>";
       
- $referers = join ($lesreferers[$numero],"</li><li>");
       if (count($lesreferers[$numero]) > 1) {
+ $referers = join ($lesreferers[$numero],"</li><li>");
         echo "<p />";
         echo $ret;
- echo "<b>$lesdomaines[$numero]</b>";
+ echo "<a href='http://".$lesurls[$numero]."'><b><font color='$couleur_foncee'>".$lesdomaines[$numero]."</font></b></a>";
+ if ($rac = $lesliensracine[$numero]) echo " <font size='1'>($rac)</font>";
         echo "<ul><font size='1'><li>$referers</li></font></ul>";
         echo "</li><p />\n";
       } else {
         echo $ret;
- echo "<a href='".$lesliens[$numero]."'><b>$lesdomaines[$numero]</b>/</a>";
- echo "<font size='1'>$referers</font>";
+ echo "<a href='http://".$lesurls[$numero]."'><b>".$lesdomaines[$numero]."</b></a>";
+ if ($lien = ereg_replace(" \([0-9]+\)$", "",$lesreferers[$numero][0]));
+ echo "<font size='1'>$lien</font>";
         echo "</li>";
       }
     }
+
+ // le lien pour en afficher "plus"
+ if (spip_num_rows($result) == $limit) {
+ $lien = $clean_link;
+ $lien->addVar('limit',$limit+200);
+ echo "<p /><li><a href='".$lien->getUrl()."'>+++</a></li>";
+ }
     echo "</ul>";
   }
-
-

}
echo "</font>";

--- statistiques_referers.php3 DELETED ---