$s_month = '';
for ($i = 0; $i < sizeof($set_of_months); $i++) {
    $selected = $month == $i + 1 ? ' selected="selected"' : '';
    $s_month .= '<option value="' . ($i + 1) . '"' . $selected . '>' . $lang['datetime'][$set_of_months[$i]] . '</option>';
}
$s_month = sprintf('<select name="start_month" onchange="forms[\'f_calendar_scheduler\'].submit();">%s</select>', $s_month);
// buid select list for year
$year = intval(gmdate('Y', $start_date));
$s_year = '<select name="start_year" onchange="forms[\'f_calendar_scheduler\'].submit();">';
for ($i = 1971; $i < 2070; $i++) {
    $selected = $year == $i ? ' selected="selected"' : '';
    $s_year .= '<option value="' . $i . '"' . $selected . '>' . $i . '</option>';
}
$s_year .= '</select>';
// build a forum select list
$s_forum_list = '<select name="selected_id" onchange="forms[\'f_calendar_scheduler\'].submit();">' . get_tree_option($fid) . '</select>';
// send header
$k = $first_day_of_week;
for ($i = 0; $i <= 6; $i++) {
    $template->assign_block_vars('header_cell', array('L_DAY' => $lang['datetime'][$set_of_days[$k]]));
    $k++;
    if ($k > 6) {
        $k = 0;
    }
}
$prec = gmmktime(0, 0, 0, $month - 1, $day, $year);
$next = gmmktime(0, 0, 0, $month + 1, $day, $year);
$template->assign_vars(array('S_MONTH' => $s_month, 'S_YEAR' => $s_year, 'U_PREC' => append_sid('calendar_scheduler.' . PHP_EXT . '?d=' . $prec . '&amp;fid=' . $fid), 'U_NEXT' => append_sid('calendar_scheduler.' . PHP_EXT . '?d=' . $next . '&amp;fid=' . $fid), 'U_CALENDAR' => append_sid('calendar.' . PHP_EXT . '?start=' . $year . $month . '01&amp;fid=' . $fid), 'L_CALENDAR' => $lang['Calendar'], 'IMG_CALENDAR' => $images['icon_calendar']));
// get first day of the month
$offset = gmdate('w', gmmktime(0, 0, 0, $month, 01, $year)) - $first_day_of_week;
if ($offset < 0) {
         $s_pos_opt .= '<option value="' . $tree['sub'][$item['main']][$i] . '"' . $selected . '>|--&nbsp;' . get_object_lang($tree['sub'][$item['main']][$i], 'name', true) . '</option>';
     }
 }
 // Auth duplication
 $forumlist = '<option value="-1">' . $lang['None'] . '</option>' . get_tree_option_optg('', true, true);
 // place to move topics and attachements
 $s_move_opt = get_tree_option('--', true);
 $s_move_opt = '<option value="" selected="selected">' . $lang['Delete_all_posts'] . '</option>' . $s_move_opt;
 // icon
 $icon_img = empty($item['icon']) ? '' : '<br /><img src="' . (isset($images[$item['icon']]) ? $images[$item['icon']] : $item['icon']) . '" alt="' . $item['icon'] . '" title="' . $item['icon'] . '" />';
 $icon = $item['icon'];
 // Mighty Gorgon - Forum Icons Select - BEGIN
 $icons_list = build_icons_select_box('../', 'images/forums/', 'icon', 'icon_image_sel', $icon, false, false, ' onchange="update_icon(this.options[selectedIndex].value);"');
 // Mighty Gorgon - Forum Icons Select - END
 // vars
 $template->assign_vars(array('L_COPY_AUTH' => $lang['Copy_Auth'], 'L_COPY_AUTH_EXPLAIN' => $lang['Copy_Auth_Explain'], 'S_FORUM_LIST' => $forumlist, 'S_TYPE_OPT' => $s_type_opt, 'NAME' => htmlspecialchars(stripslashes($item['name'])), 'NAME_CLEAN' => $item['name_clean'], 'DESC' => htmlspecialchars(stripslashes($item['desc'])), 'S_FORUMS_OPT' => get_tree_option($item['main'], true), 'S_POS_OPT' => $s_pos_opt, 'S_STATUS_OPT' => $s_status_opt, 'S_MOVE_OPT' => $s_move_opt, 'ICON' => $item['icon'], 'ICON_LIST' => $icons_list, 'ICON_IMG' => IP_ROOT_PATH . ($icon != '' ? $icon : 'images/spacer.gif'), 'MODE' => $mode, 'PRUNE_DISPLAY' => $item['prune_enable'] ? '' : 'none', 'PRUNE_ENABLE_YES' => $item['prune_enable'] ? 'checked="checked"' : '', 'PRUNE_ENABLE_NO' => !$item['prune_enable'] ? 'checked="checked"' : '', 'PRUNE_DAYS' => $item['prune_days'], 'PRUNE_FREQ' => $item['prune_freq'], 'FORUM_LINK' => $item['link'], 'FORUM_LIKE_YES' => $item['forum_likes'] ? ' checked="checked"' : '', 'FORUM_LIKE_NO' => !$item['forum_likes'] ? ' checked="checked"' : '', 'FORUM_LIMIT_EDIT_TIME_YES' => $item['forum_limit_edit_time'] ? ' checked="checked"' : '', 'FORUM_LIMIT_EDIT_TIME_NO' => !$item['forum_limit_edit_time'] ? ' checked="checked"' : '', 'FORUM_SIMILAR_TOPICS_YES' => $item['forum_similar_topics'] ? ' checked="checked"' : '', 'FORUM_SIMILAR_TOPICS_NO' => !$item['forum_similar_topics'] ? ' checked="checked"' : '', 'FORUM_TOPIC_VIEWS_YES' => $item['forum_topic_views'] ? ' checked="checked"' : '', 'FORUM_TOPIC_VIEWS_NO' => !$item['forum_topic_views'] ? ' checked="checked"' : '', 'FORUM_TAGS_YES' => $item['forum_tags'] ? ' checked="checked"' : '', 'FORUM_TAGS_NO' => !$item['forum_tags'] ? ' checked="checked"' : '', 'FORUM_SORT_BOX_YES' => $item['forum_sort_box'] ? ' checked="checked"' : '', 'FORUM_SORT_BOX_NO' => !$item['forum_sort_box'] ? ' checked="checked"' : '', 'FORUM_KB_MODE_YES' => $item['forum_kb_mode'] ? ' checked="checked"' : '', 'FORUM_KB_MODE_NO' => !$item['forum_kb_mode'] ? ' checked="checked"' : '', 'FORUM_RECURRING_FIRST_POST_YES' => $item['forum_recurring_first_post'] ? ' checked="checked"' : '', 'FORUM_RECURRING_FIRST_POST_NO' => !$item['forum_recurring_first_post'] ? ' checked="checked"' : '', 'FORUM_INDEX_ICONS_YES' => $item['forum_index_icons'] ? ' checked="checked"' : '', 'FORUM_INDEX_ICONS_NO' => !$item['forum_index_icons'] ? ' checked="checked"' : '', 'FORUM_NOTIFY_YES' => $item['forum_notify'] ? ' checked="checked"' : '', 'FORUM_NOTIFY_NO' => !$item['forum_notify'] ? ' checked="checked"' : '', 'FORUM_POST_COUNT_YES' => $item['forum_postcount'] ? ' checked="checked"' : '', 'FORUM_POST_COUNT_NO' => !$item['forum_postcount'] ? ' checked="checked"' : '', 'FORUM_RULES' => $item['forum_rules_switch'] ? ' checked="checked"' : '', 'RULES' => $item['forum_rules'], 'RULES_CUSTOM_TITLE' => $item['forum_rules_custom_title'], 'S_RULES_DISPLAY_TITLE_ENABLED' => !empty($item['forum_rules_display_title']) ? 'checked="checked"' : '', 'S_RULES_VIEWFORUM_ENABLED' => !empty($item['forum_rules_in_viewforum']) ? 'checked="checked"' : '', 'S_RULES_VIEWTOPIC_ENABLED' => !empty($item['forum_rules_in_viewtopic']) ? 'checked="checked"' : '', 'S_RULES_POSTING_ENABLED' => !empty($item['forum_rules_in_posting']) ? 'checked="checked"' : '', 'LINK_INTERNAL_YES' => $item['link_internal'] ? 'checked="checked"' : '', 'LINK_INTERNAL_NO' => !$item['link_internal'] ? 'checked="checked"' : '', 'LINK_COUNT_YES' => $item['link_hit_count'] ? 'checked="checked"' : '', 'LINK_COUNT_NO' => !$item['link_hit_count'] ? 'checked="checked"' : '', 'S_PRESET_OPT' => $s_presets, 'AUTH_SPAN' => $item['type'] == POST_FORUM_URL ? 4 : 1));
 // some switches
 if ($item['type'] == POST_CAT_URL) {
     $template->assign_block_vars('category', array());
 } else {
     $template->assign_block_vars('no_category', array());
 }
 if ($item['type'] == POST_FORUM_URL) {
     $template->assign_block_vars('forum', array());
 } else {
     $template->assign_block_vars('no_forum', array());
 }
 if ($item['type'] == POST_FLINK_URL) {
     $template->assign_block_vars('link', array());
 } else {
     $template->assign_block_vars('no_link', array());
function display_calendar($main_template, $nb_days = 0, $start = 0, $fid = '')
{
    global $db, $cache, $config, $user, $template, $images, $lang, $bbcode, $tree;
    static $handler;
    if (empty($handler)) {
        $handler = 1;
    } else {
        $handler++;
    }
    $day_of_week = array($lang['datetime']['Sunday'], $lang['datetime']['Monday'], $lang['datetime']['Tuesday'], $lang['datetime']['Wednesday'], $lang['datetime']['Thursday'], $lang['datetime']['Friday'], $lang['datetime']['Saturday']);
    $months = array(' ------------ ', $lang['datetime']['January'], $lang['datetime']['February'], $lang['datetime']['March'], $lang['datetime']['April'], $lang['datetime']['May'], $lang['datetime']['June'], $lang['datetime']['July'], $lang['datetime']['August'], $lang['datetime']['September'], $lang['datetime']['October'], $lang['datetime']['November'], $lang['datetime']['December']);
    // get some parameter
    $first_day_of_week = isset($config['calendar_week_start']) ? intval($config['calendar_week_start']) : 1;
    $nb_row_per_cell = isset($config['calendar_nb_row']) ? intval($config['calendar_nb_row']) : 5;
    // get the start date - calendar doesn't go before 1971
    $cur_date = empty($start) || intval(gmdate('Y', $start)) < 1971 ? cal_date(time(), $config['board_timezone']) : $start;
    $cur_date = gmmktime(0, 0, 0, intval(gmdate('m', $cur_date)), intval(gmdate('d', $cur_date)), intval(gmdate('Y', $cur_date)));
    $cur_month = 0;
    $cur_day = 0;
    // the full month is displayed
    if (empty($nb_days)) {
        // set indicator
        $full_month = true;
        // set the start day on the start of the month
        $start_date = gmmktime(0, 0, 0, intval(gmdate('m', $cur_date)), 01, intval(gmdate('Y', $cur_date)));
        // get the day number set as start of the display
        $cfg_week_day_start = $first_day_of_week;
        // get the number of blank cells
        $start_inc = intval(gmdate('w', $start_date)) - $cfg_week_day_start;
        if ($start_inc < 0) {
            $start_inc = 7 + $start_inc;
        }
        // Used to adjust birthdays SQL
        $cur_month = intval(gmdate('n', $cur_date));
        // get the end date
        $year = intval(gmdate('Y', $start_date));
        $month = intval(gmdate('m', $start_date)) + 1;
        if ($month > 12) {
            $year++;
            $month = 1;
        }
        $end_date = gmmktime(0, 0, 0, $month, 01, $year);
        // set the number of cells per line
        $nb_cells = 7;
        // get the number of rows
        $nb_rows = intval(($start_inc + intval(($end_date - $start_date) / 86400)) / $nb_cells) + 1;
    } else {
        // set indicator
        $full_month = false;
        // set the start date to the day before the date selected
        $start_date = gmmktime(0, 0, 0, gmdate('m', $cur_date), gmdate('d', $cur_date) - 1, gmdate('Y', $cur_date));
        // get the day number set as start of the week
        $cfg_week_day_start = intval(gmdate('w', $start_date));
        // get the numbe of blank cells
        $start_inc = 0;
        // get the end date
        $end_date = gmmktime(0, 0, 0, gmdate('m', $start_date), gmdate('d', $start_date) + $nb_days, gmdate('Y', $start_date));
        // set the number of cells per line
        $nb_cells = $nb_days;
        // set the number of rows
        $nb_rows = 1;
    }
    // Ok, let's get the various events :)
    $events = array();
    $number = 0;
    // topics
    get_event_topics($events, $number, $start_date, $end_date, false, 0, -1, $fid);
    $pages_array = array('calendar.' . PHP_EXT, CMS_PAGE_FORUM, CMS_PAGE_VIEWFORUM);
    //$current_page = $_SERVER['SCRIPT_NAME'];
    $current_page = basename($_SERVER['SCRIPT_NAME']);
    // No limits in calendar
    $day_end = 0;
    $birthdays_limit = 0;
    if ($current_page != 'calendar.' . PHP_EXT) {
        // Limit total birthdays in forum and viewforum... in large could take forever!
        $birthdays_limit = 50;
        // We are not in calendar, so we can force date to today!!!
        $cur_time = time() + 3600 * $config['board_timezone'];
        $cur_month = intval(gmdate('n', $cur_time));
        $cur_day = intval(gmdate('j', $cur_time));
        // Force one week walk forward...
        $days_walk_forward = 7;
        $day_end = intval(gmdate('j', $cur_time + $days_walk_forward * 86400));
    }
    if ($config['calendar_birthday'] == true && in_array(strtolower($current_page), $pages_array)) {
        // get_birthdays(&$events, &$number, $start_date, $end_date, $year = 0, $year_lt = false, $month = 0, $day = 0, $day_end = 0, $limit = 0, $show_inactive = false)
        get_birthdays($events, $number, $start_date, $end_date, 0, false, $cur_month, $cur_day, $day_end, $birthdays_limit, false);
    }
    /*
    for ($i = 0; $i < sizeof($pages_array); $i++)
    {
    	if (strpos(strtolower($current_page), strtolower($pages_array[$i])) !== false)
    	{
    		get_birthdays($events, $number, $start_date, $end_date);
    	}
    }
    */
    // And now display them
    // build a list per date
    $map = array();
    for ($i = 0; $i < sizeof($events); $i++) {
        $event_time = $events[$i]['event_calendar_time'];
        // adjust the event period to the start of day
        $event_time_end = $event_time + $events[$i]['event_calendar_duration'];
        $event_end = gmmktime(0, 0, 0, intval(gmdate('m', $event_time_end)), intval(gmdate('d', $event_time_end)), intval(gmdate('Y', $event_time_end)));
        $event_start = gmmktime(0, 0, 0, intval(gmdate('m', $event_time)), intval(gmdate('d', $event_time)), intval(gmdate('Y', $event_time)));
        if ($event_start < $start_date) {
            $event_start = $start_date;
        }
        if ($event_end > $end_date) {
            $event_end = $end_date;
        }
        // search a free day map offset in the start day
        $event_id = $events[$i]['event_id'];
        $offset_date = $event_start;
        $map_offset = sizeof($map[$event_start]);
        $found = false;
        for ($k = 0; $k < sizeof($map[$event_start]) && !$found; $k++) {
            if ($map[$event_start][$k] == -1) {
                $found = true;
                $map_offset = $k;
            }
        }
        // mark the offset as used for the whole event period
        $offset_date = $event_start;
        while ($offset_date <= $event_end) {
            for ($l = sizeof($map[$offset_date]); $l <= $map_offset; $l++) {
                $map[$offset_date][$l] = -1;
            }
            $map[$offset_date][$map_offset] = $i;
            $offset_date = gmmktime(0, 0, 0, gmdate('m', $offset_date), gmdate('d', $offset_date) + 1, gmdate('Y', $offset_date));
        }
    }
    // template
    $template->set_filenames(array('_calendar_body' . $handler => 'calendar_box.tpl'));
    // buid select list for month
    $month = intval(gmdate('m', $start_date));
    $s_month = '<select name="start_month" onchange="forms[\'f_calendar\'].submit();">';
    for ($i = 1; $i < sizeof($months); $i++) {
        $selected = $month == $i ? ' selected="selected"' : '';
        $s_month .= '<option value="' . $i . '"' . $selected . '>' . $months[$i] . '</option>';
    }
    $s_month .= '</select>';
    // buid select list for year
    $year = intval(gmdate('Y', $start_date));
    $s_year = '<select name="start_year" onchange="forms[\'f_calendar\'].submit();">';
    for ($i = 1971; $i < 2070; $i++) {
        $selected = $year == $i ? ' selected="selected"' : '';
        $s_year .= '<option value="' . $i . '"' . $selected . '>' . $i . '</option>';
    }
    $s_year .= '</select>';
    // build a forum select list
    $s_forum_list = '<select name="selected_id" onchange="forms[\'f_calendar\'].submit();">' . get_tree_option($fid) . '</select>';
    // header
    $config['calendar_display_open'] = false;
    $template->assign_vars(array('UP_ARROW' => $images['cal_up_arrow'], 'DOWN_ARROW' => $images['cal_down_arrow'], 'UP_ARROW2' => $images['arrow_up'], 'DOWN_ARROW2' => $images['arrow_down'], 'TOGGLE_ICON' => $config['calendar_display_open'] == false ? $images['cal_up_arrow'] : $images['cal_down_arrow'], 'TOGGLE_ICON2' => $config['calendar_display_open'] == false ? $images['arrow_up'] : $images['arrow_down'], 'TOGGLE_STATUS' => $config['calendar_display_open'] == false ? 'none' : ''));
    $prec = gmdate('Ym', $start_date) > 197101 ? gmdate('Ymd', gmmktime(0, 0, 0, gmdate('m', $start_date) - 1, 01, gmdate('Y', $start_date))) : gmdate('Ymd', $start_date);
    $next = gmdate('Ymd', gmmktime(0, 0, 0, gmdate('m', $start_date) + 1, 01, gmdate('Y', $start_date)));
    $template->assign_block_vars('_calendar_box', array('L_CALENDAR' => '<a href="' . append_sid(IP_ROOT_PATH . 'calendar.' . PHP_EXT . '?start=' . gmdate('Ymd', cal_date(time(), $config['board_timezone']))) . '"><img src="' . $images['icon_calendar'] . '" hspace="3" style="vertical-align: top;" alt="' . $lang['Calendar_event'] . '" /></a>' . $lang['Calendar'], 'L_CALENDAR_TXT' => $lang['Calendar'], 'SPAN_ALL' => $nb_cells, 'S_MONTH' => $s_month, 'S_YEAR' => $s_year, 'S_FORUM_LIST' => $s_forum_list, 'L_GO' => $lang['Go'], 'ACTION' => append_sid(IP_ROOT_PATH . 'calendar.' . PHP_EXT), 'U_PREC' => append_sid('calendar.' . PHP_EXT . '?start=' . $prec . '&amp;fid=' . $fid), 'U_NEXT' => append_sid('calendar.' . PHP_EXT . '?start=' . $next . '&amp;fid=' . $fid)));
    if ($full_month) {
        $template->assign_block_vars('_calendar_box.switch_full_month', array());
        $offset = $cfg_week_day_start;
        for ($j = 0; $j < $nb_cells; $j++) {
            if ($offset >= sizeof($day_of_week)) {
                $offset = 0;
            }
            $template->assign_block_vars('_calendar_box.switch_full_month._cell', array('WIDTH' => floor(100 / $nb_cells), 'L_DAY' => $day_of_week[$offset]));
            $offset++;
        }
    } else {
        $template->assign_block_vars('_calendar_box.switch_full_month_no', array());
    }
    // display
    $offset_date = gmmktime(0, 0, 0, gmdate('m', $start_date), gmdate('d', $start_date) - $start_inc, gmdate('Y', $start_date));
    for ($i = 0; $i < $nb_rows; $i++) {
        $template->assign_block_vars('_calendar_box._row', array());
        for ($j = 0; $j < $nb_cells; $j++) {
            $span = 1;
            // date less than start
            if (intval(gmdate('Ymd', $offset_date)) < intval(gmdate('Ymd', $start_date))) {
                // compute the cell to span
                $span = $start_inc;
                $j = $start_inc - 1;
                $offset_date = gmmktime(0, 0, 0, gmdate('m', $start_date), gmdate('d', $start_date) - 1, gmdate('Y', $start_date));
            }
            // date greater than last
            if (intval(gmdate('Ymd', $offset_date)) >= intval(gmdate('Ymd', $end_date))) {
                // compute the cell to span
                $span = $nb_cells - $j;
                $j = $nb_cells;
            }
            $format = intval(gmdate('Ymd', $offset_date)) == intval(gmdate('Ymd', cal_date(time(), $config['board_timezone']))) ? '<b>%s</b>' : '%s';
            $template->assign_block_vars('_calendar_box._row._cell', array('WIDTH' => floor(100 / $nb_cells), 'SPAN' => $span, 'DATE' => sprintf($format, date_dsp(($full_month ? '' : 'D ') . $lang['DATE_FORMAT_CALENDAR'], $offset_date)), 'U_DATE' => append_sid(IP_ROOT_PATH . 'calendar_scheduler.' . PHP_EXT . '?d=' . $offset_date . '&amp;fid=' . $fid)));
            // blank cells
            if (intval(gmdate('Ymd', $offset_date)) >= intval(gmdate('Ymd', $start_date)) && intval(gmdate('Ymd', $offset_date)) < intval(gmdate('Ymd', $end_date))) {
                $template->assign_block_vars('_calendar_box._row._cell.switch_filled', array('EVENT_DATE' => $offset_date, 'TOGGLE_STATUS' => 'none', 'TOGGLE_ICON' => $images['arrow_down']));
                // send events
                $more = false;
                $over = sizeof($map[$offset_date]) > $nb_row_per_cell;
                for ($k = 0; $k < sizeof($map[$offset_date]); $k++) {
                    // we are just over the limit
                    if ($over && $k == $nb_row_per_cell) {
                        $more = true;
                        $template->assign_block_vars('_calendar_box._row._cell.switch_filled._event._more_header', array());
                    }
                    $ind = $map[$offset_date][$k];
                    $template->assign_block_vars('_calendar_box._row._cell.switch_filled._event', array('U_EVENT' => $events[$ind]['event_link'], 'EVENT_TYPE' => $events[$ind]['event_type_icon'], 'EVENT_TITLE' => $events[$ind]['event_short_title'], 'EVENT_CLASS' => $events[$ind]['event_txt_class'], 'EVENT_MESSAGE' => str_replace(array('"'), array('&quot;'), addslashes($events[$ind]['event_message']))));
                    $flag = $over && $k == $nb_row_per_cell - 1;
                    if ($ind > -1) {
                        $template->assign_block_vars('_calendar_box._row._cell.switch_filled._event.switch_event', array());
                        if ($flag) {
                            $template->assign_block_vars('_calendar_box._row._cell.switch_filled._event.switch_event._more', array());
                        } else {
                            $template->assign_block_vars('_calendar_box._row._cell.switch_filled._event.switch_event._more_no', array());
                        }
                    } else {
                        $template->assign_block_vars('_calendar_box._row._cell.switch_filled._event.switch_event_no', array());
                        if ($flag) {
                            $template->assign_block_vars('_calendar_box._row._cell.switch_filled._event.switch_event_no._more', array());
                        } else {
                            $template->assign_block_vars('_calendar_box._row._cell.switch_filled._event.switch_event_no._more_no', array());
                        }
                    }
                    if ($k == sizeof($map[$offset_date]) - 1 && $more) {
                        $template->assign_block_vars('_calendar_box._row._cell.switch_filled._event._more_footer', array());
                    }
                }
            } else {
                $template->assign_block_vars('_calendar_box._row._cell.switch_filled_no', array());
            }
            $offset_date = gmmktime(0, 0, 0, gmdate('m', $offset_date), gmdate('d', $offset_date) + 1, gmdate('Y', $offset_date));
        }
    }
    // fill the main template
    $template->assign_var_from_handle($main_template, '_calendar_body' . $handler);
}
 $s_post_opt = '';
 $selected = $item['position'] == $item['main'] ? ' selected="selected"' : '';
 $s_pos_opt .= '<option value="' . $item['main'] . '"' . $selected . '>' . get_object_lang($item['main'], 'name', true) . '</option>';
 for ($i = 0; $i < count($tree['sub'][$item['main']]); $i++) {
     if ($tree['sub'][$item['main']][$i] != $fid) {
         $selected = $tree['sub'][$item['main']][$i] == $item['position'] ? ' selected="selected"' : '';
         $s_pos_opt .= '<option value="' . $tree['sub'][$item['main']][$i] . '"' . $selected . '>|--&nbsp;' . get_object_lang($tree['sub'][$item['main']][$i], 'name', true) . '</option>';
     }
 }
 // place to move topics and attachements
 $s_move_opt = get_tree_option('--', true);
 $s_move_opt = '<option value="" selected="selected">' . $lang['Delete_all_posts'] . '</option>' . $s_move_opt;
 // icon
 $icon_img = empty($item['icon']) ? '' : '<br /><img src="' . (isset($images[$item['icon']]) ? $phpbb_root_path . $images[$item['icon']] : $item['icon']) . '" border="0" alt="' . $item['icon'] . '" title="' . $item['icon'] . '" />';
 // vars
 $template->assign_vars(array('S_TYPE_OPT' => $s_type_opt, 'NAME' => str_replace("''", "'", $item['name']), 'DESC' => str_replace("''", "'", $item['desc']), 'S_FORUMS_OPT' => get_tree_option($item['main'], true), 'S_POS_OPT' => $s_pos_opt, 'S_STATUS_OPT' => $s_status_opt, 'S_MOVE_OPT' => $s_move_opt, 'ICON' => $item['icon'], 'ICON_IMG' => $icon_img, 'PRUNE_DISPLAY' => $item['prune_enable'] ? '' : 'none', 'PRUNE_ENABLE_YES' => $item['prune_enable'] ? 'checked="checked"' : '', 'PRUNE_ENABLE_NO' => !$item['prune_enable'] ? 'checked="checked"' : '', 'PRUNE_DAYS' => $item['prune_days'], 'PRUNE_FREQ' => $item['prune_freq'], 'FORUM_LINK' => $item['link'], 'LINK_INTERNAL_YES' => $item['link_internal'] ? 'checked="checked"' : '', 'LINK_INTERNAL_NO' => !$item['link_internal'] ? 'checked="checked"' : '', 'LINK_COUNT_YES' => $item['link_hit_count'] ? 'checked="checked"' : '', 'LINK_COUNT_NO' => !$item['link_hit_count'] ? 'checked="checked"' : '', 'S_PRESET_OPT' => $s_presets, 'AUTH_SPAN' => $item['type'] == POST_FORUM_URL ? 4 : 1));
 // some switches
 if ($item['type'] == POST_CAT_URL) {
     $template->assign_block_vars('category', array());
 } else {
     $template->assign_block_vars('no_category', array());
 }
 if ($item['type'] == POST_FORUM_URL) {
     $template->assign_block_vars('forum', array());
 } else {
     $template->assign_block_vars('no_forum', array());
 }
 if ($item['type'] == POST_FLINK_URL) {
     $template->assign_block_vars('link', array());
 } else {
     $template->assign_block_vars('no_link', array());
Example #5
0
		AJAX_message_die($result_ar);
	}
	else
	{
		if ($show_results == 'bookmarks')
		{
			message_die(GENERAL_MESSAGE, $lang['No_Bookmarks']);
		}
		else
		{
			message_die(GENERAL_MESSAGE, $lang['No_search_match']);
		}
	}
}

