function id_get_gm_level($id) { // we're not concerned with Web Admin if ($id >= 1073741824) { $id -= 1073741824; } return gmlevel_name($id); }
function edit_motd() { global $output, $action_permission, $sql; valid_login($action_permission["update"]); if (empty($_GET["id"])) { redirect("motd.php?error=1"); } $id = $sql["mgr"]->quote_smart($_GET["id"]); if (!is_numeric($id)) { redirect("motd.php?error=1"); } if (!isset($_GET["msg"])) { $msg = $sql["mgr"]->result($sql["mgr"]->query("SELECT Message FROM motd WHERE ID='" . $id . "'"), 0); } else { $msg = $_GET["msg"]; } $priority = $sql["mgr"]->result($sql["mgr"]->query("SELECT Priority FROM motd WHERE ID='" . $id . "'"), 0); $enabled = $sql["mgr"]->result($sql["mgr"]->query("SELECT Enabled FROM motd WHERE ID='" . $id . "'"), 0); $redirect = isset($_GET["redirect"]) ? $sql["mgr"]->quote_smart($_GET["redirect"]) : NULL; $target = $sql["mgr"]->result($sql["mgr"]->query("SELECT Target FROM motd WHERE ID='" . $id . "'"), 0); if ($target != 0) { if ($core == 1) { $un_query = "SELECT login FROM accounts WHERE acct=" . $motd["Target"]; } else { $un_query = "SELECT username AS login FROM account WHERE id=" . $motd["Target"]; } $un_result = $sql["logon"]->query($un_query); $un = $sql["logon"]->fetch_assoc($un_result); } $target = $un; $min_sec_level = $sql["mgr"]->result($sql["mgr"]->query("SELECT Min_Sec_Level FROM motd WHERE ID='" . $id . "'"), 0); $output .= ' <script> function do_submit_preview() { document.getElementById("form").action.value = "edit_preview"; document.getElementById("form").submit(); } </script> <center> <form action="motd.php" method="get" id="form"> <input type="hidden" name="id" value="' . $id . '" /> <input type="hidden" name="action" value="do_edit_motd" /> <input type="hidden" name="redirect" value="' . $redirect . '" /> <table class="top_hidden"> <tr> <td colspan="3">'; unset($id); bbcode_add_editor(); $output .= ' </td> </tr> <tr> <td colspan="3" align="left"> ' . lang("motd", "enabled") . ': <input type="checkbox" name="enabled" ' . ($enabled ? 'checked="checked"' : '') . ' /> </td> </tr> <tr> <td>' . lang("motd", "priority") . ': <select name="priority"> <option value="0" ' . ($priority == 0 ? 'selected="selected"' : '') . '>' . lang("motd", "veryhigh") . '</option> <option value="1" ' . ($priority == 1 ? 'selected="selected"' : '') . '>' . lang("motd", "high") . '</option> <option value="2" ' . ($priority == 2 ? 'selected="selected"' : '') . '>' . lang("motd", "med") . '</option> <option value="3" ' . ($priority == 3 ? 'selected="selected"' : '') . '>' . lang("motd", "low") . '</option> <option value="4" ' . ($priority == 4 ? 'selected="selected"' : '') . '>' . lang("motd", "verylow") . '</option> </select> </td> <td> ' . lang("motd", "targetname") . ': <input type="text" name="target" value="' . $target . '" /> </td> <td> ' . lang("motd", "min_sec_level") . ': <select name="min_sec_level">'; $s_query = "SELECT * FROM config_gm_level_names"; $s_result = $sql["mgr"]->query($s_query); while ($level = $sql["mgr"]->fetch_assoc($s_result)) { $output .= ' <option value="' . $level["Security_Level"] . '"' . ($min_sec_level == $level["Security_Level"] ? ' selected="selected"' : '') . '>' . gmlevel_name($level["Security_Level"]) . '</option>'; } $output .= ' </select> </td> </tr> <tr> <td colspan="3"> <textarea id="msg" name="msg" rows="26" cols="97">' . $msg . '</textarea> </td> </tr> <tr> <td>' . lang("motd", "post_rules") . '</td> <td>'; unset($msg); makebutton(lang("motd", "post_motd"), 'javascript:do_submit()" type="wrn', 230); $output .= ' </td> <td>'; makebutton(lang("motd", "preview_motd"), 'javascript:do_submit_preview()" type="wrn', 230); $output .= ' </td> </tr> <tr> <td></td> <td></td> <td>'; makebutton(lang("global", "back"), 'javascript:window.history.back()" type="def', 230); $output .= ' </td> </tr> </table> </form> <br /> </center>'; }
} //----Check if a user has login, if Guest mode is enabled, code above will login as Guest if (isset($_SESSION["user_lvl"]) && isset($_SESSION["login"]) && isset($_SESSION["realm_id"]) && empty($_GET["site_error"])) { // check for host php script max memory allowed, // setting it higher if it is not enough for CoreManager to run if (ini_get("memory_limit") < 16) { @ini_set("memory_limit", "16M"); } // resuming logged in user settings session_regenerate_id(); $user_lvl = $_SESSION["user_lvl"]; $user_name = $_SESSION["login"]; $user_id = $_SESSION["user_id"]; // for CoreManager security system, getting the users' account group name // switched to use $_SESSION["gmlvl"] $user_lvl_name = gmlevel_name($_SESSION["gm_lvl"]); // get the file name that called this header $array = explode('/', $_SERVER["PHP_SELF"]); $lookup_file = $array[sizeof($array) - 1]; unset($array); //---------------------Top Menu---------------------------------------------- $output .= ' <div id="menuwrapper"> <ul id="menubar">'; $action_permission = array(); foreach ($menu_array as $trunk) { // ignore "invisible array" this is for setting security read/write values // for not accessible elements not in the navbar! if ('invisible' == $trunk[1]) { foreach ($trunk[2] as $branch) { if ($branch[0] === $lookup_file) {