Kod:
if (($_REQUEST['do'] == 'cybtpimx') AND $vbulletin->options['cybtpimx_enable_product'] AND is_member_of($vbulletin->userinfo, split(',', $vbulletin->options['cybtpimx_allowed_groups'])))
{
$db->hide_errors();
global $vbulletin;
if ($vbulletin->options['cybtpimx_excl_groups']!='')
{
$cybtpimx_exclgids = ','.$vbulletin->options['cybtpimx_excl_groups'];
}
$cybtpimx_exclgids = substr($cybtpimx_exclgids, 1);
if ($cybtpimx_exclgids!='')
{
$cybtpimx_exclgroups = "AND user.usergroupid NOT IN ($cybtpimx_exclgids)";
}
if ($vbulletin->options['cybtpimx_excl_users']!='')
{
$cybtpimx_excluids = ','.$vbulletin->options['cybtpimx_excl_users'];
}
$cybtpimx_excluids = substr($cybtpimx_excluids, 1);
if ($cybtpimx_excluids!='')
{
$cybtpimx_exclusers = "AND post.userid NOT IN ($cybtpimx_excluids)";
}
if ($vbulletin->options['cybtpimx_excl_forums']!='')
{
$cybtpimx_exclfids = ','.$vbulletin->options['cybtpimx_excl_forums'];
}
$cybtpimx_exclfids = substr($cybtpimx_exclfids, 1);
if ($cybtpimx_exclfids!='')
{
$cybtpimx_exclforums = "AND thread.forumid NOT IN ($cybtpimx_exclfids)";
}
$reqmonth = $vbulletin->input->clean_gpc('r', 'm', TYPE_UINT);
$reqyear = $vbulletin->input->clean_gpc('r', 'y', TYPE_UINT);
if (!$reqmonth OR !$reqyear)
{
$reqmonth = $vbulletin->input->clean_gpc('p', 'm', TYPE_UINT);
$reqyear = $vbulletin->input->clean_gpc('p', 'y', TYPE_UINT);
}
if (!$reqmonth OR !$reqyear)
{
$reqmonth = ltrim(date('m'), '0');
$reqyear = ltrim(date('Y'), '0');
}
foreach (range($vbulletin->options['cybtpimx_start_year'], date('Y')) AS $cyb_year_option)
{
eval('$cyb_year_opts .= " <option value=\"'.$cyb_year_option.'\" " . iif($reqyear==$cyb_year_option," selected=\"selected\"","").">'.$cyb_year_option.'</option> ";');
}
$cyb_month_options = explode(',', '1,2,3,4,5,6,7,8,9,10,11,12,13');
foreach ($cyb_month_options AS $cyb_month_option)
{
if ($cyb_month_option=='13')
{
eval('$cyb_month_opts .= " <option value=\"'.$cyb_month_option.'\" " . iif($reqmonth==13," selected=\"selected\"","").">'.$vbphrase['cybtpimx_all'].'</option> ";');
}
else
{
eval('$cyb_month_opts .= " <option value=\"'.$cyb_month_option.'\" " . iif($reqmonth==$cyb_month_option," selected=\"selected\"","").">'.$cyb_month_option.'</option> ";');
}
}
$perpage = $vbulletin->options['cybtpimx_perpage'];
$pagenumber = $vbulletin->input->clean_gpc('r', 'pagenumber', TYPE_UINT);
if ($reqmonth=='13')
{
$fromtime = gmmktime(0,0,0,1,1,$reqyear);
$totime = gmmktime(0,0,0,1,1,$reqyear+1);
$cybtpimx_monthinfo = '';
}
else
{
$fromtime = gmmktime(0,0,0,$reqmonth,1,$reqyear);
$totime = gmmktime(0,0,0,$reqmonth+1,1,$reqyear);
$cybtpimx_monthinfo = $reqmonth.'-';
}
$cyb_tpim_totres = $vbulletin->db->query_read("
SELECT COUNT(post.dateline) AS cybpcount, post.userid, post.visible, post.dateline, thread.forumid, user.usergroupid, thread.forumid
FROM " . TABLE_PREFIX . "post AS post
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (post.userid = user.userid)
LEFT JOIN " . TABLE_PREFIX . "thread AS thread ON (post.threadid = thread.threadid)
WHERE user.username != '' AND post.visible = '1' AND post.userid > 0 AND post.dateline > $fromtime AND post.dateline < $totime $cybtpimx_exclgroups $cybtpimx_exclusers $cybtpimx_exclforums
GROUP BY userid
");
$cybtpimx_totres = $db->num_rows($cyb_tpim_totres);
sanitize_pageresults($cybtpimx_totres, $pagenumber, $perpage, 100, 25);
$limitlower = ($pagenumber - 1) * $perpage + 1;
$limitupper = $pagenumber * $perpage;
if ($limitupper > $cybtpimx_totres)
{
$limitupper = $cybtpimx_totres;
if ($limitlower > $cybtpimx_totres)
{
$limitlower = $cybtpimx_totres - $perpage;
}
}
if ($limitlower <= 0)
{
$limitlower = 1;
}
$cyb_tpim_get = $vbulletin->db->query_read("
SELECT COUNT(post.dateline) AS cybpcount, post.userid, user.username, user.usergroupid, post.visible, user.posts, user.joindate, thread.forumid
FROM " . TABLE_PREFIX . "post AS post
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (post.userid = user.userid)
LEFT JOIN " . TABLE_PREFIX . "thread AS thread ON (post.threadid = thread.threadid)
WHERE user.username != '' AND post.visible = '1' AND post.userid > 0 AND post.dateline > $fromtime AND post.dateline < $totime $cybtpimx_exclgroups $cybtpimx_exclusers $cybtpimx_exclforums
GROUP BY userid
ORDER BY cybpcount DESC
LIMIT " . ($limitlower - 1) . ", $perpage
");
$nr = $limitlower-1;
while ($cyb_tpim = $db->fetch_array($cyb_tpim_get))
{
$nr += 1;
exec_switch_bg();
$cyb_tpim[musername] = fetch_musername($cyb_tpim);
$cyb_tpim_joindate = vbdate($vbulletin->options[dateformat], $cyb_tpim['joindate']);
eval('$cybtpimx_posters .= "' . $vbulletin->templatecache['cyb_top_posters_in_monthx_bit'] . '";');
}
$pagenav = construct_page_nav($pagenumber, $perpage, $cybtpimx_totres, 'misc.php?' . $vbulletin->session->vars['sessionurl'] . 'do=cybtpimx&m='.$reqmonth.'&y='.$reqyear, "");
eval('$cybtpimx .= "' . $vbulletin->templatecache['cyb_top_posters_in_monthx'] . '";');
require_once('./global.php');
construct_forum_jump();
$navbits = construct_navbits(array('' => $vbphrase['cyb_topposters_stats']));
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('cyb_top_posters_in_monthx') . '");');
$db->show_errors();
}
Proszę o pomoc.