function spamalyser_build_post_path(&$logitem) { global $lang, $forums, $mybb; $bburl = htmlspecialchars_uni($mybb->settings['bburl'] . '/'); $subject = htmlspecialchars_uni($logitem['subject']); if ($logitem['real_pid']) { $subject = '<a href="' . $bburl . get_post_link($logitem['pid'], $logitem['tid']) . '#pid' . $logitem['pid'] . '" target="_blank">' . $subject . '</a>'; } if ($logitem['threadsubject']) { if ($logitem['real_tid']) { $subject = '<a href="' . $bburl . get_thread_link($logitem['tid']) . '" target="_blank">' . htmlspecialchars_uni($logitem['threadsubject']) . '</a> » ' . $subject; } else { $subject = htmlspecialchars_uni($logitem['threadsubject']) . ' » ' . $subject; } } if (empty($forums)) { $forums = $GLOBALS['cache']->read('forums'); } if ($forums[$logitem['fid']]) { $subject = '<a href="' . $bburl . get_forum_link($logitem['fid']) . '" target="_blank">' . $forums[$logitem['fid']]['name'] . '</a> » ' . $subject; } // new/edit icons if ($logitem['event'] == 0) { $subject = '<img src="spamalyser_img/post_new.gif" title="' . $lang->icon_new_thread_post . '" alt="' . $lang->icon_alt_new_thread_post . '" style="margin-right: 0.5em; font-size: smaller; vertical-align: middle;" />' . $subject; } elseif ($logitem['event'] == 2) { $subject = '<img src="spamalyser_img/post_merge.gif" title="' . $lang->icon_merge_post . '" alt="' . $lang->icon_alt_merge_post . '" style="margin-right: 0.5em; font-size: smaller; vertical-align: middle;" />' . $subject; } else { $subject = '<img src="spamalyser_img/post_edit.gif" title="' . $lang->icon_edit_thread_post . '" alt="' . $lang->icon_alt_edit_thread_post . '" style="margin-right: 0.5em; font-size: smaller; vertical-align: middle;" />' . $subject; } return $subject; }
function reportthread_dopost() { require_once MYBB_ROOT . "inc/datahandlers/post.php"; global $db, $mybb; if (intval($mybb->settings['rtt_enabled']) == 1 || preg_replace("/[^a-z]/i", "", $mybb->settings['rtt_enabled']) == "yes") { if ($mybb->input['type'] == 'post') { $title = "Reported Post By "; $post = get_post($mybb->input['pid']); $thread = get_thread($post['tid']); $forum = get_forum($thread['fid']); $tlink = get_thread_link($thread['tid']); $flink = get_forum_link($thread['fid']); $reason = $mybb->input['reason']; if ($reason === 'other') { $reason = $mybb->input['comment']; } $post_data = $mybb->user['username'] . " has reported a post.\r\n\r\nOriginal Thread: [url=" . $mybb->settings['bburl'] . "/{$tlink}]" . $thread['subject'] . "[/url]\r\nForum: [url=" . $mybb->settings['bburl'] . "/{$flink}]" . $forum['name'] . "[/url]\r\n\r\nReason Given:\r\n[quote=\"" . $mybb->user['username'] . "\" dateline=\"" . time() . "\"]" . $reason . "[/quote]\r\n\r\nPost Content:\r\n[quote=\"" . $post['username'] . "\" pid=\"" . $post['pid'] . "\" dateline=\"" . $post['dateline'] . "\"]" . $post['message'] . "[/quote]"; } else { if ($mybb->input['type'] == 'reputation') { $title = "Reported Reputation By "; $rep = get_reputation_point($mybb->input['pid']); $giver = get_user($rep['adduid']); $reason = $mybb->input['reason']; if ($reason === 'other') { $reason = $mybb->input['comment']; } $post_data = $mybb->user['username'] . " has reported a reputation point.\r\n\r\nReason Given:\r\n[quote=\"" . $mybb->user['username'] . "\" dateline=\"" . time() . "\"]" . $reason . "[/quote]\r\n\r\nReputation comment:\r\n[quote=\"" . $giver['username'] . "\" dateline=\"" . $rep['dateline'] . "\"]" . $rep['comments'] . "[/quote]"; } } $new_thread = array("fid" => $mybb->settings['rtt_fid'], "prefix" => 0, "subject" => $title . $mybb->user['username'], "icon" => 0, "uid" => $mybb->user['uid'], "username" => $mybb->user['username'], "message" => $post_data, "ipaddress" => get_ip(), "posthash" => md5($mybb->user['uid'] . random_str())); $posthandler = new PostDataHandler("insert"); $posthandler->action = "thread"; $posthandler->set_data($new_thread); if ($posthandler->validate_thread()) { $thread_info = $posthandler->insert_thread(); } } }
function akismet_redirect_forum() { global $isspam, $url, $lang, $fid, $mybb; if ($isspam && $mybb->settings['akismetswitch'] == 1) { $lang->load("akismet", false, true); $url = get_forum_link($fid); error("<div align=\"center\">" . $lang->redirect_newthread . "<br /><br />" . $lang->sprintf($lang->redirect_return_forum, $url) . "</div>", $lang->akismet_error); } }
$modlogresults = ''; while ($logitem = $db->fetch_array($query)) { $information = ''; $logitem['action'] = htmlspecialchars_uni($logitem['action']); $log_date = my_date('relative', $logitem['dateline']); $trow = alt_trow(); $username = format_name($logitem['username'], $logitem['usergroup'], $logitem['displaygroup']); $logitem['profilelink'] = build_profile_link($username, $logitem['uid']); $logitem['ipaddress'] = my_inet_ntop($db->unescape_binary($logitem['ipaddress'])); if ($logitem['tsubject']) { $logitem['tsubject'] = htmlspecialchars_uni($logitem['tsubject']); $logitem['thread'] = get_thread_link($logitem['tid']); eval("\$information .= \"" . $templates->get("modcp_modlogs_result_thread") . "\";"); } if ($logitem['fname']) { $logitem['forum'] = get_forum_link($logitem['fid']); eval("\$information .= \"" . $templates->get("modcp_modlogs_result_forum") . "\";"); } if ($logitem['psubject']) { $logitem['psubject'] = htmlspecialchars_uni($logitem['psubject']); $logitem['post'] = get_post_link($logitem['pid']); eval("\$information .= \"" . $templates->get("modcp_modlogs_result_post") . "\";"); } // Edited a user or managed announcement? if (!$logitem['tsubject'] || !$logitem['fname'] || !$logitem['psubject']) { $data = my_unserialize($logitem['data']); if ($data['uid']) { $information = $lang->sprintf($lang->edited_user_info, htmlspecialchars_uni($data['username']), get_profile_link($data['uid'])); } if ($data['aid']) { $data['subject'] = htmlspecialchars_uni($data['subject']);
/** * Builds a friendly named Who's Online location from an "activity" and array of user data. Assumes fetch_wol_activity has already been called. * * @param array Array containing activity and essential IDs. * @return string Location name for the activity being performed. */ function build_friendly_wol_location($user_activity) { 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(); $inactiveforums = get_inactive_forums(); $fidnot = ''; $unviewablefids = $inactivefids = array(); if ($unviewableforums) { $fidnot = " AND fid NOT IN ({$unviewableforums})"; $unviewablefids = explode(',', $unviewableforums); } if ($inactiveforums) { $fidnot .= " AND fid NOT IN ({$inactiveforums})"; $inactivefids = explode(',', $inactiveforums); } // Fetch any users if (!is_array($usernames) && count($uid_list) > 0) { $uid_sql = implode(",", $uid_list); if ($uid_sql != $mybb->user['uid']) { $query = $db->simple_select("users", "uid,username", "uid IN ({$uid_sql})"); while ($user = $db->fetch_array($query)) { $usernames[$user['uid']] = $user['username']; } } else { $usernames[$mybb->user['uid']] = $mybb->user['username']; } } // Fetch any attachments if (!is_array($attachments) && count($aid_list) > 0) { $aid_sql = implode(",", $aid_list); $query = $db->simple_select("attachments", "aid,pid", "aid IN ({$aid_sql})"); while ($attachment = $db->fetch_array($query)) { $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 if (!is_array($posts) && count($pid_list) > 0) { $pid_sql = implode(",", $pid_list); $query = $db->simple_select("posts", "pid,tid", "pid IN ({$pid_sql}) {$fidnot}"); while ($post = $db->fetch_array($query)) { $posts[$post['pid']] = $post['tid']; $tid_list[] = $post['tid']; } } // Fetch any threads if (!is_array($threads) && count($tid_list) > 0) { $perms = array(); $tid_sql = implode(",", $tid_list); $query = $db->simple_select('threads', 'uid, fid, tid, subject, visible, prefix', "tid IN({$tid_sql}) {$fidnot}"); $threadprefixes = build_prefixes(); while ($thread = $db->fetch_array($query)) { $thread['threadprefix'] = ''; if ($thread['prefix'] && !empty($threadprefixes[$thread['prefix']])) { $thread['threadprefix'] = $threadprefixes[$thread['prefix']]['displaystyle']; } if (empty($perms[$thread['fid']])) { $perms[$thread['fid']] = forum_permissions($thread['fid']); } if (isset($perms[$thread['fid']]['canonlyviewownthreads']) && $perms[$thread['fid']]['canonlyviewownthreads'] == 1 && $thread['uid'] != $mybb->user['uid'] && !is_moderator($thread['fid'])) { continue; } if (is_moderator($thread['fid']) || $thread['visible'] == 1) { $thread_title = ''; if ($thread['threadprefix']) { $thread_title = $thread['threadprefix'] . ' '; } $thread_title .= htmlspecialchars_uni($parser->parse_badwords($thread['subject'])); $threads[$thread['tid']] = $thread_title; $fid_list[] = $thread['fid']; } } } // Fetch any forums if (!is_array($forums) && count($fid_list) > 0) { $fidnot = array_merge($unviewablefids, $inactivefids); foreach ($forum_cache as $fid => $forum) { if (in_array($fid, $fid_list) && !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) { $eid_sql = implode(",", $eid_list); $query = $db->simple_select("events", "eid,name", "eid IN ({$eid_sql})"); while ($event = $db->fetch_array($query)) { $events[$event['eid']] = htmlspecialchars_uni($parser->parse_badwords($event['name'])); } } // Now we've got everything we need we can put a name to the location switch ($user_activity['activity']) { // announcement.php functions case "announcements": if (!empty($announcements[$user_activity['ann']])) { $location_name = $lang->sprintf($lang->viewing_announcements, get_announcement_link($user_activity['ann']), $announcements[$user_activity['ann']]); } else { $location_name = $lang->viewing_announcements2; } break; // attachment.php actions // attachment.php actions case "attachment": $pid = $attachments[$user_activity['aid']]; $tid = $posts[$pid]; if (!empty($threads[$tid])) { $location_name = $lang->sprintf($lang->viewing_attachment2, $user_activity['aid'], $threads[$tid], get_thread_link($tid)); } else { $location_name = $lang->viewing_attachment; } break; // calendar.php functions // calendar.php functions case "calendar": $location_name = $lang->viewing_calendar; break; case "calendar_event": if (!empty($events[$user_activity['eid']])) { $location_name = $lang->sprintf($lang->viewing_event2, get_event_link($user_activity['eid']), $events[$user_activity['eid']]); } else { $location_name = $lang->viewing_event; } break; case "calendar_addevent": $location_name = $lang->adding_event; break; case "calendar_editevent": $location_name = $lang->editing_event; break; case "contact": $location_name = $lang->viewing_contact_us; break; // editpost.php functions // editpost.php functions case "editpost": $location_name = $lang->editing_post; break; // forumdisplay.php functions // forumdisplay.php functions case "forumdisplay": if (!empty($forums[$user_activity['fid']])) { if ($forums_linkto[$user_activity['fid']]) { $location_name = $lang->sprintf($lang->forum_redirect_to, get_forum_link($user_activity['fid']), $forums[$user_activity['fid']]); } else { $location_name = $lang->sprintf($lang->viewing_forum2, get_forum_link($user_activity['fid']), $forums[$user_activity['fid']]); } } else { $location_name = $lang->viewing_forum; } break; // index.php functions // index.php functions case "index": $location_name = $lang->sprintf($lang->viewing_index, $mybb->settings['bbname']); break; // managegroup.php functions // managegroup.php functions case "managegroup": $location_name = $lang->managing_group; break; // member.php functions // member.php functions case "member_activate": $location_name = $lang->activating_account; break; case "member_profile": if (!empty($usernames[$user_activity['uid']])) { $location_name = $lang->sprintf($lang->viewing_profile2, get_profile_link($user_activity['uid']), $usernames[$user_activity['uid']]); } else { $location_name = $lang->viewing_profile; } break; case "member_register": $location_name = $lang->registering; break; case "member": case "member_login": // Guest or member? if ($mybb->user['uid'] == 0) { $location_name = $lang->logging_in; } else { $location_name = $lang->logging_in_plain; } break; case "member_logout": $location_name = $lang->logging_out; break; case "member_emailuser": $location_name = $lang->emailing_user; break; case "member_rate": $location_name = $lang->rating_user; break; case "member_resendactivation": $location_name = $lang->member_resendactivation; break; case "member_lostpw": $location_name = $lang->member_lostpw; break; // memberlist.php functions // memberlist.php functions case "memberlist": $location_name = $lang->viewing_memberlist; break; // misc.php functions // misc.php functions case "misc_dstswitch": $location_name = $lang->changing_dst; break; case "misc_whoposted": if (!empty($threads[$user_activity['tid']])) { $location_name = $lang->sprintf($lang->viewing_whoposted2, get_thread_link($user_activity['tid']), $threads[$user_activity['tid']]); } else { $location_name = $lang->viewing_whoposted; } break; case "misc_markread": $location_name = $lang->sprintf($lang->marking_read, $mybb->post_code); break; case "misc_help": $location_name = $lang->viewing_helpdocs; break; case "misc_buddypopup": $location_name = $lang->viewing_buddylist; break; case "misc_smilies": $location_name = $lang->viewing_smilies; break; case "misc_syndication": $location_name = $lang->viewing_syndication; break; case "misc_imcenter": $location_name = $lang->viewing_imcenter; break; // modcp.php functions // modcp.php functions case "modcp_modlogs": $location_name = $lang->viewing_modlogs; break; case "modcp_announcements": $location_name = $lang->managing_announcements; break; case "modcp_finduser": $location_name = $lang->search_for_user; break; case "modcp_warninglogs": $location_name = $lang->managing_warninglogs; break; case "modcp_ipsearch": $location_name = $lang->searching_ips; break; case "modcp_report": $location_name = $lang->viewing_reports; break; case "modcp_new_announcement": $location_name = $lang->adding_announcement; break; case "modcp_delete_announcement": $location_name = $lang->deleting_announcement; break; case "modcp_edit_announcement": $location_name = $lang->editing_announcement; break; case "modcp_mod_queue": $location_name = $lang->managing_modqueue; break; case "modcp_editprofile": $location_name = $lang->editing_user_profiles; break; case "modcp_banning": $location_name = $lang->managing_bans; break; case "modcp": $location_name = $lang->viewing_modcp; break; // moderation.php functions // moderation.php functions case "moderation": $location_name = $lang->using_modtools; break; // newreply.php functions // newreply.php functions case "newreply": if (!empty($threads[$user_activity['tid']])) { $location_name = $lang->sprintf($lang->replying_thread2, get_thread_link($user_activity['tid']), $threads[$user_activity['tid']]); } else { $location_name = $lang->replying_thread; } break; // newthread.php functions // newthread.php functions case "newthread": if (!empty($forums[$user_activity['fid']])) { $location_name = $lang->sprintf($lang->posting_thread2, get_forum_link($user_activity['fid']), $forums[$user_activity['fid']]); } else { $location_name = $lang->posting_thread; } break; // online.php functions // online.php functions case "wol": $location_name = $lang->viewing_wol; break; case "woltoday": $location_name = $lang->viewing_woltoday; break; // polls.php functions // polls.php functions case "newpoll": $location_name = $lang->creating_poll; break; case "editpoll": $location_name = $lang->editing_poll; break; case "showresults": $location_name = $lang->viewing_pollresults; break; case "vote": $location_name = $lang->voting_poll; break; // printthread.php functions // printthread.php functions case "printthread": if (!empty($threads[$user_activity['tid']])) { $location_name = $lang->sprintf($lang->printing_thread2, get_thread_link($user_activity['tid']), $threads[$user_activity['tid']]); } else { $location_name = $lang->printing_thread; } break; // private.php functions // private.php functions case "private_send": $location_name = $lang->sending_pm; break; case "private_read": $location_name = $lang->reading_pm; break; case "private_folders": $location_name = $lang->editing_pmfolders; break; case "private": $location_name = $lang->using_pmsystem; break; /* Ratethread functions */ /* Ratethread functions */ case "ratethread": $location_name = $lang->rating_thread; break; // report.php functions // report.php functions case "report": $location_name = $lang->reporting_post; break; // reputation.php functions // reputation.php functions case "reputation": $location_name = $lang->sprintf($lang->giving_reputation, get_profile_link($user_activity['uid']), $usernames[$user_activity['uid']]); break; case "reputation_report": if (!empty($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 // search.php functions case "search": $location_name = $lang->sprintf($lang->searching_forum, $mybb->settings['bbname']); break; // showthread.php functions // showthread.php functions case "showthread": if (!empty($threads[$user_activity['tid']])) { $pagenote = ''; $location_name = $lang->sprintf($lang->reading_thread2, get_thread_link($user_activity['tid']), $threads[$user_activity['tid']], $pagenote); } else { $location_name = $lang->reading_thread; } break; case "showpost": if (!empty($posts[$user_activity['pid']]) && !empty($threads[$posts[$user_activity['pid']]])) { $pagenote = ''; $location_name = $lang->sprintf($lang->reading_thread2, get_thread_link($posts[$user_activity['pid']]), $threads[$posts[$user_activity['pid']]], $pagenote); } else { $location_name = $lang->reading_thread; } break; // showteam.php functions // showteam.php functions case "showteam": $location_name = $lang->viewing_team; break; // stats.php functions // stats.php functions case "stats": $location_name = $lang->viewing_stats; break; // usercp.php functions // usercp.php functions case "usercp_profile": $location_name = $lang->updating_profile; break; case "usercp_editlists": $location_name = $lang->managing_buddyignorelist; break; case "usercp_options": $location_name = $lang->updating_options; break; case "usercp_editsig": $location_name = $lang->editing_signature; break; case "usercp_avatar": $location_name = $lang->changing_avatar; break; case "usercp_subscriptions": $location_name = $lang->viewing_subscriptions; break; case "usercp_favorites": $location_name = $lang->viewing_favorites; break; case "usercp_notepad": $location_name = $lang->editing_pad; break; case "usercp_password": $location_name = $lang->editing_password; break; case "usercp": $location_name = $lang->user_cp; break; case "usercp2_favorites": $location_name = $lang->managing_favorites; break; case "usercp2_subscriptions": $location_name = $lang->managing_subscriptions; break; case "portal": $location_name = $lang->viewing_portal; break; // sendthread.php functions // sendthread.php functions case "sendthread": $location_name = $lang->sending_thread; break; // warnings.php functions // warnings.php functions case "warnings_revoke": $location_name = $lang->revoking_warning; break; case "warnings_warn": $location_name = $lang->warning_user; break; case "warnings_view": $location_name = $lang->viewing_warning; break; case "warnings": $location_name = $lang->managing_warnings; break; } $plugin_array = array('user_activity' => &$user_activity, 'location_name' => &$location_name); $plugins->run_hooks("build_friendly_wol_location_end", $plugin_array); if (isset($user_activity['nopermission']) && $user_activity['nopermission'] == 1) { $location_name = $lang->viewing_noperms; } if (!$location_name) { $location_name = $lang->sprintf($lang->unknown_location, $user_activity['location']); } return $location_name; }
function bb_repermalink() { global $page; $location = bb_get_location(); $uri = $_SERVER['REQUEST_URI']; if (isset($_GET['id'])) { $id = $_GET['id']; } else { $id = bb_get_path(); } $_original_id = $id; do_action('pre_permalink', $id); $id = apply_filters('bb_repermalink', $id); switch ($location) { case 'front-page': $path = null; $querystring = null; if ($page > 1) { if (bb_get_option('mod_rewrite')) { $path = 'page/' . $page; } else { $querystring = array('page' => $page); } } $permalink = bb_get_uri($path, $querystring, BB_URI_CONTEXT_HEADER); $issue_404 = true; break; case 'forum-page': if (empty($id)) { $permalink = bb_get_uri(null, null, BB_URI_CONTEXT_HEADER); break; } global $forum_id, $forum; $forum = bb_get_forum($id); $forum_id = $forum->forum_id; $permalink = get_forum_link($forum->forum_id, $page); break; case 'topic-edit-page': case 'topic-page': if (empty($id)) { $permalink = bb_get_uri(null, null, BB_URI_CONTEXT_HEADER); break; } global $topic_id, $topic; $topic = get_topic($id); $topic_id = $topic->topic_id; $permalink = get_topic_link($topic->topic_id, $page); break; case 'profile-page': // This handles the admin side of the profile as well. global $user_id, $user, $profile_hooks, $self; if (isset($_GET['id'])) { $id = $_GET['id']; } elseif (isset($_GET['username'])) { $id = $_GET['username']; } else { $id = bb_get_path(); } $_original_id = $id; if (!$id) { $user = bb_get_current_user(); // Attempt to go to the current users profile } else { if (bb_get_option('mod_rewrite') === 'slugs') { if (!($user = bb_get_user_by_nicename($id))) { $user = bb_get_user($id); } } else { if (!($user = bb_get_user($id))) { $user = bb_get_user_by_nicename($id); } } } if (!$user || 1 == $user->user_status && !bb_current_user_can('moderate')) { bb_die(__('User not found.'), '', 404); } $user_id = $user->ID; bb_global_profile_menu_structure(); $valid = false; if ($tab = isset($_GET['tab']) ? $_GET['tab'] : bb_get_path(2)) { foreach ($profile_hooks as $valid_tab => $valid_file) { if ($tab == $valid_tab) { $valid = true; $self = $valid_file; } } } if ($valid) { $permalink = get_profile_tab_link($user->ID, $tab, $page); } else { $permalink = get_user_profile_link($user->ID, $page); unset($self, $tab); } break; case 'favorites-page': $permalink = get_favorites_link(); break; case 'tag-page': // It's not an integer and tags.php pulls double duty. $id = isset($_GET['tag']) ? $_GET['tag'] : false; if (!$id || !bb_get_tag((string) $id)) { $permalink = bb_get_tag_page_link(); } else { global $tag, $tag_name; $tag_name = $id; $tag = bb_get_tag((string) $id); $permalink = bb_get_tag_link(0, $page); // 0 => grabs $tag from global. } break; case 'view-page': // Not an integer if (isset($_GET['view'])) { $id = $_GET['view']; } else { $id = bb_get_path(); } $_original_id = $id; global $view; $view = $id; $permalink = get_view_link($view, $page); break; default: return; break; } nxt_parse_str($_SERVER['QUERY_STRING'], $args); $args = urlencode_deep($args); if ($args) { $permalink = add_query_arg($args, $permalink); if (bb_get_option('mod_rewrite')) { $pretty_args = array('id', 'page', 'tag', 'tab', 'username'); // these are already specified in the path if ($location == 'view-page') { $pretty_args[] = 'view'; } foreach ($pretty_args as $pretty_arg) { $permalink = remove_query_arg($pretty_arg, $permalink); } } } $permalink = apply_filters('bb_repermalink_result', $permalink, $location); $domain = bb_get_option('domain'); $domain = preg_replace('/^https?/', '', $domain); $check = preg_replace('|^.*' . trim($domain, ' /') . '|', '', $permalink, 1); $uri = rtrim($uri, " \t\n\r\v?"); $uri = str_replace('/index.php', '/', $uri); global $bb_log; $bb_log->debug($uri, 'bb_repermalink() ' . __('REQUEST_URI')); $bb_log->debug($check, 'bb_repermalink() ' . __('should be')); $bb_log->debug($permalink, 'bb_repermalink() ' . __('full permalink')); $bb_log->debug(isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : null, 'bb_repermalink() ' . __('PATH_INFO')); if ($check != $uri && $check != str_replace(urlencode($_original_id), $_original_id, $uri)) { if ($issue_404 && rtrim($check, " \t\n\r\v/") !== rtrim($uri, " \t\n\r\v/")) { status_header(404); bb_load_template('404.php'); } else { nxt_redirect($permalink); } exit; } do_action('post_permalink', $permalink); }
$useronly = ""; if ($forumpermissions['canonlyviewownthreads'] == 1) { $useronly = "AND uid={$mybb->user['uid']}"; } // Paginate this forum $query = $db->simple_select("threads", "COUNT(tid) AS threads", "fid='{$id}' AND visible='1' {$useronly}"); $threadcount = $db->fetch_field($query, "threads"); // Build the navigation build_forum_breadcrumb($forum['fid'], 1); // No threads and not a category? Error! if (($threadcount < 1 || $forumpermissions['canviewthreads'] != 1) && $forum['type'] != 'c') { archive_header(strip_tags($forum['name']), $forum['name'], $mybb->settings['bburl'] . "/" . get_forum_link($id, $page) . ""); archive_error($lang->error_nothreads); } // Build the archive header. archive_header(strip_tags($forum['name']), $forum['name'], $mybb->settings['bburl'] . "/" . get_forum_link($id, $page), 1); $plugins->run_hooks("archive_forum_start"); if (!$mybb->settings['threadsperpage'] || (int) $mybb->settings['threadsperpage'] < 1) { $mybb->settings['threadsperpage'] = 20; } $perpage = $mybb->settings['threadsperpage']; $pages = ceil($threadcount / $perpage); if ($page > $pages) { $page = 1; } if ($page > 0) { $start = ($page - 1) * $perpage; } else { $start = 0; $page = 1; }
/** * bb_get_new_topic_link() - Get the link to the form for a new topic * * @since 1.0 * @param mixed The arguments for this function. * @return string The link to the new topic form */ function bb_get_new_topic_link($args = null) { $defaults = array('text' => __('Add New »'), 'forum' => 0, 'tag' => ''); if ($args && is_string($args) && false === strpos($args, '=')) { $args = array('text' => $args); } $args = wp_parse_args($args, $defaults); extract($args, EXTR_SKIP); if ($forum && ($forum = bb_get_forum($forum))) { $url = get_forum_link($forum->forum_id) . '#postform'; } elseif ($tag && ($tag = bb_get_tag($tag))) { $url = bb_get_tag_link($tag->tag) . '#postform'; } elseif (bb_is_forum()) { global $forum; $url = get_forum_link($forum->forum_id) . '#postform'; } elseif (bb_is_tag()) { global $tag; $url = bb_get_tag_link($tag) . '#postform'; } elseif (bb_is_topic()) { $url = get_forum_link() . '#postform'; } elseif (bb_is_front()) { $url = bb_get_uri(null, array('new' => 1)); } if (!bb_is_user_logged_in()) { $url = bb_get_uri('bb-login.php', array('re' => $url), BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_USER_FORMS); } elseif (bb_is_forum() || bb_is_topic()) { if (!bb_current_user_can('write_topic', get_forum_id())) { return; } } else { if (!bb_current_user_can('write_topics')) { return; } } if ($url = esc_attr(apply_filters('new_topic_url', $url, $args))) { return '<a href="' . $url . '" class="new-topic">' . $text . '</a>' . "\n"; } }
$groups_in = implode(",", array_keys($usergroups)); $users_in = implode(",", array_keys($moderators)); if (!$groups_in) { $groups_in = 0; } if (!$users_in) { $users_in = 0; } $forum_permissions = forum_permissions(); $query = $db->simple_select("users", "uid, username, displaygroup, usergroup, ignorelist, hideemail, receivepms", "displaygroup IN ({$groups_in}) OR (displaygroup='0' AND usergroup IN ({$groups_in})) OR uid IN ({$users_in})", array('order_by' => 'username')); while ($user = $db->fetch_array($query)) { // If this user is a moderator if (isset($moderators[$user['uid']])) { foreach ($moderators[$user['uid']] as $forum) { if ($forum_permissions[$forum['fid']]['canview'] == 1) { $forum_url = get_forum_link($forum['fid']); eval("\$forumlist .= \"" . $templates->get("showteam_moderators_forum") . "\";"); } } $user['forumlist'] = $forumlist; $forumlist = ''; $usergroups[6]['user_list'][$user['uid']] = $user; } if ($user['displaygroup'] == '6' || $user['usergroup'] == '6') { $usergroups[6]['user_list'][$user['uid']] = $user; } // Are they also in another group which is being shown on the list? if ($user['displaygroup'] != 0) { $group = $user['displaygroup']; } else { $group = $user['usergroup'];
} $interval = (int) $mybb->settings['statscachetime'] * 60860; if (!$statistics || TIME_NOW - $interval > $statistics['time'] || $mybb->settings['statscachetime'] == 0) { $cache->update_statistics(); $statistics = $cache->read('statistics'); } // Top forum $query = $db->simple_select('forums', 'fid, name, threads, posts', "type='f'{$fidnot}", array('order_by' => 'posts', 'order_dir' => 'DESC', 'limit' => 1)); $forum = $db->fetch_array($query); if (empty($forum['fid'])) { $topforum = $lang->none; $topforumposts = $lang->no; $topforumthreads = $lang->no; } else { $forum['name'] = htmlspecialchars_uni(strip_tags($forum['name'])); $topforum = '<a href="' . get_forum_link($forum['fid']) . "\">{$forum['name']}</a>"; $topforumposts = $forum['posts']; $topforumthreads = $forum['threads']; } // Top referrer defined for the templates even if we don't use it $top_referrer = ''; if ($mybb->settings['statstopreferrer'] == 1 && isset($statistics['top_referrer']['uid'])) { // Only show this if we have anything more the 0 referrals if ($statistics['top_referrer']['referrals'] > 0) { $toprefuser = build_profile_link($statistics['top_referrer']['username'], $statistics['top_referrer']['uid']); $top_referrer = $lang->sprintf($lang->top_referrer, $toprefuser, my_number_format($statistics['top_referrer']['referrals'])); } } // Today's top poster if (!isset($statistics['top_poster']['uid'])) { $topposter = $lang->nobody;
function ps_GetNewestPosts($NumOfRows, $feed = false) { global $mybb, $db, $templates, $theme, $lang, $unviewables, $under_mod_forums_arr, $vcheck, $parser, $lightbulb, $trow, $newestposts_cols_name, $newestposts_cols, $colspan, $feeditem; if (!is_object($parser)) { require_once MYBB_ROOT . 'inc/class_parser.php'; $parser = new postParser(); } $query = $db->query("\n\t\tSELECT t.subject,t.username,t.uid,t.tid,t.fid,t.lastpost,t.lastposter,t.lastposteruid,t.replies,t.visible,tr.uid AS truid,tr.dateline,tp.displaystyle AS styledprefix,f.name \n\t\tFROM " . TABLE_PREFIX . "threads t \n\t\tLEFT JOIN " . TABLE_PREFIX . "threadsread tr ON (tr.tid=t.tid AND tr.uid='" . $mybb->user['uid'] . "') \n\t\tLEFT JOIN " . TABLE_PREFIX . "threadprefixes tp ON (tp.pid = t.prefix) \n\t\tLEFT JOIN " . TABLE_PREFIX . "forums f ON (f.fid = t.fid) \n\t\tWHERE (t.visible = '1' " . $vcheck . ") \n\t\t" . $unviewables['string'] . " \n\t\tAND t.closed NOT LIKE 'moved|%' \n\t\tAND t.visible != '-2' \n\t\tAND f.active = '1' \n\t\tORDER BY t.lastpost DESC \n\t\tLIMIT 0," . $NumOfRows); $newestposts_cols_name = ""; $newestposts_cols = ""; $colspan = 0; $active_cells = ""; $latest_posts_cells_arr = escaped_explode(",", htmlspecialchars_uni($mybb->settings['ps_latest_posts_cells']), 20); foreach ($latest_posts_cells_arr as $latest_posts_cell) { ++$colspan; switch ($latest_posts_cell) { case "Latest_posts": $active_cells['Latest_posts'] = 1; eval("\$newestposts_cols_name .= \"" . $templates->get("prostats_newestposts_head_latest_posts") . "\";"); $cell_order[$colspan] = 'Latest_posts'; break; case "Date": $active_cells['Date'] = 1; eval("\$newestposts_cols_name .= \"" . $templates->get("prostats_newestposts_head_date") . "\";"); $cell_order[$colspan] = 'Date'; break; case "Starter": $active_cells['Starter'] = 1; eval("\$newestposts_cols_name .= \"" . $templates->get("prostats_newestposts_head_starter") . "\";"); $cell_order[$colspan] = 'Starter'; break; case "Last_sender": $active_cells['Last_sender'] = 1; eval("\$newestposts_cols_name .= \"" . $templates->get("prostats_newestposts_head_last_sender") . "\";"); $cell_order[$colspan] = 'Last_sender'; break; case "Forum": $active_cells['Forum'] = 1; eval("\$newestposts_cols_name .= \"" . $templates->get("prostats_newestposts_head_forum") . "\";"); $cell_order[$colspan] = 'Forum'; break; default: --$colspan; } } $trow = "trow1"; $loop_counter = 0; while ($newest_threads = $db->fetch_array($query)) { $tid = $newest_threads['tid']; $fuid = $newest_threads['uid']; $fid = $newest_threads['fid']; $lightbulb['folder'] = "off"; $newestposts_cols = ""; $plainprefix = ""; $styledprefix = ""; $highlight = ps_GetHighlight($newest_threads); if ($newest_threads['styledprefix'] && $mybb->settings['ps_latest_posts_prefix']) { $plainprefix = strip_tags($newest_threads['styledprefix']) . ' '; $styledprefix = $newest_threads['styledprefix'] . ' '; } if ($mybb->user['uid']) { if ($newest_threads['dateline'] && $newest_threads['truid'] == $mybb->user['uid']) { if ($newest_threads['lastpost'] > $newest_threads['dateline']) { $lightbulb['folder'] = "on"; } } else { if ($newest_threads['lastpost'] > $mybb->user['lastvisit']) { $lightbulb['folder'] = "on"; } } } $dateformat = $mybb->settings['ps_date_format']; if ($active_cells['Date']) { $isty = ps_GetTY($mybb->settings['ps_date_format_ty'], $newest_threads['lastpost'], $offset = "", $ty = 1); if ($isty) { // Relative Time: if (TIME_NOW - $newest_threads['lastpost'] < 43200) { $datetime = my_date('relative', $newest_threads['lastpost'], NULL, 1); } else { $dateformat = preg_replace('#' . $mybb->settings['ps_date_format_ty'] . '#', "vvv", $dateformat); $datetime = my_date($dateformat, $newest_threads['lastpost'], NULL, 1); $datetime = preg_replace('#vvv#', $isty, $datetime); } } else { $datetime = my_date($dateformat, $newest_threads['lastpost'], NULL, 1); } } if ($active_cells['Latest_posts']) { $parsed_subject = $parser->parse_badwords($newest_threads['subject']); $subject = htmlspecialchars_uni(ps_SubjectLength($plainprefix . $parsed_subject)); $subject = $styledprefix . my_substr($subject, my_strlen($plainprefix)); $subject_long = $plainprefix . htmlspecialchars_uni($parsed_subject); $threadlink = $mybb->settings['bburl'] . '/' . get_thread_link($tid, NULL, "lastpost"); eval("\$readstate_icon = \"" . $templates->get("prostats_readstate_icon") . "\";"); eval("\$newestposts_specialchar = \"" . $templates->get("prostats_newestposts_specialchar") . "\";"); } if ($active_cells['Starter']) { $username = ps_FormatNameDb($fuid, htmlspecialchars_uni($newest_threads['username'])); $profilelink = $mybb->settings['bburl'] . '/' . get_profile_link($fuid); } if ($active_cells['Last_sender']) { $lastposter_uname = ps_FormatNameDb($newest_threads['lastposteruid'], htmlspecialchars_uni($newest_threads['lastposter'])); $lastposter_profile = $mybb->settings['bburl'] . '/' . get_profile_link($newest_threads['lastposteruid']); } if ($active_cells['Forum']) { $forumlink = get_forum_link($fid); $forumname_long = $parser->parse_badwords(strip_tags($newest_threads['name'])); $forumname = htmlspecialchars_uni(ps_SubjectLength($forumname_long, NULL, true)); } for ($i = 1; $i <= $colspan; ++$i) { switch ($cell_order[$i]) { case "Latest_posts": eval("\$newestposts_cols .= \"" . $templates->get("prostats_newestposts_latest_posts") . "\";"); break; case "Date": eval("\$newestposts_cols .= \"" . $templates->get("prostats_newestposts_date") . "\";"); break; case "Starter": eval("\$newestposts_cols .= \"" . $templates->get("prostats_newestposts_starter") . "\";"); break; case "Last_sender": eval("\$newestposts_cols .= \"" . $templates->get("prostats_newestposts_last_sender") . "\";"); break; case "Forum": eval("\$newestposts_cols .= \"" . $templates->get("prostats_newestposts_forum") . "\";"); break; default: NULL; } } eval("\$newestposts_row .= \"" . $templates->get("prostats_newestposts_row") . "\";"); if ($feed) { $feeditem[$loop_counter]['tid'] = $tid; $feeditem[$loop_counter]['fuid'] = $fuid; $feeditem[$loop_counter]['fid'] = $fid; $feeditem[$loop_counter]['bulb'] = $lightbulb['folder']; $feeditem[$loop_counter]['lasttime'] = $newest_threads['lastpost']; $feeditem[$loop_counter]['datetime'] = $datetime; if ($active_cells['Latest_posts']) { $feeditem[$loop_counter]['subject'] = $subject; $feeditem[$loop_counter]['subject_long'] = $subject_long; } if ($active_cells['Starter']) { $feeditem[$loop_counter]['username'] = htmlspecialchars_uni($newest_threads['username']); $feeditem[$loop_counter]['username_formed'] = $username; } if ($active_cells['Last_sender']) { $feeditem[$loop_counter]['lastposter_uid'] = $newest_threads['lastposteruid']; $feeditem[$loop_counter]['lastposter_uname'] = htmlspecialchars_uni($newest_threads['lastposter']); $feeditem[$loop_counter]['lastposter_uname_formed'] = $lastposter_uname; } if ($active_cells['Forum']) { $feeditem[$loop_counter]['forumname'] = $forumname; $feeditem[$loop_counter]['forumname_long'] = $forumname_long; } } ++$loop_counter; } eval("\$newestposts = \"" . $templates->get("prostats_newestposts") . "\";"); return $newestposts; }
/** * Return members of the board with administrative function * Taken from /showteam.php * * @return array */ function getForumStaff() { $this->lang->load('showteam'); $usergroups = array(); $moderators = array(); $users = array(); // Fetch the list of groups which are to be shown on the page $query = $this->db->simple_select("usergroups", "gid, title, usertitle", "showforumteam=1", array('order_by' => 'disporder')); while ($usergroup = $this->db->fetch_array($query)) { $usergroups[$usergroup['gid']] = $usergroup; } if (empty($usergroups)) { return $this->lang->error_noteamstoshow; } // Fetch specific forum moderator details if ($usergroups[6]['gid']) { $query = $this->db->query("\n\t\t\t\tSELECT m.*, f.name\n\t\t\t\tFROM " . TABLE_PREFIX . "moderators m\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid=m.uid)\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "forums f ON (f.fid=m.fid)\n\t\t\t\tWHERE f.active = 1\n\t\t\t\tORDER BY u.username\n\t\t\t"); while ($moderator = $this->db->fetch_array($query)) { $moderators[$moderator['uid']][] = $moderator; } } // Now query the users of those specific groups $groups_in = implode(",", array_keys($usergroups)); $users_in = implode(",", array_keys($moderators)); if (!$groups_in) { $groups_in = 0; } if (!$users_in) { $users_in = 0; } $forum_permissions = forum_permissions(); $query = $this->db->simple_select("users", "uid, username, displaygroup, usergroup, ignorelist, hideemail, receivepms", "displaygroup IN ({$groups_in}) OR (displaygroup='0' AND usergroup IN ({$groups_in})) OR uid IN ({$users_in})", array('order_by' => 'username')); while ($user = $this->db->fetch_array($query)) { // If this user is a moderator if (isset($moderators[$user['uid']])) { foreach ($moderators[$user['uid']] as $forum) { if ($forum_permissions[$forum['fid']]['canview'] == 1) { $forum_url = get_forum_link($forum['fid']); } } $usergroups[6]['user_list'][$user['uid']] = $user; } if ($user['displaygroup'] == '6' || $user['usergroup'] == '6') { $usergroups[6]['user_list'][$user['uid']] = $user; } // Are they also in another group which is being shown on the list? if ($user['displaygroup'] != 0) { $group = $user['displaygroup']; } else { $group = $user['usergroup']; } if ($usergroups[$group] && $group != 6) { $usergroups[$group]['user_list'][$user['uid']] = $user; } } return $usergroups; }
/** * Build the forum breadcrumb nagiation (the navigation to a specific forum including all parent forums) * * @param int The forum ID to build the navigation for * @param array The multipage drop down array of information */ function build_forum_breadcrumb($fid, $multipage = array()) { global $pforumcache, $currentitem, $forum_cache, $navbits, $lang, $base_url, $archiveurl; if (!$pforumcache) { if (!is_array($forum_cache)) { cache_forums(); } foreach ($forum_cache as $key => $val) { $pforumcache[$val['fid']][$val['pid']] = $val; } } if (is_array($pforumcache[$fid])) { foreach ($pforumcache[$fid] as $key => $forumnav) { if ($fid == $forumnav['fid']) { if (!empty($pforumcache[$forumnav['pid']])) { build_forum_breadcrumb($forumnav['pid']); } $navsize = count($navbits); // Convert & to & $navbits[$navsize]['name'] = preg_replace("#&(?!\\#[0-9]+;)#si", "&", $forumnav['name']); if (defined("IN_ARCHIVE")) { // Set up link to forum in breadcrumb. if ($pforumcache[$fid][$forumnav['pid']]['type'] == 'f' || $pforumcache[$fid][$forumnav['pid']]['type'] == 'c') { $navbits[$navsize]['url'] = "{$base_url}forum-" . $forumnav['fid'] . ".html"; } else { $navbits[$navsize]['url'] = $archiveurl . "/index.php"; } } elseif (!empty($multipage)) { $navbits[$navsize]['url'] = get_forum_link($forumnav['fid'], $multipage['current_page']); $navbits[$navsize]['multipage'] = $multipage; $navbits[$navsize]['multipage']['url'] = str_replace('{fid}', $forumnav['fid'], FORUM_URL_PAGED); } else { $navbits[$navsize]['url'] = get_forum_link($forumnav['fid']); } } } } return 1; }
} $sortsel['rating'] = ''; // Needs to be initialized in order to speed-up things. Fixes #2031 $sortsel[$mybb->input['sortby']] = ' selected="selected"'; // Pick the right string to join the sort URL if ($mybb->seo_support == true) { $string = "?"; } else { $string = "&"; } // Are we viewing a specific page? $mybb->input['page'] = $mybb->get_input('page', MyBB::INPUT_INT); if ($mybb->input['page'] > 1) { $sorturl = get_forum_link($fid, $mybb->input['page']) . $string . "datecut={$datecut}&prefix={$tprefix}"; } else { $sorturl = get_forum_link($fid) . $string . "datecut={$datecut}&prefix={$tprefix}"; } eval("\$orderarrow['{$sortby}'] = \"" . $templates->get("forumdisplay_orderarrow") . "\";"); $threadcount = 0; $useronly = $tuseronly = ""; if (isset($fpermissions['canonlyviewownthreads']) && $fpermissions['canonlyviewownthreads'] == 1) { $useronly = "AND uid={$mybb->user['uid']}"; $tuseronly = "AND t.uid={$mybb->user['uid']}"; } if ($fpermissions['canviewthreads'] != 0) { // How many posts are there? if ($datecut > 0 && $datecut != 9999 || isset($fpermissions['canonlyviewownthreads']) && $fpermissions['canonlyviewownthreads'] == 1) { $query = $db->simple_select("threads", "COUNT(tid) AS threads", "fid = '{$fid}' {$useronly} {$visibleonly} {$datecutsql} {$prefixsql}"); $threadcount = $db->fetch_field($query, "threads"); } else { $query = $db->simple_select("forums", "threads, unapprovedthreads, deletedthreads", "fid = '{$fid}'", array('limit' => 1));
$mybb->input['action'] = "editpost"; } else { $postinfo = $posthandler->update_post(); $visible = $postinfo['visible']; $first_post = $postinfo['first_post']; // Help keep our attachments table clean. $db->delete_query("attachments", "filename='' OR filesize<1"); // Did the user choose to post a poll? Redirect them to the poll posting page. if ($mybb->input['postpoll'] && $forumpermissions['canpostpolls']) { $url = "polls.php?action=newpoll&tid={$tid}&polloptions=" . intval($mybb->input['numpolloptions']); $lang->redirect_postedited = $lang->redirect_postedited_poll; } else { if ($visible == 0 && $first_post && !is_moderator($fid, "", $mybb->user['uid'])) { // Moderated post $lang->redirect_postedited .= $lang->redirect_thread_moderation; $url = get_forum_link($fid); } else { if ($visible == 0 && !is_moderator($fid, "", $mybb->user['uid'])) { $lang->redirect_postedited .= $lang->redirect_post_moderation; $url = get_thread_link($tid); } else { $lang->redirect_postedited .= $lang->redirect_postedited_redirect; $url = get_post_link($pid, $tid) . "#pid{$pid}"; } } } $plugins->run_hooks("editpost_do_editpost_end"); redirect($url, $lang->redirect_postedited); } } if (!$mybb->input['action'] || $mybb->input['action'] == "editpost") {
$form = new Form("index.php?module=forum/moderation_queue", "post"); $table = new Table(); $table->construct_header($lang->subject); $table->construct_header($lang->author, array("class" => "align_center", "width" => "20%")); $table->construct_header($lang->posted, array("class" => "align_center", "width" => "20%")); $query = $db->query("\n\t\t\tSELECT p.pid, p.subject, p.message, t.subject AS threadsubject, t.tid, u.username, p.uid, t.fid\n\t\t\tFROM " . TABLE_PREFIX . "posts p\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "threads t ON (t.tid=p.tid)\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid=p.uid)\n\t\t\tWHERE p.visible='0' AND t.firstpost != p.pid\n\t\t\tORDER BY p.dateline DESC\n\t\t\tLIMIT {$start}, {$per_page}\n\t\t"); while ($post = $db->fetch_array($query)) { $altbg = alt_trow(); $post['threadsubject'] = htmlspecialchars_uni($post['threadsubject']); $post['subject'] = htmlspecialchars_uni($post['subject']); if (!$post['subject']) { $post['subject'] = $lang->re . " " . $post['threadsubject']; } $post['postlink'] = get_post_link($post['pid'], $post['tid']); $post['threadlink'] = get_thread_link($post['tid']); $post['forumlink'] = get_forum_link($post['fid']); $forum_name = $forum_cache[$post['fid']]['name']; $postdate = my_date($mybb->settings['dateformat'], $post['dateline']); $posttime = my_date($mybb->settings['timeformat'], $post['dateline']); $profile_link = build_profile_link($post['username'], $post['uid']); $post['message'] = nl2br(htmlspecialchars_uni($post['message'])); $table->construct_cell("<a href=\"../{$post['postlink']}#pid{$post['pid']}\">{$post['subject']}</a>"); $table->construct_cell($profile_link, array("class" => "align_center")); $table->construct_cell("{$postdate}, {$posttime}", array("class" => "align_center")); $table->construct_row(); $controls = "<div class=\"modqueue_controls\">\n"; $controls .= $form->generate_radio_button("posts[{$post['pid']}]", "ignore", $lang->ignore, array('class' => 'radio_ignore', 'checked' => true)) . " "; $controls .= $form->generate_radio_button("posts[{$post['pid']}]", "delete", $lang->delete, array('class' => 'radio_delete', 'checked' => false)) . " "; $controls .= $form->generate_radio_button("posts[{$post['pid']}]", "approve", $lang->approve, array('class' => 'radio_approve', 'checked' => false)); $controls .= "</div>"; $thread = "<strong>{$lang->thread} <a href=\"../{$post['threadlink']}\">{$post['threadsubject']}</a></strong>";
/** * Build a list of forum bits. * * @param int The parent forum to fetch the child forums for (0 assumes all) * @param int The depth to return forums with. * @return array Array of information regarding the child forums of this parent forum */ function build_forumbits($pid = 0, $depth = 1) { global $fcache, $moderatorcache, $forumpermissions, $theme, $mybb, $templates, $bgcolor, $collapsed, $lang, $showdepth, $plugins, $parser, $forum_viewers; $forum_listing = ''; // If no forums exist with this parent, do nothing if (!is_array($fcache[$pid])) { return; } // Foreach of the forums in this parent foreach ($fcache[$pid] as $parent) { foreach ($parent as $forum) { $forums = $subforums = $sub_forums = ''; $lastpost_data = ''; $counters = ''; $forum_viewers_text = ''; $forum_viewers_text_plain = ''; // Get the permissions for this forum $permissions = $forumpermissions[$forum['fid']]; // If this user doesnt have permission to view this forum and we're hiding private forums, skip this forum if ($permissions['canview'] != 1 && $mybb->settings['hideprivateforums'] == 1) { continue; } $plugins->run_hooks_by_ref("build_forumbits_forum", $forum); // Build the link to this forum $forum_url = get_forum_link($forum['fid']); // This forum has a password, and the user isn't authenticated with it - hide post information $hideinfo = false; $showlockicon = 0; if ($permissions['canviewthreads'] != 1) { $hideinfo = true; } if ($forum['password'] != '' && $mybb->cookies['forumpass'][$forum['fid']] != md5($mybb->user['uid'] . $forum['password'])) { $hideinfo = true; $showlockicon = 1; } $lastpost_data = array("lastpost" => $forum['lastpost'], "lastpostsubject" => $forum['lastpostsubject'], "lastposter" => $forum['lastposter'], "lastposttid" => $forum['lastposttid'], "lastposteruid" => $forum['lastposteruid']); // Fetch subforums of this forum if (isset($fcache[$forum['fid']])) { $forum_info = build_forumbits($forum['fid'], $depth + 1); // Increment forum counters with counters from child forums $forum['threads'] += $forum_info['counters']['threads']; $forum['posts'] += $forum_info['counters']['posts']; $forum['unapprovedthreads'] += $forum_info['counters']['unapprovedthreads']; $forum['unapprovedposts'] += $forum_info['counters']['unapprovedposts']; $forum['viewers'] += $forum_info['counters']['viewing']; // If the child forums' lastpost is greater than the one for this forum, set it as the child forums greatest. if ($forum_info['lastpost']['lastpost'] > $lastpost_data['lastpost']) { $lastpost_data = $forum_info['lastpost']; } $sub_forums = $forum_info['forum_list']; } // If we are hiding information (lastpost) because we aren't authenticated against the password for this forum, remove them if ($hideinfo == true) { unset($lastpost_data); } // If the current forums lastpost is greater than other child forums of the current parent, overwrite it if ($lastpost_data['lastpost'] > $parent_lastpost['lastpost']) { $parent_lastpost = $lastpost_data; } if (is_array($forum_viewers) && $forum_viewers[$forum['fid']] > 0) { $forum['viewers'] = $forum_viewers[$forum['fid']]; } // Increment the counters for the parent forum (returned later) if ($hideinfo != true) { $parent_counters['threads'] += $forum['threads']; $parent_counters['posts'] += $forum['posts']; $parent_counters['unapprovedposts'] += $forum['unapprovedposts']; $parent_counters['unapprovedthreads'] += $forum['unapprovedthreads']; $parent_counters['viewers'] += $forum['viewers']; } // Done with our math, lets talk about displaying - only display forums which are under a certain depth if ($depth > $showdepth) { continue; } // Get the lightbulb status indicator for this forum based on the lastpost $lightbulb = get_forum_lightbulb($forum, $lastpost_data, $showlockicon); // Fetch the number of unapproved threads and posts for this forum $unapproved = get_forum_unapproved($forum); if ($hideinfo == true) { unset($unapproved); } // Sanitize name and description of forum. $forum['name'] = preg_replace("#&(?!\\#[0-9]+;)#si", "&", $forum['name']); // Fix & but allow unicode $forum['description'] = preg_replace("#&(?!\\#[0-9]+;)#si", "&", $forum['description']); // Fix & but allow unicode $forum['name'] = preg_replace("#&([^\\#])(?![a-z1-4]{1,10};)#i", "&\$1", $forum['name']); $forum['description'] = preg_replace("#&([^\\#])(?![a-z1-4]{1,10};)#i", "&\$1", $forum['description']); // If this is a forum and we've got subforums of it, load the subforums list template if ($depth == 2 && $sub_forums) { eval("\$subforums = \"" . $templates->get("forumbit_subforums") . "\";"); } else { if ($depth == 3) { if ($donecount < $mybb->settings['subforumsindex']) { $statusicon = ''; // Showing mini status icons for this forum if ($mybb->settings['subforumsstatusicons'] == 1) { $lightbulb['folder'] = "mini" . $lightbulb['folder']; eval("\$statusicon = \"" . $templates->get("forumbit_depth3_statusicon", 1, 0) . "\";"); } // Fetch the template and append it to the list eval("\$forum_list .= \"" . $templates->get("forumbit_depth3", 1, 0) . "\";"); $comma = ', '; } // Have we reached our max visible subforums? put a nice message and break out of the loop ++$donecount; if ($donecount == $mybb->settings['subforumsindex']) { if (subforums_count($fcache[$pid]) > $donecount) { $forum_list .= $comma . $lang->sprintf($lang->more_subforums, subforums_count($fcache[$pid]) - $donecount); } } continue; } } // Forum is a category, set template type if ($forum['type'] == 'c') { $forumcat = '_cat'; } else { $forumcat = '_forum'; } if ($forum['linkto'] == '') { // No posts have been made in this forum - show never text if (($lastpost_data['lastpost'] == 0 || $lastpost_data['lastposter'] == '') && $hideinfo != true) { $lastpost = "<div style=\"text-align: center;\">{$lang->lastpost_never}</div>"; } elseif ($hideinfo != true) { // Format lastpost date and time $lastpost_date = my_date($mybb->settings['dateformat'], $lastpost_data['lastpost']); $lastpost_time = my_date($mybb->settings['timeformat'], $lastpost_data['lastpost']); // Set up the last poster, last post thread id, last post subject and format appropriately $lastpost_profilelink = build_profile_link($lastpost_data['lastposter'], $lastpost_data['lastposteruid']); $lastpost_link = get_thread_link($lastpost_data['lastposttid'], 0, "lastpost"); $lastpost_subject = $full_lastpost_subject = $parser->parse_badwords($lastpost_data['lastpostsubject']); if (my_strlen($lastpost_subject) > 25) { $lastpost_subject = my_substr($lastpost_subject, 0, 25) . "..."; } $lastpost_subject = htmlspecialchars_uni($lastpost_subject); $full_lastpost_subject = htmlspecialchars_uni($full_lastpost_subject); // Call lastpost template if ($depth != 1) { eval("\$lastpost = \"" . $templates->get("forumbit_depth{$depth}_forum_lastpost") . "\";"); } } if ($mybb->settings['showforumviewing'] != 0 && $forum['viewers'] > 0) { if ($forum['viewers'] == 1) { $forum_viewers_text = $lang->viewing_one; } else { $forum_viewers_text = $lang->sprintf($lang->viewing_multiple, $forum['viewers']); } $forum_viewers_text_plain = $forum_viewers_text; $forum_viewers_text = "<span class=\"smalltext\">{$forum_viewers_text}</span>"; } } // If this forum is a link or is password protected and the user isn't authenticated, set lastpost and counters to "-" if ($forum['linkto'] != '' || $hideinfo == true) { $lastpost = "<div style=\"text-align: center;\">-</div>"; $posts = "-"; $threads = "-"; } else { $posts = my_number_format($forum['posts']); $threads = my_number_format($forum['threads']); } // Moderator column is not off if ($mybb->settings['modlist'] != 0) { $done_moderators = array(); $moderators = ''; // Fetch list of moderators from this forum and its parents $parentlistexploded = explode(',', $forum['parentlist']); foreach ($parentlistexploded as $mfid) { // This forum has moderators if (is_array($moderatorcache[$mfid])) { // Fetch each moderator from the cache and format it, appending it to the list foreach ($moderatorcache[$mfid] as $moderator) { if (in_array($moderator['uid'], $done_moderators)) { continue; } $moderators .= "{$comma}<a href=\"" . get_profile_link($moderator['uid']) . "\">" . htmlspecialchars_uni($moderator['username']) . "</a>"; $comma = ', '; $done_moderators[] = $moderator['uid']; } } } $comma = ''; // If we have a moderators list, load the template if ($moderators) { eval("\$modlist = \"" . $templates->get("forumbit_moderators") . "\";"); } else { $modlist = ''; } } // Descriptions aren't being shown - blank them if ($mybb->settings['showdescriptions'] == 0) { $forum['description'] = ''; } // Check if this category is either expanded or collapsed and hide it as necessary. $expdisplay = ''; $collapsed_name = "cat_{$forum['fid']}_c"; if (isset($collapsed[$collapsed_name]) && $collapsed[$collapsed_name] == "display: show;") { $expcolimage = "collapse_collapsed.gif"; $expdisplay = "display: none;"; $expaltext = "[+]"; } else { $expcolimage = "collapse.gif"; $expaltext = "[-]"; } // Swap over the alternate backgrounds $bgcolor = alt_trow(); // Add the forum to the list eval("\$forum_list .= \"" . $templates->get("forumbit_depth{$depth}{$forumcat}") . "\";"); } } // Return an array of information to the parent forum including child forums list, counters and lastpost information return array("forum_list" => $forum_list, "counters" => $parent_counters, "lastpost" => $parent_lastpost); }
function makeprintablenav($pid = "0", $depth = "--") { global $db, $pforumcache, $fid, $forum, $lang; if (!is_array($pforumcache)) { $parlist = build_parent_list($fid, "fid", "OR", $forum['parentlist']); $query = $db->simple_select("forums", "name, fid, pid", "{$parlist}", array('order_by' => 'pid, disporder')); while ($forumnav = $db->fetch_array($query)) { $pforumcache[$forumnav['pid']][$forumnav['fid']] = $forumnav; } unset($forumnav); } if (is_array($pforumcache[$pid])) { foreach ($pforumcache[$pid] as $key => $forumnav) { $forums .= "+" . $depth . " {$lang->forum} {$forumnav['name']} (<i>" . $mybb->settings['bburl'] . "/" . get_forum_link($forumnav['fid']) . "</i>)<br />\n"; if ($pforumcache[$forumnav['fid']]) { $newdepth = $depth . "-"; $forums .= makeprintablenav($forumnav['fid'], $newdepth); } } } return $forums; }
$lang->drafts_count = $lang->sprintf($lang->drafts_count, my_number_format($draftcount)); // Show a listing of all of the current 'draft' posts or threads the user has. if ($draftcount) { $query = $db->query("\n\t\t\tSELECT p.subject, p.pid, t.tid, t.subject AS threadsubject, t.fid, f.name AS forumname, p.dateline, t.visible AS threadvisible, p.visible AS postvisible\n\t\t\tFROM " . TABLE_PREFIX . "posts p\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "threads t ON (t.tid=p.tid)\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "forums f ON (f.fid=t.fid)\n\t\t\tWHERE p.uid = '{$mybb->user['uid']}' AND p.visible = '-2'\n\t\t\tORDER BY p.dateline DESC\n\t\t"); while ($draft = $db->fetch_array($query)) { $detail = ''; $trow = alt_trow(); if ($draft['threadvisible'] == 1) { $draft['threadlink'] = get_thread_link($draft['tid']); $draft['threadsubject'] = htmlspecialchars_uni($draft['threadsubject']); eval("\$detail = \"" . $templates->get("usercp_drafts_draft_thread") . "\";"); $editurl = "newreply.php?action=editdraft&pid={$draft['pid']}"; $id = $draft['pid']; $type = "post"; } elseif ($draft['threadvisible'] == -2) { $draft['forumlink'] = get_forum_link($draft['fid']); $draft['forumname'] = htmlspecialchars_uni($draft['forumname']); eval("\$detail = \"" . $templates->get("usercp_drafts_draft_forum") . "\";"); $editurl = "newthread.php?action=editdraft&tid={$draft['tid']}"; $id = $draft['tid']; $type = "thread"; } $draft['subject'] = htmlspecialchars_uni($draft['subject']); $savedate = my_date('relative', $draft['dateline']); eval("\$drafts .= \"" . $templates->get("usercp_drafts_draft") . "\";"); } } else { $disable_delete_drafts = 'disabled="disabled"'; eval("\$drafts = \"" . $templates->get("usercp_drafts_none") . "\";"); } $plugins->run_hooks("usercp_drafts_end");
} if (isset($mybb->input['fid'])) { $validforum = get_forum($mybb->input['fid']); if (!$validforum) { if (!isset($mybb->input['ajax'])) { error($lang->error_invalidforum); } else { echo 0; exit; } } require_once MYBB_ROOT . "/inc/functions_indicators.php"; mark_forum_read($mybb->input['fid']); $plugins->run_hooks("misc_markread_forum"); if (!isset($mybb->input['ajax'])) { redirect(get_forum_link($mybb->input['fid']), $lang->redirect_markforumread); } else { echo 1; exit; } } else { $plugins->run_hooks("misc_markread_end"); require_once MYBB_ROOT . "/inc/functions_indicators.php"; mark_all_forums_read(); redirect("index.php", $lang->redirect_markforumsread); } } elseif ($mybb->input['action'] == "clearpass") { $plugins->run_hooks("misc_clearpass"); if (isset($mybb->input['fid'])) { if (!verify_post_check($mybb->get_input('my_post_key'))) { error($lang->invalid_post_code);
/** * Prepares forum data for return in an XML-RPC object * * @since 1.0 * @return array The prepared forum data * @param array|object The unprepared forum data **/ function prepare_forum($forum) { // Cast to an array $_forum = (array) $forum; // Set the URI $_forum['forum_uri'] = get_forum_link($_forum['forum_id']); // Give this a definite value if (!isset($_forum['forum_is_category'])) { $_forum['forum_is_category'] = 0; } // Allow plugins to modify the data return apply_filters('bb_xmlrpc_prepare_forum', $_forum, (array) $forum); }
$message = ''; switch ($old_status) { case 0: switch ($status) { case 0: break; case 1: $message = 'deleted'; break; } break; case 1: switch ($status) { case 0: $message = 'undeleted'; break; case 1: break; } break; } if ($sendto = wp_get_referer()) { $sendto = remove_query_arg('message', $sendto); $sendto = add_query_arg('message', $message, $sendto); } elseif (0 == $topic->topic_status) { $sendto = get_forum_link($topic->forum_id); } else { $sendto = get_topic_link($topic_id); } wp_redirect($sendto); exit;
$data .= "if(typeof(inlineModeration) != 'undefined') {\n\t\t\t\t\t\$('#inlinemod_{$pid}').bind(\"click\", function(e) {\n\t\t\t\t\t\tinlineModeration.checkItem();\n\t\t\t\t\t});\n\t\t\t\t}\n"; if ($closed == 1) { $data .= "\$('#quick_reply_form .trow1').removeClass('trow1 trow2').addClass('trow_shaded');\n"; } else { $data .= "\$('#quick_reply_form .trow_shaded').removeClass('trow_shaded').addClass('trow1');\n"; } $data .= "</script>\n"; header("Content-type: application/json; charset={$lang->settings['charset']}"); echo json_encode(array("data" => $data)); exit; } else { redirect(get_thread_link($tid, 0, "lastpost"), $lang->redirect_newreply_moderation, "", true); exit; } } else { $lang->redirect_newreply .= $lang->sprintf($lang->redirect_return_forum, get_forum_link($fid)); redirect($url, $lang->redirect_newreply, "", $force_redirect); exit; } } } // Show the newreply form. if ($mybb->input['action'] == "newreply" || $mybb->input['action'] == "editdraft") { $plugins->run_hooks("newreply_start"); $quote_ids = $multiquote_external = ''; // If this isn't a preview and we're not editing a draft, then handle quoted posts if (empty($mybb->input['previewpost']) && !$reply_errors && $mybb->input['action'] != "editdraft" && !$mybb->get_input('attachmentaid', MyBB::INPUT_INT) && !$mybb->get_input('newattachment') && !$mybb->get_input('updateattachment') && !$mybb->get_input('rem')) { $message = ''; $quoted_posts = array(); // Handle multiquote if (isset($mybb->cookies['multiquote']) && $mybb->settings['multiquote'] != 0) {
$timeout = 0; } if ($mybb->get_input('maxoptions', MyBB::INPUT_INT) > 0 && $mybb->get_input('maxoptions', MyBB::INPUT_INT) < $polloptions) { $maxoptions = $mybb->get_input('maxoptions', MyBB::INPUT_INT); } else { $maxoptions = 0; } $newpoll = array("tid" => $thread['tid'], "question" => $db->escape_string($mybb->input['question']), "dateline" => TIME_NOW, "options" => $db->escape_string($optionslist), "votes" => $db->escape_string($voteslist), "numoptions" => (int) $optioncount, "numvotes" => 0, "timeout" => $timeout, "closed" => 0, "multiple" => $postoptions['multiple'], "public" => $postoptions['public'], "maxoptions" => $maxoptions); $plugins->run_hooks("polls_do_newpoll_process"); $pid = $db->insert_query("polls", $newpoll); $db->update_query("threads", array('poll' => $pid), "tid='" . $thread['tid'] . "'"); $plugins->run_hooks("polls_do_newpoll_end"); if ($thread['visible'] == 1) { redirect(get_thread_link($thread['tid']), $lang->redirect_pollposted); } else { redirect(get_forum_link($thread['fid']), $lang->redirect_pollpostedmoderated); } } if ($mybb->input['action'] == "editpoll") { $pid = $mybb->get_input('pid', MyBB::INPUT_INT); $plugins->run_hooks("polls_editpoll_start"); $query = $db->simple_select("polls", "*", "pid='{$pid}'"); $poll = $db->fetch_array($query); if (!$poll) { error($lang->error_invalidpoll); } $query = $db->simple_select("threads", "*", "poll='{$pid}'"); $thread = $db->fetch_array($query); if (!$thread) { error($lang->error_invalidthread); }
function bb_forum_row($forum_id = 0, $echo = true, $close = false) { global $forum, $forums_count; if ($forum_id) { $_forum = bb_get_forum($forum_id); } else { $_forum =& $forum; } if (!$_forum) { return; } $description = get_forum_description($_forum->forum_id); $r = ''; if ($close) { $r .= "\t<li id='forum-{$_forum->forum_id}'" . get_alt_class('forum', 'forum clear list-block') . ">\n"; } $r .= "\t\t<div class='list-block posrel'>\n"; $r .= "\t\t\t<div class=\"row-title\">" . get_forum_name($_forum->forum_id) . "</div>\n"; if ($description) { $r .= "\t\t\t<p class=\"row-description\">" . get_forum_description($_forum->forum_id) . "</p>\n"; } $r .= "\t\t\t<div class=\"row-actions\"><span>\n"; $r .= "\t\t\t\t<a class='edit' href='" . get_forum_link() . "'>" . __('View') . "</a>\n"; if (bb_current_user_can('manage_forums')) { $r .= "\t\t\t\t| <a class='edit' href='" . esc_attr(bb_get_uri('bb-admin/forums.php', array('action' => 'edit', 'id' => $_forum->forum_id), BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN)) . "'>" . __('Edit') . "</a>\n"; } if (bb_current_user_can('delete_forum', $_forum->forum_id) && 1 < $forums_count) { $r .= "\t\t\t\t| <a class='delete' href='" . esc_attr(bb_get_uri('bb-admin/forums.php', array('action' => 'delete', 'id' => $_forum->forum_id), BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN)) . "'>" . __('Delete') . "</a>\n"; } $r .= "\t\t\t</span> </div>\n"; $r .= "\t\t</div>\n"; if ($close) { $r .= "\t</li>\n"; } if ($echo) { echo $r; } return $r; }
} else { $folder_label .= $lang->icon_no_new; } if ($post['thread_replies'] >= $mybb->settings['hottopic'] || $post['thread_views'] >= $mybb->settings['hottopicviews']) { $folder .= "hot"; $folder_label .= $lang->icon_hot; } if ($thread['thread_closed'] == 1) { $folder .= "lock"; $folder_label .= $lang->icon_lock; } $folder .= "folder"; $post['thread_replies'] = my_number_format($post['thread_replies']); $post['thread_views'] = my_number_format($post['thread_views']); if ($forumcache[$post['fid']]) { $post['forumlink'] = "<a href=\"" . get_forum_link($post['fid']) . "\">" . $forumcache[$post['fid']]['name'] . "</a>"; } else { $post['forumlink'] = ""; } if (!$post['subject']) { $post['subject'] = $post['message']; } if (my_strlen($post['subject']) > 50) { $post['subject'] = htmlspecialchars_uni(my_substr($post['subject'], 0, 50) . "..."); } else { $post['subject'] = htmlspecialchars_uni($post['subject']); } // What we do here is parse the post using our post parser, then strip the tags from it $parser_options = array('allow_html' => 0, 'allow_mycode' => 1, 'allow_smilies' => 0, 'allow_imgcode' => 0, 'filter_badwords' => 1); $post['message'] = strip_tags($parser->parse_message($post['message'], $parser_options)); if (my_strlen($post['message']) > 200) {
$table->construct_header($lang->date, array("class" => "align_center", 'width' => '15%')); $table->construct_header($lang->action, array("class" => "align_center", 'width' => '35%')); $table->construct_header($lang->information, array("class" => "align_center", 'width' => '30%')); $table->construct_header($lang->ipaddress, array("class" => "align_center", 'width' => '10%')); $query = $db->query("\n\t\tSELECT l.*, u.username, u.usergroup, u.displaygroup, t.subject AS tsubject, f.name AS fname, p.subject AS psubject\n\t\tFROM " . TABLE_PREFIX . "moderatorlog l\n\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid=l.uid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "threads t ON (t.tid=l.tid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "forums f ON (f.fid=l.fid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "posts p ON (p.pid=l.pid)\n\t\t{$where}\n\t\tORDER BY {$sortby} {$order}\n\t\tLIMIT {$start}, {$perpage}\n\t"); while ($logitem = $db->fetch_array($query)) { $information = ''; $logitem['dateline'] = date("jS M Y, G:i", $logitem['dateline']); $trow = alt_trow(); $username = format_name($logitem['username'], $logitem['usergroup'], $logitem['displaygroup']); $logitem['profilelink'] = build_profile_link($username, $logitem['uid']); if ($logitem['tsubject']) { $information = "<strong>{$lang->thread}</strong> <a href=\"../" . get_thread_link($logitem['tid']) . "\" target=\"_blank\">" . htmlspecialchars_uni($logitem['tsubject']) . "</a><br />"; } if ($logitem['fname']) { $information .= "<strong>{$lang->forum}</strong> <a href=\"../" . get_forum_link($logitem['fid']) . "\" target=\"_blank\">" . htmlspecialchars_uni($logitem['fname']) . "</a><br />"; } if ($logitem['psubject']) { $information .= "<strong>{$lang->post}</strong> <a href=\"../" . get_post_link($logitem['pid']) . "#pid{$logitem['pid']}\">" . htmlspecialchars_uni($logitem['psubject']) . "</a>"; } $table->construct_cell($logitem['profilelink']); $table->construct_cell($logitem['dateline'], array("class" => "align_center")); $table->construct_cell($logitem['action'], array("class" => "align_center")); $table->construct_cell($information); $table->construct_cell($logitem['ipaddress'], array("class" => "align_center")); $table->construct_row(); } if ($table->num_rows() == 0) { $table->construct_cell($lang->no_modlogs, array("colspan" => "5")); $table->construct_row(); }
die; } $posts = array(); foreach ($topics as $topic) { $posts[] = bb_get_first_post($topic->topic_id); } $title = esc_html(sprintf(__('%1$s » Forum: %2$s - Recent Topics'), bb_get_option('name'), get_forum_name($feed_id))); $link = get_forum_link($feed_id); $link_self = bb_get_forum_topics_rss_link($feed_id); break; case 'forum-posts': if (!($posts = bb_get_latest_forum_posts($feed_id))) { die; } $title = esc_html(sprintf(__('%1$s » Forum: %2$s - Recent Posts'), bb_get_option('name'), get_forum_name($feed_id))); $link = get_forum_link($feed_id); $link_self = bb_get_forum_posts_rss_link($feed_id); break; // Get just the first post from the latest topics // Get just the first post from the latest topics case 'all-topics': if (!($topics = get_latest_topics())) { die; } $posts = array(); foreach ($topics as $topic) { $posts[] = bb_get_first_post($topic->topic_id); } $title = esc_html(sprintf(__('%1$s » Recent Topics'), bb_get_option('name'))); $link = bb_get_uri(); $link_self = bb_get_topics_rss_link();
$posthandler = new PostDataHandler("update"); $posthandler->action = "post"; // Set the post data that came from the input to the $post array. $updatepost = array("pid" => $post['pid'], "message" => $message, "editreason" => $editreason, "edit_uid" => $mybb->user['uid']); $posthandler->set_data($updatepost); // Now let the post handler do all the hard work. if (!$posthandler->validate_post()) { $post_errors = $posthandler->get_friendly_errors(); xmlhttp_error($post_errors); } else { $postinfo = $posthandler->update_post(); $visible = $postinfo['visible']; if ($visible == 0 && !is_moderator($post['fid'], "canviewunapprove")) { // Is it the first post? if ($thread['firstpost'] == $post['pid']) { echo json_encode(array("moderation_thread" => $lang->thread_moderation, 'url' => $mybb->settings['bburl'] . '/' . get_forum_link($thread['fid']), "message" => $post['message'])); exit; } else { echo json_encode(array("moderation_post" => $lang->post_moderation, 'url' => $mybb->settings['bburl'] . '/' . get_thread_link($thread['tid']), "message" => $post['message'])); exit; } } } require_once MYBB_ROOT . "inc/class_parser.php"; $parser = new postParser(); $parser_options = array("allow_html" => $forum['allowhtml'], "allow_mycode" => $forum['allowmycode'], "allow_smilies" => $forum['allowsmilies'], "allow_imgcode" => $forum['allowimgcode'], "allow_videocode" => $forum['allowvideocode'], "me_username" => $post['username'], "filter_badwords" => 1); if ($post['smilieoff'] == 1) { $parser_options['allow_smilies'] = 0; } if ($mybb->user['showimages'] != 1 && $mybb->user['uid'] != 0 || $mybb->settings['guestimages'] != 1 && $mybb->user['uid'] == 0) { $parser_options['allow_imgcode'] = 0;
while ($row = $db->fetch_array($query)) { $tids[] = $row['tid']; } $ret = $custommod->execute(intval($mybb->input['action']), $tids, $pids); $lang->custom_tool = $lang->sprintf($lang->custom_tool, $tool['name']); log_moderator_action($modlogdata, $lang->custom_tool); if ($mybb->input['inlinetype'] == 'search') { clearinline($mybb->input['searchid'], 'search'); $lang->redirect_customtool_search = $lang->sprintf($lang->redirect_customtool_search, $tool['name']); $return_url = htmlspecialchars_uni($mybb->input['url']); redirect($return_url, $lang->redirect_customtool_search); } else { clearinline($tid, 'thread'); if ($ret == 'forum') { $lang->redirect_customtool_forum = $lang->sprintf($lang->redirect_customtool_forum, $tool['name']); moderation_redirect(get_forum_link($fid), $lang->redirect_customtool_forum); } else { $lang->redirect_customtool_thread = $lang->sprintf($lang->redirect_customtool_thread, $tool['name']); moderation_redirect(get_thread_link($tid), $lang->redirect_customtool_thread); } } break; } } error_no_permission(); break; } // Some little handy functions for our inline moderation function getids($id, $type) { global $mybb;