Private GIT

Skip to content
Snippets Groups Projects
Commit 6b6f5437 authored by ck's avatar ck
Browse files

Fichier de plug in valck pour l'ajout de badge

parent 8ae9f19e
Branches
No related tags found
No related merge requests found
<?php
// Make sure we can't access this file directly from the browser.
if(!defined('IN_MYBB'))
{
die('This file cannot be accessed directly.');
}
// my first hook
$plugins->add_hook("global_start", "valck_run");
function valck_info()
{
return array(
'name' => "valck",
'description' => "Variables de CK pour global a réutiliser dans template",
'website' => "#",
'author' => "ck",
'authorsite' => "#",
'version' => "1.0",
'compatibility' => "18*"
);
}
function valck_run()
{
global $mybb, $lang, $db, $valck_run;
// requete pour le badge message aujourdui
if($mybb->get_input('days', MyBB::INPUT_INT) < 1)
{
$days = 1;
}
else
{
$days = $mybb->get_input('days', MyBB::INPUT_INT);
}
$datecut = TIME_NOW-(86400*$days);
$sql = "SELECT count(*) FROM `".TABLE_PREFIX."threads` where lastpost >= ".$datecut." ORDER BY `tid` DESC";
$query = $db->query("SELECT count(*) as count FROM `" . TABLE_PREFIX . "threads` where lastpost >= ".$datecut." ORDER BY `tid` DESC");
$count = $db->fetch_field($query, "count");
$db->free_result($query);
// le code pour le forum
$valck_run = <<<EOT
<li>
<div class="w-25 p-2">
<a href="{$mybb->settings['bburl']}/search.php?action=getdaily">
<h5><span data-toggle="tooltip" title="{$lang->welcome_todaysposts}"
class="align-middle badge badge-primary badge-pill shadow">{$count}</span></h5>
</a>
</div>
</li>
EOT;
return $valck_run;
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment