1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
function mbhattatgal_run()
{
global $mybb, $db, $collapsed, $collapsedimg, $templates, $theme, $mbhattachment_gallery;
if($mybb->settings['mbhattatgal_ed'] != 0)
{
$mbhattatgal_num = intval($mybb->settings['mbhattatgal_num']);
if(is_array(explode(',', $mybb->settings['mbhattatgal_fid'])))
{
foreach(explode(',', $mybb->settings['mbhattatgal_fid']) as $mbhattatgal_tid)
{
$mbhattatgal_tid_array[] = intval($mbhattatgal_tid);
}
}
$query = $db->query("
SELECT a.updatetime, a.md5hash, a.uploadtime, a.aid, a.attachname, a.filename, t.*
FROM ".TABLE_PREFIX."xtattachments a
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=a.tid)
WHERE t.visible=1 AND t.fid IN ('".implode("','", $mbhattatgal_tid_array)."')
GROUP BY a.tid
ORDER BY RAND()
LIMIT $mbhattatgal_num
");
while($mbhatt = $db->fetch_array($query))
{
$mbhatt_username = htmlspecialchars_uni($mbhatt['username']);
$mbhatt_title = htmlspecialchars_uni($mbhatt['subject']);
$mbhatt_postlink = get_thread_link(intval($mbhatt['tid']));
$mbhatt_datetime = my_date($mybb->settings['dateformat'], $mbhatt['uploadtime']).' '.my_date($mybb->settings['timeformat'], $mbhatt['uploadtime']);
$mbhatt_att_thumb = xthreads_get_xta_url($mbhatt).'/thumb160x120';
eval("\$mbhatt_gallery_gallery .= \"".$templates->get("mbhatt_gallery_gallery")."\";");
}
eval("\$mbhattachment_gallery = \"".$templates->get("mbhatt_gallery")."\";");
}
}
?>
|