Zeile 3 | Zeile 3 |
---|
* MyBB 1.2 * Copyright � 2006 MyBB Group, All Rights Reserved *
|
* MyBB 1.2 * Copyright � 2006 MyBB Group, All Rights Reserved *
|
* Website: http://www.mybboard.com * License: http://www.mybboard.com/eula.html
| * Website: http://www.mybboard.net * License: http://www.mybboard.net/eula.html
|
*
|
*
|
* $Id: portal.php 2164 2006-08-30 06:17:49Z chris $
| * $Id: portal.php 3030 2007-04-26 00:19:47Z Tikitiki $
|
*/
define("IN_MYBB", 1);
| */
define("IN_MYBB", 1);
|
Zeile 17 | Zeile 17 |
---|
// end editing
|
// end editing
|
if(!chdir($forumdir) && $forumdir)
| $change_dir = "./";
if(!@chdir($forumdir) && !empty($forumdir))
|
{
|
{
|
die("\$forumdir is invalid!");
| if(@is_dir($forumdir)) { $change_dir = $forumdir; } else { die("\$forumdir is invalid!"); }
|
}
$templatelist = "portal_welcome,portal_welcome_membertext,portal_stats,portal_search,portal_whosonline_memberbit,portal_whosonline,portal_latestthreads_thread_lastpost,portal_latestthreads_thread,portal_latestthreads,portal_announcement_numcomments_no,portal_announcement,portal_announcement_numcomments,portal";
|
}
$templatelist = "portal_welcome,portal_welcome_membertext,portal_stats,portal_search,portal_whosonline_memberbit,portal_whosonline,portal_latestthreads_thread_lastpost,portal_latestthreads_thread,portal_latestthreads,portal_announcement_numcomments_no,portal_announcement,portal_announcement_numcomments,portal";
|
require_once "./global.php";
| require_once $change_dir."global.php";
|
require_once MYBB_ROOT."inc/functions_post.php"; require_once MYBB_ROOT."inc/functions_user.php"; require_once MYBB_ROOT."inc/class_parser.php"; $parser = new postParser;
global $theme, $templates;
|
require_once MYBB_ROOT."inc/functions_post.php"; require_once MYBB_ROOT."inc/functions_user.php"; require_once MYBB_ROOT."inc/class_parser.php"; $parser = new postParser;
global $theme, $templates;
|
| // Fetch the current URL $portal_url = get_current_location();
|
// Load global language phrases $lang->load("portal");
|
// Load global language phrases $lang->load("portal");
|
|
|
add_breadcrumb($lang->nav_portal, "portal.php");
// This allows users to login if the portal is stored offsite or in a different directory
| add_breadcrumb($lang->nav_portal, "portal.php");
// This allows users to login if the portal is stored offsite or in a different directory
|
Zeile 48 | Zeile 60 |
---|
$login_text = '';
if(!username_exists($mybb->input['username']))
|
$login_text = '';
if(!username_exists($mybb->input['username']))
|
{ my_setcookie('loginattempts', $logins + 1);
| { my_setcookie('loginattempts', $logins + 1);
|
$db->query("UPDATE ".TABLE_PREFIX."sessions SET loginattempts=loginattempts+1 WHERE sid = '{$session->sid}'"); if($mybb->settings['failedlogintext'] == "yes") { $login_text = sprintf($lang->failed_login_again, $mybb->settings['failedlogincount'] - $logins); } error($lang->error_invalidusername.$login_text);
|
$db->query("UPDATE ".TABLE_PREFIX."sessions SET loginattempts=loginattempts+1 WHERE sid = '{$session->sid}'"); if($mybb->settings['failedlogintext'] == "yes") { $login_text = sprintf($lang->failed_login_again, $mybb->settings['failedlogincount'] - $logins); } error($lang->error_invalidusername.$login_text);
|
}
| }
|
$user = validate_password_from_username($mybb->input['username'], $mybb->input['password']); if(!$user['uid']) {
| $user = validate_password_from_username($mybb->input['username'], $mybb->input['password']); if(!$user['uid']) {
|
Zeile 70 | Zeile 82 |
---|
}
my_setcookie('loginattempts', 1);
|
}
my_setcookie('loginattempts', 1);
|
$db->delete_query(TABLE_PREFIX."sessions", "ip='".$session->ipaddress."' AND sid != '".$session->sid."'");
| $db->delete_query(TABLE_PREFIX."sessions", "ip='".$db->escape_string($session->ipaddress)."' AND sid != '".$session->sid."'");
|
$newsession = array( "uid" => $user['uid'], "loginattempts" => 1,
| $newsession = array( "uid" => $user['uid'], "loginattempts" => 1,
|
Zeile 80 | Zeile 92 |
---|
// Temporarily set the cookie remember option for the login cookies $mybb->user['remember'] = $user['remember'];
|
// Temporarily set the cookie remember option for the login cookies $mybb->user['remember'] = $user['remember'];
|
my_setcookie("mybbuser", $user['uid']."_".$user['loginkey']); my_setcookie("sid", $session->sid, -1);
| my_setcookie("mybbuser", $user['uid']."_".$user['loginkey'], null, true); my_setcookie("sid", $session->sid, -1, true);
|
if(function_exists("loggedIn")) { loggedIn($user['uid']);
| if(function_exists("loggedIn")) { loggedIn($user['uid']);
|
Zeile 95 | Zeile 107 |
---|
$plugins->run_hooks("portal_start");
|
$plugins->run_hooks("portal_start");
|
| // First validate announcement fids: $mybb->settings['portal_announcementsfid'] = explode(',', $mybb->settings['portal_announcementsfid']); if(is_array($mybb->settings['portal_announcementsfid'])) { foreach($mybb->settings['portal_announcementsfid'] as $fid) { $fid_array[] = intval($fid); } $mybb->settings['portal_announcementsfid'] = implode(',', $fid_array); }
|
// get forums user cannot view $unviewable = get_unviewable_forums();
| // get forums user cannot view $unviewable = get_unviewable_forums();
|
Zeile 139 | Zeile 161 |
---|
if(!$newann) { $newann = 0;
|
if(!$newann) { $newann = 0;
|
} }
| } }
|
else { $newposts = 0; $newthreads = 0; $newann = 0;
|
else { $newposts = 0; $newthreads = 0; $newann = 0;
|
}
| }
|
// Make the text if($newann == 1)
|
// Make the text if($newann == 1)
|
{
| {
|
$lang->new_announcements = $lang->new_announcement;
|
$lang->new_announcements = $lang->new_announcement;
|
} else {
| } else {
|
$lang->new_announcements = sprintf($lang->new_announcements, $newann); } if($newthreads == 1) { $lang->new_threads = $lang->new_thread;
|
$lang->new_announcements = sprintf($lang->new_announcements, $newann); } if($newthreads == 1) { $lang->new_threads = $lang->new_thread;
|
} else {
| } else {
|
$lang->new_threads = sprintf($lang->new_threads, $newthreads); } if($newposts == 1) { $lang->new_posts = $lang->new_post;
|
$lang->new_threads = sprintf($lang->new_threads, $newthreads); } if($newposts == 1) { $lang->new_posts = $lang->new_post;
|
}
| }
|
else { $lang->new_posts = sprintf($lang->new_posts, $newposts);
| else { $lang->new_posts = sprintf($lang->new_posts, $newposts);
|
Zeile 197 | Zeile 219 |
---|
$postsnum = $stats['numposts']; $membersnum = $stats['numusers']; if(!$stats['lastusername'])
|
$postsnum = $stats['numposts']; $membersnum = $stats['numusers']; if(!$stats['lastusername'])
|
{
| {
|
$newestmember = "<b>" . $lang->no_one . "</b>"; } else
| $newestmember = "<b>" . $lang->no_one . "</b>"; } else
|
Zeile 228 | Zeile 250 |
---|
"); while($user = $db->fetch_array($query)) {
|
"); while($user = $db->fetch_array($query)) {
|
| // Create a key to test if this user is a search bot. $botkey = strtolower(str_replace("bot=", '', $user['sid']));
|
if($user['uid'] == "0")
|
if($user['uid'] == "0")
|
{ $guestcount++;
| { ++$guestcount; } elseif(strpos($user['sid'], "bot=") !== false && $session->bots[$botkey]) { // The user is a search bot. $onlinemembers .= $comma.format_name($session->bots[$botkey], $session->botgroup); $comma = ", "; ++$botcount;
|
} else { if($doneusers[$user['uid']] < $user['time'] || !$doneusers[$user['uid']])
|
} else { if($doneusers[$user['uid']] < $user['time'] || !$doneusers[$user['uid']])
|
{
| {
|
$doneusers[$user['uid']] = $user['time'];
|
$doneusers[$user['uid']] = $user['time'];
|
$membercount++; if($user['invisible'] != "yes" || $mybb->usergroup['canviewwolinvis'] == "yes")
| // If the user is logged in anonymously, update the count for that. if($user['invisible'] == "yes") { ++$anoncount; } else { ++$membercount; } if($user['invisible'] == "yes") { $invisiblemark = "*"; } else { $invisiblemark = ''; } if(($user['invisible'] == "yes" && ($mybb->usergroup['canviewwolinvis'] == "yes" || $user['uid'] == $mybb->user['uid'])) || $user['invisible'] != "yes")
|
{
|
{
|
if($user['invisible'] == "yes") { $invisiblemark = "*"; } else { $invisiblemark = ''; }
| |
$user['username'] = format_name($user['username'], $user['usergroup'], $user['displaygroup']);
|
$user['username'] = format_name($user['username'], $user['usergroup'], $user['displaygroup']);
|
| $user['profilelink'] = get_profile_link($user['uid']);
|
eval("\$onlinemembers .= \"".$templates->get("portal_whosonline_memberbit", 1, 0)."\";"); $comma = ", "; } } } }
|
eval("\$onlinemembers .= \"".$templates->get("portal_whosonline_memberbit", 1, 0)."\";"); $comma = ", "; } } } }
|
$onlinecount = $membercount + $guestcount + $anoncount;
| $onlinecount = $membercount + $guestcount + $botcount; // If we can see invisible users add them to the count if($mybb->usergroup['canviewwolinvis'] == "yes") { $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'] != "yes" && $mybb->user['invisible'] == "yes") { ++$onlinecount; }
|
// Most users online $mostonline = $cache->read("mostonline");
| // Most users online $mostonline = $cache->read("mostonline");
|
Zeile 278 | Zeile 335 |
---|
// Latest forum discussions if($mybb->settings['portal_showdiscussions'] != "no" && $mybb->settings['portal_showdiscussionsnum']) {
|
// Latest forum discussions if($mybb->settings['portal_showdiscussions'] != "no" && $mybb->settings['portal_showdiscussionsnum']) {
|
$altbg = "trow1";
| $altbg = alt_trow();
|
$threadlist = ''; $query = $db->query(" SELECT t.*, u.username
| $threadlist = ''; $query = $db->query(" SELECT t.*, u.username
|
Zeile 316 | Zeile 373 |
---|
}
// Get latest news announcements
|
}
// Get latest news announcements
|
// First validate announcement fids: $mybb->settings['portal_announcementsfid'] = explode(',', $mybb->settings['portal_announcementsfid']); foreach($mybb->settings['portal_announcementsfid'] as $fid) { $fid_array[] = intval($fid); } $mybb->settings['portal_announcementsfid'] = implode(',', $fid_array); // And get them!
| |
$query = $db->simple_select(TABLE_PREFIX."forums", "*", "fid IN (".$mybb->settings['portal_announcementsfid'].")"); while($forumrow = $db->fetch_array($query))
|
$query = $db->simple_select(TABLE_PREFIX."forums", "*", "fid IN (".$mybb->settings['portal_announcementsfid'].")"); while($forumrow = $db->fetch_array($query))
|
{
| {
|
$forum[$forumrow['fid']] = $forumrow; }
| $forum[$forumrow['fid']] = $forumrow; }
|
Zeile 341 | Zeile 390 |
---|
LIMIT 0, ".$mybb->settings['portal_numannouncements'] ); while($getid = $db->fetch_array($query))
|
LIMIT 0, ".$mybb->settings['portal_numannouncements'] ); while($getid = $db->fetch_array($query))
|
{
| {
|
$pids .= ",'$getid[pid]'"; $posts[$getid['tid']] = $getid; }
| $pids .= ",'$getid[pid]'"; $posts[$getid['tid']] = $getid; }
|
Zeile 353 | Zeile 402 |
---|
$attachcache[$attachment['pid']][$attachment['aid']] = $attachment; }
|
$attachcache[$attachment['pid']][$attachment['aid']] = $attachment; }
|
foreach($forum as $fid => $forumrow)
| if(is_array($forum))
|
{
|
{
|
$forumpermissions[$fid] = forum_permissions($fid);
| foreach($forum as $fid => $forumrow) { $forumpermissions[$fid] = forum_permissions($fid); }
|
}
$icon_cache = $cache->read("posticons");
| }
$icon_cache = $cache->read("posticons");
|
Zeile 382 | Zeile 434 |
---|
if($announcement['icon'] > 0 && $icon_cache[$announcement['icon']]) { $icon = $icon_cache[$announcement['icon']];
|
if($announcement['icon'] > 0 && $icon_cache[$announcement['icon']]) { $icon = $icon_cache[$announcement['icon']];
|
$icon = "<img src=\"{$icon[path]}\" alt=\"{$icon[name]}\" />";
| $icon = "<img src=\"{$icon['path']}\" alt=\"{$icon['name']}\" />";
|
} else { $icon = " ";
|
} else { $icon = " ";
|
}
| }
|
if($announcement['avatar'] != '') { $avatar_dimensions = explode("|", $announcement['avatardimensions']);
| if($announcement['avatar'] != '') { $avatar_dimensions = explode("|", $announcement['avatardimensions']);
|
Zeile 409 | Zeile 461 |
---|
eval("\$numcomments = \"".$templates->get("portal_announcement_numcomments")."\";"); } else
|
eval("\$numcomments = \"".$templates->get("portal_announcement_numcomments")."\";"); } else
|
{
| {
|
eval("\$numcomments = \"".$templates->get("portal_announcement_numcomments_no")."\";"); $lastcomment = ''; }
|
eval("\$numcomments = \"".$templates->get("portal_announcement_numcomments_no")."\";"); $lastcomment = ''; }
|
| $plugins->run_hooks("portal_announcement");
$parser_options = array( "allow_html" => $forum[$announcement['fid']]['allowhtml'], "allow_mycode" => $forum[$announcement['fid']]['allowmycode'], "allow_smilies" => $forum[$announcement['fid']]['allowsmilies'], "allow_imgcode" => $forum[$announcement['fid']]['allowimgcode'] ); if($announcement['smilieoff'] == "yes") { $parser_options['allow_smilies'] = "no"; }
$message = $parser->parse_message($announcement['message'], $parser_options);
|
if(is_array($attachcache[$announcement['pid']])) { // This post has 1 or more attachments $validationcount = 0;
| if(is_array($attachcache[$announcement['pid']])) { // This post has 1 or more attachments $validationcount = 0;
|
Zeile 434 | Zeile 502 |
---|
} $attachment['icon'] = get_attachment_icon($ext); // Support for [attachment=id] code
|
} $attachment['icon'] = get_attachment_icon($ext); // Support for [attachment=id] code
|
if(stripos($announcement['message'], "[attachment=".$attachment['aid']."]") !== false)
| if(stripos($message, "[attachment=".$attachment['aid']."]") !== false)
|
{ if($attachment['thumbnail'] != "SMALL" && $attachment['thumbnail'] != '') { // We have a thumbnail to show (and its not the "SMALL" enough image
| { if($attachment['thumbnail'] != "SMALL" && $attachment['thumbnail'] != '') { // We have a thumbnail to show (and its not the "SMALL" enough image
|
Zeile 444 | Zeile 512 |
---|
{ // Image is small enough to show - no thumbnail eval("\$attbit = \"".$templates->get("postbit_attachments_images_image")."\";");
|
{ // Image is small enough to show - no thumbnail eval("\$attbit = \"".$templates->get("postbit_attachments_images_image")."\";");
|
} else {
| } else {
|
// Show standard link to attachment eval("\$attbit = \"".$templates->get("postbit_attachments_attachment")."\";");
|
// Show standard link to attachment eval("\$attbit = \"".$templates->get("postbit_attachments_attachment")."\";");
|
} $announcement['message'] = preg_replace("#\[attachment=".$attachment['aid']."]#si", $attbit, $announcement['message']);
| } $message = preg_replace("#\[attachment=".$attachment['aid']."]#si", $attbit, $message);
|
} else {
| } else {
|
Zeile 468 | Zeile 536 |
---|
{ // Image is small enough to show - no thumbnail eval("\$post['imagelist'] .= \"".$templates->get("postbit_attachments_images_image")."\";");
|
{ // Image is small enough to show - no thumbnail eval("\$post['imagelist'] .= \"".$templates->get("postbit_attachments_images_image")."\";");
|
}
| }
|
else { eval("\$post['attachmentlist'] .= \"".$templates->get("postbit_attachments_attachment")."\";"); } }
|
else { eval("\$post['attachmentlist'] .= \"".$templates->get("postbit_attachments_attachment")."\";"); } }
|
}
| }
|
else { $validationcount++;
| else { $validationcount++;
|
Zeile 493 | Zeile 561 |
---|
eval("\$post['attachments'] = \"".$templates->get("postbit_attachments")."\";"); } }
|
eval("\$post['attachments'] = \"".$templates->get("postbit_attachments")."\";"); } }
|
$plugins->run_hooks("portal_announcement");
$parser_options = array( "allow_html" => $forum[$announcement['fid']]['allow_html'], "allow_mycode" => $forum[$announcement['fid']]['allow_mycode'], "allow_smilies" => $forum[$announcement['fid']]['allowsmilies'], "allow_imgcode" => $forum[$announcement['fid']]['allowimgcode'] ); if($announcement['smilieoff'] == "yes") { $parser_options['allow_smilies'] = "no"; }
$message = $parser->parse_message($announcement['message'], $parser_options);
| |
eval("\$announcements .= \"".$templates->get("portal_announcement")."\";"); unset($post);
| eval("\$announcements .= \"".$templates->get("portal_announcement")."\";"); unset($post);
|