diff --git a/upload/inc/plugins/valck.php b/upload/inc/plugins/valck.php new file mode 100755 index 0000000000000000000000000000000000000000..ebf81a4a42fd7c33f71a0395a893cd88d8d38fe0 --- /dev/null +++ b/upload/inc/plugins/valck.php @@ -0,0 +1,61 @@ +<?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