<?php
/***************************************************************
* ProPortal
* Copyright � 2010 ProMyBB, All Rights Reserved
*
* Website: http://www.promybb.com/
* License: http://creativecommons.org/licenses/by-nc-sa/3.0/
*
* Expansion created by Thomas Rotner
* Website: http://www.HundeLexi.de
* Support: http://www.mybbcoder.info/thema-5217.html
***************************************************************/
if (!defined("IN_PORTAL")) {
die("<div style=\"border:1px solid #CC0000; padding:3px; margin:0; font-family:Tahoma; width:250px; font-size:12px;\"><strong>Error:</strong> This file cannot be viewed directly!</div>");
}
$unviewable = get_unviewable_forums();
$lang->load("usercp");
if($unviewable)
{
$unviewwhere = " AND fid NOT IN ($unviewable)";
}
$abothreadlimit = 10;
$query = $db->query("
SELECT s.*, t.*, t.username AS threadusername, u.username, p.displaystyle AS threadprefix
FROM ".TABLE_PREFIX."threadsubscriptions s
LEFT JOIN ".TABLE_PREFIX."threads t ON (s.tid=t.tid)
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid)
LEFT JOIN ".TABLE_PREFIX."threadprefixes p ON (p.pid=t.prefix)
WHERE s.uid='".$mybb->user['uid']."' {$visible}
ORDER BY t.lastpost DESC
LIMIT 0, $abothreadlimit
");
while($thread = $db->fetch_array($query)){
$query_2 = $db->simple_select("forums", "fid, name", "fid IN (".$thread['fid'].")");
while($forumrow = $db->fetch_array($query_2)){
$portal_forums = $forumrow['name'];
$thread['forumlink'] = get_forum_link($thread['fid']);
$thread['autorlink'] = get_profile_link($thread['uid']);
}
$query_3 = $db->simple_select("threadsread", "*", "uid='{$mybb->user['uid']}' AND tid IN (".$thread['tid'].")");
while($forumrow = $db->fetch_array($query_3)){
$thread['lastread'] = $forumrow['dateline'];
}
if($mybb->settings['dotfolders'] != 0 && $mybb->user['uid']){
$query_4 = $db->simple_select("posts", "tid,uid", "uid='{$mybb->user['uid']}' AND tid IN (".$thread['tid'].")");
while($post = $db->fetch_array($query_4)){
$thread['doticon'] = 1;
}
}
$folder = '';
$folder_label = '';
if($thread['doticon']){
$folder = "dot_";
$folder_label .= $lang->icon_dot;
}
$gotounread = '';
$isnew = 0;
$donenew = 0;
if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid'] && $thread['lastpost'] > $forum_read){
if($thread['lastread']){
$last_read = $thread['lastread'];
}else{
$last_read = $read_cutoff;
}
}else{
$last_read = my_get_array_cookie("threadread", $thread['tid']);
}
if($forum_read > $last_read){
$last_read = $forum_read;
}
if($thread['lastpost'] > $last_read && $moved[0] != "moved"){
$folder .= "new";
$folder_label .= $lang->icon_new;
}else{
$folder_label .= $lang->icon_no_new;
$new_class = "";
}
if($thread['replies'] >= $mybb->settings['hottopic'] || $thread['views'] >= $mybb->settings['hottopicviews']){
$folder .= "hot";
$folder_label .= $lang->icon_hot;
}
if($thread['closed'] == 1){
$folder .= "lock";
$folder_label .= $lang->icon_lock;
}
if($moved[0] == "moved"){
$folder = "move";
$gotounread = '';
}
$folder .= "folder";
$portal_lastpostdate = my_date($mybb->settings['dateformat'], $thread['lastpost']);
$portal_lastposttime = my_date($mybb->settings['timeformat'], $thread['lastpost']);
if($thread['lastposteruid'] == 0){
$portal_lastposterlink = $thread['lastposter'];
}else{
$portal_lastposterlink = build_profile_link($thread['lastposter'], $thread['lastposteruid']);
}
if(my_strlen($thread['subject']) > 50){
$thread['subject'] = my_substr($thread['subject'], 0, 50) . "...";
}
$icon_cache = $cache->read("posticons");
if($thread['icon'] > 0 && $icon_cache[$thread['icon']]){
$icon = $icon_cache[$thread['icon']];
$icon = "<img src=\"{$icon['path']}\" alt=\"{$icon['name']}\" /> ";
}else{
$icon = " ";
}
$thread['threadlink'] = get_thread_link($thread['tid']);
$thread['lastpostlink'] = get_thread_link($thread['tid'], 0, "lastpost");
switch($thread['notification']){
case "1":
$notification_type = $lang->instant_notification;
break;
default:
$notification_type = $lang->no_notification;
}
$query = $db->query("
SELECT COUNT(ts.tid) as threads
FROM ".TABLE_PREFIX."threadsubscriptions ts
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid = ts.tid)
WHERE ts.uid = '".$mybb->user['uid']."' {$visible}
");
$threadcount = $db->fetch_field($query, "threads");
$abothreads .= "<tr>
<td align=\"center\" class=\"$altbg\" width=\"2%\"><img src=\"$theme[imgdir]/$folder.gif\" alt=\"$folder_label\" title=\"$folder_label\" /></td>
<td align=\"center\" class=\"$altbg\" width=\"2%\">$icon</td>
<td class=\"$altbg\">$gotounread $thread[threadprefix] <a href=\"$thread[threadlink]\" class=\"$new_class\">$thread[subject]</a><br /><span class=\"smalltext\">$lang->notification_method $notification_type</span></td>
<td align=\"center\" class=\"$altbg\">$thread[replies]</a></td>
<td align=\"center\" class=\"$altbg\">$thread[views]</td>
<td class=\"$altbg\" style=\"white-space: nowrap\">
<span class=\"smalltext\">$portal_lastpostdate / $portal_lastposttime<br />
<a href=\"$thread[lastpostlink]\">$lang->lastpost</a>: $portal_lastposterlink</span>
</td>
</tr>";
}
if(!$abothreads){
$abothreads = "<tr><td class=\"trow1\" colspan=\"5\">{$lang->no_thread}</td></tr>";
}
echo "<table border=\"0\" cellspacing=\"".$theme['borderwidth']."\" cellpadding=\"".$theme['tablespace']."\" class=\"tborder\">
<tr>
<td class=\"thead\" colspan=\"6\"><div class=\"expcolimage\"><img src=\"{$theme['imgdir']}/{$expcolimage}\" id=\"block_{$result_blocks['id']}_img\" class=\"expander\" alt=\"{$expaltext}\" title=\"{$expaltext}\" /></div><strong>{$lang->subscriptions}</strong></td>
</tr>
<tr>
<td class=\"tcat\" colspan=\"3\"align=\"center\" width=\"50%\"><span class=\"smalltext\"><strong>{$lang->thread}</strong></span></td>
<td class=\"tcat\" align=\"center\" width=\"5%\"><span class=\"smalltext\"><strong>{$lang->replies}</strong></span></td>
<td class=\"tcat\" align=\"center\" width=\"5%\"><span class=\"smalltext\"><strong>{$lang->views}</strong></span></td>
<td class=\"tcat\" align=\"center\" width=\"40%\"><span class=\"smalltext\"><strong>{$lang->lastpost}</strong></span></td>
</tr>
<tbody style=\"{$expdisplay}\" id=\"block_{$result_blocks['id']}_e\">
{$abothreads}
</tbody>
</table>";
?>