PORTAL sayfasında kenarda çıkan bilgileri nasıl anasayfaya da ekleyebilirim ? ( portal.php dosyasındaki kodlarla anasayfamda yandaki boş kısma eklemek istiyorum)
// Load global language phrases $lang->load("portal");
// Fetch the current URL $portal_url = get_current_location();
add_breadcrumb($lang->nav_portal, "portal.php");
$plugins->run_hooks("portal_start");
// get forums user cannot view $unviewable = get_unviewable_forums(true); if($unviewable) { $unviewwhere = " AND fid NOT IN ($unviewable)"; } // If user is known, welcome them if($mybb->settings['portal_showwelcome'] != 0) { if($mybb->user['uid'] != 0) { // Get number of new posts, threads, announcements $query = $db->simple_select("posts", "COUNT(pid) AS newposts", "visible=1 AND dateline>'".$mybb->user['lastvisit']."' $unviewwhere"); $newposts = $db->fetch_field($query, "newposts"); if($newposts) { // If there aren't any new posts, there is no point in wasting two more queries $query = $db->simple_select("threads", "COUNT(tid) AS newthreads", "visible=1 AND dateline>'".$mybb->user['lastvisit']."' $unviewwhere"); $newthreads = $db->fetch_field($query, "newthreads");
$query = $db->simple_select("privatemessages", "COUNT(*) AS pms_unread", "uid='".$mybb->user['uid']."' AND CASE WHEN status = '0' AND folder = '0' THEN TRUE ELSE FALSE END"); $messages['pms_unread'] = $db->fetch_field($query, "pms_unread"); break; default: $query = $db->simple_select("privatemessages", "COUNT(*) AS pms_total, SUM(IF(status='0' AND folder='1','1','0')) AS pms_unread", "uid='".$mybb->user['uid']."'"); $messages = $db->fetch_array($query); }
// If we can see invisible users add them to the count if($mybb->usergroup['canviewwolinvis'] == 1) { $onlinecount += $anoncount; }
// If we can't see invisible users but the user is an invisible user incriment the count by one if($mybb->usergroup['canviewwolinvis'] != 1 && $mybb->user['invisible'] == 1) { ++$onlinecount; }
// Latest forum discussions if($mybb->settings['portal_showdiscussions'] != 0 && $mybb->settings['portal_showdiscussionsnum']) { $altbg = alt_trow(); $threadlist = ''; $query = $db->query(" SELECT t.*, u.username FROM ".TABLE_PREFIX."threads t LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=t.uid) WHERE 1=1 $unviewwhere AND t.visible='1' AND t.closed NOT LIKE 'moved|%' ORDER BY t.lastpost DESC LIMIT 0, ".$mybb->settings['portal_showdiscussionsnum'] ); while($thread = $db->fetch_array($query)) { $forumpermissions[$thread['fid']] = forum_permissions($thread['fid']);
// Make sure we can view this thread if($forumpermissions[$thread['fid']]['canview'] == 0 || $forumpermissions[$thread['fid']]['canviewthreads'] == 0 || $forumpermissions[$thread['fid']]['canonlyviewownthreads'] == 1 && $thread['uid'] != $mybb->user['uid']) { continue; }
$lastpostdate = my_date($mybb->settings['dateformat'], $thread['lastpost']); $lastposttime = my_date($mybb->settings['timeformat'], $thread['lastpost']); // Don't link to guest's profiles (they have no profile). if($thread['lastposteruid'] == 0) { $lastposterlink = $thread['lastposter']; } else { $lastposterlink = build_profile_link($thread['lastposter'], $thread['lastposteruid']); } if(my_strlen($thread['subject']) > 25) { $thread['subject'] = my_substr($thread['subject'], 0, 25) . "..."; } $thread['subject'] = htmlspecialchars_uni($parser->parse_badwords($thread['subject'])); $thread['threadlink'] = get_thread_link($thread['tid']); $thread['lastpostlink'] = get_thread_link($thread['tid'], 0, "lastpost"); eval("\$threadlist .= \"".$templates->get("portal_latestthreads_thread")."\";"); $altbg = alt_trow(); } if($threadlist) { // Show the table only if there are threads eval("\$latestthreads = \"".$templates->get("portal_latestthreads")."\";"); } }
$announcements = ''; if(!empty($mybb->settings['portal_announcementsfid'])) { // Get latest news announcements // First validate announcement fids: $announcementsfids = explode(',', $mybb->settings['portal_announcementsfid']); if(is_array($announcementsfids)) { foreach($announcementsfids as $fid) { $fid_array[] = intval($fid); } $announcementsfids = implode(',', $fid_array); } // And get them! foreach($forum_cache as $fid => $f) { if(is_array($fid_array) && in_array($fid, $fid_array)) { $forum[$fid] = $f; } }
$numannouncements = intval($mybb->settings['portal_numannouncements']); if(!$numannouncements) { $numannouncements = 10; // Default back to 10 }
$pids = ''; $tids = ''; $comma = ''; $posts = array(); $query = $db->query(" SELECT p.pid, p.message, p.tid, p.smilieoff FROM ".TABLE_PREFIX."posts p LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid) WHERE t.fid IN (".$announcementsfids.") AND t.visible='1' AND t.closed NOT LIKE 'moved|%' AND t.firstpost=p.pid ORDER BY t.dateline DESC LIMIT 0, {$numannouncements}" ); while($getid = $db->fetch_array($query)) { $pids .= ",'{$getid['pid']}'"; $tids .= ",'{$getid['tid']}'"; $posts[$getid['tid']] = $getid; } if(!empty($posts)) { $pids = "pid IN(0{$pids})"; // Now lets fetch all of the attachments for these posts $query = $db->simple_select("attachments", "*", $pids); while($attachment = $db->fetch_array($query)) { $attachcache[$attachment['pid']][$attachment['aid']] = $attachment; }
$query = $db->query(" SELECT t.*, t.username AS threadusername, u.username, u.avatar, u.avatardimensions FROM ".TABLE_PREFIX."threads t LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid) WHERE t.fid IN (".$announcementsfids.") AND t.tid IN (0{$tids}) AND t.visible='1' AND t.closed NOT LIKE 'moved|%' ORDER BY t.dateline DESC LIMIT 0, {$numannouncements}" ); while($announcement = $db->fetch_array($query)) { // Make sure we can view this announcement if($forumpermissions[$announcement['fid']]['canview'] == 0 || $forumpermissions[$announcement['fid']]['canviewthreads'] == 0 || $forumpermissions[$announcement['fid']]['canonlyviewownthreads'] == 1 && $announcement['uid'] != $mybb->user['uid']) { continue; }