From 9b114d97a7786deb8bdfbdbf0ce35c6f6132d007 Mon Sep 17 00:00:00 2001 From: ARNO* <arno@rezo.net> Date: Wed, 21 Aug 2002 07:21:33 +0000 Subject: [PATCH] Modifs statistiques --- ecrire/inc_presentation.php3 | 17 +++++-- ecrire/inc_statistiques.php3 | 2 +- ecrire/statistiques_visites.php3 | 78 ++++++++++++++++++++++++++++++-- 3 files changed, 87 insertions(+), 10 deletions(-) diff --git a/ecrire/inc_presentation.php3 b/ecrire/inc_presentation.php3 index 83ce4b69da..c6eeefc430 100644 --- a/ecrire/inc_presentation.php3 +++ b/ecrire/inc_presentation.php3 @@ -1738,10 +1738,10 @@ function creer_colonne_droite(){ global $connect_id_auteur, $spip_ecran; global $flag_3_colonnes; - $deja_colonne_droite = true; - if ($flag_3_colonnes) { + if ($flag_3_colonnes AND !$deja_colonne_droite) { + $deja_colonne_droite = true; echo "<td width=37 rowspan=2> </td>"; echo "<td rowspan=1></td>"; echo "<td width=37 rowspan=2> </td>"; @@ -1940,7 +1940,12 @@ function fin_page() { global $connect_id_auteur; ?> -<p> </p> + +</td></tr></table> + +<? +debut_grand_cadre(); +?> <div align='right'><font face="Verdana,Arial,Helvetica,sans-serif" size='2'> <a href='http://www.uzine.net/spip'>SPIP <?php echo $spip_version_affichee; ?></a> est un logiciel libre distribué <a href='copyright_fr.html'>sous licence GPL.</a> @@ -1951,8 +1956,10 @@ if (ereg("index\.php3", $GLOBALS['REQUEST_URI']) || !ereg("\.php3", $GLOBALS['RE } ?> </font></div> -<br> -</td></tr></table></center> +<? +fin_grand_cadre(); +?> +</center> <?php diff --git a/ecrire/inc_statistiques.php3 b/ecrire/inc_statistiques.php3 index 7e1f7abf12..4487c37cc0 100644 --- a/ecrire/inc_statistiques.php3 +++ b/ecrire/inc_statistiques.php3 @@ -262,7 +262,7 @@ function optimiser_referers() { $referers = $row['referers']; $visites = $row['visites']; - $popularite = $referers * $visites; + $popularite = ($referers + 1) * $visites; $popularite_update[$popularite][] = $id_article; if ($max < $popularite) $max = $popularite; } diff --git a/ecrire/statistiques_visites.php3 b/ecrire/statistiques_visites.php3 index b85f58c43e..b415343b08 100644 --- a/ecrire/statistiques_visites.php3 +++ b/ecrire/statistiques_visites.php3 @@ -58,10 +58,11 @@ debut_gauche(); } echo "<font size=1>"; - $query = "SELECT id_article, titre FROM spip_articles WHERE statut='publie' AND visites > 0 ORDER BY popularite DESC LIMIT 0,20"; + $query = "SELECT id_article, titre FROM spip_articles WHERE statut='publie' AND visites > 0 ORDER BY date DESC LIMIT 0,20"; $result = spip_query($query); - if (mysql_num_rows($result) > 0) + if (mysql_num_rows($result) > 0) { + echo "<br><br>"; while ($row = mysql_fetch_array($result)) { $titre = typo($row['titre']); $l_article = $row['id_article']; @@ -71,15 +72,84 @@ debut_gauche(); echo "\n<li><a href='statistiques_visites.php3?id_article=$l_article'>$titre</a></li>"; } } - else + } + else { echo "\n<i>(aucun article visité)</i>"; - + } echo "</font>"; echo "</ul>"; echo "</font>"; echo "</div>"; + creer_colonne_droite(); + + // Par popularite + $query = "SELECT id_article, titre, popularite FROM spip_articles WHERE statut='publie' AND popularite > 0 ORDER BY popularite DESC LIMIT 0,10"; + $result = spip_query($query); + + if (mysql_num_rows($result) > 0) { + echo "<p>"; + echo "<div class='iconeoff' style='padding: 5px;'>"; + echo "<font face='Verdana,Arial,Helvetica,sans-serif' size=2>"; + echo typo("Afficher les visites pour <b>les articles les plus populaires</b>:"); + echo "<ul>"; + echo "<font size=1>"; + + while ($row = mysql_fetch_array($result)) { + $titre = typo($row['titre']); + $l_article = $row['id_article']; + $popularite = $row['popularite']; + if ($l_article == $id_article){ + echo "\n<li><b>$titre</b></li>"; + } else { + echo "\n<li><a href='statistiques_visites.php3?id_article=$l_article'>$titre ($popularite%)</a></li>"; + } + } + echo "</font>"; + echo "</ul>"; + echo "</font>"; + echo "</div>"; + } + + + $query = "SELECT date FROM spip_visites_articles ORDER BY date DESC LIMIT 0,1"; + $result = spip_query($query); + if ($row = mysql_fetch_array($result)) { + $hier = $row['date']; + + // Par visites hier + $query = "SELECT articles.id_article AS id_article, articles.titre AS titre, lien.visites AS visiteurs FROM spip_articles AS articles, spip_visites_articles AS lien WHERE lien.date='$hier' AND lien.visites > 0 AND articles.statut='publie' AND articles.id_article=lien.id_article ORDER BY visiteurs DESC LIMIT 0,10"; + $result = spip_query($query); + + if (mysql_num_rows($result) > 0) { + echo "<p>"; + echo "<div class='iconeoff' style='padding: 5px;'>"; + echo "<font face='Verdana,Arial,Helvetica,sans-serif' size=2>"; + echo typo("Afficher les visites pour <b>les articles les plus visités hier</b>:"); + echo "<ul>"; + echo "<font size=1>"; + + while ($row = mysql_fetch_array($result)) { + $titre = typo($row['titre']); + $l_article = $row['id_article']; + $visiteurs = $row['visiteurs']; + if ($l_article == $id_article){ + echo "\n<li><b>$titre</b></li>"; + } else { + echo "\n<li><a href='statistiques_visites.php3?id_article=$l_article'>$titre ($visiteurs)</a></li>"; + } + } + echo "</font>"; + echo "</ul>"; + echo "</font>"; + echo "</div>"; + } + + } + + + // // Afficher les boutons de creation d'article et de breve -- GitLab