function menus()
{
    global $output, $corem_db;
    $sqlm = new SQL();
    $sqlm->connect($corem_db["addr"], $corem_db["user"], $corem_db["pass"], $corem_db["name"], $corem_db["encoding"]);
    $menu_action = "start";
    if (isset($_GET["editmenu"])) {
        $menu_action = "edit";
    }
    if (isset($_GET["delmenu"])) {
        $menu_action = "delmenu";
    }
    if (isset($_GET["addmenu"])) {
        $menu_action = "addmenu";
    }
    if (isset($_GET["editmenu_item"])) {
        $menu_action = "edititem";
    }
    if (isset($_GET["delmenu_item"])) {
        $menu_action = "delitem";
    }
    if (isset($_GET["addmenu_item"])) {
        $menu_action = "additem";
    }
    if (isset($_GET["savemenu"])) {
        $menu_action = "savemenu";
    }
    switch ($menu_action) {
        case "start":
            $top_menus = $sqlm->query("SELECT * FROM config_top_menus");
            $output .= '
        <form action="admin.php" method="get" id="form">
          <div>
            <input type="hidden" name="section" value="menus" />
          </div>
          <table class="simple" id="admin_top_menus">
            <tr>
              <th>' . lang("admin", "edit") . '</th>
              <th>' . lang("admin", "remove") . '</th>
              <th>' . lang("admin", "internalname") . '</th>
              <th>' . lang("admin", "action") . '</th>
              <th>' . lang("admin", "enabled") . '</th>
            </tr>';
            $color = "#EEEEEE";
            while ($top_menu = $sqlm->fetch_assoc($top_menus)) {
                $output .= '
            <tr>
              <td style="background-color:' . $color . '; text-align: center;">
                <span>
                  <a href="admin.php?section=menus&amp;top_menu=' . $top_menu["Index"] . '&amp;editmenu=editmenu">
                    <img src="img/edit.png" alt="" />
                  </a>
                </span>
              </td>
              <td style="background-color:' . $color . '; text-align: center;">
                <span>
                  <a href="admin.php?section=menus&amp;top_menu=' . $top_menu["Index"] . '&amp;delmenu=delmenu">
                    <img src="img/aff_cross.png" alt="" />
                  </a>
                </span>
              </td>
              <td style="background-color:' . $color . '; text-align: center;">
                <span>' . $top_menu["Name"] . '</span>
              </td>
              <td style="background-color:' . $color . '; text-align: center;">
                <span>' . $top_menu["Action"] . '</span>
              </td>
              <td style="background-color:' . $color . '; text-align: center;">
                <span><img src="img/' . ($top_menu["Enabled"] ? 'up' : 'down') . '.gif" alt="" /></span>
              </td>
            </tr>';
                $color = $color == "#EEEEEE" ? "#FFFFFF" : "#EEEEEE";
            }
            $output .= '
            <tr>
              <td style="background-color:' . $color . '; text-align: center;">
                <span>
                  <a href="admin.php?section=menus&amp;addmenu=addmenu">
                    <img src="img/add.png" alt="" />
                  </a>
                </span>
              </td>
              <td style="background-color:' . $color . ';" colspan="4">
                <a href="admin.php?section=menus&amp;addmenu=addmenu">' . lang("admin", "addmenu") . '</a>
              </td>
            </tr>
          </table>
        </form>';
            break;
        case "edit":
            $top_menu = $sqlm->quote_smart($_GET["top_menu"]);
            $top = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_top_menus WHERE `Index`='" . $top_menu . "'"));
            $output .= '
        <div class="center" id="admin_edit_menu_wrap">
          <form action="admin.php" method="get" id="form">
            <div>
              <input type="hidden" name="section" value="menus" />
              <input type="hidden" name="top_index" value="' . $top_menu . '" />';
            if ($top["Name"] == "main" || $top["Name"] == "invisible") {
                $output .= '
              <input type="hidden" name="enabled" value="1" />';
            }
            $output .= '
            </div>
            <table class="simple" id="admin_edit_top_menu_nameaction">
              <tr>
                <th colspan="2">' . lang("admin", "top_menu") . '</th>
              </tr>
              <tr>
                <td>' . lang("admin", "internalname2") . ': </td>
                <td>
                  <input type="text" name="top_name" value="' . $top["Name"] . '" class="admin_edit_top_menu_action" />
                </td>
              </tr>
              <tr>
                <td>' . lang("admin", "action") . ': </td>
                <td>
                  <textarea name="menu_action" class="admin_edit_top_menu_action" rows="2" cols="32">' . $top["Action"] . '</textarea>
                </td>
              </tr>
              <tr>
                <td>' . lang("admin", "enabled") . ': </td>
                <td>';
            if ($top["Name"] != "main" && $top["Name"] != "invisible") {
                $output .= '
                  <input type="checkbox" name="enabled"' . ($top["Enabled"] ? ' checked="checked"' : '') . ' />';
            } else {
                $output .= '<img src="img/lock.png" alt="" /> (' . lang("admin", "nodisable") . ')';
            }
            $output .= '
                </td>
              </tr>
            </table>
            <table class="simple" id="admin_edit_top_menu_submenus">
              <tr>
                <th>' . lang("admin", "edit") . '</th>
                <th>' . lang("admin", "remove") . '</th>
                <th>' . lang("admin", "order") . '</th>
                <th style="width: 15%;">' . lang("admin", "internalname") . '</th>
                <th style="width: 25%;">' . lang("admin", "action") . '</th>
                <th>' . lang("admin", "view") . '</th>
                <th>' . lang("admin", "insert") . '</th>
                <th>' . lang("admin", "update") . '</th>
                <th>' . lang("admin", "delete") . '</th>
                <th>' . lang("admin", "enabled") . '</th>
              </tr>';
            $menus = $sqlm->query("SELECT * FROM config_menus WHERE Menu='" . $top_menu . "'");
            $color = "#EEEEEE";
            while ($menu = $sqlm->fetch_assoc($menus)) {
                $output .= '
              <tr>
                <td style="background-color:' . $color . '; text-align: center;">
                  <span>
                    <a href="admin.php?section=menus&amp;top_index=' . $top_menu . '&amp;menu_item=' . $menu["Index"] . '&amp;editmenu_item=editmenuitem">
                      <img src="img/edit.png" alt="" />
                    </a>
                  </span>
                </td>
                <td style="background-color:' . $color . '; text-align: center;">
                  <span>
                    <a href="admin.php?section=menus&amp;top_index=' . $top_menu . '&amp;menu_item=' . $menu["Index"] . '&amp;delmenu_item=delmenuitem">
                      <img src="img/aff_cross.png" alt="" />
                    </a>
                  </span>
                </td>
                <td style="background-color:' . $color . '; text-align: center;">
                  <span>' . $menu["Order"] . '</span>
                </td>
                <td style="background-color:' . $color . '; text-align: center;">
                  <span>' . $menu["Name"] . '</span>
                </td>
                <td style="background-color:' . $color . '; text-align: center;">
                  <span>' . $menu["Action"] . '</span>
                </td>
                <td style="background-color:' . $color . '; text-align: center;">
                  <span>' . sec_level_name($menu["View"]) . ' (' . $menu["View"] . ')' . '</span>
                </td>
                <td style="background-color:' . $color . '; text-align: center;">
                  <span>' . sec_level_name($menu["Insert"]) . ' (' . $menu["Insert"] . ')' . '</span>
                </td>
                <td style="background-color:' . $color . '; text-align: center;">
                  <span>' . sec_level_name($menu["Update"]) . ' (' . $menu["Update"] . ')' . '</span>
                </td>
                <td style="background-color:' . $color . '; text-align: center;">
                  <span>' . sec_level_name($menu["Delete"]) . ' (' . $menu["Delete"] . ')' . '</span>
                </td>
                <td style="background-color:' . $color . '; text-align: center;">
                  <span>
                    <img src="img/' . ($menu["Enabled"] ? 'up' : 'down') . '.gif" alt="" />
                  </span>
                </td>
              </tr>';
                $color = $color == "#EEEEEE" ? "#FFFFFF" : "#EEEEEE";
            }
            $output .= '
              <tr>
                <td style="background-color:' . $color . '; text-align: center;">
                  <span>
                    <a href="admin.php?section=menus&amp;top_index=' . $top_menu . '&amp;addmenu_item=addmenuitem">
                      <img src="img/add.png" alt="" />
                    </a>
                  </span>
                </td>
                <td style="background-color:' . $color . '" colspan="8">
                  <a href="admin.php?section=menus&amp;top_index=' . $top_menu . '&amp;addmenu_item=addmenuitem">' . lang("admin", "addmenu_item") . '</a>
                </td>
              </tr>
            </table>
            <div>
              <input type="submit" name="savemenu" value="' . lang("admin", "save") . '" />
            </div>
          </form>
        </div>';
            break;
        case "edititem":
            $menu_item = $sqlm->quote_smart($_GET["menu_item"]);
            $menu = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_menus WHERE `Index`='" . $menu_item . "'"));
            $sec_list = sec_level_list();
            $top_menu_query = "SELECT * FROM config_top_menus";
            $top_menu_result = $sqlm->query($top_menu_query);
            $output .= '
        <div id="admin_edit_menu_field">
          <form action="admin.php" method="get" id="form">
            <div>
              <input type="hidden" name="section" value="menus" />
              <input type="hidden" name="action" value="savemenu" />
              <input type="hidden" name="menu_item" value="' . $menu_item . '" />
            </div>
            <fieldset>
              <table class="help" id="admin_edit_menu">
                <tr>
                  <td>
                    <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "menu_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "menu") . '</a>:
                  </td>
                  <td>
                    <select name="menu">';
            //<input type="text" name="menu" value="'.$menu["Menu"].'" id="admin_edit_menu_fields">
            while ($row = $sqlm->fetch_assoc($top_menu_result)) {
                $output .= '
                      <option value="' . $row["Index"] . '" ' . ($row["Index"] == $menu["Menu"] ? 'selected="selected"' : '') . ' class="admin_edit_menu_fields">' . $row["Name"] . '</option>';
            }
            $output .= '
                    </select>
                  </td>
                </tr>
                <tr>
                  <td>
                    <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "order_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "order") . '</a>:
                  </td>
                  <td>
                    <input type="text" name="order" value="' . $menu["Order"] . '" class="admin_edit_menu_fields" />
                  </td>
                </tr>
                <tr>
                  <td>
                    <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "menuname_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "internalname2") . '</a>:
                  </td>
                  <td>
                    <input type="text" name="name" value="' . $menu["Name"] . '" class="admin_edit_menu_fields" />
                  </td>
                </tr>
                <tr>
                  <td>
                    <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "action_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "action") . '</a>:
                  </td>
                  <td>
                    <textarea name="menu_action" style="width:260px" rows="2" cols="32">' . $menu["Action"] . '</textarea>
                  </td>
                </tr>
                <tr>
                  <td>
                    <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "view_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "view") . '</a>:
                  </td>
                  <td>
                    <select name="view">';
            foreach ($sec_list as $row) {
                $output .= '
                      <option value="' . $row["Sec"] . '" ' . ($row["Sec"] == $menu["View"] ? 'selected="selected"' : '') . '>' . $row["Name"] . ' (' . $row["Sec"] . ')</option>';
            }
            $output .= '
                    </select>
                  </td>
                </tr>
                <tr>
                  <td>
                    <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "insert") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "insert") . '</a>:
                  </td>
                  <td>
                    <select name="insert">';
            foreach ($sec_list as $row) {
                $output .= '
                      <option value="' . $row["Sec"] . '" ' . ($row["Sec"] == $menu["Insert"] ? 'selected="selected"' : '') . '>' . $row["Name"] . ' (' . $row["Sec"] . ')</option>';
            }
            $output .= '
                    </select>
                  </td>
                </tr>
                <tr>
                  <td>
                    <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "update_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "update") . '</a>:
                  </td>
                  <td>
                    <select name="update">';
            foreach ($sec_list as $row) {
                $output .= '
                      <option value="' . $row["Sec"] . '" ' . ($row["Sec"] == $menu["Update"] ? 'selected="selected"' : '') . '>' . $row["Name"] . ' (' . $row["Sec"] . ')</option>';
            }
            $output .= '
                    </select>
                  </td>
                </tr>
                <tr>
                  <td>
                    <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "delete") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "delete") . '</a>:
                  </td>
                  <td>
                    <select name="delete">';
            foreach ($sec_list as $row) {
                $output .= '
                      <option value="' . $row["Sec"] . '" ' . ($row["Sec"] == $menu["Delete"] ? 'selected="selected"' : '') . '>' . $row["Name"] . ' (' . $row["Sec"] . ')</option>';
            }
            $output .= '
                    </select>
                  </td>
                </tr>';
            if ($menu_item != 8) {
                $output .= '
                <tr>
                  <td>
                    <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "enabled_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "enabled") . '</a>:
                  </td>
                  <td>
                    <input type="checkbox" name="enabled" ' . ($menu["Enabled"] ? 'checked="checked"' : '') . ' />
                  </td>
                </tr>';
            } else {
                $output .= '
                <tr>
                  <td>
                    <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "enabled_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "enabled") . '</a>:
                  </td>
                  <td>
                    <input type="checkbox" name="enabled" ' . ($menu["Enabled"] ? 'checked="checked' : '') . ' disabled="disabled" />
                  </td>
                </tr>';
            }
            $output .= '
              </table>
            </fieldset>
            <div>
              <input type="submit" name="save_menu_item" value="' . lang("admin", "save") . '" />
            </div>
          </form>
        </div>';
            break;
        case "addmenu":
            $max = $sqlm->fetch_assoc($sqlm->query("SELECT MAX(`Index`) FROM config_top_menus"));
            $max = $max["MAX(`Index`)"] + 1;
            $result = $sqlm->query("INSERT INTO config_top_menus (`Index`, Action, Name, Enabled) VALUES ('" . $max . "', '', '', '0')");
            redirect("admin.php?section=menus");
            break;
        case "delmenu":
            $top_menu = $sqlm->quote_smart($_GET["top_menu"]);
            if (is_numeric($top_menu)) {
                $result = $sqlm->query("DELETE FROM config_top_menus WHERE `Index`='" . $top_menu . "'");
                redirect("admin.php?section=menus");
            } else {
                redirect("admin.php?section=menus&error=1");
            }
            break;
        case "savemenu":
            $top_index = $sqlm->quote_smart($_GET["top_index"]);
            $top_name = $sqlm->quote_smart($_GET["top_name"]);
            $top_action = $sqlm->quote_smart($_GET["menu_action"]);
            $enabled = isset($_GET["enabled"]) ? 1 : 0;
            $result = $sqlm->query("UPDATE config_top_menus SET Name='" . $top_name . "', Action='" . $top_action . "', Enabled='" . $enabled . "' WHERE `Index`='" . $top_index . "'");
            redirect("admin.php?section=menus");
            break;
        case "additem":
            $top_index = $sqlm->quote_smart($_GET["top_index"]);
            $result = $sqlm->query("INSERT INTO config_menus (Menu, Action, Name) VALUES ('" . $top_index . "', '','')");
            redirect("admin.php?section=menus&top_menu=" . $top_index . "&editmenu=editmenu");
            break;
        case "delitem":
            $menu_item = $sqlm->quote_smart($_GET["menu_item"]);
            $top_index = $sqlm->quote_smart($_GET["top_index"]);
            if (is_numeric($menu_item)) {
                $result = $sqlm->query("DELETE FROM config_menus WHERE `Index`='" . $menu_item . "'");
                redirect("admin.php?section=menus&top_menu=" . $top_index . "&editmenu=editmenu");
            } else {
                redirect("admin.php?section=menus&error=1");
            }
            break;
        default:
            redirect("admin.php?section=menus&error=1");
            break;
    }
}
Beispiel #2
0
function forum()
{
    global $output, $corem_db;
    $sqlm = new SQL();
    $sqlm->connect($corem_db["addr"], $corem_db["user"], $corem_db["pass"], $corem_db["name"], $corem_db["encoding"]);
    $forum_action = "start";
    if (isset($_GET["editforum"])) {
        $forum_action = "edit";
    }
    if (isset($_GET["delforum"])) {
        $forum_action = "delforum";
    }
    if (isset($_GET["addforum"])) {
        $forum_action = "addforum";
    }
    if (isset($_GET["editforum_item"])) {
        $forum_action = "edititem";
    }
    if (isset($_GET["delforum_item"])) {
        $forum_action = "delitem";
    }
    if (isset($_GET["addforum_item"])) {
        $forum_action = "additem";
    }
    if (isset($_GET["saveforum"])) {
        $forum_action = "saveforum";
    }
    switch ($forum_action) {
        case "start":
            $cats = $sqlm->query("SELECT * FROM config_forum_categories");
            $output .= '
        <div class="center" id="admin_forum_categories">
          <form action="admin.php" method="get" id="form">
            <div>
              <input type="hidden" name="section" value="forum" />
            </div>
            <table class="simple admin_top_menus">
              <tr>
                <th colspan="2">' . lang("admin", "cats") . '</th>
              </tr>
            </table>
            <table class="simple admin_top_menus">
              <tr>
                <th style="width: 15%;">' . lang("admin", "edit") . '</th>
                <th style="width: 5%;">' . lang("admin", "remove") . '</th>
                <th>' . lang("admin", "name") . '</th>
              </tr>';
            $color = "#EEEEEE";
            while ($cat = $sqlm->fetch_assoc($cats)) {
                $output .= '
              <tr>
                <td style="background-color:' . $color . '; text-align: center;">
                  <span>
                    <a href="admin.php?section=forum&amp;category=' . $cat["Index"] . '&amp;editforum=editforum">
                      <img src="img/edit.png" alt="" />
                    </a>
                  </span>
                </td>
                <td style="background-color:' . $color . '; text-align: center;">
                  <span>
                    <a href="admin.php?section=forum&amp;category=' . $cat["Index"] . '&amp;delforum=delforum">
                      <img src="img/aff_cross.png" alt="" />
                    </a>
                  </span>
                </td>
                <td style="background-color:' . $color . '; text-align: center;">
                  <span>' . $cat["Name"] . '</span>
                </td>
              </tr>';
                $color = $color == "#EEEEEE" ? "#FFFFFF" : "#EEEEEE";
            }
            $output .= '
              <tr>
                <td style="background-color:' . $color . '; text-align: center;">
                  <span>
                    <a href="admin.php?section=forum&amp;addforum=addforum">
                      <img src="img/add.png" alt="" />
                    </a>
                  </span>
                </td>
                <td style="background-color:' . $color . '" colspan="2">
                  <a href="admin.php?section=forum&amp;addforum=addforum">' . lang("admin", "addforum") . '</a>
                </td>
              </tr>
            </table>
          </form>
        </div>';
            break;
        case "edit":
            $cat_id = $sqlm->quote_smart($_GET["category"]);
            $cat = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_forum_categories WHERE `Index`='" . $cat_id . "'"));
            $sec_levels = sec_level_list();
            $output .= '
        <div class="center" id="admin_edit_forum_wrap">
          <form action="admin.php" method="get" id="form">
            <div>
              <input type="hidden" name="section" value="forum" />
              <input type="hidden" name="category" value="' . $cat_id . '" />
            </div>
            <table class="simple" id="admin_edit_top_menu_nameaction">
              <tr>
                <th colspan="2">' . lang("admin", "cat") . '</th>
              </tr>
              <tr>
                <td>' . lang("admin", "name") . ': </td>
                <td>
                  <input type="text" name="cat_name" value="' . $cat["Name"] . '" id="admin_edit_top_menu_action" />
                </td>
              </tr>
            </table>
            <table class="simple" id="admin_edit_top_menu_submenus">
              <tr>
                <th>' . lang("admin", "edit") . '</th>
                <th>' . lang("admin", "remove") . '</th>
                <th style="width: 25%;">' . lang("admin", "name") . '</th>
                <th style="width: 25%;">' . lang("admin", "desc") . '</th>
                <th>' . lang("admin", "sideaccess") . '</th>
                <th>' . lang("admin", "secread") . '</th>
                <th>' . lang("admin", "secpost") . '</th>
                <th>' . lang("admin", "sectopic") . '</th>
              </tr>';
            $forums = $sqlm->query("SELECT * FROM config_forums WHERE Category='" . $cat_id . "'");
            $color = "#EEEEEE";
            while ($forum = $sqlm->fetch_assoc($forums)) {
                $output .= '
              <tr>
                <td style="background-color:' . $color . '; text-align: center;">
                  <span>
                    <a href="admin.php?section=forum&amp;category=' . $cat_id . '&amp;forum_item=' . $forum["Index"] . '&amp;editforum_item=editforumsection">
                      <img src="img/edit.png" alt="" />
                    </a>
                  </span>
                </td>
                <td style="background-color:' . $color . '; text-align: center;">
                  <span>
                    <a href="admin.php?section=forum&amp;category=' . $cat_id . '&amp;forum_item=' . $forum["Index"] . '&amp;delforum_item=delforumsection">
                      <img src="img/aff_cross.png" alt="" />
                    </a>
                  </span>
                </td>
                <td style="background-color:' . $color . '; text-align: center;">
                  <span>' . $forum["Name"] . '</span>
                </td>
                <td style="background-color:' . $color . '; text-align: center;">
                  <span>' . $forum["Desc"] . '</span>
                </td>
                <td style="background-color:' . $color . '; text-align: center;">
                  <span>' . $forum["Side_Access"] . '</span>
                </td>
                <td style="background-color:' . $color . '; text-align: center;">
                  <span>' . sec_level_name($forum["Min_Security_Level_Read"]) . '</span>
                </td>
                <td style="background-color:' . $color . '; text-align: center;">
                  <span>' . sec_level_name($forum["Min_Security_Level_Post"]) . '</span>
                </td>
                <td style="background-color:' . $color . '; text-align: center;">
                  <span>' . sec_level_name($forum["Min_Security_Level_Create_Topic"]) . '</span>
                </td>
              </tr>';
                $color = $color == "#EEEEEE" ? "#FFFFFF" : "#EEEEEE";
            }
            $output .= '
              <tr>
                <td style="background-color:' . $color . '; text-align: center;">
                  <span>
                    <a href="admin.php?section=forum&amp;category=' . $cat_id . '&amp;addforum_item=addforumsection">
                      <img src="img/add.png" alt="" />
                    </a>
                  </span>
                </td>
                <td style="background-color:' . $color . '" colspan="7">
                  <a href="admin.php?section=forum&amp;category=' . $cat_id . '&amp;addforum_item=addforumsection">' . lang("admin", "addforum_item") . '</a>
                </td>
              </tr>
            </table>
            <div>
              <input type="submit" name="saveforum" value="' . lang("admin", "save") . '" />
            </div>
          </form>
        </div>';
            break;
        case "edititem":
            $forum_item = $sqlm->quote_smart($_GET["forum_item"]);
            $forum = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_forums WHERE `Index`='" . $forum_item . "'"));
            $sec_list = sec_level_list();
            $cat_list_query = "SELECT * FROM config_forum_categories";
            $cat_list_result = $sqlm->query($cat_list_query);
            $output .= '
        <div id="admin_edit_forum_field">
          <form action="admin.php" method="get" id="form">
            <div>
              <input type="hidden" name="section" value="forum" />
              <input type="hidden" name="action" value="saveforum" />
              <input type="hidden" name="forum_item" value="' . $forum_item . '" />
            </div>
            <fieldset>
              <table class="help" id="admin_edit_forum_item">
                <tr>
                  <td>
                    <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "cat_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "cat") . '</a>:
                  </td>
                  <td>
                    <select name="category">';
            //<input type="text" name="category" value="'.$forum["Category"].'" id="admin_edit_menu_fields">
            while ($row = $sqlm->fetch_assoc($cat_list_result)) {
                $output .= '
                      <option value="' . $row["Index"] . '" ' . ($row["Index"] == $forum["Category"] ? 'selected="selected"' : '') . ' class="admin_edit_menu_fields">' . $row["Name"] . '</option>';
            }
            $output .= '
                    </select>
                  </td>
                </tr>
                <tr>
                  <td>
                    <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "forumname_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "name") . '</a>:
                  </td>
                  <td>
                    <input type="text" name="name" value="' . $forum["Name"] . '" class="admin_edit_menu_fields" />
                  </td>
                </tr>
                <tr>
                  <td>
                    <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "desc_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "desc") . '</a>:
                  </td>
                  <td>
                    <input type="text" name="desc" value="' . $forum["Desc"] . '" class="admin_edit_menu_fields" />
                  </td>
                </tr>
                <tr>
                  <td>
                    <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "sideaccess_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "sideaccess2") . '</a>:
                  </td>
                  <td>
                    <input type="text" name="sideaccess" value="' . $forum["Side_Access"] . '" class="admin_edit_menu_fields" />
                  </td>
                </tr>
                <tr>
                  <td>
                    <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "secread_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "secread2") . '</a>:
                  </td>
                  <td>
                    <select name="min_security_level_read">';
            foreach ($sec_list as $row) {
                $output .= '
                      <option value="' . $row["Sec"] . '" ' . ($row["Sec"] == $forum["Min_Security_Level_Read"] ? 'selected="selected"' : '') . '>' . $row["Name"] . ' (' . $row["Sec"] . ')</option>';
            }
            $output .= '
                    </select>
                  </td>
                </tr>
                <tr>
                  <td>
                    <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "secpost_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "secpost2") . '</a>:
                  </td>
                  <td>
                    <select name="min_security_level_post">';
            foreach ($sec_list as $row) {
                $output .= '
                      <option value="' . $row["Sec"] . '" ' . ($row["Sec"] == $forum["Min_Security_Level_Post"] ? 'selected="selected"' : '') . '>' . $row["Name"] . ' (' . $row["Sec"] . ')</option>';
            }
            $output .= '
                    </select>
                  </td>
                </tr>
                <tr>
                  <td>
                    <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "sectopic_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "sectopic2") . '</a>:
                  </td>
                  <td>
                    <select name="min_security_level_create_topic">';
            foreach ($sec_list as $row) {
                $output .= '
                      <option value="' . $row["Sec"] . '" ' . ($row["Sec"] == $forum["Min_Security_Level_Create_Topic"] ? 'selected="selected"' : '') . '>' . $row["Name"] . ' (' . $row["Sec"] . ')</option>';
            }
            $output .= '
                    </select>
                  </td>
                </tr>
              </table>
            </fieldset>
            <div>
              <input type="submit" name="save_forum_item" value="' . lang("admin", "save") . '" />
            </div>
          </form>
        </div>';
            break;
        case "addforum":
            $max = $sqlm->fetch_assoc($sqlm->query("SELECT MAX(`Index`) FROM config_forum_categories"));
            $max = $max["MAX(`Index`)"] + 1;
            $result = $sqlm->query("INSERT INTO config_forum_categories (`Index`, Name) VALUES ('" . $max . "', '')");
            redirect("admin.php?section=forum");
            break;
        case "delforum":
            $category = $sqlm->quote_smart($_GET["category"]);
            if (is_numeric($category)) {
                $result = $sqlm->query("DELETE FROM config_forum_categories WHERE `Index`='" . $category . "'");
                redirect("admin.php?section=forum");
            } else {
                redirect("admin.php?section=forum&error=1");
            }
            break;
        case "saveforum":
            $category = $sqlm->quote_smart($_GET["category"]);
            $category_name = $sqlm->quote_smart($_GET["top_name"]);
            $result = $sqlm->query("UPDATE config_forum_categories SET Name='" . $category_name . "' WHERE `Index`='" . $category . "'");
            redirect("admin.php?section=forum");
            break;
        case "additem":
            $category = $sqlm->quote_smart($_GET["category"]);
            $result = $sqlm->query("INSERT INTO config_forums (Category, Name, `Desc`, Side_Access) VALUES ('" . $category . "', '', '', '')");
            redirect("admin.php?section=forum&category=" . $category . "&editforum=editforum");
            break;
        case "delitem":
            $category = $sqlm->quote_smart($_GET["category"]);
            $forum_item = $sqlm->quote_smart($_GET["forum_item"]);
            if (is_numeric($forum_item)) {
                $result = $sqlm->query("DELETE FROM config_forums WHERE `Index`='" . $forum_item . "'");
                redirect("admin.php?section=forum&category=" . $category . "&editforum=editforum");
            } else {
                redirect("admin.php?section=forum&error=1");
            }
            break;
        default:
            redirect("admin.php?section=forum&error=1");
            break;
    }
}