Zeile 6 | Zeile 6 |
---|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* $Id: portal.php 5147 2010-07-30 23:18:16Z RyanGordon $
| * $Id$
|
*/
define("IN_MYBB", 1);
| */
define("IN_MYBB", 1);
|
Zeile 47 | Zeile 47 |
---|
$portal_url = get_current_location();
add_breadcrumb($lang->nav_portal, "portal.php");
|
$portal_url = get_current_location();
add_breadcrumb($lang->nav_portal, "portal.php");
|
// This allows users to login if the portal is stored offsite or in a different directory if($mybb->input['action'] == "do_login" && $mybb->request_method == "post") { $plugins->run_hooks("portal_do_login_start");
// Checks to make sure the user can login; they haven't had too many tries at logging in. // Is a fatal call if user has had too many tries $logins = login_attempt_check(); $login_text = '';
if(!username_exists($mybb->input['username'])) { error($lang->error_invalidpworusername.$login_text); } $user = validate_password_from_username($mybb->input['username'], $mybb->input['password']); if(!$user['uid']) { my_setcookie('loginattempts', $logins + 1); $db->update_query("users", array('loginattempts' => 'loginattempts+1'), "LOWER(username) = '".$db->escape_string(my_strtolower($mybb->input['username']))."'", 1, true); if($mybb->settings['failedlogintext'] == 1) { $login_text = $lang->sprintf($lang->failed_login_again, $mybb->settings['failedlogincount'] - $logins); } error($lang->error_invalidpassword.$login_text); }
my_setcookie('loginattempts', 1); $db->delete_query("sessions", "ip='".$db->escape_string($session->ipaddress)."' AND sid != '".$session->sid."'"); $newsession = array( "uid" => $user['uid'], ); $db->update_query("sessions", $newsession, "sid='".$session->sid."'"); $db->update_query("users", array("loginattempts" => 1), "uid='{$mybb->user['uid']}'");
my_setcookie("mybbuser", $user['uid']."_".$user['loginkey'], ($mybb->input['remember'] == "yes" ? null : 0), true); my_setcookie("sid", $session->sid, -1, true);
if(function_exists("loggedIn")) { loggedIn($user['uid']); }
$plugins->run_hooks("portal_do_login_end");
redirect("portal.php", $lang->redirect_loggedin); }
| |
$plugins->run_hooks("portal_start");
| $plugins->run_hooks("portal_start");
|
Zeile 121 | Zeile 73 |
---|
$announcementsfids = explode(',', $mybb->settings['portal_announcementsfid']); if(is_array($announcementsfids))
|
$announcementsfids = explode(',', $mybb->settings['portal_announcementsfid']); if(is_array($announcementsfids))
|
{
| {
|
foreach($announcementsfids as $fid) { $fid_array[] = intval($fid);
| foreach($announcementsfids as $fid) { $fid_array[] = intval($fid);
|
Zeile 161 | Zeile 113 |
---|
if($newthreads == 1) { $lang->new_threads = $lang->new_thread;
|
if($newthreads == 1) { $lang->new_threads = $lang->new_thread;
|
} else {
| } else {
|
$lang->new_threads = $lang->sprintf($lang->new_threads, $newthreads);
|
$lang->new_threads = $lang->sprintf($lang->new_threads, $newthreads);
|
}
| }
|
if($newposts == 1) { $lang->new_posts = $lang->new_post;
| if($newposts == 1) { $lang->new_posts = $lang->new_post;
|
Zeile 173 | Zeile 125 |
---|
else { $lang->new_posts = $lang->sprintf($lang->new_posts, $newposts);
|
else { $lang->new_posts = $lang->sprintf($lang->new_posts, $newposts);
|
}
| }
|
eval("\$welcometext = \"".$templates->get("portal_welcome_membertext")."\";");
}
| eval("\$welcometext = \"".$templates->get("portal_welcome_membertext")."\";");
}
|
Zeile 181 | Zeile 133 |
---|
{ $lang->guest_welcome_registration = $lang->sprintf($lang->guest_welcome_registration, $mybb->settings['bburl'] . '/member.php?action=register'); $mybb->user['username'] = $lang->guest;
|
{ $lang->guest_welcome_registration = $lang->sprintf($lang->guest_welcome_registration, $mybb->settings['bburl'] . '/member.php?action=register'); $mybb->user['username'] = $lang->guest;
|
| switch($mybb->settings['username_method']) { case 0: $username = $lang->username; break; case 1: $username = $lang->username1; break; case 2: $username = $lang->username2; break; default: $username = $lang->username; break; }
|
eval("\$welcometext = \"".$templates->get("portal_welcome_guesttext")."\";"); } $lang->welcome = $lang->sprintf($lang->welcome, $mybb->user['username']);
| eval("\$welcometext = \"".$templates->get("portal_welcome_guesttext")."\";"); } $lang->welcome = $lang->sprintf($lang->welcome, $mybb->user['username']);
|
Zeile 363 | Zeile 330 |
---|
); while($thread = $db->fetch_array($query)) {
|
); 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'];
|
$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']);
| else { $lastposterlink = build_profile_link($thread['lastposter'], $thread['lastposteruid']);
|
Zeile 380 | Zeile 355 |
---|
} $thread['subject'] = htmlspecialchars_uni($parser->parse_badwords($thread['subject'])); $thread['threadlink'] = get_thread_link($thread['tid']);
|
} $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();
|
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")."\";");
|
if($threadlist) { // Show the table only if there are threads eval("\$latestthreads = \"".$templates->get("portal_latestthreads")."\";");
|
} }
| } }
|
// Get latest news announcements // First validate announcement fids: $announcementsfids = explode(',', $mybb->settings['portal_announcementsfid']); if(is_array($announcementsfids))
|
// 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);
| foreach($announcementsfids as $fid) { $fid_array[] = intval($fid);
|
Zeile 402 | Zeile 378 |
---|
$announcementsfids = implode(',', $fid_array); } // And get them!
|
$announcementsfids = implode(',', $fid_array); } // And get them!
|
$query = $db->simple_select("forums", "*", "fid IN (".$announcementsfids.")"); while($forumrow = $db->fetch_array($query))
| foreach($forum_cache as $fid => $f)
|
{
|
{
|
$forum[$forumrow['fid']] = $forumrow;
| 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 = '';
| }
$pids = '';
|
Zeile 417 | Zeile 401 |
---|
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
|
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, ".$mybb->settings['portal_numannouncements'] );
| LIMIT 0, {$numannouncements}" );
|
while($getid = $db->fetch_array($query)) { $pids .= ",'{$getid['pid']}'";
| while($getid = $db->fetch_array($query)) { $pids .= ",'{$getid['pid']}'";
|
Zeile 450 | Zeile 434 |
---|
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
|
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, ".$mybb->settings['portal_numannouncements']
| LIMIT 0, {$numannouncements}"
|
); while($announcement = $db->fetch_array($query)) {
|
); 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; }
|
$announcement['message'] = $posts[$announcement['tid']]['message']; $announcement['pid'] = $posts[$announcement['tid']]['pid']; $announcement['smilieoff'] = $posts[$announcement['tid']]['smilieoff']; $announcement['threadlink'] = get_thread_link($announcement['tid']);
|
$announcement['message'] = $posts[$announcement['tid']]['message']; $announcement['pid'] = $posts[$announcement['tid']]['pid']; $announcement['smilieoff'] = $posts[$announcement['tid']]['smilieoff']; $announcement['threadlink'] = get_thread_link($announcement['tid']);
|
|
|
if($announcement['uid'] == 0)
|
if($announcement['uid'] == 0)
|
{
| {
|
$profilelink = htmlspecialchars_uni($announcement['threadusername']); } else { $profilelink = build_profile_link($announcement['username'], $announcement['uid']);
|
$profilelink = htmlspecialchars_uni($announcement['threadusername']); } else { $profilelink = build_profile_link($announcement['username'], $announcement['uid']);
|
}
| }
|
if(!$announcement['username']) {
| if(!$announcement['username']) {
|
Zeile 474 | Zeile 464 |
---|
} $announcement['subject'] = htmlspecialchars_uni($parser->parse_badwords($announcement['subject'])); if($announcement['icon'] > 0 && $icon_cache[$announcement['icon']])
|
} $announcement['subject'] = htmlspecialchars_uni($parser->parse_badwords($announcement['subject'])); if($announcement['icon'] > 0 && $icon_cache[$announcement['icon']])
|
{
| {
|
$icon = $icon_cache[$announcement['icon']]; $icon = "<img src=\"{$icon['path']}\" alt=\"{$icon['name']}\" />";
|
$icon = $icon_cache[$announcement['icon']]; $icon = "<img src=\"{$icon['path']}\" alt=\"{$icon['name']}\" />";
|
}
| }
|
else
|
else
|
{
| {
|
$icon = " "; } if($announcement['avatar'] != '')
|
$icon = " "; } if($announcement['avatar'] != '')
|
{
| {
|
$avatar_dimensions = explode("|", $announcement['avatardimensions']); if($avatar_dimensions[0] && $avatar_dimensions[1]) {
| $avatar_dimensions = explode("|", $announcement['avatardimensions']); if($avatar_dimensions[0] && $avatar_dimensions[1]) {
|
Zeile 618 | Zeile 608 |
---|
eval("\$portal = \"".$templates->get("portal")."\";"); output_page($portal);
|
eval("\$portal = \"".$templates->get("portal")."\";"); output_page($portal);
|
| |
?>
| ?>
|