function bb_forum_form($forum_id = 0) { $forum_id = (int) $forum_id; if ($forum_id && !($forum = bb_get_forum($forum_id))) { return; } $forum_name = ''; $forum_slug = ''; $forum_description = ''; $forum_position = ''; if ($forum_id) { $forum_name = get_forum_name($forum_id); $forum_slug = apply_filters('editable_slug', $forum->forum_slug); $forum_description = get_forum_description($forum_id); $forum_position = get_forum_position($forum_id); $legend = __('Edit Forum'); $submit = __('Save Changes'); $action = 'update'; } else { $legend = __('Add Forum'); $submit = __('Add Forum'); $action = 'add'; } $forum_options = array('forum_name' => array('title' => __('Name'), 'value' => $forum_name), 'forum_slug' => array('title' => __('Slug'), 'value' => $forum_slug), 'forum_desc' => array('title' => __('Description'), 'value' => $forum_description, 'class' => 'long'), 'forum_parent' => array('title' => __('Parent'), 'type' => 'select', 'options' => bb_get_forum_dropdown(array('cut_branch' => $forum_id, 'id' => 'forum_parent', 'none' => true, 'selected' => $forum_id ? get_forum_parent($forum_id) : 0, 'disable_categories' => 0, 'options_only' => true))), 'forum_order' => array('title' => __('Position'), 'value' => $forum_position, 'class' => 'short'), 'forum_is_category' => array('title' => __('Category'), 'type' => 'checkbox', 'options' => array(1 => array('label' => __('Make this forum a category'), 'value' => bb_get_forum_is_category($forum_id))), 'note' => __('Categories are forums where new topics cannot be created. Categories usually contain a group of sub-forums.'))); if (!$forum_id) { unset($forum_options['forum_slug']); unset($forum_options['forum_order']); } ?> <form class="settings" method="post" id="<?php echo $action; ?> -forum" action="<?php bb_uri('bb-admin/bb-forum.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN); ?> " class="add:forum-list: forum-form"> <fieldset> <legend><?php echo $legend; ?> </legend> <?php foreach ($forum_options as $option => $args) { bb_option_form_element($option, $args); } ?> <fieldset class="submit"> <?php if ($forum_id) { ?> <input type="hidden" name="forum_id" value="<?php echo $forum_id; ?> " /> <?php } ?> <?php bb_nonce_field('order-forums', 'order-nonce'); ?> <?php bb_nonce_field($action . '-forum'); ?> <input type="hidden" name="action" value="<?php echo $action; ?> " /> <input class="submit" type="submit" name="submit" value="<?php echo $submit; ?> " /> </fieldset> </fieldset> </form> <?php }
add_filter('post_edit_uri', 'bb_make_link_view_all'); $post_query = new BB_Query_Form('post', array('post_status' => 'normal', 'count' => true, 'per_page' => 20)); $bb_posts =& $post_query->results; $total = $post_query->found_rows; ?> <div class="wrap"> <h2><?php _e('Posts'); $h2_search = $post_query->get('post_text'); $h2_forum = $post_query->get('forum_id'); $h2_tag = $post_query->get('tag_id'); $h2_author = $post_query->get('post_author_id'); $h2_search = $h2_search ? ' ' . sprintf(__('containing “%s”'), esc_html($h2_search)) : ''; $h2_forum = $h2_forum ? ' ' . sprintf(__('in “%s”'), get_forum_name($h2_forum)) : ''; $h2_tag = $h2_tag ? ' ' . sprintf(__('with tag “%s”'), esc_html(bb_get_tag_name($h2_tag))) : ''; $h2_author = $h2_author ? ' ' . sprintf(__('by %s'), esc_html(get_user_name($h2_author))) : ''; if ($ip_available) { $h2_ip = $post_query->get('poster_ip'); $h2_ip = $h2_ip ? ' ' . sprintf(__('from IP address %s'), esc_html($h2_ip)) : ''; } else { $h2_ip = ''; } if ($h2_search || $h2_forum || $h2_tag || $h2_author || $h2_ip) { echo '<span class="subtitle">'; printf(__('%1$s%2$s%3$s%4$s%5$s'), $h2_search, $h2_forum, $h2_tag, $h2_author, $h2_ip); echo '</span>'; } ?> </h2>
/* Decrement count of posts in forums table */ $sql = "UPDATE %sforums SET num_posts=num_posts-1, last_post=last_post WHERE forum_id=%d"; $result = queryDB($sql, array(TABLE_PREFIX, $fid)); } if ($ppid) { $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY'); header('Location: view.php?fid=' . $fid . SEP . 'pid=' . $ppid); exit; } else { $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY'); header('Location: index.php?fid=' . $fid); exit; } } } $_pages['mods/_standard/forums/forum/index.php?fid=' . $fid]['title'] = get_forum_name($fid); $_pages['mods/_standard/forums/forum/index.php?fid=' . $fid]['parent'] = 'forum/list.php'; $_pages['mods/_standard/forums/forum/index.php?fid=' . $fid]['children'] = array('mods/_standard/forums/forum/new_thread.php?fid=' . $fid); $_pages['mods/_standard/forums/forum/new_thread.php?fid=' . $fid]['title_var'] = 'new_thread'; $_pages['mods/_standard/forums/forum/new_thread.php?fid=' . $fid]['parent'] = 'mods/_standard/forums/forum/index.php?fid=' . $fid; $_pages['mods/_standard/forums/forum/view.php']['title'] = $post_row['subject']; $_pages['mods/_standard/forums/forum/view.php']['parent'] = 'forum/index.php?fid=' . $fid; $_pages['mods/_standard/forums/forum/delete_thread.php']['title_var'] = 'delete_post'; $_pages['mods/_standard/forums/forum/delete_thread.php']['parent'] = 'mods/_standard/forums/forum/index.php?fid=' . $fid; $_pages['mods/_standard/forums/forum/delete_thread.php']['children'] = array(); require AT_INCLUDE_PATH . 'header.inc.php'; $sql = "SELECT * from %sforums_threads WHERE post_id = %d"; $row = queryDB($sql, array(TABLE_PREFIX, $pid), TRUE); $title = AT_print($row['subject'], 'forums_threads.subject'); $hidden_vars['fid'] = $_GET['fid']; $hidden_vars['pid'] = $_GET['pid'];
} $sql = "UPDATE %sforums_threads SET num_comments=num_comments+1, last_comment='%s', date=date WHERE post_id=%d"; $result = queryDB($sql, array(TABLE_PREFIX, $now, $_POST['parent_id'])); if ($subscriber_email_list) { require AT_INCLUDE_PATH . 'classes/phpmailer/atutormailer.class.php'; if ($_POST['parent_name'] == '') { $_POST['parent_name'] = $_POST['subject']; } $_POST['parent_name'] = urldecode($_POST['parent_name']); foreach ($subscriber_email_list as $subscriber) { $mail = new ATutorMailer(); $mail->AddAddress($subscriber['email'], get_display_name($subscriber['member_id'])); $body = _AT('forum_new_submsg', $_SESSION['course_title'], get_forum_name($_POST['fid']), $_POST['parent_name'], AT_BASE_HREF . 'mods/_standard/forums/forum/view.php?fid=' . $_POST['fid'] . SEP . 'pid=' . $_POST['parent_id']); $body .= "\n----------------------------------------------\n"; $body .= _AT('course') . ': ' . $_SESSION['course_title'] . "\n"; $body .= _AT('forum') . ': ' . get_forum_name($_POST['fid']) . "\n"; $body .= _AT('thread') . ': ' . $_POST['parent_name'] . "\n"; $body .= _AT('posted_by') . ": " . get_display_name($_SESSION['member_id']) . "\n"; $body .= $_POST['body'] . "\n"; $mail->FromName = $_config['site_name']; $mail->From = $_config['contact_email']; $mail->Subject = _AT('thread_notify1') . ': ' . $_POST['parent_name']; $mail->Body = $body; if (!$mail->Send()) { $msg->addError('SENDING_ERROR'); } unset($mail); } } if ($_REQUEST['subscribe']) { if ($_POST['parent_id'] != 0) {
function bb_get_forum_bread_crumb($args = '') { $defaults = array('forum_id' => 0, 'separator' => ' » ', 'class' => null); $args = wp_parse_args($args, $defaults); extract($args, EXTR_SKIP); $trail = ''; $trail_forum = bb_get_forum(get_forum_id($forum_id)); if ($class) { $class = ' class="' . $class . '"'; } $current_trail_forum_id = $trail_forum->forum_id; while ($trail_forum && $trail_forum->forum_id > 0) { $crumb = $separator; if ($current_trail_forum_id != $trail_forum->forum_id || !bb_is_forum()) { $crumb .= '<a' . $class . ' href="' . get_forum_link($trail_forum->forum_id) . '">'; } elseif ($class) { $crumb .= '<span' . $class . '>'; } $crumb .= get_forum_name($trail_forum->forum_id); if ($current_trail_forum_id != $trail_forum->forum_id || !bb_is_forum()) { $crumb .= '</a>'; } elseif ($class) { $crumb .= '</span>'; } $trail = $crumb . $trail; $trail_forum = bb_get_forum($trail_forum->forum_parent); } return apply_filters('bb_get_forum_bread_crumb', $trail, $forum_id); }
exit; } // set default thread display order to ascending if (!isset($_SESSION['thread_order'])) { $_SESSION['thread_order'] = 'a'; } else if (isset($_GET['order'])) { $_SESSION['thread_order'] = $_GET['order']; } $forum_info = get_forum($fid); $_pages[url_rewrite('mods/_standard/forums/forum/index.php?fid='.$fid)]['title'] = get_forum_name($fid); $_pages[url_rewrite('mods/_standard/forums/forum/index.php?fid='.$fid)]['parent'] = 'mods/_standard/forums/forum/list.php'; $_pages[url_rewrite('mods/_standard/forums/forum/index.php?fid='.$fid)]['children'] = array(url_rewrite('mods/_standard/forums/forum/new_thread.php?fid='.$fid), 'search.php?search_within[]=forums'); $_pages[url_rewrite('mods/_standard/forums/forum/new_thread.php?fid='.$fid)]['title_var'] = 'new_thread'; $_pages[url_rewrite('mods/_standard/forums/forum/new_thread.php?fid='.$fid)]['parent'] = url_rewrite('mods/_standard/forums/forum/index.php?fid='.$fid); $_pages['mods/_standard/forums/forum/view.php']['parent'] = url_rewrite('mods/_standard/forums/forum/index.php?fid='.$fid); $_pages['search.php?search_within[]=forums']['title_var'] = 'search'; $_pages['search.php?search_within[]=forums']['parent'] = url_rewrite('mods/_standard/forums/forum/index.php'); if ($_REQUEST['reply']) { $onload = 'document.form.subject.focus();'; } $pid = intval($_GET['pid']);
if (!($topics = get_latest_topics($feed_id))) { 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();
exit; } // else: /* Decrement count for number of posts and topics*/ $sql = "UPDATE " . TABLE_PREFIX . "forums SET num_posts=num_posts-1-" . $row['num_comments'] . ", num_topics=num_topics-1, last_post=last_post WHERE forum_id={$_REQUEST['fid']}"; $result = mysql_query($sql, $db); $sql = "UPDATE " . TABLE_PREFIX . "forums SET num_posts=num_posts+1+" . $row['num_comments'] . ", num_topics=num_topics+1, last_post=last_post WHERE forum_id={$_REQUEST['new_fid']}"; $result = mysql_query($sql, $db); $sql = "UPDATE " . TABLE_PREFIX . "forums_threads SET forum_id={$_REQUEST['new_fid']}, last_comment=last_comment, date=date WHERE (parent_id={$_REQUEST['pid']} OR post_id={$_REQUEST['pid']}) AND forum_id={$_REQUEST['fid']}"; $result = mysql_query($sql, $db); $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY'); header('Location: index.php?fid=' . $_REQUEST['fid']); exit; } } $_pages['mods/_standard/forums/forum/index.php?fid=' . $_REQUEST['fid']]['title'] = get_forum_name($_REQUEST['fid']); $_pages['mods/_standard/forums/forum/index.php?fid=' . $_REQUEST['fid']]['parent'] = 'mods/_standard/forums/forum/list.php'; $_pages['mods/_standard/forums/forum/index.php?fid=' . $_REQUEST['fid']]['children'] = array('mods/_standard/forums/forum/move_thread.php'); $_pages['mods/_standard/forums/forum/move_thread.php']['title_var'] = 'move_thread'; $_pages['mods/_standard/forums/forum/move_thread.php']['parent'] = 'mods/_standard/forums/forum/index.php?fid=' . $_REQUEST['fid']; $_pages['mods/_standard/forums/forum/move_thread.php']['children'] = array(); require AT_INCLUDE_PATH . 'header.inc.php'; ?> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> "> <input type="hidden" name="fid" value="<?php echo $_REQUEST['fid']; ?> " />
} } $sql = "UPDATE ".TABLE_PREFIX."forums_threads SET num_comments=num_comments+1, last_comment='$now', date=date WHERE post_id=$_POST[parent_id]"; $result = mysql_query($sql, $db); if ($subscriber_email_list) { require(AT_INCLUDE_PATH . 'classes/phpmailer/atutormailer.class.php'); if ($_POST['parent_name'] == ''){ $_POST['parent_name'] = $_POST['subject']; } $_POST['parent_name'] = urldecode($_POST['parent_name']); foreach ($subscriber_email_list as $subscriber){ $mail = new ATutorMailer; $mail->AddAddress($subscriber['email'], get_display_name($subscriber['member_id'])); $body = _AT('forum_new_submsg', $_SESSION['course_title'], get_forum_name($_POST['fid']), $_POST['parent_name'], AT_BASE_HREF.'mods/_standard/forums/forum/view.php?fid='.$_POST['fid'].SEP.'pid='.$_POST['parent_id']); $body .= "\n----------------------------------------------\n"; $body .= _AT('posted_by').": ".get_display_name($_SESSION['member_id'])."\n"; $body .= $_POST['body']."\n"; $mail->FromName = $_config['site_name']; $mail->From = $_config['contact_email']; $mail->Subject = _AT('thread_notify1'); $mail->Body = $body; if(!$mail->Send()) { $msg->addError('SENDING_ERROR'); } unset($mail); } }
function breadcrumbs() { $page = ''; if (bb_get_location() == 'login-page') { $page = __('Log in', 'guangzhou'); } elseif (is_forum()) { $page = get_forum_name(); } elseif (is_bb_tags() && get_tag_name() != '') { $page = '<a href="' . bb_get_tag_page_link() . '">' . __('Tags') . '</a> » ' . get_tag_name(); } elseif (is_topic()) { if (get_forum_name()) { $page = '<a href="' . get_forum_link() . '">' . get_forum_name() . '</a>'; } } if ($page) { $page = '| ' . $page; } return '<a href="' . bb_get_option('uri') . '">' . bb_get_option('name') . '</a> ' . $page; }