(PLUGIN) Nombre d'Utilisateurs en ligne aujourd'hui
Téléchargez le plugin : (http://forum.coppermine-gallery.net/index.php?action=dlattach;topic=35233.0;attach=4753)
http://forum.coppermine-gallery.net/index.php?action=dlattach;topic=35233.0;attach=4753
ONLINE_TODAY v1.0
Affichez le nombre de connexions (online today)
S'installe traditionnellement comme un plugin Coppermine:
Créez un nouveau dossier online_today ( votre-cpg/plugin/online_today/ )
Dans votre page CONFIGURATION de Coppermine activez les plugins si ce n'est déjà fait.
Ouvrez la page Plugin Manager (administrez les plugins)
Si vous désirez affichez cette info aux Utilisateurs enregistrés seulement, modifiez CODEBASE.PHP comme ceci :
remplacez
if($matches[1] != 'onlinetoday') {
par
if($matches[1] != 'onlinetoday' || !USER_ID) {
Affichez cette info uniquement aux ADMIN de la Galerie,
remplacez
if($matches[1] != 'onlinetoday') {
par
if($matches[1] != 'onlinetoday' || !GALLERY_ADMIN_MODE) {
Après avoir installé ce Plugin, déclarez-le depuis votre page CONFIGURATION, paramètres Affichage de la liste des albums comme ceci (et à l'emplacement où vous désirez voir apparaitre l'info) :
catlist/breadcrumb/random,1/alblist/lastup,1/lasthits,1/onlinetoday
PYAP
sujet original : http://forum.coppermine-gallery.net/index.php?topic=17308.0
En Français dans le texte
Bien que le fichier CODEBASE.PHP soit facilement assimilable par la majeure partie d'entre vous, certains aiment pourtant lire les infos en français :D
Remplacez (ou renommez-le) alors le fichier CODEBASE.PHP d'origine par celui ci-dessous. Copiez/Collez et nommez-le CODEBASE.PHP !
<?php
/*************************
Coppermine Photo Gallery
************************
Copyright (c) 2003-2005 Coppermine Dev Team
v1.1 originaly written by Gregory DEMAR
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
********************************************
Main idea from: probinson77
Plugin Created by Bmossavari 21/08/2006
v1.01 Frenchyzed by PYAP 22-09-2006
*/
if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');
// Add an install & configure & uninstall actions
$thisplugin->add_action('plugin_install','online_today_install');
$thisplugin->add_action('plugin_configure','online_today_configure');
$thisplugin->add_action('plugin_uninstall','online_today_uninstall');
// Add block action
$thisplugin->add_filter('plugin_block','online_today');
function online_today_configure()
{
echo <<< EOT
Apres installation du plugin, declarez <strong>onlinetoday</strong> to the value of :<br />
<tt>configuration => Affichage de la liste des albums => Le contenu de la page principale</tt><br />
comme ceci par exemple : catlist/breadcrumb/random,1/alblist/lastup,1/lasthits,1/onlinetoday
<br />
<form action="{$_SERVER['REQUEST_URI']}" method="post">
<input type="submit" value="OK !" name="ot" />
</form>
EOT;
}
function online_today_install()
{
global $CONFIG;
if (isset($_POST['ot'])) {
return true;
}
else
{
return 1;
}
}
// Unnstall
function online_today_uninstall()
{
return true;
}
function online_today($html)
{
global $CONFIG, $matches ;
// Pour afficher cette info uniquement aux ADMIN, supprimez les "//" :
if($matches[1] != 'onlinetoday' || !GALLERY_ADMIN_MODE)
// Pour afficher cette info uniquement aux Utilisateurs enregistres, supprimez les "//" :
// if($matches[1] != 'onlinetoday' || !USER_ID)
// Pour afficher cette info uniquement aux Utilisateurs enregistres, supprimez les "//" :
// if($matches[1] != 'onlinetoday')
{
return $matches;
}
$result = cpg_db_query("SELECT user_id,user_lastvisit FROM {$CONFIG['TABLE_USERS']} WHERE user_lastvisit LIKE '".date("Y-m-d", mktime())
."%'");
$first = 1;
$total = 0;
$online_today = '';
while ($row = mysql_fetch_array($result)) {
$total++;
$user_id = $row['user_id'];
$user_time = substr($row['user_lastvisit'],10);
$user_name = get_username($user_id);
if ($first == 1)
{
$comma = '';
$first = 0;
}
else
{
$comma = ', ';
}
// Supprimez ( {$user_time} ) ci-dessous si vous ne voulez pas une info horaire.
$online_today .= $comma . "<a href=\"profile.php?uid={$user_id}\">{$user_name} ( {$user_time} )</a>";
}
starttable("100%", "Utilisateurs en ligne aujourd'hui ($total users)");
echo '<tr><td class="tableb">';
echo "{$online_today}</td></tr>";
endtable();
}
?>