function add_row($idx, $CH_this, $level, $id)
{
    global $template, $images, $lang;
    global $tree, $selected_id;
    // get data for this level
    $folder = $images['acp_forum'];
    $l_folder = $lang['Forum'];
    if ($tree['data'][$idx]['forum_status'] == FORUM_LOCKED) {
        $folder = $images['acp_forum_locked'];
        $l_folder = $lang['Forum_locked'];
    }
    if ($tree['type'][$idx] == POST_CAT_URL || !empty($tree['sub'][$CH_this])) {
        $folder = $images['acp_category'];
        $l_folder = $lang['Category'];
        if ($tree['data'][$idx]['forum_status'] == FORUM_LOCKED) {
            $folder = $images['acp_category_locked'];
            $l_folder = $lang['Forum_locked'];
        }
    }
    if (!empty($tree['data'][$idx]['forum_link'])) {
        $folder = $images['acp_link'];
        $l_folder = $lang['Forum_link'];
    }
    $icon = '';
    if (!empty($tree['data'][$idx]['icon'])) {
        $icon = $tree['data'][$idx]['icon'];
        $icon_img = $icon;
        if (isset($images[$icon_img])) {
            $icon_img = $images[$icon_img];
        }
    }
    $color = !$color;
    if ($selected_id == '') {
        $selected_id = 'Root';
    }
    // Fields for javascript collapsing
    $s_hidden_fields = '<input type="hidden" id="sub-id-' . $tree['main'][$idx] . '-' . $id . '" value="' . $CH_this . '" />';
    $s_hidden_fields .= '<input type="hidden" id="nr-sub-' . $CH_this . '" value="' . sizeof($tree['sub'][$CH_this]) . '" />';
    $s_hidden_fields .= '<input type="hidden" id="collapsed-' . $CH_this . '" value="0" />';
    $template->assign_block_vars('row', array('ID' => $CH_this, 'PARENT_ID' => $tree['main'][$idx], 'COLLAPSE_ID' => $id, 'LEVEL_WIDTH' => $level * 20, 'COLOR' => $color ? 'row1' : 'row2', 'FOLDER' => $folder, 'L_FOLDER' => $l_folder, 'ICON_IMG' => $icon_img != '' ? IP_ROOT_PATH . $icon_img : IP_ROOT_PATH . 'images/spacer.gif', 'ICON' => $icon, 'FORUM_NAME' => get_object_lang($CH_this, 'name', true), 'FORUM_DESC' => get_object_lang($CH_this, 'desc', true), 'TOPICS' => $tree['data'][$idx]['tree.forum_topics'], 'POSTS' => $tree['data'][$idx]['tree.forum_posts'], 'IS_CAT' => $tree['type'][$idx] == POST_CAT_URL, 'U_FORUM' => append_sid('admin_forums_extend.' . PHP_EXT . '?selected_id=' . $CH_this), 'U_ADD' => append_sid('admin_forums_extend.' . PHP_EXT . '?mode=create&amp;main=' . $CH_this), 'U_EDIT' => append_sid('admin_forums_extend.' . PHP_EXT . '?mode=edit&amp;fid=' . $CH_this), 'U_DELETE' => append_sid('admin_forums_extend.' . PHP_EXT . '?mode=delete&amp;fid=' . $CH_this), 'U_RESYNC' => append_sid('admin_forums_extend.' . PHP_EXT . '?mode=resync&amp;fid=' . $CH_this), 'U_MOVEUP' => append_sid('admin_forums_extend.' . PHP_EXT . '?mode=moveup&amp;fid=' . $CH_this . '&amp;selected_id=' . $selected_id), 'U_MOVEDW' => append_sid('admin_forums_extend.' . PHP_EXT . '?mode=movedw&amp;fid=' . $CH_this . '&amp;selected_id=' . $selected_id), 'U_PERMS' => append_sid('admin_forumauth.' . PHP_EXT . '?' . POST_FORUM_URL . '=' . $CH_this), 'S_HIDDEN_FIELDS' => $s_hidden_fields));
    if (!empty($icon)) {
        $template->assign_block_vars('row.forum_icon', array());
    }
    // is there some sub-levels for this level ?
    if (isset($tree['sub'][$CH_this])) {
        // build sub-levels links (collapsed)
        $links = '';
        for ($i = 0; $i < sizeof($tree['sub'][$CH_this]); $i++) {
            $sub_this = $tree['sub'][$CH_this][$i];
            $sub_idx = $tree['keys'][$sub_this];
            $sub_folder = $images['acp_icon_minipost'];
            $sub_l_folder = $lang['Forum'];
            if ($tree['data'][$sub_idx]['forum_status'] == FORUM_LOCKED) {
                $sub_folder = $images['acp_icon_minipost_lock'];
                $sub_l_folder = $lang['Forum_locked'];
            }
            if ($tree['type'][$sub_idx] == POST_CAT_URL || !empty($tree['sub'][$sub_this])) {
                $sub_folder = $images['acp_icon_minicat'];
                $sub_l_folder = $lang['Category'];
                if ($tree['data'][$sub_idx]['forum_status'] == FORUM_LOCKED) {
                    $sub_folder = $images['acp_icon_minicat_locked'];
                    $sub_l_folder = $lang['Category_locked'];
                }
            }
            if (!empty($tree['data'][$sub_idx]['forum_link'])) {
                $sub_folder = $images['acp_icon_minilink'];
                $sub_l_folder = $lang['Forum_link'];
            }
            $link = '<a href="' . append_sid('admin_forums_extend.' . PHP_EXT . '?selected_id=' . $sub_this) . '" class="gensmall" style="text-decoration: none;">';
            $link .= '<img src="' . $sub_folder . '" alt="' . $sub_l_folder . '" style="vertical-align: middle;" />';
            $link .= '&nbsp;' . get_object_lang($sub_this, 'name', true) . '</a>';
            $links .= (empty($links) ? '' : ', ') . $link;
        }
        $template->assign_block_vars('row.has_sublevels', array('LINKS' => $links));
        // build sub-levels (expanded)
        for ($i = 0; $i < sizeof($tree['sub'][$CH_this]); $i++) {
            $sub_this = $tree['sub'][$CH_this][$i];
            $sub_idx = $tree['keys'][$sub_this];
            add_row($sub_idx, $sub_this, $level + 1, $i);
        }
    } else {
        $template->assign_block_vars('row.has_no_sublevels', array());
    }
}
Esempio n. 2
0
if(!empty($topic_id))
{
	$sql = "SELECT f.forum_id, f.forum_name, f.forum_topics, t.topic_poster FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f
		WHERE t.topic_id = " . $topic_id . " AND f.forum_id = t.forum_id";
	$db->sql_return_on_error(true);
	$result = $db->sql_query($sql);
	$db->sql_return_on_error(false);
	if(!$result)
	{
		if (!defined('STATUS_404')) define('STATUS_404', true);
		message_die(GENERAL_MESSAGE, 'NO_TOPIC');
	}
	$topic_row = $db->sql_fetchrow($result);
	$forum_topics = ($topic_row['forum_topics'] == '0') ? '1' : $topic_row['forum_topics'];
	$forum_id = $topic_row['forum_id'];
	$forum_name = get_object_lang(POST_FORUM_URL . $topic_row['forum_id'], 'name');
}
elseif(!empty($forum_id))
{
	$sql = "SELECT COUNT(t.topic_id) AS total_topics FROM " . TOPICS_TABLE . " t WHERE t.forum_id = " . $forum_id . " $where_type";
	$db->sql_return_on_error(true);
	$result = $db->sql_query($sql);
	$db->sql_return_on_error(false);
	if(!$result)
	{
		if (!defined('STATUS_404')) define('STATUS_404', true);
		message_die(GENERAL_MESSAGE, 'NO_FORUM');
	}
	$topic_row = $db->sql_fetchrow($result);
	$forum_topics = $topic_row['total_topics'];
}
Esempio n. 3
0
	default:
		message_die(GENERAL_MESSAGE, $lang['No_valid_mode']);
}

$result = $db->sql_query($sql);
$post_info = $db->sql_fetchrow($result);
if ($result && $post_info)
{
	$db->sql_freeresult($result);

	$forum_id = $post_info['forum_id'];
	if (!empty($post_info['topic_calendar_duration']))
	{
		$post_info['topic_calendar_duration']++;
	}
	$forum_name = get_object_lang(POST_FORUM_URL . $post_info['forum_id'], 'name');

	$is_auth = auth(AUTH_ALL, $forum_id, $user->data, $post_info);

	// Topic Lock/Unlock
	$lock = (isset($_POST['lock'])) ? true : false;
	$unlock = (isset($_POST['unlock'])) ? true : false;

	if (($submit || $confirm) && ($lock || $unlock) && $is_auth['auth_mod'] && ($mode != 'newtopic') && (!$refresh))
	{
		$t_id = (!isset($post_info['topic_id'])) ? $topic_id : $post_info['topic_id'];
		if ($lock || $unlock)
		{
			$sql = "UPDATE " . TOPICS_TABLE . "
			SET topic_status = " . ($lock ? TOPIC_LOCKED : TOPIC_UNLOCKED) . "
			WHERE topic_id = " . $t_id . "
Esempio n. 4
0
            $link .= '&nbsp;' . get_object_lang($sub_this, 'name', true) . '</a>';
            $links .= (empty($links) ? '' : ',</span> ') . $link;
        }
        if ($links != '') {
            $links .= '</span>';
        }
        $icon = '';
        if (!empty($tree['data'][$idx]['icon'])) {
            $icon = $tree['data'][$idx]['icon'];
            $icon_img = $icon;
            if (isset($images[$icon_img])) {
                $icon_img = $phpbb_root_path . $images[$icon_img];
            }
        }
        $color = !$color;
        $template->assign_block_vars('row', array('COLOR' => $color ? 'row1' : 'row2', 'FOLDER' => $phpbb_root_path . $folder, 'L_FOLDER' => $l_folder, 'ICON_IMG' => $icon_img, 'ICON' => $icon, 'FORUM_NAME' => get_object_lang($this_key, 'name', true), 'FORUM_DESC' => get_object_lang($this_key, 'desc', true), 'TOPICS' => $tree['data'][$idx]['tree.forum_topics'], 'POSTS' => $tree['data'][$idx]['tree.forum_posts'], 'LINKS' => empty($links) ? '' : '<br /><b>' . $lang['Subforums'] . ':&nbsp;</b>' . $links, 'U_FORUM' => append_sid("./admin_forums.{$phpEx}?selected_id={$this_key}"), 'U_EDIT' => append_sid("./admin_forums.{$phpEx}?mode=edit&fid={$this_key}"), 'U_DELETE' => append_sid("./admin_forums.{$phpEx}?mode=delete&fid={$this_key}"), 'U_RESYNC' => append_sid("./admin_forums.{$phpEx}?mode=resync&fid={$this_key}"), 'U_MOVEUP' => append_sid("./admin_forums.{$phpEx}?mode=moveup&fid={$this_key}"), 'U_MOVEDW' => append_sid("./admin_forums.{$phpEx}?mode=movedw&fid={$this_key}")));
        if (!empty($icon)) {
            $template->assign_block_vars('row.forum_icon', array());
        }
    }
    // no subforums
    if (empty($tree['sub'][$selected_id])) {
        $template->assign_block_vars('empty', array());
    }
    // footer
    $s_hidden_fields = '';
    $s_hidden_fields .= '<input type="hidden" name="selected_id" value="' . $selected_id . '" />';
    $template->assign_vars(array('L_INDEX' => sprintf($lang['Forum_Index'], $board_config['sitename']), 'NAV_CAT_DESC' => admin_get_nav_cat_desc($selected_id), 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'U_INDEX' => append_sid("./admin_forums.{$phpEx}"), 'S_ACTION' => append_sid("./admin_forums.{$phpEx}")));
}
// dump
$template->pparse('body');
Esempio n. 5
0
		$mark_as_read = '';
		$mark_always_read = '<a href="' . append_sid(CMS_PAGE_FORUM . '?forum_id=' . $forum_id . $kb_mode_append . '&amp;always_read=unset') . '">' . $lang['upi2db_always_read_forum_unset_short'] . '</a>';
		$marked_as_read = $lang['upi2db_forum_is_always_read'];
	}
}
else
{
	$mark_as_read = '<a href="' . append_sid(CMS_PAGE_VIEWFORUM . '?' . $forum_id_append . $kb_mode_append . '&amp;mark=topics') . '">' . $lang['Mark_all_topics'] . '</a>';
	$mark_always_read = '';
	$marked_as_read = '';
}
// UPI2DB - END

// Dump out the page header and load viewforum template

$forum_row['forum_name'] = get_object_lang(POST_FORUM_URL . $forum_id, 'name');
if ($config['display_viewonline'])
{
	define('SHOW_ONLINE', true);
}
if (!$config['board_disable'] || ($config['board_disable'] && ($user->data['user_level'] == ADMIN)))
{
	$template->vars['S_TPL_FILENAME'] = 'index';
}

//$template->assign_block_vars('google_ad', array());
$meta_content['page_title'] = $forum_row['forum_name'];
$meta_content['description'] = '';
$meta_content['keywords'] = '';
$breadcrumbs['bottom_right_links'] = '';
if ($user->data['session_logged_in'] && !$user->data['is_bot'])
function get_tree_option($cur = '', $all = false)
{
    global $tree, $lang;
    $keys = array();
    $keys = get_auth_keys('Root', $all);
    $last_level = -1;
    $res = '';
    for ($i = 0; $i < sizeof($keys['id']); $i++) {
        // only get object that are not forum links type
        if (empty($tree['type'][$keys['idx'][$i]]) || empty($tree['data'][$keys['idx'][$i]]['forum_link']) || $tree['type'][$keys['idx'][$i]] != POST_FORUM_URL) {
            $level = $keys['real_level'][$i];
            $inc = '';
            for ($k = 0; $k < $level; $k++) {
                $inc .= "[*{$k}*]&nbsp;&nbsp;&nbsp;";
            }
            if ($level < $last_level) {
                //insert spacer if level goes down
                $res .= '<option value="-1">' . $inc . '|&nbsp;&nbsp;&nbsp;</option>';
                // make valid lines solid
                $res = str_replace("[*{$level}*]", "|", $res);
                // erase all unnessecary lines
                for ($k = $level + 1; $k < $last_level; $k++) {
                    $res = str_replace("[*{$k}*]", "&nbsp;", $res);
                }
            } elseif ($level == 0 && $last_level == -1) {
                $res .= '<option value="-1">|</option>';
            }
            $last_level = $level;
            $selected = $cur == $keys['id'][$i] ? ' selected="selected"' : '';
            $res .= '<option value="' . $keys['id'][$i] . '"' . $selected . '>';
            // name
            $name = strip_tags(get_object_lang($keys['id'][$i], 'name', $all));
            if ($keys['level'][$i] >= 0) {
                $res .= $inc . '|--';
            }
            $res .= $name . '</option>';
        }
    }
    // erase all unnessecary lines
    for ($k = 0; $k < $last_level; $k++) {
        $res = str_replace("[*{$k}*]", "&nbsp;", $res);
    }
    return $res;
}
Esempio n. 7
0
// UPI2DB - BEGIN
				// Edited By Mighty Gorgon - BEGIN
				if (($user->data['user_level'] == ADMIN) || ($user->data['user_level'] == MOD))
				{
					$mark_read_forbid = false;
				}
				else
				{
					$mark_read_forbid = (($tt == POST_STICKY) || ($tt == POST_ANNOUNCE) || ($tt == POST_GLOBAL_ANNOUNCE)) ? true : false;
				}
				// Edited By Mighty Gorgon - END
// UPI2DB - END

				$template->assign_block_vars('searchresults', array(
					'ROW_CLASS' => (!($i % 2)) ? $theme['td_class1'] : $theme['td_class2'],
					'FORUM_NAME' => get_object_lang(POST_FORUM_URL . $searchset[$i]['forum_id'], 'name'),
					'FORUM_ID' => $forum_id,
					'TOPIC_ID' => $topic_id,

					'TOPIC_FOLDER_IMG' => $topic_link['image'],
					'L_TOPIC_FOLDER_ALT' => $topic_link['image_alt'],
					'TOPIC_AUTHOR' => $topic_author,
					'TOPIC_TITLE' => $topic_title,
					'TOPIC_TITLE_PLAIN' => $topic_title_plain,
					'TOPIC_TYPE' => $topic_link['type'],
					'TOPIC_TYPE_ICON' => $topic_link['icon'],
					'TOPIC_CLASS' => (!empty($topic_link['class_new']) ? ('topiclink' . $topic_link['class_new']) : $topic_link['class']),
					'CLASS_NEW' => $topic_link['class_new'],
					'NEWEST_POST_IMG' => $topic_link['newest_post_img'],
					'L_NEWS' => $news_label,
					'TOPIC_ATTACHMENT_IMG' => topic_attachment_image($searchset[$i]['topic_attachment']),
function make_cat_nav_tree($cur, $pgm = '', $nav_class = 'nav', $topic_title = '', $forum_id = 0)
{
    global $phpbb_root_path, $phpEx, $db;
    global $global_orig_word, $global_replacement_word;
    global $nav_separator;
    global $tree;
    // get topic or post level
    $type = substr($cur, 0, 1);
    $id = intval(substr($cur, 1));
    $fcur = '';
    switch ($type) {
        case POST_TOPIC_URL:
            if (empty($forum_id) || empty($topic_title)) {
                $sql = "SELECT forum_id, topic_title\n\t\t\t\t\t\t\tFROM " . TOPICS_TABLE . " WHERE topic_id = {$id}";
                if (!($result = $db->sql_query($sql))) {
                    message_die(GENERAL_ERROR, 'Could not query topics information', '', __LINE__, __FILE__, $sql);
                }
                if ($row = $db->sql_fetchrow($result)) {
                    $topic_title = $row['topic_title'];
                    $forum_id = $row['forum_id'];
                }
            } else {
                $row = array();
                $row['topic_title'] = $topic_title;
                $row['forum_id'] = $forum_id;
            }
            if (!empty($forum_id)) {
                $fcur = POST_FORUM_URL . $row['forum_id'];
                $topic_title = $row['topic_title'];
                $orig_word = array();
                $replacement_word = array();
                obtain_word_list($orig_word, $replacement_word);
                if (count($orig_word)) {
                    $topic_title = preg_replace($orig_word, $replacement_word, $topic_title);
                }
            }
            break;
        case POST_POST_URL:
            if (empty($forum_id) || empty($topic_title)) {
                $sql = "SELECT t.forum_id, t.topic_title\n\t\t\t\t\t\t\tFROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t\n\t\t\t\t\t\t\tWHERE t.topic_id=p.topic_id AND post_id = {$id}";
                if (!($result = $db->sql_query($sql))) {
                    message_die(GENERAL_ERROR, 'Could not query posts information', '', __LINE__, __FILE__, $sql);
                }
                if (!($row = $db->sql_fetchrow($result))) {
                    $row['forum_id'] = 0;
                    $row['topic_title'] = '';
                }
            } else {
                $row['forum_id'] = $forum_id;
                $row['topic_title'] = $topic_title;
            }
            if (!empty($forum_id) && !empty($topic_title)) {
                $fcur = POST_FORUM_URL . $row['forum_id'];
                $topic_title = $row['topic_title'];
                $orig_word = array();
                $replacement_word = array();
                obtain_word_list($orig_word, $replacement_word);
                if (count($orig_word)) {
                    $topic_title = preg_replace($orig_word, $replacement_word, $topic_title);
                }
            }
            break;
    }
    // keep the compliancy with prec versions
    if (!isset($tree['keys'][$cur])) {
        $cur = isset($tree['keys'][POST_CAT_URL . $cur]) ? POST_CAT_URL . $cur : $cur;
    }
    // find the object
    $this_key = isset($tree['keys'][$cur]) ? $tree['keys'][$cur] : -1;
    $res = '';
    while ($this_key >= 0 || $fcur != '') {
        $type = substr($fcur, 0, 1) != '' ? substr($cur, 0, 1) : $tree['type'][$this_key];
        switch ($type) {
            case POST_CAT_URL:
                $field_name = get_object_lang($cur, 'name');
                $param_type = POST_CAT_URL;
                $param_value = $tree['id'][$this_key];
                $pgm_name = "forum.{$phpEx}";
                break;
            case POST_FORUM_URL:
                $field_name = get_object_lang($cur, 'name');
                $param_type = POST_FORUM_URL;
                $param_value = $tree['id'][$this_key];
                $pgm_name = "viewforum.{$phpEx}";
                break;
            case POST_TOPIC_URL:
                $field_name = $topic_title;
                $param_type = POST_TOPIC_URL;
                $param_value = $id;
                $pgm_name = "viewtopic.{$phpEx}";
                break;
            case POST_POST_URL:
                $field_name = $topic_title;
                $param_type = POST_POST_URL;
                $param_value = $id . '#' . $id;
                $pgm_name = "viewtopic.{$phpEx}";
                break;
            default:
                $field_name = '';
                $param_type = '';
                $param_value = '';
                $pgm_name = "index.{$phpEx}";
                break;
        }
        if ($pgm != '') {
            $pgm_name = "{$pgm}.{$phpEx}";
        }
        if (!empty($field_name)) {
            $res = '<a href="' . append_sid('./' . $pgm_name . ($field_name != '' ? "?{$param_type}={$param_value}" : '')) . '" class="' . $nav_class . '">' . $field_name . '</a>' . ($res != '' ? $nav_separator . $res : '');
        }
        // find parent object
        if ($fcur != '') {
            $cur = $fcur;
            $pgm = '';
            $fcur = '';
            $topic_title = '';
        } else {
            $cur = $tree['main'][$this_key];
        }
        $this_key = isset($tree['keys'][$cur]) ? $tree['keys'][$cur] : -1;
    }
    return $res;
}
    $template->set_filenames(array('body' => 'auth_select_body.tpl'));
    $select_list = '<select name="' . POST_FORUM_URL . '">';
    for ($i = 0; $i < count($forum_rows); $i++) {
        $select_list .= '<option value="' . $forum_rows[$i]['forum_id'] . '">' . $forum_rows[$i]['forum_name'] . '</option>';
    }
    $select_list .= '</select>';
    $template->assign_vars(array('L_AUTH_TITLE' => $lang['Auth_Control_Forum'], 'L_AUTH_EXPLAIN' => $lang['Forum_auth_explain'], 'L_AUTH_SELECT' => $lang['Select_a_Forum'], 'L_LOOK_UP' => $lang['Look_up_Forum'], 'S_AUTH_ACTION' => append_sid("admin_forumauth.{$phpEx}"), 'S_AUTH_SELECT' => $select_list));
} else {
    //
    // Output the authorisation details if an id was
    // specified
    //
    $template->set_filenames(array('body' => 'auth_forum_body.tpl'));
    $forum_name = $forum_rows[0]['forum_name'];
    $forum_rows[0] = $tree['data'][$tree['keys'][POST_FORUM_URL . $forum_id]];
    $forum_name_trad = get_object_lang(POST_FORUM_URL . $forum_id, 'name');
    $forum_name = $forum_rows[0]['forum_name'];
    if ($forum_name != $forum_name_trad) {
        $forum_name = '(' . $forum_name . ') ' . $forum_name_trad;
    }
    @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;
Esempio n. 10
0
        include IP_ROOT_PATH . 'includes/class_mcp.' . PHP_EXT;
    }
    if (empty($class_mcp)) {
        $class_mcp = new class_mcp();
    }
    for ($i = 0; $i < sizeof($forum_rows); $i++) {
        $p_result = prune($forum_rows[$i]['forum_id'], $prunedate);
        $class_mcp->sync('forum', $forum_rows[$i]['forum_id']);
        $row_class = !($i % 2) ? $theme['td_class1'] : $theme['td_class2'];
        $template->assign_block_vars('prune_results', array('ROW_CLASS' => $row_class, 'FORUM_NAME' => get_object_lang(POST_FORUM_URL . $forum_rows[$i]['forum_id'], 'name'), 'FORUM_TOPICS' => $p_result['topics'], 'FORUM_POSTS' => $p_result['posts']));
    }
    $template->assign_vars(array('L_FORUM_PRUNE' => $lang['Forum_Prune'], 'L_FORUM' => $lang['Forum'], 'L_TOPICS_PRUNED' => $lang['Topics_pruned'], 'L_POSTS_PRUNED' => $lang['Posts_pruned'], 'L_PRUNE_RESULT' => $lang['Prune_success']));
} else {
    // If they haven't selected a forum for pruning yet then display a select box to use for pruning.
    if (empty($_POST[POST_FORUM_URL])) {
        // Output a selection table if no forum id has been specified.
        $template->set_filenames(array('body' => ADM_TPL . 'forum_prune_select_body.tpl'));
        $select_list = ip_make_forum_select(POST_FORUM_URL, false, '', true);
        $template->assign_vars(array('L_FORUM_PRUNE' => $lang['Forum_Prune'], 'L_SELECT_FORUM' => $lang['Select_a_Forum'], 'L_LOOK_UP' => $lang['Look_up_Forum'], 'S_FORUMPRUNE_ACTION' => append_sid('admin_forum_prune.' . PHP_EXT), 'S_FORUMS_SELECT' => $select_list));
    } else {
        // Output the form to retrieve Prune information.
        $template->set_filenames(array('body' => ADM_TPL . 'forum_prune_body.tpl'));
        $forum_name = $fid == 'Root' ? $lang['All_Forums'] : get_object_lang($fid, 'name');
        $prune_data = $lang['Prune_topics_not_posted'] . " ";
        $prune_data .= '<input class="post" type="text" name="prunedays" size="4" /> ' . $lang['Days'];
        $hidden_input = '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $fid . '" />';
        $template->assign_vars(array('FORUM_NAME' => $forum_name, 'L_FORUM' => $parent_id > 0 ? $lang['Category'] : $lang['Forum'], 'L_FORUM_PRUNE' => $lang['Forum_Prune'], 'L_FORUM_PRUNE_EXPLAIN' => $lang['Forum_Prune_explain'], 'L_DO_PRUNE' => $lang['Do_Prune'], 'S_FORUMPRUNE_ACTION' => append_sid('admin_forum_prune.' . PHP_EXT), 'S_PRUNE_DATA' => $prune_data, 'S_HIDDEN_VARS' => $hidden_input));
    }
}
$template->pparse('body');
include IP_ROOT_PATH . ADM . '/page_footer_admin.' . PHP_EXT;
Esempio n. 11
0
                                 } else {
                                     $optionlist_acl_adv[$forum_id][$k] .= '<option value="1">' . $lang['ON'] . '</option><option value="0" selected="selected">' . $lang['OFF'] . '</option>';
                                 }
                             }
                             $optionlist_acl_adv[$forum_id][$k] .= '</select>';
                         }
                     }
                 }
             }
         }
         $optionlist_mod = '<select id="moderator_id_' . $forum_id . '" name="moderator[' . $forum_id . ']">';
         $optionlist_mod .= $user_ary['auth_mod'] ? '<option value="1" selected="selected">' . $lang['Is_Moderator'] . '</option><option value="0">' . $lang['Not_Moderator'] . '</option>' : '<option value="1">' . $lang['Is_Moderator'] . '</option><option value="0" selected="selected">' . $lang['Not_Moderator'] . '</option>';
         $optionlist_mod .= '</select>';
         $row_class = !($i % 2) ? 'row2' : 'row1';
         $template->assign_block_vars('row', array());
         $template->assign_block_vars('row.forums', array('INC_SPAN' => $max_level - $level + 1, 'ROW_CLASS' => $row_class, 'FORUM_NAME' => get_object_lang(POST_FORUM_URL . $tree['data'][$keys['idx'][$i]]['forum_id'], 'name'), 'U_FORUM_AUTH' => append_sid('admin_forumauth.' . PHP_EXT . '?' . POST_FORUM_URL . '=' . $tree['data'][$keys['idx'][$i]]['forum_id']), 'S_MOD_SELECT' => $optionlist_mod));
         for ($k = 1; $k <= $level; $k++) {
             $template->assign_block_vars('row.forums.inc', array());
         }
         if (!$adv) {
             $template->assign_block_vars('row.forums.aclvalues', array('S_ACL_SELECT' => $optionlist_acl));
         } else {
             for ($j = 0; $j < sizeof($forum_auth_fields); $j++) {
                 $template->assign_block_vars('row.forums.aclvalues', array('S_ACL_SELECT' => $optionlist_acl_adv[$forum_id][$j]));
             }
         }
     }
 }
 //	@reset($auth_user);
 if ($mode == 'user') {
     $t_username = $ug_info[0]['username'];
Esempio n. 12
0
function get_tree_option_optg($cur = '', $all = false, $opt_prefix = true, $mark_selected = false)
{
    global $tree, $lang;
    $keys = array();
    $keys = get_auth_keys('Root', $all);
    $last_level = -1;
    $cat_open = false;
    for ($i = 0; $i < sizeof($keys['id']); $i++) {
        // only get object that are not forum links type
        if ($tree['type'][$keys['idx'][$i]] != POST_FORUM_URL || empty($tree['data'][$keys['idx'][$i]]['forum_link'])) {
            $level = $keys['real_level'][$i];
            $inc = '';
            for ($k = 0; $k < $level; $k++) {
                $inc .= "[*{$k}*]&nbsp;&nbsp;&nbsp;";
            }
            if ($level < $last_level) {
                //insert spacer if level goes down
                //$res .='<option value="-1">' . $inc . '|&nbsp;&nbsp;&nbsp;</option>';
                // make valid lines solid
                $res = str_replace("[*{$level}*]", "|", $res);
                // erase all unnessecary lines
                for ($k = $level + 1; $k < $last_level; $k++) {
                    $res = str_replace("[*{$k}*]", "&nbsp;", $res);
                }
            } elseif ($level == 0 && $last_level == -1) {
                //$res .='<option value="-1">|</option>';
            }
            $last_level = $level;
            if ($tree['type'][$keys['idx'][$i]] == POST_CAT_URL) {
                if ($cat_open == true) {
                    $res .= '</optgroup>';
                } else {
                    $cat_open = true;
                }
                $res .= '<optgroup label="';
                // name
                $name = strip_tags(get_object_lang($keys['id'][$i], 'name', $all));
                if ($keys['level'][$i] >= 0) {
                    $res .= $inc . '|--';
                }
                $res .= $name . '">';
            } else {
                if ($keys['id'][$i] != 'Root') {
                    $is_selected = $cur == $keys['id'][$i] ? true : false;
                    $selected = $is_selected ? ' selected="selected"' : '';
                    if ($opt_prefix == true) {
                        $res .= '<option value="' . $keys['id'][$i] . '"' . $selected . '>';
                    } else {
                        $res .= '<option value="' . str_replace(POST_FORUM_URL, '', $keys['id'][$i]) . '"' . $selected . '>';
                    }
                    // name
                    $name = ($is_selected && $mark_selected ? ' * ' : '') . strip_tags(get_object_lang($keys['id'][$i], 'name', $all));
                    if ($keys['level'][$i] >= 0) {
                        $res .= $inc . '|--';
                    }
                    $res .= $name . '</option>';
                }
            }
        }
    }
    if ($cat_open == true) {
        $res .= '</optgroup>';
    }
    // erase all unnecessary lines
    for ($k = 0; $k < $last_level; $k++) {
        $res = str_replace("[*{$k}*]", "&nbsp;", $res);
    }
    return $res;
}