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: functions_online.php 5498 2011-07-18 08:05:00Z Tomm $
| * $Id$
|
*/
|
*/
|
$uid_list = $aid_list = $pid_list = $tid_list = $fid_list = $eid_list = array();
| $uid_list = $aid_list = $pid_list = $tid_list = $fid_list = $ann_list = $eid_list = array();
|
/** * Fetch a users activity and any corresponding details from their location.
| /** * Fetch a users activity and any corresponding details from their location.
|
Zeile 19 | Zeile 19 |
---|
*/ function fetch_wol_activity($location, $nopermission=false) {
|
*/ function fetch_wol_activity($location, $nopermission=false) {
|
global $uid_list, $aid_list, $pid_list, $tid_list, $fid_list, $eid_list, $plugins, $user, $parameters;
| global $uid_list, $aid_list, $pid_list, $tid_list, $fid_list, $ann_list, $eid_list, $plugins, $user, $parameters;
|
$user_activity = array();
| $user_activity = array();
|
Zeile 51 | Zeile 51 |
---|
switch($filename) { case "announcements":
|
switch($filename) { case "announcements":
|
if(is_numeric($parameters['fid']))
| if(is_numeric($parameters['aid']))
|
{
|
{
|
$fid_list[] = $parameters['fid'];
| $ann_list[] = $parameters['aid'];
|
} $user_activity['activity'] = "announcements";
|
} $user_activity['activity'] = "announcements";
|
$user_activity['fid'] = $parameters['fid'];
| $user_activity['ann'] = $parameters['aid'];
|
break; case "attachment": if(is_numeric($parameters['aid']))
| break; case "attachment": if(is_numeric($parameters['aid']))
|
Zeile 87 | Zeile 87 |
---|
else { $user_activity['activity'] = "calendar";
|
else { $user_activity['activity'] = "calendar";
|
} break;
| } break;
|
case "editpost": $user_activity['activity'] = "editpost"; break;
| case "editpost": $user_activity['activity'] = "editpost"; break;
|
Zeile 136 | Zeile 136 |
---|
elseif($parameters['action'] == "emailuser" || $parameters['action'] == "do_emailuser") { $user_activity['activity'] = "member_emailuser";
|
elseif($parameters['action'] == "emailuser" || $parameters['action'] == "do_emailuser") { $user_activity['activity'] = "member_emailuser";
|
}
| }
|
elseif($parameters['action'] == "rate" || $parameters['action'] == "do_rate")
|
elseif($parameters['action'] == "rate" || $parameters['action'] == "do_rate")
|
{
| {
|
$user_activity['activity'] = "member_rate"; } elseif($parameters['action'] == "resendactivation" || $parameters['action'] == "do_resendactivation")
|
$user_activity['activity'] = "member_rate"; } elseif($parameters['action'] == "resendactivation" || $parameters['action'] == "do_resendactivation")
|
{
| {
|
$user_activity['activity'] = "member_resendactivation"; } elseif($parameters['action'] == "lostpw" || $parameters['action'] == "do_lostpw" || $parameters['action'] == "resetpassword") { $user_activity['activity'] = "member_lostpw";
|
$user_activity['activity'] = "member_resendactivation"; } elseif($parameters['action'] == "lostpw" || $parameters['action'] == "do_lostpw" || $parameters['action'] == "resetpassword") { $user_activity['activity'] = "member_lostpw";
|
}
| }
|
else { $user_activity['activity'] = "member";
| else { $user_activity['activity'] = "member";
|
Zeile 171 | Zeile 171 |
---|
elseif(in_array($parameters['action'], $accepted_parameters)) { $user_activity['activity'] = "misc_".$parameters['action'];
|
elseif(in_array($parameters['action'], $accepted_parameters)) { $user_activity['activity'] = "misc_".$parameters['action'];
|
}
| }
|
else
|
else
|
{
| {
|
$user_activity['activity'] = "misc"; } break;
| $user_activity['activity'] = "misc"; } break;
|
Zeile 183 | Zeile 183 |
---|
foreach($accepted_parameters as $action) { if($parameters['action'] == $action)
|
foreach($accepted_parameters as $action) { if($parameters['action'] == $action)
|
{
| {
|
$user_activity['activity'] = "modcp_".$action; break; }
| $user_activity['activity'] = "modcp_".$action; break; }
|
Zeile 219 | Zeile 219 |
---|
if(is_numeric($parameters['pid'])) { $pid_list[] = $parameters['pid'];
|
if(is_numeric($parameters['pid'])) { $pid_list[] = $parameters['pid'];
|
$user_activity['activity'] = "newreply";
| $user_activity['activity'] = "newreply";
|
$user_activity['pid'] = $parameters['pid'];
|
$user_activity['pid'] = $parameters['pid'];
|
}
| }
|
else { if(is_numeric($parameters['tid']))
| else { if(is_numeric($parameters['tid']))
|
Zeile 230 | Zeile 230 |
---|
} $user_activity['activity'] = "newreply"; $user_activity['tid'] = $parameters['tid'];
|
} $user_activity['activity'] = "newreply"; $user_activity['tid'] = $parameters['tid'];
|
} break;
| } break;
|
case "newthread": if(is_numeric($parameters['fid']))
|
case "newthread": if(is_numeric($parameters['fid']))
|
{
| {
|
$fid_list[] = $parameters['fid'];
|
$fid_list[] = $parameters['fid'];
|
}
| }
|
$user_activity['activity'] = "newthread"; $user_activity['fid'] = $parameters['fid']; break;
| $user_activity['activity'] = "newthread"; $user_activity['fid'] = $parameters['fid']; break;
|
Zeile 244 | Zeile 244 |
---|
if($parameters['action'] == "today") { $user_activity['activity'] = "woltoday";
|
if($parameters['action'] == "today") { $user_activity['activity'] = "woltoday";
|
} else
| } else
|
{ $user_activity['activity'] = "wol"; }
| { $user_activity['activity'] = "wol"; }
|
Zeile 277 | Zeile 277 |
---|
{ $user_activity['activity'] = "showresults"; }
|
{ $user_activity['activity'] = "showresults"; }
|
} break;
| } break;
|
case "printthread": if(is_numeric($parameters['tid'])) {
| case "printthread": if(is_numeric($parameters['tid'])) {
|
Zeile 295 | Zeile 295 |
---|
elseif($parameters['action'] == "read") { $user_activity['activity'] = "private_read";
|
elseif($parameters['action'] == "read") { $user_activity['activity'] = "private_read";
|
}
| }
|
elseif($parameters['action'] == "folders" || $parameters['action'] == "do_folders")
|
elseif($parameters['action'] == "folders" || $parameters['action'] == "do_folders")
|
{
| {
|
$user_activity['activity'] = "private_folders"; } else { $user_activity['activity'] = "private";
|
$user_activity['activity'] = "private_folders"; } else { $user_activity['activity'] = "private";
|
} break;
| } break;
|
case "ratethread": $user_activity['activity'] = "ratethread";
|
case "ratethread": $user_activity['activity'] = "ratethread";
|
break;
| break;
|
case "report": $user_activity['activity'] = "report"; break; case "reputation":
|
case "report": $user_activity['activity'] = "report"; break; case "reputation":
|
$user_activity['activity'] = "reputation";
| if(is_numeric($parameters['uid'])) { $uid_list[] = $parameters['uid']; $user_activity['uid'] = $parameters['uid']; }
if($parameters['action'] == "add") { $user_activity['activity'] = "reputation"; } else { $user_activity['activity'] = "reputation_report"; }
|
break; case "search": $user_activity['activity'] = "search";
| break; case "search": $user_activity['activity'] = "search";
|
Zeile 437 | Zeile 450 |
---|
// Expects $location to be passed through already sanitized $user_activity['location'] = $location;
|
// Expects $location to be passed through already sanitized $user_activity['location'] = $location;
|
$plugins->run_hooks_by_ref("fetch_wol_activity_end", $user_activity);
| $user_activity = $plugins->run_hooks("fetch_wol_activity_end", $user_activity);
|
return $user_activity; }
|
return $user_activity; }
|
|
|
/** * Builds a friendly named Who's Online location from an "activity" and array of user data. Assumes fetch_wol_activity has already been called. *
| /** * Builds a friendly named Who's Online location from an "activity" and array of user data. Assumes fetch_wol_activity has already been called. *
|
Zeile 450 | Zeile 463 |
---|
*/ function build_friendly_wol_location($user_activity) {
|
*/ function build_friendly_wol_location($user_activity) {
|
global $db, $lang, $uid_list, $aid_list, $pid_list, $tid_list, $fid_list, $eid_list, $plugins, $parser, $mybb; global $threads, $forums, $forums_linkto, $posts, $events, $usernames, $attachments;
| global $db, $lang, $uid_list, $aid_list, $pid_list, $tid_list, $fid_list, $ann_list, $eid_list, $plugins, $parser, $mybb; global $threads, $forums, $forums_linkto, $forum_cache, $posts, $announcements, $events, $usernames, $attachments;
|
// Fetch forum permissions for this user $unviewableforums = get_unviewable_forums(); if($unviewableforums)
|
// Fetch forum permissions for this user $unviewableforums = get_unviewable_forums(); if($unviewableforums)
|
{
| {
|
$fidnot = " AND fid NOT IN ($unviewableforums)"; }
| $fidnot = " AND fid NOT IN ($unviewableforums)"; }
|
Zeile 468 | Zeile 481 |
---|
while($user = $db->fetch_array($query)) { $usernames[$user['uid']] = $user['username'];
|
while($user = $db->fetch_array($query)) { $usernames[$user['uid']] = $user['username'];
|
}
| }
|
} // Fetch any attachments
| } // Fetch any attachments
|
Zeile 480 | Zeile 493 |
---|
{ $attachments[$attachment['aid']] = $attachment['pid']; $pid_list[] = $attachment['pid'];
|
{ $attachments[$attachment['aid']] = $attachment['pid']; $pid_list[] = $attachment['pid'];
|
}
| } }
// Fetch any announcements if(!is_array($announcements) && count($ann_list) > 0) { $aid_sql = implode(",", $ann_list); $query = $db->simple_select("announcements", "aid,subject", "aid IN ({$aid_sql}) {$fidnot}"); while($announcement = $db->fetch_array($query)) { $announcement_title = htmlspecialchars_uni($parser->parse_badwords($announcement['subject'])); $announcements[$announcement['aid']] = $announcement_title; }
|
}
// Fetch any posts
| }
// Fetch any posts
|
Zeile 492 | Zeile 517 |
---|
{ $posts[$post['pid']] = $post['tid']; $tid_list[] = $post['tid'];
|
{ $posts[$post['pid']] = $post['tid']; $tid_list[] = $post['tid'];
|
}
| }
|
}
// Fetch any threads
| }
// Fetch any threads
|
Zeile 517 | Zeile 542 |
---|
if($perms[$thread['fid']]['canonlyviewownthreads'] == 1 && $thread['uid'] != $mybb->user['uid'] && !is_moderator($thread['fid'])) { continue;
|
if($perms[$thread['fid']]['canonlyviewownthreads'] == 1 && $thread['uid'] != $mybb->user['uid'] && !is_moderator($thread['fid'])) { continue;
|
}
| }
|
if(is_moderator($thread['fid']) || $thread['visible'] != '0') {
| if(is_moderator($thread['fid']) || $thread['visible'] != '0') {
|
Zeile 537 | Zeile 562 |
---|
// Fetch any forums if(!is_array($forums) && count($fid_list) > 0)
|
// Fetch any forums if(!is_array($forums) && count($fid_list) > 0)
|
{ $fid_sql = implode(",", $fid_list); $query = $db->simple_select("forums", "fid,name,linkto", "fid IN ($fid_sql) $fidnot"); while($forum = $db->fetch_array($query)) { $forums[$forum['fid']] = $forum['name']; $forums_linkto[$forum['fid']] = $forum['linkto']; } }
| { if($fidnot && $unviewableforums) { $fidnot = explode(',', $unviewableforums); }
foreach($forum_cache as $fid => $forum) { if(in_array($fid, $fid_list) && (!$fidnot || is_array($fidnot) && !in_array("'{$fid}'", $fidnot))) { $forums[$fid] = $forum['name']; $forums_linkto[$fid] = $forum['linkto']; } } }
|
// And finaly any events if(!is_array($events) && count($eid_list) > 0) {
| // And finaly any events if(!is_array($events) && count($eid_list) > 0) {
|
Zeile 563 | Zeile 594 |
---|
{ // announcement.php functions case "announcements":
|
{ // announcement.php functions case "announcements":
|
if($forums[$user_activity['fid']])
| if($announcements[$user_activity['ann']])
|
{
|
{
|
$location_name = $lang->sprintf($lang->viewing_announcements, get_forum_link($user_activity['fid']), $forums[$user_activity['fid']]);
| $location_name = $lang->sprintf($lang->viewing_announcements, get_announcement_link($user_activity['ann']), $announcements[$user_activity['ann']]);
|
} else {
| } else {
|
Zeile 583 | Zeile 614 |
---|
else { $location_name = $lang->viewing_attachment;
|
else { $location_name = $lang->viewing_attachment;
|
} break;
| } break;
|
// calendar.php functions case "calendar": $location_name = $lang->viewing_calendar;
| // calendar.php functions case "calendar": $location_name = $lang->viewing_calendar;
|
Zeile 608 | Zeile 639 |
---|
// editpost.php functions case "editpost": $location_name = $lang->editing_post;
|
// editpost.php functions case "editpost": $location_name = $lang->editing_post;
|
break;
| break;
|
// forumdisplay.php functions case "forumdisplay": if($forums[$user_activity['fid']])
| // forumdisplay.php functions case "forumdisplay": if($forums[$user_activity['fid']])
|
Zeile 643 | Zeile 674 |
---|
if($usernames[$user_activity['uid']]) { $location_name = $lang->sprintf($lang->viewing_profile2, get_profile_link($user_activity['uid']), $usernames[$user_activity['uid']]);
|
if($usernames[$user_activity['uid']]) { $location_name = $lang->sprintf($lang->viewing_profile2, get_profile_link($user_activity['uid']), $usernames[$user_activity['uid']]);
|
} else
| } else
|
{ $location_name = $lang->viewing_profile; }
| { $location_name = $lang->viewing_profile; }
|
Zeile 839 | Zeile 870 |
---|
break; // reputation.php functions case "reputation":
|
break; // reputation.php functions case "reputation":
|
$location_name = $lang->giving_reputation;
| $location_name = $lang->sprintf($lang->giving_reputation, get_profile_link($user_activity['uid']), $usernames[$user_activity['uid']]); break; case "reputation_report": if($usernames[$user_activity['uid']]) { $location_name = $lang->sprintf($lang->viewing_reputation_report, "reputation.php?uid={$user_activity['uid']}", $usernames[$user_activity['uid']]); } else { $location_name = $lang->sprintf($lang->viewing_reputation_report2); }
|
break; // search.php functions case "search":
| break; // search.php functions case "search":
|
Zeile 925 | Zeile 966 |
---|
} $plugin_array = array('user_activity' => &$user_activity, 'location_name' => &$location_name);
|
} $plugin_array = array('user_activity' => &$user_activity, 'location_name' => &$location_name);
|
$plugins->run_hooks_by_ref("build_friendly_wol_location_end", $plugin_array);
| $plugins->run_hooks("build_friendly_wol_location_end", $plugin_array);
|
if($user_activity['nopermission'] == 1) {
| if($user_activity['nopermission'] == 1) {
|