function make_forum_select($box_name, $ignore_forum = false, $select_forum = '', $for_prune = false) { global $db, $userdata; $is_auth_ary = auth(AUTH_READ, AUTH_LIST_ALL, $userdata); // Begin PNphpBB2 Categories Hierarchie Mod global $phpEx, $lang; $category_rows = array(); $category_rows = get_auth_cat(); // add Index $forum_list .= '<option value="' . ($for_prune ? 'C0' : -1) . '">[' . $lang['Forum_index'] . ']</option>'; // get cats for ($i = 0; $i < count($category_rows); $i++) { // increment $inc = ''; for ($k = 1; $k < $category_rows[$i]['level']; $k++) { $inc = '| ' . $inc; } $inc = ($category_rows[$i]['level'] > 0 ? '| ' : '|--') . $inc; $inc .= $category_rows[$i]['level'] > 0 ? '|--' : ''; // add cat $forum_list .= '<option value="' . ($for_prune ? 'C' . $category_rows[$i]['cat_id'] : -1) . '">' . $inc . '[' . $category_rows[$i]['cat_title'] . ']' . '</option>'; $sql = "select * from " . FORUMS_TABLE . " where cat_id = " . $category_rows[$i]['cat_id']; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Couldn not obtain forums information', '', __LINE__, __FILE__, $sql); } while ($row = $db->sql_fetchrow($result)) { if ($is_auth_ary[$row['forum_id']]['auth_read'] && $ignore_forum != $row['forum_id']) { $selected = $select_forum == $row['forum_id'] ? ' selected="selected"' : ''; $forum_list .= '<option value="' . $row['forum_id'] . '"' . $selected . '>' . '| ' . $inc . ' ' . $row['forum_name'] . '</option>'; } } } /* $sql = 'SELECT f.forum_id, f.forum_name FROM ' . CATEGORIES_TABLE . ' c, ' . FORUMS_TABLE . ' f WHERE f.cat_id = c.cat_id ORDER BY c.cat_order, f.forum_order'; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Couldn not obtain forums information', '', __LINE__, __FILE__, $sql); } $forum_list = ''; while( $row = $db->sql_fetchrow($result) ) { if ( $is_auth_ary[$row['forum_id']]['auth_read'] && $ignore_forum != $row['forum_id'] ) { $selected = ( $select_forum == $row['forum_id'] ) ? ' selected="selected"' : ''; $forum_list .= '<option value="' . $row['forum_id'] . '"' . $selected .'>' . $row['forum_name'] . '</option>'; } } */ // End PNphpBB2 Categories Hierarchie Mod $forum_list = $forum_list == '' ? '<option value="-1">-- ! No Forums ! --</option>' : '<select name="' . $box_name . '">' . $forum_list . '</select>'; return $forum_list; }
function make_jumpbox($action, $match_forum_id = 0) { global $template, $userdata, $lang, $db, $nav_links, $phpEx, $SID; // $is_auth = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata); // Begin PNphpBB2 Categories Hierarchie Mod /* $sql = "SELECT c.cat_id, c.cat_title, c.cat_order FROM " . CATEGORIES_TABLE . " c, " . FORUMS_TABLE . " f WHERE f.cat_id = c.cat_id GROUP BY c.cat_id, c.cat_title, c.cat_order ORDER BY c.cat_order"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, "Couldn't obtain category list.", "", __LINE__, __FILE__, $sql); } $category_rows = array(); while ( $row = $db->sql_fetchrow($result) ) { $category_rows[] = $row; } */ $category_rows = array(); $category_rows = get_auth_cat(); // End PNphpBB2 Categories Hierarchie Mod if ($total_categories = count($category_rows)) { $sql = "SELECT *\n\t\t\tFROM " . FORUMS_TABLE . "\n\t\t\tORDER BY cat_id, forum_order"; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not obtain forums information', '', __LINE__, __FILE__, $sql); } $boxstring = '<select name="' . POST_FORUM_URL . '" onchange="if(this.options[this.selectedIndex].value != -1){ forms[\'jumpbox\'].submit() }"><option value="-1">' . $lang['Select_forum'] . '</option>'; $forum_rows = array(); while ($row = $db->sql_fetchrow($result)) { $forum_rows[] = $row; } if ($total_forums = count($forum_rows)) { for ($i = 0; $i < $total_categories; $i++) { $boxstring_forums = ''; // Begin PNphpBB2 Categories Hierarchie Mod $inc = ''; for ($k = 1; $k < $category_rows[$i]['level']; $k++) { $inc = '| ' . $inc; } $inc = ($category_rows[$i]['level'] > 0 ? '| ' : '|--') . $inc; $inc .= $category_rows[$i]['level'] > 0 ? '|--' : ''; // End PNphpBB2 Categories Hierarchie Mod for ($j = 0; $j < $total_forums; $j++) { // Begin PNphpBB2 Categories Hierarchie Mod // if ( $forum_rows[$j]['cat_id'] == $category_rows[$i]['cat_id'] && $forum_rows[$j]['auth_view'] <= AUTH_REG ) // { $do_it = false; if ($forum_rows[$j]['cat_id'] == $category_rows[$i]['cat_id']) { $is_auth = array(); $is_auth = auth(AUTH_ALL, $forum_rows[$j]['forum_id'], $userdata); $do_it = $is_auth['auth_view']; } if ($do_it) { // End PNphpBB2 Categories Hierarchie Mod // if ( $forum_rows[$j]['cat_id'] == $category_rows[$i]['cat_id'] && $is_auth[$forum_rows[$j]['forum_id']]['auth_view'] ) // { $selected = $forum_rows[$j]['forum_id'] == $match_forum_id ? 'selected="selected"' : ''; // Begin PNphpBB2 Categories Hierarchie Mod // $boxstring_forums .= '<option value="' . $forum_rows[$j]['forum_id'] . '"' . $selected . '>' . $forum_rows[$j]['forum_name'] . '</option>'; $boxstring_forums .= '<option value="' . $forum_rows[$j]['forum_id'] . '"' . $selected . '>' . '| ' . $inc . ' ' . $forum_rows[$j]['forum_name'] . '</option>'; // End PNphpBB2 Categories Hierarchie Mod // // Add an array to $nav_links for the Mozilla navigation bar. // 'chapter' and 'forum' can create multiple items, therefore we are using a nested array. // $nav_links['chapter forum'][$forum_rows[$j]['forum_id']] = array('url' => append_sid("viewforum.{$phpEx}?" . POST_FORUM_URL . "=" . $forum_rows[$j]['forum_id']), 'title' => $forum_rows[$j]['forum_name']); } } // Begin PNphpBB2 Categories Hierarchie Mod /* if ( $boxstring_forums != '' ) { $boxstring .= '<option value="-1"> </option>'; $boxstring .= '<option value="-1">' . $category_rows[$i]['cat_title'] . '</option>'; $boxstring .= '<option value="-1">----------------</option>'; $boxstring .= $boxstring_forums; } */ if ($i == 0) { $boxstring .= '<option value="-1"> </option>'; $boxstring .= '<option value="-1">' . $lang['Forum_index'] . '</option>'; } $boxstring .= '<option value="-1">' . $inc . '[' . $category_rows[$i]['cat_title'] . ']</option>'; $boxstring .= $boxstring_forums; // End PNphpBB2 Categories Hierarchie Mod } } $boxstring .= '</select>'; } else { $boxstring .= '<select name="' . POST_FORUM_URL . '" onchange="if(this.options[this.selectedIndex].value != -1){ forms[\'jumpbox\'].submit() }"></select>'; } // Let the jumpbox work again in sites having additional session id checks. // if ( !empty($SID) ) // { $boxstring .= '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />'; // } // Begin PNphpBB2 Module $boxstring .= '<input type="hidden" name="op" value="modload" />'; $modinfo = ModUtil::getInfoFromName("ZphpBB2"); $boxstring .= '<input type="hidden" name="module" value=' . $modinfo['url'] . ' />'; $boxstring .= '<input type="hidden" name="file" value="viewforum" />'; $boxstring .= '<input type="hidden" name="sid" value="' . $SID . '" />'; // End PNphpBB2 Module $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; }