$s_forums = get_tree_option();

// Number of chars returned
$s_characters = '<option value="-1">' . $lang['All_available'] . '</option>';
$s_characters .= '<option value="0">0</option>';
$s_characters .= '<option value="25">25</option>';
$s_characters .= '<option value="50">50</option>';

for($i = 100; $i < 1100 ; $i += 100)
{
	$selected = ($i == 200) ? ' selected="selected"' : '';
	$s_characters .= '<option value="' . $i . '"' . $selected . '>' . $i . '</option>';
}

// Sorting
$s_sort_by = '';
function selectbox($box_name, $ignore_forum = false, $select_forum = '', $all = false)
{
    $s_id = $select_forum != '' ? POST_FORUM_URL . $select_forum : '';
    $s_list = get_tree_option($select_forum, $all);
    $res = '<select name="' . $box_name . '">' . $s_list . '</select>';
    return $res;
}
Example #7
0
function jumpbox($action, $match_forum_id = 0)
{
    global $db, $template, $user, $lang;
    // build the jumpbox
    $boxstring = '<select name="selected_id" onchange="if(this.options[this.selectedIndex].value != -1){ forms[\'jumpbox\'].submit() }">';
    $boxstring .= get_tree_option(POST_FORUM_URL . $match_forum_id);
    $boxstring .= '</select>';
    $boxstring .= '<input type="hidden" name="sid" value="' . $user->data['session_id'] . '" />';
    // dump this to template
    $template->set_filenames(array('jumpbox' => 'jumpbox.tpl'));
    $template->assign_vars(array('L_GO' => $lang['Go'], 'L_JUMP_TO' => $lang['Jump_to'], 'L_SELECT_FORUM' => $lang['Select_forum'], 'S_JUMPBOX_SELECT' => $boxstring, 'S_JUMPBOX_ACTION' => append_sid($action)));
    $template->assign_var_from_handle('JUMPBOX', 'jumpbox');
    return;
}