foreach ($data['not_auth_forums'] as $key => $val) { $data['not_auth_forums'][$key] = join(',', $val); } $data['tracker_forums'] = join(',', $data['tracker_forums']); $this->store('cat_forums', $data); // // jumpbox // $data = array('guest' => get_forum_select('guest', 'f', null, null, null, 'id="jumpbox" onchange="window.location.href=\'viewforum.php?f=\'+this.value;"'), 'user' => get_forum_select('user', 'f', null, null, null, 'id="jumpbox" onchange="window.location.href=\'viewforum.php?f=\'+this.value;"')); $this->store('jumpbox', $data); file_write($data['guest'], AJAX_HTML_DIR . 'jumpbox_guest.html', false, true, true); file_write($data['user'], AJAX_HTML_DIR . 'jumpbox_user.html', false, true, true); // // viewtopic_forum_select // $data = array('viewtopic_forum_select' => get_forum_select('admin', 'new_forum_id')); $this->store('viewtopic_forum_select', $data); // // latest_news // if ($bb_cfg['show_latest_news'] and $news_forum_ids = $bb_cfg['latest_news_forum_id']) { $news_count = max($bb_cfg['latest_news_count'], 1); $data = DB()->fetch_rowset("\n\t\tSELECT topic_id, topic_time, topic_title, forum_id\n\t\tFROM " . BB_TOPICS . "\n\t\tWHERE forum_id IN ({$news_forum_ids})\n\t\t\tAND topic_moved_id = 0\n\t\tORDER BY topic_time DESC\n\t\tLIMIT {$news_count}\n\t"); $this->store('latest_news', $data); } // // Network_news // if ($bb_cfg['show_network_news'] and $net_forum_ids = $bb_cfg['network_news_forum_id']) { $net_count = max($bb_cfg['network_news_count'], 1); $data = DB()->fetch_rowset("\n\t\tSELECT topic_id, topic_time, topic_title, forum_id\n\t\tFROM " . BB_TOPICS . "\n\t\tWHERE forum_id IN ({$net_forum_ids})\n\t\t\tAND topic_moved_id = 0\n\t\tORDER BY topic_time DESC\n\t\tLIMIT {$net_count}\n\t");
} require './pagestart.php'; $all_forums = -1; $pruned_total = 0; $prune_performed = false; if (isset($_REQUEST['submit'])) { if (!($var =& $_REQUEST['f']) or !($f_selected = get_id_ary($var))) { bb_die('Forum not selected'); } if (!($var =& $_REQUEST['prunedays']) or !($prunedays = abs(intval($var)))) { bb_die($lang['NOT_DAYS']); } $prunetime = TIMENOW - 86400 * $prunedays; $forum_csv = in_array($all_forums, $f_selected) ? $all_forums : join(',', $f_selected); $where_sql = $forum_csv != $all_forums ? "WHERE forum_id IN({$forum_csv})" : ''; $sql = "SELECT forum_id, forum_name FROM " . BB_FORUMS . " {$where_sql}"; foreach (DB()->fetch_rowset($sql) as $i => $row) { $pruned_topics = topic_delete('prune', $row['forum_id'], $prunetime, !empty($_POST['prune_all_topic_types'])); $pruned_total += $pruned_topics; $prune_performed = true; $template->assign_block_vars('pruned', array('ROW_CLASS' => !($i % 2) ? 'row1' : 'row2', 'FORUM_NAME' => htmlCHR($row['forum_name']), 'PRUNED_TOPICS' => $pruned_topics)); } if (!$prune_performed) { bb_die($lang['NONE_SELECTED']); } if (!$pruned_total) { bb_die($lang['NO_SEARCH_MATCH']); } } $template->assign_vars(array('PRUNED_TOTAL' => $pruned_total, 'S_PRUNE_ACTION' => basename(__FILE__), 'SEL_FORUM' => get_forum_select('admin', 'f[]', null, 65, 16, '', $all_forums))); print_page('admin_forum_prune.tpl', 'admin');
$redirect = url_arg($redirect, 'mod', 1, '&'); $mod_redirect_url = LOGIN_URL . "?redirect={$redirect}&admin=1"; if ($moderation && !$userdata['session_admin']) { redirect($mod_redirect_url); } } if ($moderation) { if (IS_ADMIN) { if (!($forum_select = $datastore->get('viewtopic_forum_select'))) { $datastore->update('viewtopic_forum_select'); $forum_select = $datastore->get('viewtopic_forum_select'); } $forum_select_html = $forum_select['viewtopic_forum_select']; } else { $not_auth_forums_csv = $user->get_not_auth_forums(AUTH_VIEW); $forum_select_html = get_forum_select(explode(',', $not_auth_forums_csv), 'new_forum_id'); } $template->assign_vars(array('S_FORUM_SELECT' => $forum_select_html)); } if (!($forums = $datastore->get('cat_forums'))) { $datastore->update('cat_forums'); $forums = $datastore->get('cat_forums'); } $template->assign_vars(array('CAT_TITLE' => $forums['cat_title_html'][$t_data['cat_id']], 'U_VIEWCAT' => CAT_URL . $t_data['cat_id'], 'PARENT_FORUM_HREF' => ($parent_id = $t_data['forum_parent']) ? FORUM_URL . $parent_id : '', 'PARENT_FORUM_NAME' => ($parent_id = $t_data['forum_parent']) ? htmlCHR($forums['f'][$parent_id]['forum_name']) : '')); unset($forums); $datastore->rm('cat_forums'); if ($post_id && !empty($t_data['prev_posts'])) { $start = floor(($t_data['prev_posts'] - 1) / $posts_per_page) * $posts_per_page; } // // Is user watching this thread?
if (!$is_auth['auth_delete']) { bb_die(sprintf($lang['SORRY_AUTH_DELETE'], $is_auth['auth_delete_type'])); } // Delete posts $result = post_delete(explode(',', $post_id_sql)); $msg = $result ? $lang['DELETE_POSTS_SUCCESFULLY'] : 'No posts were removed'; bb_die(return_msg_mcp($msg)); } else { $sql = "SELECT u.username, p.*, pt.post_text, p.post_username\n\t\t\t\tFROM " . BB_POSTS . " p, " . BB_USERS . " u, " . BB_POSTS_TEXT . " pt\n\t\t\t\tWHERE p.topic_id = {$topic_id}\n\t\t\t\t\tAND p.poster_id = u.user_id\n\t\t\t\t\tAND p.post_id = pt.post_id\n\t\t\t\tORDER BY p.post_time ASC"; if (!($result = DB()->sql_query($sql))) { bb_die('Could not get topic / post information'); } $s_hidden_fields = '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" /><input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" /><input type="hidden" name="' . POST_TOPIC_URL . '" value="' . $topic_id . '" /><input type="hidden" name="mode" value="split" />'; if (($total_posts = DB()->num_rows($result)) > 0) { $postrow = DB()->sql_fetchrowset($result); $template->assign_vars(array('FORUM_NAME' => htmlCHR($forum_name), 'U_VIEW_FORUM' => FORUM_URL . $forum_id, 'S_SPLIT_ACTION' => 'modcp.php', 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_FORUM_SELECT' => get_forum_select('admin', 'new_forum_id', $forum_id))); for ($i = 0; $i < $total_posts; $i++) { $post_id = $postrow[$i]['post_id']; $poster_id = $postrow[$i]['poster_id']; $poster = $postrow[$i]['username']; $post_date = bb_date($postrow[$i]['post_time']); $message = $postrow[$i]['post_text']; // // If the board has HTML off but the post has HTML // on then we process it, else leave it alone // $message = bbcode2html($message); $row_class = !($i % 2) ? 'row1' : 'row2'; $template->assign_block_vars('postrow', array('ROW_CLASS' => $row_class, 'POSTER_NAME' => wbr($poster), 'POST_DATE' => $post_date, 'MESSAGE' => $message, 'CHECKBOX' => defined('BEGIN_CHECKBOX') ? TRUE : FALSE, 'POST_ID' => $post_id, 'ROW_ID' => $i, 'CB_ID' => 'cb_' . $i)); if ($post_id == $topic_first_post_id) { define('BEGIN_CHECKBOX', TRUE);
$datetime_href_s = url_arg($url, $datetime_key, date($dt_format, $row['log_time'])); $datetime_href_s = url_arg($datetime_href_s, $daysback_key, 1); $template->assign_block_vars('log', array('ACTION_DESC' => $lang['LOG_ACTION']['LOG_TYPE'][$log_type_flip[$row['log_type_id']]], 'ACTION_HREF_S' => url_arg($url, $type_key, $row['log_type_id']), 'USER_ID' => $row['log_user_id'], 'USERNAME' => $row['log_username'], 'USER_HREF_S' => url_arg($url, $user_key, $row['log_user_id']), 'USER_IP' => decode_ip($row['log_user_ip']), 'FORUM_ID' => $row['log_forum_id'], 'FORUM_HREF' => BB_ROOT . FORUM_URL . $row['log_forum_id'], 'FORUM_HREF_S' => url_arg($url, $forum_key, $row['log_forum_id']), 'FORUM_NAME' => htmlCHR($forum_name), 'FORUM_ID_NEW' => $row['log_forum_id_new'], 'FORUM_HREF_NEW' => BB_ROOT . FORUM_URL . $row['log_forum_id_new'], 'FORUM_HREF_NEW_S' => url_arg($url, $forum_key, $row['log_forum_id_new']), 'FORUM_NAME_NEW' => htmlCHR($forum_name_new), 'TOPIC_ID' => $row['log_topic_id'], 'TOPIC_HREF' => !$topic_deleted ? BB_ROOT . TOPIC_URL . $row['log_topic_id'] : '', 'TOPIC_HREF_S' => url_arg($url, $topic_key, $row['log_topic_id']), 'TOPIC_TITLE' => $topic_title, 'TOPIC_ID_NEW' => $row['log_topic_id_new'], 'TOPIC_HREF_NEW' => BB_ROOT . TOPIC_URL . $row['log_topic_id_new'], 'TOPIC_HREF_NEW_S' => url_arg($url, $topic_key, $row['log_topic_id_new']), 'TOPIC_TITLE_NEW' => $topic_title_new, 'DATE' => bb_date($row['log_time'], 'j-M'), 'TIME' => bb_date($row['log_time'], 'H:i'), 'DATETIME_HREF_S' => $datetime_href_s, 'MSG' => $msg, 'ROW_CLASS' => $row_class)); // Topics if ($topic_csv && empty($filter['topics'][$row['log_topic_title']])) { $template->assign_block_vars('topics', array('TOPIC_TITLE' => $row['log_topic_title'])); $filter['topics'][$row['log_topic_title']] = true; } // Forums if ($forum_csv && empty($filter['forums'][$forum_name])) { $template->assign_block_vars('forums', array('FORUM_NAME' => htmlCHR($forum_name))); $filter['forums'][$forum_name] = true; } // Users if ($user_csv && empty($filter['users'][$row['log_username']])) { $template->assign_block_vars('users', array('USERNAME' => $row['log_username'])); $filter['users'][$row['log_username']] = true; } } $template->assign_vars(array('FILTERS' => $topic_csv || $forum_csv || $user_csv, 'FILTER_TOPICS' => !empty($filter['topics']), 'FILTER_FORUMS' => !empty($filter['forums']), 'FILTER_USERS' => !empty($filter['users']))); } else { $template->assign_block_vars('log_not_found', array()); } // // Selects // $log_type_select = array($lang['ACTS_LOG_ALL_ACTIONS'] => $all_types) + $log_action->log_type_select; // Order select $order_options = '<option value=""> ' . $lang['ACTS_LOG_TIME'] . ' </option>'; $template->assign_vars(array('LOG_COLSPAN' => 4, 'DATETIME_NAME' => $datetime_key, 'DATETIME_VAL' => date('Y-m-d', $datetime_val), 'DAYSBACK_NAME' => $daysback_key, 'DAYSBACK_VAL' => $daysback_val, 'FIRST_LOG_TIME' => $first_log_time ? date('Y-m-d', $first_log_time) : $lang['ACC_NONE'], 'TITLE_MATCH_MAX' => $title_match_max_len, 'TITLE_MATCH_NAME' => $title_match_key, 'TITLE_MATCH_VAL' => $title_match_val, 'ORDER_NAME' => '', 'ORDER_OPTIONS' => $order_options, 'SORT_NAME' => $sort_key, 'SORT_ASC' => $sort_asc, 'SORT_DESC' => $sort_desc, 'SORT_ASC_CHECKED' => $sort_val == $sort_asc ? HTML_CHECKED : '', 'SORT_DESC_CHECKED' => $sort_val == $sort_desc ? HTML_CHECKED : '', 'SEL_FORUM' => get_forum_select('admin', "{$forum_key}[]", $forum_selected, $max_forum_name_len, $select_max_height, '', $all_forums), 'SEL_LOG_TYPE' => build_select("{$type_key}[]", $log_type_select, $type_selected, 60, $select_max_height), 'SEL_USERS' => build_select("{$user_key}[]", $users, $user_selected, 16, $select_max_height), 'S_LOG_ACTION' => "admin_log.php", 'TOPIC_CSV' => $topic_csv)); print_page('admin_log.tpl', 'admin');
$chars_opt = array($show_all => array('lang' => $lang['ALL_AVAILABLE']), $show_briefly => array('lang' => $lang['BRIEFLY'])); $chars_select = array(); foreach ($chars_opt as $val => $opt) { $chars_select[$opt['lang']] = $val; } $GPC = array('all_words' => array('allw', 1, CHBOX), 'cat' => array('c', null, REQUEST), 'chars' => array('ch', $show_all, SELECT), 'display_as' => array('dm', $as_topics, SELECT), 'dl_cancel' => array('dla', 0, CHBOX), 'dl_compl' => array('dlc', 0, CHBOX), 'dl_down' => array('dld', 0, CHBOX), 'dl_user_id' => array('dlu', $user_id, CHBOX), 'dl_will' => array('dlw', 0, CHBOX), 'forum' => array('f', $search_all, REQUEST), 'my_topics' => array('myt', 0, CHBOX), 'new' => array('new', 0, CHBOX), 'new_topics' => array('nt', 0, CHBOX), 'order' => array('o', $ord_posted, SELECT), 'poster_id' => array('uid', null, REQUEST), 'poster_name' => array('pn', null, REQUEST), 'sort' => array('s', $sort_desc, SELECT), 'text_match' => array('nm', null, REQUEST), 'time' => array('tm', $search_all, SELECT), 'title_only' => array('to', 0, CHBOX), 'topic' => array('t', null, REQUEST)); // Define all GPC vars with default values foreach ($GPC as $var_name => $var_options) { $GLOBALS["{$var_name}_key"] = $var_options[KEY_NAME]; $GLOBALS["{$var_name}_val"] = $var_options[DEF_VAL]; } // Output basic page if (empty($_GET) && empty($_POST)) { // Make forum select box $forum_select_mode = explode(',', $excluded_forums_csv); $forum_select = get_forum_select($forum_select_mode, "{$forum_key}[]", $search_all, $max_forum_name_len, $forum_select_size, 'style="width: 95%;"', $search_all); $template->assign_vars(array('TPL_SEARCH_MAIN' => true, 'PAGE_TITLE' => $lang['SEARCH'], 'POSTER_ID_KEY' => $poster_id_key, 'TEXT_MATCH_KEY' => $text_match_key, 'POSTER_NAME_KEY' => $poster_name_key, 'THIS_USER_ID' => $userdata['user_id'], 'THIS_USER_NAME' => addslashes($userdata['username']), 'SEARCH_ACTION' => "search.php", 'U_SEARCH_USER' => "search.php?mode=searchuser&input_name={$poster_name_key}", 'ONLOAD_FOCUS_ID' => 'text_match_input', 'MY_TOPICS_ID' => 'my_topics', 'MY_TOPICS_CHBOX' => build_checkbox($my_topics_key, $lang['SEARCH_MY_TOPICS'], $my_topics_val, true, null, 'my_topics'), 'TITLE_ONLY_CHBOX' => build_checkbox($title_only_key, $lang['SEARCH_TITLES_ONLY'], true, $bb_cfg['disable_ft_search_in_posts']), 'ALL_WORDS_CHBOX' => build_checkbox($all_words_key, $lang['SEARCH_ALL_WORDS'], true), 'DL_CANCEL_CHBOX' => build_checkbox($dl_cancel_key, $lang['SEARCH_DL_CANCEL'], $dl_cancel_val, IS_GUEST, 'dlCancel'), 'DL_COMPL_CHBOX' => build_checkbox($dl_compl_key, $lang['SEARCH_DL_COMPLETE'], $dl_compl_val, IS_GUEST, 'dlComplete'), 'DL_DOWN_CHBOX' => build_checkbox($dl_down_key, $lang['SEARCH_DL_DOWN'], $dl_down_val, IS_GUEST, 'dlDown'), 'DL_WILL_CHBOX' => build_checkbox($dl_will_key, $lang['SEARCH_DL_WILL'], $dl_will_val, IS_GUEST, 'dlWill'), 'ONLY_NEW_CHBOX' => build_checkbox($new_key, $lang['BT_ONLY_NEW'], $new_val, IS_GUEST), 'NEW_TOPICS_CHBOX' => build_checkbox($new_topics_key, $lang['NEW_TOPICS'], $new_topics_val, IS_GUEST), 'FORUM_SELECT' => $forum_select, 'TIME_SELECT' => build_select($time_key, $time_select, $time_val), 'ORDER_SELECT' => build_select($order_key, $order_select, $order_val), 'SORT_SELECT' => build_select($sort_key, $sort_select, $sort_val), 'CHARS_SELECT' => '', 'DISPLAY_AS_SELECT' => build_select($display_as_key, $display_as_select, $display_as_val))); print_page('search.tpl'); } unset($forums); $datastore->rm('cat_forums'); // Restore previously found items list and search settings if we have valid $search_id if ($search_id) { $row = DB()->fetch_row("\n\t\tSELECT search_array, search_settings\n\t\tFROM " . BB_SEARCH . "\n\t\tWHERE session_id = '{$session_id}'\n\t\t\tAND search_type = " . SEARCH_TYPE_POST . "\n\t\t\tAND search_id = '{$search_id}'\n\t\tLIMIT 1\n\t"); if (empty($row['search_settings'])) { bb_die($lang['SESSION_EXPIRED']); } $previous_settings = unserialize($row['search_settings']); $items_found = explode(',', $row['search_array']); } // Get simple "CHBOX" and "SELECT" type vars
$forum_sql = ''; $adv = 0; } $datastore->update('cat_forums'); bb_die($lang['FORUM_AUTH_UPDATED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_FORUMAUTH'], '<a href="' . "admin_forumauth.php" . '">', "</a>")); } // End of submit // // Get required information, either all forums if // no id was specified or just the requsted if it // was // $forum_rows = DB()->fetch_rowset("SELECT * FROM " . BB_FORUMS . " {$forum_sql}"); if (empty($forum_id)) { // Output the selection table if no forum id was specified $template->assign_vars(array('TPL_AUTH_SELECT_FORUM' => true, 'S_AUTH_ACTION' => 'admin_forumauth.php', 'S_AUTH_SELECT' => get_forum_select('admin', 'f', null, 80))); } else { // Output the authorisation details if an id was specified $forum_name = $forum_rows[0]['forum_name']; @reset($simple_auth_ary); while (list($key, $auth_levels) = each($simple_auth_ary)) { $matched = 1; for ($k = 0; $k < count($auth_levels); $k++) { $matched_type = $key; if ($forum_rows[0][$forum_auth_fields[$k]] != $auth_levels[$k]) { $matched = 0; } } if ($matched) { break; }