<?php
//Goughy000 -> GOUGHY_CALENDAR_THREADS.php
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
$plugins->add_hook("calendar_dayview_end", "goughy_calendar_threads_dayviewlist");
function goughy_calendar_threads_info(){
return array(
"name" => "Threads On Calendar",
"description" => "Lists threads on calendar",
"website" => "http://www.byteforums.com/",
"author" => "Goughy000",
"authorsite" => "http://www.goughy000.com/",
"version" => "2.0",
"guid" => "a8bd220dd8c01acd028bd360ed2f0f6f"
);
}
function goughy_calendar_threads_dayviewlist(){
global $events;
global $day;
global $month;
global $year;
global $db;
global $mybb;
$timestamp_from = strtotime($year."-".$month."-".$day." 00:00:01");
$timestamp_to = strtotime($year."-".$month."-".$day." 23:59:59");
$threadsquery = $db->query("SELECT * FROM `".TABLE_PREFIX."threads` WHERE `dateline`>'".$timestamp_from."' AND `dateline`<'".$timestamp_to."'");
$threaddisplay .= "<br /><table border=\"0\" cellspacing=\"1\" cellpadding=\"4\" class=\"tborder\">
<tr>
<td class=\"thead\" colspan=\"6\"><strong>Threads Posted</strong></td>
</tr>";
$threaddisplay .= "<tr class=\"tcat\"><td></td><td><strong>Title</strong></td><td><strong>Author</strong></td><td><strong>Forum</strong></td><td><strong>Replies</strong></td><td><strong>Views</strong></td></tr>";
if($db->num_rows($threadsquery) > 0){
while($threaddetails = $db->fetch_array($threadsquery)){
$forumdetailsquery = $db->query("SELECT * FROM `".TABLE_PREFIX."forums` WHERE `fid`='".$threaddetails['fid']."'");
$forumdetails = $db->fetch_array($forumdetailsquery);
$icondetailsquery = $db->query("SELECT * FROM `".TABLE_PREFIX."icons` WHERE `iid`='".$threaddetails['icon']."'");
$icondetails = $db->fetch_array($icondetailsquery);
if($db->num_rows($icondetailsquery) > 0){
$icon = "<img src=\"".$mybb->settings['bburl']."/".$icondetails['path']."\" alt=\"Post Icon\" />";
}else{
$icon = "";
}
$threaddisplay .= "<tr class=\"trow1\"><td>".$icon."</td><td><a href=\"".$mybb->settings['bburl']."/showthread.php?tid=".$threaddetails['tid']."\">".$threaddetails['subject']."</a></td><td><a href=\"".$mybb->settings['bburl']."/member.php?action=profile&uid=".$threaddetails['uid']."\">".$threaddetails['username']."</a></td><td><a href=\"".$mybb->settings['bburl']."/forumdisplay.php?fid=".$threaddetails['fid']."\">".$forumdetails['name']."</a></td><td><a href=\"javascript:MyBB.whoPosted(".$threaddetails['tid'].");\">".$threaddetails['replies']."</a></td><td>".$threaddetails['views']."</td></tr>";
}
}else{
$threaddisplay .= "<tr colspan=\"2\"><td>No Threads on this day</td></tr>";
}
$threaddisplay .= "</table>";
$events.=$threaddisplay;
}
?>