function servers() { global $output, $corem_db, $get_icon_type, $get_timezone_type, $core; // we need $core to be set if ($core == 0) { $core = detectcore(); } $sqlm = new SQL(); $sqlm->connect($corem_db["addr"], $corem_db["user"], $corem_db["pass"], $corem_db["name"], $corem_db["encoding"]); $result = $sqlm->query("SELECT * FROM config_servers"); $server_action = 0; if (isset($_GET["editserver"])) { $server_action = "edit"; } if (isset($_GET["delserver"])) { $server_action = "del"; } if (isset($_GET["addserver"])) { $server_action = "add"; } if (!$server_action) { $output .= ' <div style="text-align: center;"> <span style="color:red">' . lang("admin", "server_warn") . '</span> </div> <form action="admin.php" method="get" id="form"> <div> <input type="hidden" name="section" value="servers" /> </div> <table class="simple" id="admin_servers"> <tr> <th style="width: 5%;">' . lang("admin", "edit") . '</th> <th style="width: 5%;">' . lang("admin", "remove") . '</th> <th style="width: 10%;">' . lang("admin", "realm") . '</th> <th style="width: 10%;">' . lang("admin", "name") . '</th> <th style="width: 20%;">' . lang("admin", "hosti") . '</th> <th style="width: 20%;">' . lang("admin", "hostp") . '</th> <th style="width: 1%;">' . lang("admin", "port") . '</th> <th style="width: 10%;">' . lang("admin", "icon") . '</th> <th style="width: 10%;">' . lang("admin", "timezone") . '</th> <th style="width: 10%;">' . lang("admin", "bothfactions") . '</th>'; if ($core == 1) { $output .= ' <th width="40%">' . lang("admin", "statsxml") . '</th>'; } $output .= ' </tr>'; $color = "#EEEEEE"; while ($server = $sqlm->fetch_assoc($result)) { $output .= ' <tr> <td style="background-color:' . $color . '; text-align: center;"> <span> <a href="admin.php?section=servers&sel_server=' . $server["Index"] . '&editserver=editserver"> <img src="img/edit.png" alt="" /> </a> </span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span> <a href="admin.php?section=servers&sel_server=' . $server["Index"] . '&delserver=deleteserver"> <img src="img/aff_cross.png" alt="" /> </a> </span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span>' . $server["Index"] . '</span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span>' . $server["Name"] . '</span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span>' . $server["Address"] . '</span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span>' . $server["External_Address"] . '</span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span>' . $server["Port"] . '</span> </td>'; $icon = $get_icon_type[$server["Icon"]]; $timezone = $get_timezone_type[$server["Timezone"]]; $output .= ' <td style="background-color:' . $color . '; text-align: center;"> <span>' . lang("realm", $icon[1]) . '</span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span>' . lang("realm", $timezone[1]) . '</span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span>' . ($server["Both_Factions"] ? lang("global", "yes_low") : lang("global", "no_low")) . '</span> </td>'; if ($core == 1) { $output .= ' <td style="background-color:' . $color . '; text-align: center;"> <span>' . $server["Stats_XML"] . '</span> </td>'; } $output .= ' </tr>'; $color = $color == "#EEEEEE" ? "#FFFFFF" : "#EEEEEE"; } $output .= ' <tr> <td style="background-color:' . $color . '"> <a href="admin.php?section=servers&addserver=addserver"> <img src="img/add.png" alt="" /> </a> </td> <td style="background-color:' . $color . '" colspan="' . ($core == 1 ? '10' : '9') . '"> <a href="admin.php?section=servers&addserver=addserver">' . lang("admin", "addserver") . '</a> </td> </tr> </table> </form>'; } else { if ($server_action == "edit") { $server_id = $sqlm->quote_smart($_GET["sel_server"]); if (is_numeric($server_id)) { $server = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_servers WHERE `Index`='" . $server_id . "'")); $output .= ' <div id="admin_edit_server"> <form action="admin.php" method="get" id="form"> <fieldset> <div> <input type="hidden" name="section" value="servers" /> <input type="hidden" name="action" value="saveserver" /> <input type="hidden" name="index" value="' . $server["Index"] . '" /> </div> <table class="center"> <tr> <td style="width: 45%;">' . lang("admin", "realm") . ': </td> <td> <input type="text" name="new_index" value="' . $server["Index"] . '" /> </td> </tr> <tr> <td style="width: 45%;">' . lang("admin", "name") . ': </td> <td> <input type="text" name="server_name" value="' . $server["Name"] . '" /> </td> </tr> <tr> <td style="width: 45%;" class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "hosti_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "hosti") . '</a>: </td> <td> <input type="text" name="server_hosti" value="' . $server["Address"] . '" /> </td> </tr> <tr> <td style="width: 45%;" class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "hostp_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "hostp") . '</a>: </td> <td> <input type="text" name="server_hostp" value="' . $server["External_Address"] . '" /> </td> </tr> <tr> <td>' . lang("admin", "port") . ': </td> <td> <input type="text" name="server_port" value="' . $server["Port"] . '" /> </td> </tr>'; if ($core != 1) { $output .= ' <tr> <td>' . lang("admin", "telnetport_tip") . ':</td> <td> <input type="text" name="server_telnet_port" value="' . $server["Telnet_Port"] . '" /> </td> </tr> <tr> <td>' . lang("admin", "telnetuser_tip") . ':</td> <td> <input type="text" name="server_telnet_user" value="' . $server["Telnet_User"] . '" /> </td> </tr> <tr> <td>' . lang("admin", "telnetpass_tip") . ':</td> <td> <input type="text" name="server_telnet_pass" value="' . $server["Telnet_Pass"] . '" /> </td> </tr>'; } else { $output .= ' <tr> <td style="display: none;"> <input type="hidden" name="server_telnet_port" value="' . $server["Telnet_Port"] . '" /> <input type="hidden" name="server_telnet_user" value="' . $server["Telnet_User"] . '" /> <input type="hidden" name="server_telnet_pass" value="' . $server["Telnet_Pass"] . '" /> </td> </tr>'; } $output .= ' <tr> <td>' . lang("admin", "icon") . ': </td> <td> <select name="server_type">'; foreach ($get_icon_type as $type) { $output .= ' <option value="' . $type[0] . '" ' . ($server["Icon"] == $type[0] ? 'selected="selected"' : '') . '>' . lang("realm", $type[1]) . '</option>'; } $output .= ' </select> </td> </tr> <tr> <td>' . lang("admin", "color") . ': </td> <td> <input type="text" name="server_color" value="' . $server["Color"] . '" /> </td> </tr> <tr> <td>' . lang("admin", "timezone") . ': </td> <td> <select name="server_timezone">'; foreach ($get_timezone_type as $zone) { $output .= ' <option value="' . $zone[0] . '" ' . ($server["Timezone"] == $zone[0] ? 'selected="selected"' : '') . '>' . lang("realm", $zone[1]) . '</option>'; } $output .= ' </select> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "bothfactions_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "bothfactions") . '</a>: </td> <td> <input type="checkbox" name="server_both" value="1" ' . ($server["Both_Factions"] ? 'checked="checked"' : '') . ' /> </td> </tr>'; if ($core == 1) { $output .= ' <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "statsxml_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "statsxml") . '</a>: </td> <td> <input type="text" name="server_stats" value="' . $server["Stats_XML"] . '" /> </td> </tr>'; } $output .= ' </table> </fieldset> <div> <input type="submit" name="saveserver" value="' . lang("admin", "save") . '" /> </div> </form> </div>'; } else { redirect("admin.php?section=servers&error=1"); } } elseif ($server_action == "del") { $server_id = $sqlm->quote_smart($_GET["sel_server"]); if (is_numeric($server_id)) { $result = $sqlm->query("DELETE FROM config_servers WHERE `Index`='" . $server_id . "'"); redirect("admin.php?section=servers"); } else { redirect("admin.php?section=servers&error=1"); } } else { switch ($core) { case 1: $name = "ArcEmu"; $port = "8129"; break; case 2: $name = "MaNGOS"; $port = "8085"; break; case 3: $name = "Trinity"; $port = "8085"; break; } // get highest server index $i_query = "SELECT IFNULL(MAX(`Index`), 0) AS MaxID FROM config_servers"; $i_result = $sqlm->query($i_query); $i_result = $sqlm->fetch_assoc($i_result); $max_index = $i_result["MaxID"]; $result = $sqlm->query("INSERT INTO config_servers (`Index`, Port, Name, Both_Factions, Telnet_Port, Address) VALUES ('" . ($max_index + 1) . "', '" . $port . "', '" . $name . "', 1, 0, '127.0.0.1')"); redirect("admin.php?section=servers"); } } }
<?php /* CoreManager, PHP Front End for ArcEmu, MaNGOS, and TrinityCore Copyright (C) 2012-2013 CoreManager Project This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ // this lib is used by login to get the correct user name even if the // user entered a screen name instead require_once "../configs/config.php"; require_once "config_lib.php"; require_once "global_lib.php"; $sql["logon"] = new SQL(); $sql["logon"]->connect($logon_db["addr"], $logon_db["user"], $logon_db["pass"], $logon_db["name"], $logon_db["encoding"]); $sql["mgr"] = new SQL(); $sql["mgr"]->connect($corem_db["addr"], $corem_db["user"], $corem_db["pass"], $corem_db["name"], $corem_db["encoding"]); // we duplicate the core detection that header usually does // if $core is ZERO then we auto-detect based on the auth database if ($core == 0) { $core = detectcore(); }
function dologin() { global $corem_db, $logon_db, $sql, $core; $sql["logon"] = new SQL(); $sql["logon"]->connect($logon_db["addr"], $logon_db["user"], $logon_db["pass"], $logon_db["name"], $logon_db["encoding"]); $sql["mgr"] = new SQL(); $sql["mgr"]->connect($corem_db["addr"], $corem_db["user"], $corem_db["pass"], $corem_db["name"], $corem_db["encoding"]); // if $core is ZERO then we auto-detect based on the auth database if ($core == 0) { $core = detectcore(); } if (empty($_POST["login"]) || empty($_POST["password"])) { redirect("admin_login.php?error=2"); } $user_name = $sql["mgr"]->quote_smart($_POST["login"]); $user_pass = $sql["mgr"]->quote_smart($_POST["password"]); if (strlen($user_name) > 255 || strlen($user_pass) > 255) { redirect("admin_login.php?error=1"); } // Users may log in using either their username or screen name // check for matching login if ($core == 1) { $query = "SELECT * FROM accounts WHERE login='******' AND password='******'"; } else { $pass_hash = sha1(strtoupper($user_name . ":" . $user_pass)); $query = "SELECT * FROM account WHERE username='******' AND sha_pass_hash='" . $pass_hash . "'"; } $name_result = $sql["logon"]->query($query); if (!$sql["logon"]->num_rows($name_result)) { // if we didn't find one, check for matching screen name $query = "SELECT * FROM config_accounts WHERE ScreenName='" . $user_name . "'"; $name_result = $sql["mgr"]->query($query); if ($sql["mgr"]->num_rows($name_result)) { $name = $sql["mgr"]->fetch_assoc($name_result); $user_name = $name["Login"]; } } else { // we'll still need the screen name if we have one $query = "SELECT * FROM config_accounts WHERE Login = '******'"; $name_result = $sql["mgr"]->query($query); $name = $sql["mgr"]->fetch_assoc($name_result); } // if we didn't find the name given for either entries, then the name will come up bad below if ($core == 1) { $query = "SELECT * FROM accounts WHERE login='******' AND password='******'"; } else { $pass_hash = sha1(strtoupper($user_name . ":" . $user_pass)); $query = "SELECT * FROM account WHERE username='******' AND sha_pass_hash='" . $pass_hash . "'"; } $result = $sql["logon"]->query($query); $s_result = $sql["mgr"]->query("SELECT SecurityLevel AS gm FROM config_accounts WHERE Login='******'"); $temp = $sql["mgr"]->fetch_assoc($s_result); if ($temp["gm"] >= 1073741824) { $temp["gm"] -= 1073741824; } $_SESSION["gm_lvl"] = $temp["gm"]; if ($sql["logon"]->num_rows($result) == 1) { if ($core == 1) { $acct = $sql["logon"]->result($result, 0, "acct"); } else { $acct = $sql["logon"]->result($result, 0, "id"); } if ($core == 1) { $ban_query = "SELECT banned FROM accounts WHERE login='******' AND password='******'"; } else { $ban_query = "SELECT COUNT(*) FROM account_banned WHERE id='" . $acct . "' AND active=1"; } if ($sql["logon"]->result($sql["logon"]->query($ban_query), 0)) { redirect("admin_login.php?error=3"); } else { $_SESSION["user_id"] = $acct; if ($core == 1) { $_SESSION["login"] = $sql["logon"]->result($result, 0, "login"); } else { $_SESSION["login"] = $sql["logon"]->result($result, 0, "username"); } // if we got a screen name, we'll want it later. $_SESSION["screenname"] = $name["ScreenName"]; //gets our numerical level based on Security Level. $_SESSION["user_lvl"] = gmlevel($temp["gm"]); $_SESSION["realm_id"] = $sql["logon"]->quote_smart($_POST["realm"]); $_SESSION["client_ip"] = isset($_SERVER["REMOTE_ADDR"]) ? $_SERVER["REMOTE_ADDR"] : getenv("REMOTE_ADDR"); $_SESSION["logged_in"] = true; redirect("admin.php"); } } else { redirect("admin_login.php?error=1"); } }
function accounts() { global $output, $corem_db, $logon_db, $itemperpage, $core; // we need $core to be set if ($core == 0) { $core = detectcore(); } $sqlm = new SQL(); $sqlm->connect($corem_db["addr"], $corem_db["user"], $corem_db["pass"], $corem_db["name"], $corem_db["encoding"]); $sqll = new SQL(); $sqll->connect($logon_db["addr"], $logon_db["user"], $logon_db["pass"], $logon_db["name"], $logon_db["encoding"]); $start = isset($_GET["start"]) ? $sqll->quote_smart($_GET["start"]) : 0; if (!is_numeric($start)) { $start = 0; } $order_by = isset($_GET["order_by"]) ? $sqll->quote_smart($_GET["order_by"]) : "acct"; if ($order_by == "login") { if ($core == 1) { $order_by = "login"; } else { $order_by = "username"; } } $dir = isset($_GET["dir"]) ? $sqll->quote_smart($_GET["dir"]) : 1; if (!preg_match('/^[01]{1}$/', $dir)) { $dir = 1; } $accts_per_page = isset($_GET["perpage"]) ? $sqll->quote_smart($_GET["perpage"]) : $itemperpage; if (!is_numeric($accts_per_page)) { $accts_per_page = $itemperpage; } $order_dir = $dir ? "ASC" : "DESC"; $dir = $dir ? 0 : 1; $search_value = isset($_GET["search_value"]) ? $sqll->quote_smart($_GET["search_value"]) : ""; $search_by = isset($_GET["search_by"]) ? $sqll->quote_smart($_GET["search_by"]) : ""; if ($core == 1) { $search_menu = array(array("login", "by_name"), array("acct", "by_id"), array("ScreenName", "by_sn"), array("SecurityLevel", "by_sl"), array("WebAdmin", "by_web")); } else { $search_menu = array(array("username", "by_name"), array("id", "by_id"), array("ScreenName", "by_sn"), array("SecurityLevel", "by_sl"), array("WebAdmin", "by_web")); } $search = ""; if ($search_value != "" && $search_by != "") { if ($search_by == "WebAdmin") { $search = "WHERE SecurityLevel>='1073741824'"; } else { $search = "WHERE " . $search_by . " LIKE '%" . $search_value . "%'"; } } if ($core == 1) { $query = "SELECT *, (SecurityLevel & 1073741824) AS WebAdmin\n FROM accounts\n LEFT JOIN `" . $corem_db["name"] . "`.config_accounts ON accounts.login=`" . $corem_db["name"] . "`.config_accounts.Login COLLATE utf8_general_ci\n " . $search . "\n ORDER BY " . $order_by . " " . $order_dir . " LIMIT " . $start . ", " . $accts_per_page; $count_query = "SELECT COUNT(*) FROM accounts\n LEFT JOIN `" . $corem_db["name"] . "`.config_accounts ON accounts.login=`" . $corem_db["name"] . "`.config_accounts.Login COLLATE utf8_general_ci\n " . $search; } else { $query = "SELECT *, id AS acct, username AS login, (SecurityLevel & 1073741824) AS WebAdmin\n FROM account\n LEFT JOIN `" . $corem_db["name"] . "`.config_accounts ON account.username=`" . $corem_db["name"] . "`.config_accounts.Login\n " . $search . "\n ORDER BY " . $order_by . " " . $order_dir . " LIMIT " . $start . ", " . $accts_per_page; $count_query = "SELECT COUNT(*) FROM account\n LEFT JOIN `" . $corem_db["name"] . "`.config_accounts ON account.username=`" . $corem_db["name"] . "`.config_accounts.Login\n " . $search; } $result = $sqll->query($query); $count_result = $sqll->query($count_query); $all_record = $sqll->result($count_result, 0); $accounts_action = 0; if (isset($_GET["editacct"])) { $accounts_action = "edit"; } if (!$accounts_action) { $output .= ' <div class="center" id="admin_accounts_search"> <form action="admin.php" method="get" id="form"> <div> <input type="hidden" name="section" value="accounts" /> </div> <table class="hidden" id="admin_accounts_search_table"> <tr> <td> <input type="text" size="24" maxlength="50" name="search_value" value="' . $search_value . '" /> </td> <td> <select name="search_by">'; foreach ($search_menu as $row) { $output .= ' <option value="' . $row[0] . '"' . ($search_by === $row[0] ? ' selected="selected"' : '') . '>' . lang("admin", $row[1]) . '</option>'; } $output .= ' </select> </td> <td> <input type="submit" name="search" value="' . lang("global", "search") . '" /> </td> </tr> </table> </form>'; $output .= ' <a href="admin.php?section=accounts&order_by=' . $order_by . '&start=' . $start . '&dir=' . ($dir ? 0 : 1) . '&perpage=' . $accts_per_page . '">' . lang("admin", "clearsearch") . '</a> <br /> <br />'; if ($order_by == "username") { $order_by = "login"; } $output .= ' <table class="hidden admin_accounts"> <tr> <td colspan="2" align="left"> ' . lang("admin", "per_page") . ': '; $per_page_choices = array(25, 50, 100, 200); for ($i = 0; $i < count($per_page_choices); $i++) { if ($accts_per_page != $per_page_choices[$i]) { $output .= '<a href="admin.php?section=accounts&order_by=' . $order_by . '&start=' . $start . '&dir=' . ($dir ? 0 : 1) . ($search_value && $search_by ? '&search_by=' . $search_by . '&search_value=' . $search_value . '' : '') . '&perpage=' . $per_page_choices[$i] . '">' . $per_page_choices[$i] . '</a>'; } else { $output .= $per_page_choices[$i]; } if ($i < count($per_page_choices) - 1) { $output .= ', '; } } $output .= ' </td> </tr> <tr> <td align="left">' . lang("admin", "total") . ': ' . $all_record . '</td> <td align="right">'; $output .= generate_pagination('admin.php?section=accounts&order_by=' . $order_by . '&start=' . $start . '&dir=' . ($dir ? 0 : 1) . ($search_value && $search_by ? '&search_by=' . $search_by . '&search_value=' . $search_value . '' : '') . '&perpage=' . $accts_per_page, $all_record, $accts_per_page, $start); $output .= ' </td> </tr> </table> <table class="simple admin_accounts"> <tr> <th style="width: 10%;">' . lang("admin", "edit") . '</th> <th> <a href="admin.php?section=accounts&order_by=acct&start=' . $start . ($search_value && $search_by ? '&search_by=' . $search_by . '&search_value=' . $search_value . '' : '') . '&dir=' . $dir . '&perpage=' . $accts_per_page . '"' . ($order_by == 'acct' ? ' class="' . $order_dir . '"' : '') . '>' . lang("user", "acct") . '</a> </th> <th> <a href="admin.php?section=accounts&order_by=login&start=' . $start . ($search_value && $search_by ? '&search_by=' . $search_by . '&search_value=' . $search_value . '' : '') . '&dir=' . $dir . '&perpage=' . $accts_per_page . '"' . ($order_by == 'login' ? ' class="' . $order_dir . '"' : '') . '>' . lang("admin", "login") . '</a> </th> <th> <a href="admin.php?section=accounts&order_by=ScreenName&start=' . $start . ($search_value && $search_by ? '&search_by=' . $search_by . '&search_value=' . $search_value . '' : '') . '&dir=' . $dir . '&perpage=' . $accts_per_page . '"' . ($order_by == 'ScreenName' ? ' class="' . $order_dir . '"' : '') . '>' . lang("admin", "screenname") . '</a> </th> <th style="width: 20%;"> <a href="admin.php?section=accounts&order_by=SecurityLevel&start=' . $start . ($search_value && $search_by ? '&search_by=' . $search_by . '&search_value=' . $search_value . '' : '') . '&dir=' . $dir . '&perpage=' . $accts_per_page . '"' . ($order_by == 'SecurityLevel' ? ' class="' . $order_dir . '"' : '') . '>' . lang("admin", "seclvl") . '</a> </th> <th style="width: 15%;"> <a href="admin.php?section=accounts&order_by=WebAdmin&start=' . $start . ($search_value && $search_by ? '&search_by=' . $search_by . '&search_value=' . $search_value . '' : '') . '&dir=' . $dir . '&perpage=' . $accts_per_page . '"' . ($order_by == 'WebAdmin' ? ' class="' . $order_dir . '"' : '') . '>' . lang("admin", "acpaccess") . '</a> </th> <th style="width: 15%;"> <a href="admin.php?section=accounts&order_by=TempPassword&start=' . $start . ($search_value && $search_by ? '&search_by=' . $search_by . '&search_value=' . $search_value . '' : '') . '&dir=' . $dir . '&perpage=' . $accts_per_page . '"' . ($order_by == 'TempPassword' ? ' class="' . $order_dir . '"' : '') . '>' . lang("admin", "confirm_account") . '</a> </th> </tr>'; $color = "#EEEEEE"; while ($acct = $sqll->fetch_assoc($result)) { $acct["SecurityLevel"] = isset($acct["SecurityLevel"]) ? $acct["SecurityLevel"] : 0; $acct["WebAdmin"] = isset($acct["WebAdmin"]) ? $acct["WebAdmin"] : 0; $acct["ScreenName"] = isset($acct["ScreenName"]) ? $acct["ScreenName"] : ""; if ($acct["SecurityLevel"] >= 1073741824) { $acct["SecurityLevel"] -= 1073741824; } $sl_query = "SELECT * FROM config_gm_level_names WHERE Security_Level='" . $acct["SecurityLevel"] . "'"; $sl_result = $sqlm->query($sl_query); $sl = $sqlm->fetch_assoc($sl_result); $output .= ' <tr> <td style="background-color:' . $color . '; text-align: center;"> <span> <a href="admin.php?section=accounts&acct=' . $acct["login"] . '&editacct=editaccount"> <img src="img/edit.png" alt="" /> </a> </span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span>' . $acct["acct"] . '</span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span>' . strtolower($acct["login"]) . '</span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span>' . $acct["ScreenName"] . '</span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span>' . $sl["Full_Name"] . ' (' . $acct["SecurityLevel"] . ')</span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span> <img src="img/' . ($acct["WebAdmin"] ? 'up' : 'down') . '.gif" alt="" /> </span> </td> <td style="background-color:' . $color . '; text-align: center;">'; if ($acct["TempPassword"] != "") { $output .= ' <center> <aspanhref="register.php?action=do_activate&key=' . $acct["TempPassword"] . '&redirect=1" onmouseover="oldtoolTip(\'' . lang("admin", "confirm_account_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()"> <img src="img/aff_tick.png" alt="" /> </a> </span>'; } else { $output .= ' '; } $output .= ' </td> </tr>'; $color = $color == "#EEEEEE" ? "#FFFFFF" : "#EEEEEE"; } $output .= ' </table> </div>'; } else { if (isset($_GET["acct"])) { $acct = $sqlm->quote_smart($_GET["acct"]); } else { redirect("admin.php?section=accounts&error=1"); } if ($core == 1) { $logon_acct = $sqll->fetch_assoc($sqll->query("SELECT * FROM accounts WHERE login='******'")); } else { $logon_acct = $sqll->fetch_assoc($sqll->query("SELECT *, username AS login FROM account WHERE username='******'")); } $sl_query = "SELECT * FROM config_gm_level_names"; $sl_result = $sqlm->query($sl_query); $sn_acct = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_accounts WHERE Login='******'")); $sec_level_only = $sn_acct["SecurityLevel"] ? $sn_acct["SecurityLevel"] : 0; if ($sec_level_only >= 1073741824) { $sec_level_only -= 1073741824; } $web_admin_only = $sn_acct["SecurityLevel"] & 1073741824; $output .= ' <div id="admin_edit_account"> <form action="admin.php" method="get" id="form"> <div> <input type="hidden" name="section" value="accounts" /> <input type="hidden" name="action" value="saveacct" /> </div> <fieldset> <table> <tr> <td style="width: 50%;">' . lang("admin", "login") . ': </td> <td> <input type="text" readonly="readonly" name="login" value="' . $logon_acct["login"] . '" /> </td> </tr> <tr> <td>' . lang("admin", "screenname") . ': </td> <td> <input type="text" name="sn" value="' . $sn_acct["ScreenName"] . '" /> </td> </tr> <tr> <td>' . lang("admin", "seclvl") . ': </td> <td> <select name="sec">'; while ($row = $sqlm->fetch_assoc($sl_result)) { $output .= ' <option value="' . $row["Security_Level"] . '" ' . ($sec_level_only == $row["Security_Level"] ? 'selected="selected"' : '') . '>' . $row["Full_Name"] . ' (' . $row["Security_Level"] . ')</option>'; } $output .= ' </select> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "acpaccess_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "acpaccess") . '</a>: </td> <td> <input type="checkbox" name="acp" ' . ($web_admin_only ? 'checked="checked"' : '') . ' /> </td> </tr> </table> </fieldset> <div> <input type="submit" name="saveacct" value="' . lang("admin", "save") . '" /> </div> </form> </div>'; } }
function general() { global $output, $corem_db, $world_db, $core; // we need $core to be set if ($core == 0) { $core = detectcore(); } $sqlm = new SQL(); $sqlm->connect($corem_db["addr"], $corem_db["user"], $corem_db["pass"], $corem_db["name"], $corem_db["encoding"]); $sqlw = new SQL(); $sqlw->connect($world_db[1]["addr"], $world_db[1]["user"], $world_db[1]["pass"], $world_db[1]["name"], $world_db[1]["encoding"]); $subsection = isset($_GET["subsection"]) ? $sqlm->quote_smart($_GET["subsection"]) : 1; $output .= ' <table id="sidebar"> <tr> <td ' . ($subsection == "more" ? 'class="current"' : '') . '> <a href="admin.php?section=general&subsection=more">' . lang("admin", "more") . '</a> </td> </tr> <tr> <td ' . ($subsection == "version" ? 'class="current"' : '') . '> <a href="admin.php?section=general&subsection=version">' . lang("admin", "version") . '</a> </td> </tr> <tr> <td ' . ($subsection == "mail" ? 'class="current"' : '') . '> <a href="admin.php?section=general&subsection=mail">' . lang("admin", "mail") . '</a> </td> </tr> <tr> <td ' . ($subsection == "irc" ? 'class="current"' : '') . '> <a href="admin.php?section=general&subsection=irc">' . lang("admin", "irc") . '</a> </td> </tr> <tr> <td ' . ($subsection == "proxy" ? 'class="current"' : '') . '> <a href="admin.php?section=general&subsection=proxy">' . lang("admin", "proxy") . '</a> </td> </tr> <tr> <td ' . ($subsection == "datasite" ? 'class="current"' : '') . '> <a href="admin.php?section=general&subsection=datasite">' . lang("admin", "datasite") . '</a> </td> </tr> <tr> <td ' . ($subsection == "acctcreation" ? 'class="current"' : '') . '> <a href="admin.php?section=general&subsection=acctcreation">' . lang("admin", "acct_creation") . '</a> </td> </tr> <tr> <td ' . ($subsection == "guests" ? 'class="current"' : '') . '> <a href="admin.php?section=general&subsection=guests">' . lang("admin", "guests") . '</a> </td> </tr> <tr> <td ' . ($subsection == "extratools" ? 'class="current"' : '') . '> <a href="admin.php?section=general&subsection=extratools">' . lang("admin", "extra_tools") . '</a> </td> </tr> <tr> <td ' . ($subsection == "internalmap" ? 'class="current"' : '') . '> <a href="admin.php?section=general&subsection=internalmap">' . lang("admin", "internal_map") . '</a> </td> </tr> <tr> <td ' . ($subsection == "validip" ? 'class="current"' : '') . '> <a href="admin.php?section=general&subsection=validip">' . lang("admin", "validip") . '</a> </td> </tr> <tr> <td ' . ($subsection == "ads" ? 'class="current"' : '') . '> <a href="admin.php?section=general&subsection=ads">' . lang("admin", "ads") . '</a> </td> </tr> <tr> <td ' . ($subsection == "gmlevels" ? 'class="current"' : '') . '> <a href="admin.php?section=general&subsection=gmlevels">' . lang("admin", "gm_levels") . '</a> </td> </tr> </table>'; if (isset($_GET["error"])) { $output .= ' <div id="misc_error">'; } else { $output .= ' <div id="misc">'; } $sub_action = isset($_GET["subaction"]) ? $_GET["subaction"] : ''; switch ($subsection) { case "version": if (!$sub_action) { $show_version_show = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Show_Version_Show'")); $show_version_version = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Show_Version_Version'")); $show_version_version_lvl = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Show_Version_Version_Lvl'")); $show_version_revision = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Show_Version_SVNRev'")); $show_version_revision_lvl = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Show_Version_SVNRev_Lvl'")); $output .= ' <form action="admin.php" method="get" id="form"> <div> <input type="hidden" name="section" value="general" /> <input type="hidden" name="subaction" value="saveversion" /> <input type="hidden" name="subsection" value="version" /> </div> <table class="simple"> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "show_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "show") . '</a>: </td> <td> <select name="showversion" id="admin_showversion_field"> <option value="0" ' . ($show_version_show["Value"] == 0 ? 'selected="selected"' : '') . '>' . lang("admin", "dontshow") . '</option> <option value="1" ' . ($show_version_show["Value"] == 1 ? 'selected="selected"' : '') . 'disabled="disabled">' . lang("admin", "version") . '</option> <option value="2"' . ($show_version_show["Value"] == 2 ? 'selected="selected"' : '') . '>' . lang("admin", "verrev") . '</option> </select> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "version_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "version") . '</a>: </td> <td> <input type="text" name="version" value="' . $show_version_version["Value"] . '" readonly="readonly" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "versionlvl_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "versionlvl") . '</a>: </td> <td> <input type="text" name="versionlvl" value="' . $show_version_version_lvl["Value"] . '" readonly="readonly" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "revision_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "revision") . '</a>: </td> <td> <input type="text" name="revision" value="' . $show_version_revision["Value"] . '" readonly="readonly" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "revisionlvl_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "revisionlvl") . '</a>: </td> <td> <input type="text" name="revisionlvl" value="' . $show_version_revision_lvl["Value"] . '" /> </td> </tr> </table> <div> <input type="submit" name="save" value="' . lang("admin", "save") . '" /> </div> </form>'; } else { $show_version = $sqlm->quote_smart($_GET["showversion"]); $version = $sqlm->quote_smart($_GET["version"]); $version_lvl = $sqlm->quote_smart($_GET["versionlvl"]); $revision = $sqlm->quote_smart($_GET["revision"]); $revision_lvl = $sqlm->quote_smart($_GET["revisionlvl"]); $result = $sqlm->query("UPDATE config_misc SET Value='" . $show_version . "' WHERE `Key`='Show_Version_Show'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $version . "' WHERE `Key`='Show_Version_Version'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $version_lvl . "' WHERE `Key`='Show_Version_Version_Lvl'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $revision . "' WHERE `Key`='Show_Version_SVNRev'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $revision_lvl . "' WHERE `Key`='Show_Version_SVNRev_Lvl'"); redirect("admin.php?section=general&subsection=version"); } break; case "mail": if (!$sub_action) { $mail_admin_email = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Mail_Admin_Email'")); $mail_mailer_type = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Mail_Mailer_Type'")); $mail_from_email = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Mail_From_Email'")); $mail_gmailsender = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Mail_GMailSender'")); $format_mail_html = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Format_Mail_HTML'")); $smtp_host = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='SMTP_Host'")); $smtp_port = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='SMTP_Port'")); $smtp_user = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='SMTP_User'")); $smtp_pass = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='SMTP_Pass'")); $pm_from_char = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='PM_From_Char'")); $pm_stationary = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='PM_Stationary'")); $url_path = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='URL_Path'")); $output .= ' <form action="admin.php" method="get" id="form"> <div> <input type="hidden" name="section" value="general" /> <input type="hidden" name="subaction" value="savemail" /> <input type="hidden" name="subsection" value="mail" /> </div> <table class="simple"> <tr> <td colspan="2"><b>' . lang("admin", "email") . '</b></td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "adminemail_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "adminemail") . '</a>: </td> <td> <input type="text" name="adminemail" value="' . $mail_admin_email["Value"] . '" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "mailertype_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "mailertype") . '</a>: </td> <td> <select name="mailertype" id="admin_mailertype_field"> <option value="mail" ' . ($mail_mailer_type["Value"] == "mail" ? 'selected="selected" ' : '') . '>' . lang("admin", "mail") . '</option> <option value="sendmail" ' . ($mail_mailer_type["Value"] == "sendmail" ? 'selected="selected" ' : '') . '>' . lang("admin", "sendmail") . '</option> <option value="smtp"' . ($mail_mailer_type["Value"] == "smtp" ? 'selected="selected" ' : '') . '>' . lang("admin", "smtp") . '</option> <option value="gmailsmtp"' . ($mail_gmailsender["Value"] == 1 ? 'selected="selected" ' : '') . '>' . lang("admin", "gmailsmtp") . '</option> </select> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "fromemail_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "fromemail") . '</a>: </td> <td> <input type="text" name="fromemail" value="' . $mail_from_email["Value"] . '" /> </td> </tr> <!-- tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "usegmail_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "usegmail") . '</a>: </td> <td> <input type="checkbox" name="gmail" ' . ($mail_gmailsender["Value"] == 1 ? 'checked="checked"' : '') . ' /> </td> </tr --> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "formathtml_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "formathtml") . '</a>: </td> <td> <input type="checkbox" name="usehtml" ' . ($format_mail_html["Value"] == 1 ? 'checked="checked"' : '') . ' /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "urlpath_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "urlpath") . '</a>: </td> <td> <input type="text" name="urlpath" value="' . $url_path["Value"] . '" /> </td> </tr> <tr> <td colspan="2"> <b>' . lang("admin", "smtp") . '</b> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "smtphost_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "smtphost") . '</a>: </td> <td> <input type="text" name="smtphost" value="' . $smtp_host["Value"] . '" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "smtpport_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "smtpport") . '</a>: </td> <td> <input type="text" name="smtpport" value="' . $smtp_port["Value"] . '" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "smtpuser_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "smtpuser") . '</a>: </td> <td> <input type="text" name="smtpuser" value="' . $smtp_user["Value"] . '" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "smtppass_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "smtppass") . '</a>: </td> <td> <input type="text" name="smtppass" value="' . $smtp_pass["Value"] . '" /> </td> </tr>'; if ($core == 1) { $output .= ' <tr> <td colspan="2"> <b>' . lang("admin", "pm") . '</b> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "pmfrom_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "pmfrom") . '</a>: </td> <td> <input type="text" name="fromchar" value="' . $pm_from_char["Value"] . '" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "pmstation_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "pmstation") . '</a>: </td> <td> <input type="text" name="stationary" value="' . $pm_stationary["Value"] . '" /> </td> </tr>'; } $output .= ' </table> <div> <input type="submit" name="save" value="' . lang("admin", "save") . '" /> </div> </form>'; } else { $mail_admin_email = $sqlm->quote_smart($_GET["adminemail"]); $mail_mailer_type = $sqlm->quote_smart($_GET["mailertype"]); $mail_from_email = $sqlm->quote_smart($_GET["fromemail"]); if ($mail_mailer_type == "gmailsmtp") { $mail_gmailsender = 1; } else { $mail_gmailsender = 0; } $format_mail_html = isset($_GET["usehtml"]) ? 1 : 0; $smtp_host = $sqlm->quote_smart($_GET["smtphost"]); $smtp_port = $sqlm->quote_smart($_GET["smtpport"]); $smtp_user = $sqlm->quote_smart($_GET["smtpuser"]); $smtp_pass = $sqlm->quote_smart($_GET["smtppass"]); $pm_from_char = isset($_GET["fromchar"]) ? $sqlm->quote_smart($_GET["fromchar"]) : 1; $pm_stationary = isset($_GET["stationary"]) ? $sqlm->quote_smart($_GET["stationary"]) : 41; $url_path = $sqlm->quote_smart($_GET["urlpath"]); // clean up $url_path in case user can't read if ($url_path != "" && $url_path[0] != "/") { $url_path = "/" . $url_path; } if ($url_path == "/") { $url_path = ""; } $result = $sqlm->query("UPDATE config_misc SET Value='" . $mail_admin_email . "' WHERE `Key`='Mail_Admin_Email'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $mail_mailer_type . "' WHERE `Key`='Mail_Mailer_Type'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $mail_from_email . "' WHERE `Key`='Mail_From_Email'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $mail_gmailsender . "' WHERE `Key`='Mail_GMailSender'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $format_mail_html . "' WHERE `Key`='Format_Mail_HTML'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $smtp_host . "' WHERE `Key`='SMTP_Host'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $smtp_port . "' WHERE `Key`='SMTP_Port'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $smtp_user . "' WHERE `Key`='SMTP_User'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $smtp_pass . "' WHERE `Key`='SMTP_Pass'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $pm_from_char . "' WHERE `Key`='PM_From_Char'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $pm_stationary . "' WHERE `Key`='PM_Stationary'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $url_path . "' WHERE `Key`='URL_Path'"); redirect("admin.php?section=general&subsection=mail"); } break; case "irc": if (!$sub_action) { $irc_host = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='IRC_Server'")); $irc_port = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='IRC_Port'")); $irc_channel = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='IRC_Channel'")); $irc_helppage = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='IRC_HelpPage'")); $output .= ' <form action="admin.php" method="get" id="form"> <div> <input type="hidden" name="section" value="general" /> <input type="hidden" name="subaction" value="saveirc" /> <input type="hidden" name="subsection" value="irc" /> </div> <table class="simple"> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "irchost_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "irchost") . '</a>: </td> <td> <input type="text" name="irchost" value="' . $irc_host["Value"] . '" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "ircport_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "ircport") . '</a>: </td> <td> <input type="text" name="ircport" value="' . $irc_port["Value"] . '" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "ircchannel_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "ircchannel") . '</a>: </td> <td> <input type="text" name="ircchannel" value="' . $irc_channel["Value"] . '" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "irchelppage_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "irchelppage") . '</a>: </td> <td> <input type="text" name="irchelppage" value="' . $irc_helppage["Value"] . '" readonly="readonly" /> </td> </tr> </table> <div> <input type="submit" name="save" value="' . lang("admin", "save") . '" /> </div> </form>'; } else { $irc_host = $sqlm->quote_smart($_GET["irchost"]); $irc_port = $sqlm->quote_smart($_GET["ircport"]); $irc_channel = $sqlm->quote_smart($_GET["ircchannel"]); $irc_helppage = $sqlm->quote_smart($_GET["irchelppage"]); $result = $sqlm->query("UPDATE config_misc SET Value='" . $irc_host . "' WHERE `Key`='IRC_Server'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $irc_port . "' WHERE `Key`='IRC_Port'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $irc_channel . "' WHERE `Key`='IRC_Channel'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $irc_helppage . "' WHERE `Key`='IRC_HelpPage'"); redirect("admin.php?section=general&subsection=irc"); } break; case "proxy": if (!$sub_action) { $proxy_host = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Proxy_Addr'")); $proxy_port = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Proxy_Port'")); $proxy_user = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Proxy_User'")); $proxy_pass = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Proxy_Pass'")); $output .= ' <form action="admin.php" method="get" id="form"> <div> <input type="hidden" name="section" value="general" /> <input type="hidden" name="subaction" value="saveproxy" /> <input type="hidden" name="subsection" value="proxy" /> </div> <table class="simple"> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "proxyhost_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "proxyhost") . '</a>: </td> <td> <input type="text" name="proxyhost" value="' . $proxy_host["Value"] . '" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "proxyport_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "proxyport") . '</a>: </td> <td> <input type="text" name="proxyport" value="' . $proxy_port["Value"] . '" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "proxyuser_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "proxyuser") . '</a>: </td> <td> <input type="text" name="proxyuser" value="' . $proxy_user["Value"] . '" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "proxypass_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "proxypass") . '</a>: </td> <td> <input type="text" name="proxypass" value="' . $proxy_pass["Value"] . '" /> </td> </tr> </table> <div> <input type="submit" name="save" value="' . lang("admin", "save") . '" /> </div> </form>'; } else { $proxy_host = $sqlm->quote_smart($_GET["proxyhost"]); $proxy_port = $sqlm->quote_smart($_GET["proxyport"]); $proxy_user = $sqlm->quote_smart($_GET["proxyuser"]); $proxy_pass = $sqlm->quote_smart($_GET["proxypass"]); $result = $sqlm->query("UPDATE config_misc SET Value='" . $proxy_host . "' WHERE `Key`='Proxy_Addr'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $proxy_port . "' WHERE `Key`='Proxy_Port'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $proxy_user . "' WHERE `Key`='Proxy_User'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $proxy_pass . "' WHERE `Key`='Proxy_Pass'"); redirect("admin.php?section=general&subsection=proxy"); } break; case "datasite": if (!$sub_action) { $datasite_tooltip_script_src = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Tooltip_Script_Src'")); $datasite_base = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Datasite_Base'")); $datasite_name = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Datasite_Name'")); $datasite_item = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Datasite_Item'")); $datasite_quest = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Datasite_Quest'")); $datasite_creature = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Datasite_Creature'")); $datasite_spell = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Datasite_Spell'")); $datasite_skill = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Datasite_Skill'")); $datasite_go = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Datasite_GO'")); $datasite_achieve = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Datasite_Achievement'")); $output .= ' <form action="admin.php" method="get" id="form"> <div> <input type="hidden" name="section" value="general" /> <input type="hidden" name="subaction" value="savedatasite" /> <input type="hidden" name="subsection" value="datasite" /> </div> <table class="simple" id="admin_datasite"> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "datasitetooltipscriptsrc_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "datasitetooltipscriptsrc") . '</a>: </td> <td> <input type="text" name="datasitetooltipscriptsrc" value="' . $datasite_tooltip_script_src["Value"] . '" size="50" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "datasitebase_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "datasitebase") . '</a>: </td> <td> <input type="text" name="datasitebase" value="' . $datasite_base["Value"] . '" size="50" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "datasitename_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "datasitename") . '</a>: </td> <td> <input type="text" name="datasitename" value="' . $datasite_name["Value"] . '" size="50" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "datasiteitem_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "datasiteitem") . '</a>: </td> <td> <input type="text" name="datasiteitem" value="' . $datasite_item["Value"] . '" size="50" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "datasitequest_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "datasitequest") . '</a>: </td> <td> <input type="text" name="datasitequest" value="' . $datasite_quest["Value"] . '" size="50" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "datasitecreature_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "datasitecreature") . '</a>: </td> <td> <input type="text" name="datasitecreature" value="' . $datasite_creature["Value"] . '" size="50" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "datasitespell_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "datasitespell") . '</a>: </td> <td> <input type="text" name="datasitespell" value="' . $datasite_spell["Value"] . '" size="50" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "datasiteskill_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "datasiteskill") . '</a>: </td> <td> <input type="text" name="datasiteskill" value="' . $datasite_skill["Value"] . '" size="50" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "datasitego_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "datasitego") . '</a>: </td> <td> <input type="text" name="datasitego" value="' . $datasite_go["Value"] . '" size="50" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "datasiteachieve_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "datasiteachieve") . '</a>: </td> <td> <input type="text" name="datasiteachieve" value="' . $datasite_achieve["Value"] . '" size="50" /> </td> </tr> </table> <div> <input type="submit" name="save" value="' . lang("admin", "save") . '" /> </div> </form>'; } else { $datasite_tooltip_script_src = $sqlm->quote_smart($_GET["datasitetooltipscriptsrc"]); $datasite_base = $sqlm->quote_smart($_GET["datasitebase"]); $datasite_name = $sqlm->quote_smart($_GET["datasitename"]); $datasite_item = $sqlm->quote_smart($_GET["datasiteitem"]); $datasite_quest = $sqlm->quote_smart($_GET["datasitequest"]); $datasite_creature = $sqlm->quote_smart($_GET["datasitecreature"]); $datasite_spell = $sqlm->quote_smart($_GET["datasitespell"]); $datasite_skill = $sqlm->quote_smart($_GET["datasiteskill"]); $datasite_go = $sqlm->quote_smart($_GET["datasitego"]); $datasite_achieve = $sqlm->quote_smart($_GET["datasiteachieve"]); $result = $sqlm->query("UPDATE config_misc SET Value='" . $datasite_tooltip_script_src . "' WHERE `Key`='Tooltip_Script_Src'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $datasite_base . "' WHERE `Key`='Datasite_Base'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $datasite_name . "' WHERE `Key`='Datasite_Name'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $datasite_item . "' WHERE `Key`='Datasite_Item'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $datasite_quest . "' WHERE `Key`='Datasite_Quest'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $datasite_creature . "' WHERE `Key`='Datasite_Creature'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $datasite_spell . "' WHERE `Key`='Datasite_Spell'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $datasite_skill . "' WHERE `Key`='Datasite_Skill'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $datasite_go . "' WHERE `Key`='Datasite_GO'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $datasite_achieve . "' WHERE `Key`='Datasite_Achievement'"); redirect("admin.php?section=general&subsection=datasite"); } break; case "acctcreation": if (!$sub_action) { $disable_acc_creation = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Disable_Acc_Creation'")); $invite_only = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Invitation_Only'")); $disable_reg_invite = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Disable_Invitation'")); $expansion_select = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Expansion_Select'")); $default_expansion = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Default_Expansion'")); $enabled_captcha = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Enabled_Captcha'")); $using_recaptcha = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Use_Recaptcha'")); $publickey = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Recaptcha_Public_Key'")); $privatekey = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Recaptcha_Private_Key'")); $send_mail_on_creation = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Send_Mail_On_Creation'")); $send_confirmation_mail_on_creation = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Send_Confirmation_Mail_On_Creation'")); $validate_mail_host = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Validate_Mail_Host'")); $limit_acc_per_ip = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Limit_Acc_Per_IP'")); $output .= ' <form action="admin.php" method="get" id="form"> <div> <input type="hidden" name="section" value="general" /> <input type="hidden" name="subaction" value="saveacctcreation" /> <input type="hidden" name="subsection" value="acctcreation" /> </div> <table class="simple" id="admin_acct_creation"> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "disableacccreation_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "disableacccreation") . '</a>: </td> <td> <input type="checkbox" name="disableacccreation" ' . ($disable_acc_creation["Value"] == 1 ? 'checked="checked"' : '') . ' /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "inviteonly_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "inviteonly") . '</a>: </td> <td> <input type="checkbox" name="inviteonly" ' . ($invite_only["Value"] == 1 ? 'checked="checked"' : '') . ' ' . ($disable_acc_creation["Value"] == 1 ? '' : 'disabled="disabled"') . ' /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "disablereginvite_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "disablereginvite") . '</a>: </td> <td> <input type="checkbox" name="disablereginvite" ' . ($disable_reg_invite["Value"] == 1 ? 'checked="checked"' : '') . ' ' . ($invite_only["Value"] == 0 ? '' : 'disabled="disabled"') . ' /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "expansionselect_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "expansionselect") . '</a>: </td> <td> <input type="checkbox" name="expansionselect" ' . ($expansion_select["Value"] == 1 ? 'checked="checked"' : '') . ' /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "defaultexpansion_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "defaultexpansion") . '</a>: </td> <td> <select name="defaultexpansion">'; if ($core == 1) { $output .= ' <option value="0" ' . ($default_expansion["Value"] == 0 ? 'selected="selected"' : '') . '>Classic</option> <option value="8" ' . ($default_expansion["Value"] == 8 ? 'selected="selected"' : '') . '>BC</option> <option value="16" ' . ($default_expansion["Value"] == 16 ? 'selected="selected"' : '') . '>WotLK</option> <option value="24" ' . ($default_expansion["Value"] == 24 ? 'selected="selected"' : '') . '>WotLK+BC</option>'; } else { $output .= ' <option value="0" ' . ($default_expansion["Value"] == 0 ? 'selected="selected"' : '') . '>Classic</option> <option value="1" ' . ($default_expansion["Value"] == 1 ? 'selected="selected"' : '') . '>BC</option> <option value="2" ' . ($default_expansion["Value"] == 2 ? 'selected="selected"' : '') . '>WotLK+BC</option>'; } $output .= ' </select> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "enabledcaptcha_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "enabledcaptcha") . '</a>: </td> <td> <input type="checkbox" name="enabledcaptcha" ' . ($enabled_captcha["Value"] == 1 ? 'checked="checked"' : '') . ' /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "userecaptcha_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "userecaptcha") . '</a>: </td> <td> <input type="checkbox" name="userecaptcha" ' . ($using_recaptcha["Value"] == 1 ? 'checked="checked"' : '') . ' /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "publickey_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "publickey") . '</a>: </td> <td> <input type="text" name="publickey" value="' . $publickey["Value"] . '" size="52" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "privatekey_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "privatekey") . '</a>: </td> <td> <input type="text" name="privatekey" value="' . $privatekey["Value"] . '" size="52" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "sendmailoncreation_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "sendmailoncreation") . '</a>: </td> <td> <input type="checkbox" name="sendmailoncreation" ' . ($send_mail_on_creation["Value"] == 1 ? 'checked="checked"' : '') . ' /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "sendconfirmmailoncreation_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "sendconfirmmailoncreation") . '</a>: </td> <td> <input type="checkbox" name="sendconfirmmailoncreation" ' . ($send_confirmation_mail_on_creation["Value"] == 1 ? 'checked="checked"' : '') . ' /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "validatemailhost_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "validatemailhost") . '</a>: </td> <td> <input type="checkbox" name="validatemailhost" ' . ($validate_mail_host["Value"] == 1 ? 'checked="checked"' : '') . ' /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "limitaccperip_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "limitaccperip") . '</a>: </td> <td> <input type="checkbox" name="limitaccperip" ' . ($limit_acc_per_ip["Value"] == 1 ? 'checked="checked"' : '') . ' /> </td> </tr> </table> <div> <input type="submit" name="save" value="' . lang("admin", "save") . '" /> </div> </form>'; } else { $disable_acc_creation = isset($_GET["disableacccreation"]) ? 1 : 0; $invite_only = isset($_GET["inviteonly"]) ? 1 : 0; $disable_reg_invite = isset($_GET["disablereginvite"]) ? 1 : 0; $expansion_select = isset($_GET["expansionselect"]) ? 1 : 0; $default_expansion = $sqlm->quote_smart($_GET["defaultexpansion"]); $enabled_captcha = isset($_GET["enabledcaptcha"]) ? 1 : 0; $using_recaptcha = isset($_GET["userecaptcha"]) ? 1 : 0; $publickey = $sqlm->quote_smart($_GET["publickey"]); $privatekey = $sqlm->quote_smart($_GET["privatekey"]); $send_mail_on_creation = isset($_GET["sendmailoncreation"]) ? 1 : 0; $send_confirmation_mail_on_creation = isset($_GET["sendconfirmmailoncreation"]) ? 1 : 0; $validate_mail_host = isset($_GET["validatemailhost"]) ? 1 : 0; $limit_acc_per_ip = isset($_GET["limitaccperip"]) ? 1 : 0; $result = $sqlm->query("UPDATE config_misc SET Value='" . $disable_acc_creation . "' WHERE `Key`='Disable_Acc_Creation'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $invite_only . "' WHERE `Key`='Invitation_Only'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $disable_reg_invite . "' WHERE `Key`='Disable_Invitation'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $expansion_select . "' WHERE `Key`='Expansion_Select'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $default_expansion . "' WHERE `Key`='Default_Expansion'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $enabled_captcha . "' WHERE `Key`='Enabled_Captcha'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $using_recaptcha . "' WHERE `Key`='Use_Recaptcha'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $publickey . "' WHERE `Key`='Recaptcha_Public_Key'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $privatekey . "' WHERE `Key`='Recaptcha_Private_Key'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $send_mail_on_creation . "' WHERE `Key`='Send_Mail_On_Creation'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $send_confirmation_mail_on_creation . "' WHERE `Key`='Send_Confirmation_Mail_On_Creation'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $validate_mail_host . "' WHERE `Key`='Validate_Mail_Host'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $limit_acc_per_ip . "' WHERE `Key`='Limit_Acc_Per_IP'"); redirect("admin.php?section=general&subsection=acctcreation"); } break; case "guests": if (!$sub_action) { $acp_allow_anony = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Allow_Anony'")); $acp_anony_name = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Anony_Name'")); $acp_anony_realm_id = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Anony_Realm_ID'")); $output .= ' <form action="admin.php" method="get" id="form"> <div> <input type="hidden" name="section" value="general" /> <input type="hidden" name="subaction" value="saveguests" /> <input type="hidden" name="subsection" value="guests" /> </div> <table class="simple"> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "allowanony_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "allowanony") . '</a>: </td> <td> <input type="checkbox" name="allowanony" ' . ($acp_allow_anony["Value"] == 1 ? 'checked="checked"' : '') . ' disabled="disabled" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "anonyname_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "anonyname") . '</a>: </td> <td> <input type="text" name="anonyname" value="' . $acp_anony_name["Value"] . '" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "anonyrealmid_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "anonyrealmid") . '</a>: </td> <td> <input type="text" name="anonyrealmid" value="' . $acp_anony_realm_id["Value"] . '" /> </td> </tr> </table> <div> <input type="submit" name="save" value="' . lang("admin", "save") . '" /> </div> </form>'; } else { // Allow Anonymous is disabled but must stay checked $acp_allow_anony = 1; $acp_anony_name = $sqlm->quote_smart($_GET["anonyname"]); $acp_anony_realm_id = $sqlm->quote_smart($_GET["anonyrealmid"]); $result = $sqlm->query("UPDATE config_misc SET Value='" . $acp_allow_anony . "' WHERE `Key`='Allow_Anony'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $acp_anony_name . "' WHERE `Key`='Anony_Name'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $acp_anony_realm_id . "' WHERE `Key`='Anony_Realm_ID'"); redirect("admin.php?section=general&subsection=guests"); } break; case "extratools": if (!$sub_action) { if (isset($_GET["newdisable"])) { $query = "INSERT IGNORE INTO ultravendor_disables VALUE ('" . $_GET["newdisable"] . "')"; $result = $sqlm->query($query); } if (isset($_GET["delete"])) { $query = "DELETE FROM ultravendor_disables WHERE itemid='" . $_GET["delete"] . "'"; $result = $sqlm->query($query); } $quest_item_vendor_level_mul = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Quest_Item_Vendor_Level_Mul'")); $quest_item_vendor_rew_mul = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Quest_Item_Vendor_Rew_Mul'")); $ultra_vendor_mult_0 = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Ultra_Vendor_Mult_0'")); $ultra_vendor_mult_1 = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Ultra_Vendor_Mult_1'")); $ultra_vendor_mult_2 = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Ultra_Vendor_Mult_2'")); $ultra_vendor_mult_3 = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Ultra_Vendor_Mult_3'")); $ultra_vendor_mult_4 = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Ultra_Vendor_Mult_4'")); $ultra_vendor_mult_5 = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Ultra_Vendor_Mult_5'")); $ultra_vendor_mult_6 = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Ultra_Vendor_Mult_6'")); $ultra_vendor_mult_7 = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Ultra_Vendor_Mult_7'")); $ultra_vendor_base = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Ultra_Vendor_Base'")); $ultra_vendor_max_item_level = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Ultra_Vendor_Max_Item_Level'")); $ultra_vendor_max_item_req_level = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Ultra_Vendor_Max_Item_Req_Level'")); $dis_query = "SELECT * FROM ultravendor_disables"; $dis_result = $sqlm->query($dis_query); $output .= ' <form action="admin.php" method="get" id="form"> <div> <input type="hidden" name="section" value="general" /> <input type="hidden" name="subaction" value="saveextratools" /> <input type="hidden" name="subsection" value="extratools" /> </div> <table class="simple"> <tr> <td colspan="2"> <b>' . lang("admin", "questitemvendor") . '</b> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "questitemvendorlevelmul_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "questitemvendorlevelmul") . '</a>: </td> <td> <input type="text" name="questitemvendorlevelmul" value="' . $quest_item_vendor_level_mul["Value"] . '" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "questitemvendorrewmul_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "questitemvendorrewmul") . '</a>: </td> <td> <input type="text" name="questitemvendorrewmul" value="' . $quest_item_vendor_rew_mul["Value"] . '" /> </td> </tr> <tr> <td colspan="2"> <b>' . lang("admin", "ultravendor") . '</b> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "ultravendormult0_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "ultravendormult0") . '</a>: </td> <td> <input type="text" name="ultravendormult0" value="' . $ultra_vendor_mult_0["Value"] . '" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "ultravendormult1_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "ultravendormult1") . '</a>: </td> <td> <input type="text" name="ultravendormult1" value="' . $ultra_vendor_mult_1["Value"] . '" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "ultravendormult2_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "ultravendormult2") . '</a>: </td> <td> <input type="text" name="ultravendormult2" value="' . $ultra_vendor_mult_2["Value"] . '" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "ultravendormult3_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "ultravendormult3") . '</a>: </td> <td> <input type="text" name="ultravendormult3" value="' . $ultra_vendor_mult_3["Value"] . '" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "ultravendormult4_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "ultravendormult4") . '</a>: </td> <td> <input type="text" name="ultravendormult4" value="' . $ultra_vendor_mult_4["Value"] . '" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "ultravendormult5_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "ultravendormult5") . '</a>: </td> <td> <input type="text" name="ultravendormult5" value="' . $ultra_vendor_mult_5["Value"] . '" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "ultravendormult6_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "ultravendormult6") . '</a>: </td> <td> <input type="text" name="ultravendormult6" value="' . $ultra_vendor_mult_6["Value"] . '" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "ultravendormult7_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "ultravendormult7") . '</a>: </td> <td> <input type="text" name="ultravendormult7" value="' . $ultra_vendor_mult_7["Value"] . '" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "ultravendorbase_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "ultravendorbase") . '</a>: </td> <td> <input type="text" name="ultravendorbase" value="' . $ultra_vendor_base["Value"] . '" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "ultravendormaxitemlevel_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "ultravendormaxitemlevel") . '</a>: </td> <td> <input type="text" name="ultravendormaxitemlevel" value="' . $ultra_vendor_max_item_level["Value"] . '" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "ultravendormaxitemreqlevel_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "ultravendormaxitemreqlevel") . '</a>: </td> <td> <input type="text" name="ultravendormaxitemreqlevel" value="' . $ultra_vendor_max_item_req_level["Value"] . '" /> </td> </tr> </table> <div> <input type="submit" name="save" value="' . lang("admin", "save") . '" /> </div> </form> <br /> <div> <span>' . lang("admin", "disabledinfo") . ':</span> <table class="simple"> <tr> <th class="disabled_remove_item_th"> </th> <th class="disabled_item_th">' . lang("admin", "disableditem") . '</th> <th> </th> </tr>'; while ($row = $sqlm->fetch_assoc($dis_result)) { if ($core == 1) { $item_query = "SELECT name1, name FROM items\r\n LEFT JOIN itemnames ON itemnames.entry=items.entry\r\n WHERE entry='" . $row["itemid"] . "'"; } else { $item_query = "SELECT 0 AS name1, name FROM item_template\r\n WHERE entry='" . $row["itemid"] . "'"; } $item_result = $sqlw->query($item_query); $item_result = $sqlw->fetch_assoc($item_result); // Trinity and MaNGOS will always follow the else // (at least until we add locales_item support here) if ($item_result["name1"] != 0) { $item_name = $item_result["name1"]; } else { $item_name = $item_result["name"]; } $output .= ' <tr> <td class="disabled_item_id_td"> <a href="admin.php?section=general&subsection=extratools&delete=' . $row["itemid"] . '"> <img src="img/aff_cross.png" alt="" /> </a> </td> <td class="disabled_item_id_td">' . $row["itemid"] . '</td> <td>' . $item_name . '</td> </tr>'; } $output .= ' <tr> <td colspan="2"> <a id="link" href="#" onclick="admin_extratools_disable()"> <img src="img/add.png" alt="" /> <span>' . lang("admin", "disabledadd") . ':</span> </a> </td> <td> <input type="text" id="new_dis" /> </td> </tr> </table> </div>'; } else { $quest_item_vendor_level_mul = $sqlm->quote_smart($_GET["questitemvendorlevelmul"]); $quest_item_vendor_rew_mul = $sqlm->quote_smart($_GET["questitemvendorrewmul"]); $ultra_vendor_mult_0 = $sqlm->quote_smart($_GET["ultravendormult0"]); $ultra_vendor_mult_1 = $sqlm->quote_smart($_GET["ultravendormult1"]); $ultra_vendor_mult_2 = $sqlm->quote_smart($_GET["ultravendormult2"]); $ultra_vendor_mult_3 = $sqlm->quote_smart($_GET["ultravendormult3"]); $ultra_vendor_mult_4 = $sqlm->quote_smart($_GET["ultravendormult4"]); $ultra_vendor_mult_5 = $sqlm->quote_smart($_GET["ultravendormult5"]); $ultra_vendor_mult_6 = $sqlm->quote_smart($_GET["ultravendormult6"]); $ultra_vendor_mult_7 = $sqlm->quote_smart($_GET["ultravendormult7"]); $ultra_vendor_base = $sqlm->quote_smart($_GET["ultravendorbase"]); $ultra_vendor_max_item_level = $sqlm->quote_smart($_GET["ultravendormaxitemlevel"]); $ultra_vendor_max_item_req_level = $sqlm->quote_smart($_GET["ultravendormaxitemreqlevel"]); $result = $sqlm->query("UPDATE config_misc SET Value='" . $quest_item_vendor_level_mul . "' WHERE `Key`='Quest_Item_Vendor_Level_Mul'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $quest_item_vendor_rew_mul . "' WHERE `Key`='Quest_Item_Vendor_Rew_Mul'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $ultra_vendor_mult_0 . "' WHERE `Key`='Ultra_Vendor_Mult_0'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $ultra_vendor_mult_1 . "' WHERE `Key`='Ultra_Vendor_Mult_1'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $ultra_vendor_mult_2 . "' WHERE `Key`='Ultra_Vendor_Mult_2'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $ultra_vendor_mult_3 . "' WHERE `Key`='Ultra_Vendor_Mult_3'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $ultra_vendor_mult_4 . "' WHERE `Key`='Ultra_Vendor_Mult_4'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $ultra_vendor_mult_5 . "' WHERE `Key`='Ultra_Vendor_Mult_5'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $ultra_vendor_mult_6 . "' WHERE `Key`='Ultra_Vendor_Mult_6'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $ultra_vendor_mult_7 . "' WHERE `Key`='Ultra_Vendor_Mult_7'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $ultra_vendor_base . "' WHERE `Key`='Ultra_Vendor_Base'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $ultra_vendor_max_item_level . "' WHERE `Key`='Ultra_Vendor_Max_Item_Level'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $ultra_vendor_max_item_req_level . "' WHERE `Key`='Ultra_Vendor_Max_Item_Req_Level'"); redirect("admin.php?section=general&subsection=extratools"); } break; case "internalmap": if (!$sub_action) { $map_gm_show_online_only_gmoff = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Map_GM_Show_Online_Only_GMOff'")); $map_gm_show_online_only_gmvisible = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Map_GM_Show_Online_Only_GMVisible'")); $map_gm_add_suffix = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Map_GM_Add_Suffix'")); $map_status_gm_include_all = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Map_Status_GM_Include_All'")); $map_show_status = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Map_Show_Status'")); $map_show_timer = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Map_Show_Timer'")); $map_timer = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Map_Timer'")); $map_show_online = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Map_Show_Online'")); $map_time_to_show_uptime = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Map_Time_To_Show_Uptime'")); $map_time_to_show_maxonline = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Map_Time_To_Show_MaxOnline'")); $map_time_to_show_gmonline = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Map_Time_To_Show_GMOnline'")); $output .= ' <form action="admin.php" method="get" id="form"> <div> <input type="hidden" name="section" value="general" /> <input type="hidden" name="subaction" value="saveinternalmap" /> <input type="hidden" name="subsection" value="internalmap" /> </div> <table class="simple"> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "statusgmincludeall_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "statusgmincludeall") . '</a>: </td> <td> <input type="checkbox" name="statusgmincludeall" ' . ($map_status_gm_include_all["Value"] == 1 ? 'checked="checked"' : '') . ' /> </td> </tr> <!-- tr> <td class="help"><a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "gmshowonlineonlygmoff_tip") . '\',\'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "gmshowonlineonlygmoff") . '</a>: </td> <td><input type="checkbox" name="gmshowonlineonlygmoff" ' . ($map_gm_show_online_only_gmoff["Value"] == 1 ? 'checked="checked"' : '') . ' /></td> </tr> <tr> <td class="help"><a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "gmshowonlineonlygmvisible_tip") . '\',\'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "gmshowonlineonlygmvisible") . '</a>: </td> <td><input type="checkbox" name="gmshowonlineonlygmvisible" ' . ($map_gm_show_online_only_gmvisible["Value"] == 1 ? 'checked="checked"' : '') . ' disabled="disabled" /></td> </tr --> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "gmaddsuffix_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "gmaddsuffix") . '</a>: </td> <td> <input type="checkbox" name="gmaddsuffix" ' . ($map_gm_add_suffix["Value"] == 1 ? 'checked="checked"' : '') . ' /> </td> </tr> </table> <div> <input type="submit" name="save" value="' . lang("admin", "save") . '" /> </div> </form>'; } else { $map_gm_show_online_only_gmoff = isset($_GET["gmshowonlineonlygmoff"]) ? 1 : 0; $map_gm_show_online_only_gmvisible = isset($_GET["gmshowonlineonlygmvisible"]) ? 1 : 0; $map_gm_add_suffix = isset($_GET["gmaddsuffix"]) ? 1 : 0; $map_status_gm_include_all = isset($_GET["statusgmincludeall"]) ? 1 : 0; $map_show_status = isset($_GET["showstatus"]) ? 1 : 0; $map_show_timer = isset($_GET["showtimer"]) ? 1 : 0; $map_timer = $sqlm->quote_smart($_GET["timer"]); $map_show_online = isset($_GET["showonline"]) ? 1 : 0; $map_time_to_show_uptime = $sqlm->quote_smart($_GET["timetoshowuptime"]); $map_time_to_show_maxonline = $sqlm->quote_smart($_GET["timetoshowmaxonline"]); $map_time_to_show_gmonline = $sqlm->quote_smart($_GET["timetoshowgmonline"]); $result = $sqlm->query("UPDATE config_misc SET Value='" . $map_gm_show_online_only_gmoff . "' WHERE `Key`='Map_GM_Show_Online_Only_GMOff'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $map_gm_show_online_only_gmvisible . "' WHERE `Key`='Map_GM_Show_Online_Only_GMVisible'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $map_gm_add_suffix . "' WHERE `Key`='Map_GM_Add_Suffix'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $map_status_gm_include_all . "' WHERE `Key`='Map_Status_GM_Include_All'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $map_show_status . "' WHERE `Key`='Map_Show_Status'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $map_gm_add_suffix . "' WHERE `Key`='Map_Show_Timer'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $map_timer . "' WHERE `Key`='Map_Timer'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $map_show_online . "' WHERE `Key`='Map_Show_Online'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $map_time_to_show_uptime . "' WHERE `Key`='Map_Time_To_Show_Uptime'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $map_time_to_show_maxonline . "' WHERE `Key`='Map_Time_To_Show_MaxOnline'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $map_time_to_show_gmonline . "' WHERE `Key`='Map_Time_To_Show_GMOnline'"); redirect("admin.php?section=general&subsection=internalmap"); } break; case "validip": if (!$sub_action) { $masks_query = $sqlm->query("SELECT * FROM config_valid_ip_mask"); $output .= ' <form action="admin.php" method="get" id="form"> <div> <input type="hidden" name="section" value="general" /> <input type="hidden" name="subaction" value="editvalidip" /> <input type="hidden" name="subsection" value="validip" /> </div> <table class="simple"> <tr> <th style="width: 10%;"> </th> <th style="width: 20%;"> <span style="text-align: center;">' . lang("admin", "index") . '</span> </th> <th>' . lang("admin", "validipmask") . '</th> </tr>'; while ($mask = $sqlm->fetch_assoc($masks_query)) { $output .= ' <tr> <td> <input type="radio" name="index" value="' . $mask["Index"] . '" /> </td> <td> <center>' . $mask["Index"] . '</center> </td> <td>' . $mask["ValidIPMask"] . '</td> </tr>'; } $output .= ' </table> <div> <input type="submit" name="edit" value="' . lang("admin", "editipmask") . '" /> <input type="submit" name="add" value="' . lang("admin", "addipmask") . '" /> <input type="submit" name="delete" value="' . lang("admin", "deleteipmask") . '" /> </div> </form>'; } elseif ($sub_action == "editvalidip") { if (isset($_GET["add"])) { $lim = $sqlm->fetch_assoc($sqlm->query("SELECT MAX(`Index`) FROM config_valid_ip_mask")); $lim = $lim["MAX(`Index`)"] + 1; $sqlm->query("INSERT INTO config_valid_ip_mask SET `Index`='" . $lim . "', ValidIPMask=''"); redirect("admin.php?section=general&subsection=validip"); } elseif (isset($_GET["delete"])) { $index = $sqlm->quote_smart($_GET["index"]); if (!is_numeric($index)) { redirect("admin.php?section=general&subsection=validip&error=1"); } $result = $sqlm->query("DELETE FROM config_valid_ip_mask WHERE `Index`='" . $index . "'"); redirect("admin.php?section=general&subsection=validip"); } else { $index = $sqlm->quote_smart($_GET["index"]); if (!is_numeric($index)) { redirect("admin.php?section=general&subsection=validip&error=1"); } $mask = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_valid_ip_mask WHERE `Index`='" . $index . "'")); $output .= ' <form action="admin.php" method="get" id="form"> <div> <input type="hidden" name="section" value="general" /> <input type="hidden" name="subaction" value="savevalidip" /> <input type="hidden" name="subsection" value="validip" /> <input type="hidden" name="index" value="' . $mask["Index"] . '" /> </div> <table class="simple"> <tr> <th width="20%"> <center>' . lang("admin", "index") . '</center> </th> <th class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "validipmask_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "validipmask") . '</a> </th> </tr> <tr> <td> <center>' . $mask["Index"] . '</center> </td> <td> <input type="text" name="mask" value="' . $mask["ValidIPMask"] . '" /> </td> </tr> </table> <div> <input type="submit" name="save" value="' . lang("admin", "save") . '" /> </div> </form>'; } } else { $index = $sqlm->quote_smart($_GET["index"]); $mask = $sqlm->quote_smart($_GET["mask"]); $result = $sqlm->query("UPDATE config_valid_ip_mask SET ValidIPMask='" . $mask . "' WHERE `Index`='" . $index . "'"); redirect("admin.php?section=general&subsection=validip"); } break; case "ads": if (!$sub_action) { $enable_bottom_ad = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Enable_Page_Bottom_Ad'")); $bottom_ad_content = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Page_Bottom_Ad_Content'")); $output .= ' <form action="admin.php" method="get" id="form"> <div> <input type="hidden" name="section" value="general" /> <input type="hidden" name="subaction" value="saveads" /> <input type="hidden" name="subsection" value="ads" /> </div> <table class="simple" id="admin_more"> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "enablebottomad_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "enablebottomad") . '</a>: </td> <td> <input type="checkbox" name="enablebottomad" ' . ($enable_bottom_ad["Value"] == 1 ? 'checked="checked"' : '') . ' /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "bottomadcontent_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "bottomadcontent") . '</a>: </td> <td> <textarea name="bottomadcontent" rows="5" cols="40">' . $bottom_ad_content["Value"] . '</textarea> </td> </tr> </table> <div> <input type="submit" name="save" value="' . lang("admin", "save") . '" /> </div> </form>'; } else { $page_bottom_ad = isset($_GET["enablebottomad"]) ? 1 : 0; $page_bottom_ad_content = $sqlm->quote_smart($_GET["bottomadcontent"]); $result = $sqlm->query("UPDATE config_misc SET Value='" . $page_bottom_ad . "' WHERE `Key`='Enable_Page_Bottom_Ad'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $page_bottom_ad_content . "' WHERE `Key`='Page_Bottom_Ad_Content'"); redirect("admin.php?section=general&subsection=ads"); } break; case "more": if (!$sub_action) { $sql_search_limit = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='SQL_Search_Limit'")); $item_icons = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Item_Icons'")); $remember_me_checked = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Remember_Me_Checked'")); $site_title = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Site_Title'")); $item_per_page = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Item_Per_Page'")); $show_country_flags = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Show_Country_Flags'")); $default_theme = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Default_Theme'")); $default_language = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Default_Language'")); $timezone = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Timezone'")); $timezone_offset = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Timezone_Offset'")); $player_online = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Player_Online'")); $gm_online = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='GM_Online'")); $gm_online_count = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='GM_Online_Count'")); $hide_uptime = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Hide_Uptime'")); $hide_max_players = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Hide_Max_Players'")); $hide_avg_latency = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Hide_Avg_Latency'")); $hide_server_mem = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Hide_Server_Mem'")); $hide_plr_latency = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Hide_Plr_Latency'")); $hide_coupons = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Hide_Coupons_Main_Page'")); $backup_dir = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Backup_Dir'")); $debug = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Debug'")); $test_mode = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Test_Mode'")); $multi_realm = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Multi_Realm'")); $show_emblem = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Show_Guild_Emblem'")); $language_locales_search_option = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Language_Locales_Search_Option'")); $language_site_encoding = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Language_Site_Encoding'")); $show_newest_user = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Show_Newest_User'")); $send_on_email = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Send_Mail_On_Email_Change'")); $use_custom_logo = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Use_Custom_Logo'")); $custom_logo = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Custom_Logo'")); $allow_caching = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Allow_Logo_Caching'")); $index_show_realms = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Index_Show_Realms'")); $custom_logos_result = $sqlm->query("SELECT * FROM custom_logos"); $custom_logo_count = $sqlm->num_rows($custom_logos_result); $custom_logos = array(); while ($row = $sqlm->fetch_assoc($custom_logos_result)) { $custom_logos[] = $row; } $output .= ' <form action="admin.php" method="get" enctype="multipart/form-data" id="form"> <div> <input type="hidden" name="section" value="general" /> <input type="hidden" name="subaction" value="savemore" /> <input type="hidden" name="subsection" value="more" /> </div> <table class="simple" id="admin_more"> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "sqlsearchlimit_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "sqlsearchlimit") . '</a>: </td> <td> <input type="text" name="sqlsearchlimit" value="' . $sql_search_limit["Value"] . '" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "itemicons_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "itemicons") . '</a>: </td> <td> <input type="text" name="itemicons" value="' . $item_icons["Value"] . '" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "remembermechecked_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "remembermechecked") . '</a>: </td> <td> <input type="checkbox" name="remembermechecked" ' . ($remember_me_checked["Value"] == 1 ? 'checked="checked"' : '') . ' /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "sitetitle_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "sitetitle") . '</a>: </td> <td> <input type="text" name="sitetitle" value="' . $site_title["Value"] . '" size="50"/> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "itemperpage_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "itemperpage") . '</a>: </td> <td> <input type="text" name="itemperpage" value="' . $item_per_page["Value"] . '" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "showcountryflags_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "showcountryflags") . '</a>: </td> <td> <input type="checkbox" name="showcountryflags" ' . ($show_country_flags["Value"] == 1 ? 'checked="checked"' : '') . ' /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "defaulttheme_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "defaulttheme") . '</a>: </td> <td> <input type="text" name="defaulttheme" value="' . $default_theme["Value"] . '" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "defaultlanguage_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "defaultlanguage") . '</a>: </td> <td> <select name="defaultlanguage">'; if (is_dir("./lang")) { if ($dh = opendir("./lang")) { while (($file = readdir($dh)) == true) { $lang_temp = explode(".", $file); if (isset($lang_temp[1]) && $lang_temp[1] == "php") { $output .= ' <option value="' . $lang_temp[0] . '"' . ($default_language["Value"] == $lang_temp[0] ? ' selected="selected" ' : '') . '>' . lang("edit", $lang_temp[0]) . '</option>'; } } closedir($dh); } } $output .= ' </select> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "timezone_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "timezone") . '</a>: </td> <td> <select name="timezone"> <option value="-12.0" ' . ($timezone["Value"] == "-12.0" ? 'selected="selected"' : '') . '>(UTC -12:00) Eniwetok, Kwajalein</option> <option value="-11.0" ' . ($timezone["Value"] == "-11.0" ? 'selected="selected"' : '') . '>(UTC -11:00) Midway Island, Samoa</option> <option value="-10.0" ' . ($timezone["Value"] == "-10.0" ? 'selected="selected"' : '') . '>(UTC -10:00) Hawaii</option> <option value="-9.0" ' . ($timezone["Value"] == "-9.0" ? 'selected="selected"' : '') . '>(UTC -9:00) Alaska</option> <option value="-8.0" ' . ($timezone["Value"] == "-8.0" ? 'selected="selected"' : '') . '>(UTC -8:00) Pacific Time (US & Canada)</option> <option value="-7.0" ' . ($timezone["Value"] == "-7.0" ? 'selected="selected"' : '') . '>(UTC -7:00) Mountain Time (US & Canada)</option> <option value="-6.0" ' . ($timezone["Value"] == "-6.0" ? 'selected="selected"' : '') . '>(UTC -6:00) Central Time (US & Canada), Mexico City</option> <option value="-5.0" ' . ($timezone["Value"] == "-5.0" ? 'selected="selected"' : '') . '>(UTC -5:00) Eastern Time (US & Canada), Bogota, Lima</option> <option value="-4.5" ' . ($timezone["Value"] == "-4.5" ? 'selected="selected"' : '') . '>(UTC -4:30) Caracas</option> <option value="-4.0" ' . ($timezone["Value"] == "-4.0" ? 'selected="selected"' : '') . '>(UTC -4:00) Atlantic Time (Canada), La Paz</option> <option value="-3.5" ' . ($timezone["Value"] == "-3.5" ? 'selected="selected"' : '') . '>(UTC -3:30) Newfoundland</option> <option value="-3.0" ' . ($timezone["Value"] == "-3.0" ? 'selected="selected"' : '') . '>(UTC -3:00) Brazil, Buenos Aires, Georgetown</option> <option value="-2.0" ' . ($timezone["Value"] == "-2.0" ? 'selected="selected"' : '') . '>(UTC -2:00) Mid-Atlantic</option> <option value="-1.0" ' . ($timezone["Value"] == "-1.0" ? 'selected="selected"' : '') . '>(UTC -1:00) Azores, Cape Verde Islands</option> <option value="0.0" ' . ($timezone["Value"] == "0.0" ? 'selected="selected"' : '') . '>(UTC) Western Europe Time, London, Lisbon, Casablanca</option> <option value="1.0" ' . ($timezone["Value"] == "1.0" ? 'selected="selected"' : '') . '>(UTC +1:00) Brussels, Copenhagen, Madrid, Paris</option> <option value="2.0" ' . ($timezone["Value"] == "2.0" ? 'selected="selected"' : '') . '>(UTC +2:00) Kaliningrad, South Africa</option> <option value="3.0" ' . ($timezone["Value"] == "3.0" ? 'selected="selected"' : '') . '>(UTC +3:00) Baghdad, Riyadh, Moscow, St. Petersburg</option> <option value="3.5" ' . ($timezone["Value"] == "3.5" ? 'selected="selected"' : '') . '>(UTC +3:30) Tehran</option> <option value="4.0" ' . ($timezone["Value"] == "4.0" ? 'selected="selected"' : '') . '>(UTC +4:00) Abu Dhabi, Muscat, Baku, Tbilisi</option> <option value="4.5" ' . ($timezone["Value"] == "4.5" ? 'selected="selected"' : '') . '>(UTC +4:30) Kabul</option> <option value="5.0" ' . ($timezone["Value"] == "5.0" ? 'selected="selected"' : '') . '>(UTC +5:00) Ekaterinburg, Islamabad, Karachi, Tashkent</option> <option value="5.5" ' . ($timezone["Value"] == "5.5" ? 'selected="selected"' : '') . '>(UTC +5:30) Bombay, Calcutta, Madras, New Delhi</option> <option value="5.75" ' . ($timezone["Value"] == "5.75" ? 'selected="selected"' : '') . '>(UTC +5:45) Kathmandu</option> <option value="6.0" ' . ($timezone["Value"] == "6.0" ? 'selected="selected"' : '') . '>(UTC +6:00) Almaty, Dhaka, Colombo</option> <option value="7.0" ' . ($timezone["Value"] == "7.0" ? 'selected="selected"' : '') . '>(UTC +7:00) Bangkok, Hanoi, Jakarta</option> <option value="8.0" ' . ($timezone["Value"] == "8.0" ? 'selected="selected"' : '') . '>(UTC +8:00) Beijing, Perth, Singapore, Hong Kong</option> <option value="9.0" ' . ($timezone["Value"] == "9.0" ? 'selected="selected"' : '') . '>(UTC +9:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk</option> <option value="9.5" ' . ($timezone["Value"] == "9.5" ? 'selected="selected"' : '') . '>(UTC +9:30) Adelaide, Darwin</option> <option value="10.0" ' . ($timezone["Value"] == "10.0" ? 'selected="selected"' : '') . '>(UTC +10:00) Eastern Australia, Guam, Vladivostok</option> <option value="11.0" ' . ($timezone["Value"] == "11.0" ? 'selected="selected"' : '') . '>(UTC +11:00) Magadan, Solomon Islands, New Caledonia</option> <option value="12.0" ' . ($timezone["Value"] == "12.0" ? 'selected="selected"' : '') . '>(UTC +12:00) Auckland, Wellington, Fiji, Kamchatka</option> </select> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "timezone_offset_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "timezone_offset") . '</a>: </td> <td> <input type="text" name="timezone_offset" value="' . $timezone_offset["Value"] . '" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "playeronline_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "playeronline") . '</a>: </td> <td> <select name="playeronline">'; $sl_query = "SELECT * FROM config_gm_level_names"; $sl_result = $sqlm->query($sl_query); while ($row = $sqlm->fetch_assoc($sl_result)) { $output .= ' <option value="' . $row["Security_Level"] . '" ' . ($player_online["Value"] == $row["Security_Level"] ? 'selected="selected"' : '') . '>' . $row["Full_Name"] . ' (' . $row["Security_Level"] . ')</option>'; } $output .= ' </select> <!-- input type="checkbox" name="playeronline" ' . ($player_online["Value"] == 1 ? 'checked="checked"' : '') . ' / --> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "gmonline_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "gmonline") . '</a>: </td> <td> <input type="checkbox" name="gmonline" ' . ($gm_online["Value"] == 1 ? 'checked="checked"' : '') . ' /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "gmonlinecount_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "gmonlinecount") . '</a>: </td> <td> <input type="checkbox" name="gmonlinecount" ' . ($gm_online_count["Value"] == 1 ? 'checked="checked"' : '') . ' /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "hideuptime_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "hideuptime") . '</a>: </td> <td> <input type="checkbox" name="hideuptime" ' . ($hide_uptime["Value"] == 1 ? 'checked="checked"' : '') . ' /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "hidemaxplayers_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "hidemaxplayers") . '</a>: </td> <td> <input type="checkbox" name="hidemaxplayers" ' . ($hide_max_players["Value"] == 1 ? 'checked="checked"' : '') . ' /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "hideavglatency_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "hideavglatency") . '</a>: </td> <td> <input type="checkbox" name="hideavglatency" ' . ($hide_avg_latency["Value"] == 1 ? 'checked="checked"' : '') . ' /> </td> </tr>'; if ($core == 1) { $output .= ' <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "hideservermem_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "hideservermem") . '</a>: </td> <td> <select name="hideservermem"> <option value="0" ' . ($hide_server_mem["Value"] == 0 ? 'selected="selected"' : '') . '>' . lang("admin", "hide") . '</option> <option value="1" ' . ($hide_server_mem["Value"] == 1 ? 'selected="selected"' : '') . '>' . lang("admin", "showtogmsonly") . '</option> <option value="2" ' . ($hide_server_mem["Value"] == 2 ? 'selected="selected"' : '') . '>' . lang("admin", "showall") . '</option> </select> </td> </tr>'; } $output .= ' <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "hideplrlatency_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "hideplrlatency") . '</a>: </td> <td> <input type="checkbox" name="hideplrlatency" ' . ($hide_plr_latency["Value"] == 1 ? 'checked="checked"' : '') . ' /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "hidecoupons_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "hidecoupons") . '</a>: </td> <td> <input type="checkbox" name="hidecoupons" ' . ($hide_coupons["Value"] == 1 ? 'checked="checked"' : '') . ' /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "backupdir_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "backupdir") . '</a>: </td> <td> <input type="text" name="backupdir" value="' . $backup_dir["Value"] . '" readonly="readonly" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "debug_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "debug") . '</a>: </td> <td> <input type="text" name="debug" value="' . $debug["Value"] . '" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "testmode_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "testmode") . '</a>: </td> <td> <input type="text" name="testmode" value="' . $test_mode["Value"] . '" readonly="readonly" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "multirealm_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "multirealm") . '</a>: </td> <td> <input type="text" name="multirealm" value="' . $multi_realm["Value"] . '" readonly="readonly" /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "showemblem_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "showemblem") . '</a>: </td> <td> <input type="checkbox" name="showemblem" ' . ($show_emblem["Value"] == 1 ? 'checked="checked"' : '') . ' /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "shownewuser_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "shownewuser") . '</a>: </td> <td> <input type="checkbox" name="shownewuser" ' . ($show_newest_user["Value"] == 1 ? 'checked="checked"' : '') . ' /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "sendonemail_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "sendonemail") . '</a>: </td> <td> <input type="checkbox" name="sendonemail" ' . ($send_on_email["Value"] == 1 ? 'checked="checked"' : '') . ' /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "indexshowrealms_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "indexshowrealms") . '</a>: </td> <td> <input type="checkbox" name="indexshowrealms" ' . ($index_show_realms["Value"] == 1 ? 'checked="checked"' : '') . ' /> </td> </tr> <tr> <td colspan="2"> <b>' . lang("admin", "customlogos") . '</b> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "usecustomlogo_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "usecustomlogo") . '</a>: </td> <td> <input type="checkbox" name="usecustomlogo" ' . ($use_custom_logo["Value"] == 1 ? 'checked="checked"' : '') . ' ' . ($custom_logo_count > 0 ? '' : 'disabled="disabled"') . ' /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "customlogo_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "customlogo") . '</a>: </td> <td> <select name="customlogo" ' . ($custom_logo_count > 0 ? '' : 'disabled="disabled"') . '>'; foreach ($custom_logos as $row) { $output .= ' <option value="' . $row["id"] . '" ' . ($row["id"] == $custom_logo["Value"] ? 'selected="selected"' : '') . '>' . $row["filename"] . '</option>'; } $output .= ' </select> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "deleteselectedlogo_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "deleteselectedlogo") . '</a>: </td> <td> <input type="checkbox" name="deleteselectedlogo" ' . ($custom_logo_count > 0 ? '' : 'disabled="disabled"') . ' /> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "uploadlogo_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "uploadlogo") . '</a>: </td> <td> <a href="admin.php?section=general&subsection=upload_logo">' . lang("admin", "upload") . '</a> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "allowcaching_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "allowcaching") . '</a>: </td> <td> <input type="checkbox" name="allowcaching" ' . ($allow_caching["Value"] == 1 ? 'checked="checked"' : '') . ' /> </td> </tr> <tr> <td colspan="2"> <b>' . lang("admin", "language") . '</b> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "languagelocalessearchoption_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "languagelocalessearchoption") . '</a>: </td> <td> <select name="languagelocalessearchoption"> <option value="0" ' . ($language_locales_search_option["Value"] == 0 ? 'selected="selected" ' : '') . '>' . lang("global", "language_0") . '</option> <option value="1" ' . ($language_locales_search_option["Value"] == 1 ? 'selected="selected" ' : '') . '>' . lang("global", "language_1") . '</option> <option value="2" ' . ($language_locales_search_option["Value"] == 2 ? 'selected="selected" ' : '') . '>' . lang("global", "language_2") . '</option> <option value="3" ' . ($language_locales_search_option["Value"] == 3 ? 'selected="selected" ' : '') . '>' . lang("global", "language_3") . '</option> <option value="4" ' . ($language_locales_search_option["Value"] == 4 ? 'selected="selected" ' : '') . '>' . lang("global", "language_4") . '</option> <option value="5" ' . ($language_locales_search_option["Value"] == 5 ? 'selected="selected" ' : '') . '>' . lang("global", "language_5") . '</option> <option value="6" ' . ($language_locales_search_option["Value"] == 6 ? 'selected="selected" ' : '') . '>' . lang("global", "language_6") . '</option> <option value="7" ' . ($language_locales_search_option["Value"] == 7 ? 'selected="selected" ' : '') . '>' . lang("global", "language_7") . '</option> <option value="8" ' . ($language_locales_search_option["Value"] == 8 ? 'selected="selected" ' : '') . '>' . lang("global", "language_8") . '</option> </select> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "languagesiteencoding_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "languagesiteencoding") . '</a>: </td> <td> <input type="text" name="languagesiteencoding" value="' . $language_site_encoding["Value"] . '" /> </td> </tr> </table> <div> <input type="submit" name="save" value="' . lang("admin", "save") . '" /> </div> </form>'; } else { $sql_search_limit = $sqlm->quote_smart($_GET["sqlsearchlimit"]); $item_icons = $sqlm->quote_smart($_GET["itemicons"]); $remember_me_checked = isset($_GET["remembermechecked"]) ? 1 : 0; $site_title = $sqlm->quote_smart($_GET["sitetitle"]); $item_per_page = $sqlm->quote_smart($_GET["itemperpage"]); $show_country_flags = isset($_GET["showcountryflags"]) ? 1 : 0; $default_theme = $sqlm->quote_smart($_GET["defaulttheme"]); $default_language = $sqlm->quote_smart($_GET["defaultlanguage"]); $timezone = $sqlm->quote_smart($_GET["timezone"]); $timezone_offset = $sqlm->quote_smart($_GET["timezone_offset"]); $player_online = $sqlm->quote_smart($_GET["playeronline"]); $gm_online = isset($_GET["gmonline"]) ? 1 : 0; $gm_online_count = isset($_GET["gmonlinecount"]) ? 1 : 0; $hide_uptime = isset($_GET["hideuptime"]) ? 1 : 0; $hide_max_players = isset($_GET["hidemaxplayers"]) ? 1 : 0; $hide_avg_latency = isset($_GET["hideavglatency"]) ? 1 : 0; $hide_plr_latency = isset($_GET["hideplrlatency"]) ? 1 : 0; $hide_coupons = isset($_GET["hidecoupons"]) ? 1 : 0; $backup_dir = $sqlm->quote_smart($_GET["backupdir"]); $debug = $sqlm->quote_smart($_GET["debug"]); $test_mode = $sqlm->quote_smart($_GET["testmode"]); $multi_realm = $sqlm->quote_smart($_GET["multirealm"]); $show_emblem = isset($_GET["showemblem"]) ? 1 : 0; $language_locales_search_option = $sqlm->quote_smart($_GET["languagelocalessearchoption"]); $language_site_encoding = $sqlm->quote_smart($_GET["languagesiteencoding"]); $hide_server_mem = $sqlm->quote_smart($_GET["hideservermem"]); $show_newest_user = isset($_GET["shownewuser"]) ? 1 : 0; $send_on_email = isset($_GET["sendonemail"]) ? 1 : 0; $index_show_realms = isset($_GET["indexshowrealms"]) ? 1 : 0; $use_custom_logo = isset($_GET["usecustomlogo"]) ? 1 : 0; $custom_logo = isset($_GET["customlogo"]) ? $sqlm->quote_smart($_GET["customlogo"]) : NULL; $delete_selected = isset($_GET["deleteselectedlogo"]) ? 1 : 0; $allow_caching = isset($_GET["allowcaching"]) ? 1 : 0; $result = $sqlm->query("UPDATE config_misc SET Value='" . $sql_search_limit . "' WHERE `Key`='SQL_Search_Limit'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $item_icons . "' WHERE `Key`='Item_Icons'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $remember_me_checked . "' WHERE `Key`='Remember_Me_Checked'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $site_title . "' WHERE `Key`='Site_Title'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $item_per_page . "' WHERE `Key`='Item_Per_Page'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $show_country_flags . "' WHERE `Key`='Show_Country_Flags'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $default_theme . "' WHERE `Key`='Default_Theme'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $default_language . "' WHERE `Key`='Default_Language'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $timezone . "' WHERE `Key`='Timezone'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $timezone_offset . "' WHERE `Key`='Timezone_Offset'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $player_online . "' WHERE `Key`='Player_Online'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $gm_online . "' WHERE `Key`='GM_Online'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $gm_online_count . "' WHERE `Key`='GM_Online_Count'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $hide_uptime . "' WHERE `Key`='Hide_Uptime'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $hide_max_players . "' WHERE `Key`='Hide_Max_Players'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $hide_avg_latency . "' WHERE `Key`='Hide_Avg_Latency'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $hide_server_mem . "' WHERE `Key`='Hide_Server_Mem'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $hide_plr_latency . "' WHERE `Key`='Hide_Plr_Latency'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $hide_coupons . "' WHERE `Key`='Hide_Coupons_Main_Page'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $backup_dir . "' WHERE `Key`='Backup_Dir'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $debug . "' WHERE `Key`='Debug'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $test_mode . "' WHERE `Key`='Test_Mode'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $multi_realm . "' WHERE `Key`='Multi_Realm'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $show_emblem . "' WHERE `Key`='Show_Guild_Emblem'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $language_locales_search_option . "' WHERE `Key`='Language_Locales_Search_Option'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $language_site_encoding . "' WHERE `Key`='Language_Site_Encoding'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $show_newest_user . "' WHERE `Key`='Show_Newest_User'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $send_on_email . "' WHERE `Key`='Send_Mail_On_Email_Change'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $index_show_realms . "' WHERE `Key`='Index_Show_Realms'"); if ($delete_selected) { $result = $sqlm->query("DELETE FROM custom_logos WHERE id='" . $custom_logo . "'"); // if we have no more logos, then we don't want Use Custom Logos checked. $result = $sqlm->query("SELECT * FROM custom_logos"); $logo_count = $sqlm->num_rows($result); if ($logo_count == 0) { $use_custom_logo = 0; } else { // we don't want the Custom_Logo field set to the one we just deleted // so we'll set it to the first one on the list $temp = $sqlm->fetch_assoc($result); $custom_logo = $temp["id"]; } } $result = $sqlm->query("UPDATE config_misc SET Value='" . $use_custom_logo . "' WHERE `Key`='Use_Custom_Logo'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $custom_logo . "' WHERE `Key`='Custom_Logo'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $allow_caching . "' WHERE `Key`='Allow_Logo_Caching'"); redirect("admin.php?section=general&subsection=more"); } break; case "upload_logo": if (!$sub_action) { $upload_err = isset($_GET["up_err"]) ? $_GET["up_err"] : NULL; $output .= ' <form action="admin.php?section=general&subsection=upload_logo&subaction=upload" method="post" enctype="multipart/form-data" id="form"> <table class="simple" id="admin_more">'; if (isset($upload_err)) { $msg = lang("admin", "uploaderror" . abs($upload_err)); $output .= ' <td colspan="2"> <span class="error" style="display: block; width: 100%; text-align: center;">' . $msg . '</span> </td>'; } $output .= ' <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "uploadlogo_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "uploadlogo") . '</a>: </td> <td> <input type="file" name="image" /> </td> </tr> </table> <div> <input type="submit" name="save" value="' . lang("admin", "save") . '" /> <input type="button" name="cancel" value="' . lang("admin", "cancel") . '" onclick="window.location=\'admin.php?section=general&subsection=more\'"/> </div> </form>'; } else { if (!array_key_exists("image", $_FILES)) { redirect("admin.php?section=general&subsection=upload_logo&error=1"); } $image = $_FILES["image"]; $err = checkValidUpload($image["error"]); if ($err < 0) { redirect("admin.php?section=general&subsection=upload_logo&up_err=" . $err); } else { if (!is_uploaded_file($image["tmp_name"])) { redirect("admin.php?section=general&subsection=upload_logo&up_err=-8"); } $info = getImageSize($image["tmp_name"]); if (!$info) { redirect("admin.php?section=general&subsection=upload_logo&up_err=-9"); } $name = $sqlm->quote_smart($image["name"]); $mime = $sqlm->quote_smart($info["mime"]); $data = $sqlm->quote_smart(file_get_contents($image["tmp_name"])); $upload_query = "INSERT INTO custom_logos (filename, mime_type, file_size, file_data) VALUES ('" . $name . "', '" . $mime . "', '" . $image['size'] . "', '" . $data . "')"; $sqlm->query($upload_query); redirect("admin.php?section=general&subsection=more"); } } break; case "gmlevels": if (!$sub_action) { $gm_lvls = $sqlm->query("SELECT * FROM config_gm_level_names"); if (!isset($_GET["edit_btn"])) { $output .= ' <form action="admin.php" method="get" id="form"> <div> <input type="hidden" name="section" value="general" /> <input type="hidden" name="subsection" value="gmlevels" /> <input type="hidden" name="edit_btn" value="edit" /> </div> <table class="simple"> <tr> <th>' . lang("admin", "edit") . '</th> <th>' . lang("admin", "remove") . '</th> <th>' . lang("admin", "seclvl") . '</th> <th>' . lang("admin", "fullname") . '</th> <th>' . lang("admin", "shortname") . '</th> </tr>'; $color = "#EEEEEE"; while ($gm_lvl = $sqlm->fetch_assoc($gm_lvls)) { $output .= ' <tr> <td style="background-color:' . $color . '; text-align: center;"> <a href="admin.php?section=general&subsection=gmlevels&edit=' . $gm_lvl["Index"] . '&edit_btn=Edit"> <img src="img/edit.png" alt="" /> </a> </td> <td style="background-color:' . $color . '; text-align: center;"> <a href="admin.php?section=general&subsection=gmlevels&delrow=deleterow&edit=' . $gm_lvl["Index"] . '&edit_btn=Edit"> <img src="img/aff_cross.png" alt="" /> </a> </td> <td style="background-color:' . $color . '">' . $gm_lvl["Security_Level"] . '</td> <td style="background-color:' . $color . '">' . $gm_lvl["Full_Name"] . '</td> <td style="background-color:' . $color . '">' . $gm_lvl["Short_Name"] . '</td> </tr>'; if ($color == "#EEEEEE") { $color = "#FFFFFF"; } else { $color = "#EEEEEE"; } } $output .= ' <tr> <td style="background-color:' . $color . '; text-align: center;"> <a href="admin.php?section=general&subsection=gmlevels&edit_btn=Edit&addrow=addrow"> <img src="img/add.png" alt="" /> </a> </td> <td style="background-color:' . $color . ';" colspan="4"> <a href="admin.php?section=general&subsection=gmlevels&edit_btn=Edit&addrow=addrow">' . lang("admin", "addrow") . '</a> </td> </tr>'; $output .= ' </table> </form>'; } else { if (!isset($_GET["edit"])) { if (!isset($_GET["addrow"])) { redirect("admin.php?section=general&subsection=gmlevels"); } } $del_row = isset($_GET["delrow"]) ? $_GET["delrow"] : ""; $add_row = isset($_GET["addrow"]) ? $_GET["addrow"] : ""; $edit_row = $sqlm->quote_smart($_GET["edit"]); if ($add_row) { $add_result = $sqlm->query("INSERT INTO config_gm_level_names (Security_Level) VALUES ('-1')"); redirect("admin.php?section=general&subsection=gmlevels"); } if ($del_row) { $del_result = $sqlm->query("DELETE FROM config_gm_level_names WHERE `Index`='" . $edit_row . "'"); redirect("admin.php?section=general&subsection=gmlevels"); } $gm_level = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_gm_level_names WHERE `Index`='" . $edit_row . "'")); $output .= ' <form action="admin.php" method="get" id="form"> <div> <input type="hidden" name="section" value="general" /> <input type="hidden" name="subsection" value="gmlevels" /> <input type="hidden" name="subaction" value="savegms" /> <input type="hidden" name="index" value="' . $gm_level["Index"] . '" /> </div> <fieldset id="admin_gm_level"> <table class="center"> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "seclvl_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "seclvl") . '</a>: </td> <td> <input type="text" name="seclvl" value="' . $gm_level["Security_Level"] . '" /> </td> </tr> <tr> <td>' . lang("admin", "fullname") . ': </td> <td> <input type="text" name="fullname" value="' . $gm_level["Full_Name"] . '" /> </td> </tr> <tr> <td>' . lang("admin", "shortname") . ': </td> <td> <input type="text" name="shortname" value="' . $gm_level["Short_Name"] . '" /> </td> </tr> </table> </fieldset> <div> <input type="submit" name="save" value="' . lang("admin", "save") . '" /> </div> </form>'; } } else { $index = $sqlm->quote_smart($_GET["index"]); $sec_lvl = $sqlm->quote_smart($_GET["seclvl"]); $full_name = $sqlm->quote_smart($_GET["fullname"]); $short_name = $sqlm->quote_smart($_GET["shortname"]); $result = $sqlm->query("UPDATE config_gm_level_names SET Security_Level='" . $sec_lvl . "', Full_Name='" . $full_name . "', Short_Name='" . $short_name . "' WHERE `Index`='" . $index . "'"); redirect("admin.php?section=general&subsection=gmlevels"); } break; } $output .= ' </div>'; }
function pointsystem() { global $output, $corem_db, $logon_db, $get_timezone_type, $core; // we need $core to be set if ($core == 0) { $core = detectcore(); } $sqlm = new SQL(); $sqlm->connect($corem_db["addr"], $corem_db["user"], $corem_db["pass"], $corem_db["name"], $corem_db["encoding"]); $subsection = isset($_GET["subsection"]) ? $sqlm->quote_smart($_GET["subsection"]) : 1; $output .= ' <table id="sidebar"> <tr> <td ' . ($subsection == "basic" ? 'class="current"' : '') . '> <a href="admin.php?section=pointsystem&subsection=basic">' . lang("admin", "basic") . '</a> </td> </tr> <tr> <td ' . ($subsection == "coupons" ? 'class="current"' : '') . '> <a href="admin.php?section=pointsystem&subsection=coupons">' . lang("admin", "coupons") . '</a> </td> </tr> <tr> <td ' . ($subsection == "raffles" ? 'class="current"' : '') . '> <a href="admin.php?section=pointsystem&subsection=raffles">' . lang("admin", "raffles") . '</a> </td> </tr> <tr> <td ' . ($subsection == "bags" ? 'class="current"' : '') . '> <a href="admin.php?section=pointsystem&subsection=bags">' . lang("admin", "bags") . '</a> </td> </tr> <tr> <td ' . ($subsection == "achieve" ? 'class="current"' : '') . '> <a href="admin.php?section=pointsystem&subsection=achieve">' . lang("admin", "achieve") . '</a> </td> </tr> </table>'; $sub_action = isset($_GET["subaction"]) ? $_GET["subaction"] : ''; if (isset($_GET["error"])) { $output .= ' <div id="misc_error">'; } else { $output .= ' <div id="misc">'; } switch ($subsection) { case "basic": if (!$sub_action) { $allow_fractional = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Credits_Fractional'")); $credits_per_recruit = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Credits_Per_Recruit'")); $recruit_reward_auto = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Recruit_Reward_Auto'")); $initial_credits = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='New_Account_Credits'")); $qiv_credits = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='QIV_Credits'")); $qiv_gold = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='QIV_Gold'")); $uv_credits = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='UV_Credits'")); $uv_gold = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='UV_Gold'")); // extract gold/silver/copper from single gold number $qiv_gold["Value"] = str_pad($qiv_gold["Value"], 4, "0", STR_PAD_LEFT); $qiv_g = substr($qiv_gold["Value"], 0, -4); if ($qiv_g == '') { $qiv_g = 0; } $qiv_s = substr($qiv_gold["Value"], -4, 2); if ($qiv_s == '' || $qiv_s == '00') { $qiv_s = 0; } $qiv_c = substr($qiv_gold["Value"], -2); if ($qiv_c == '' || $qiv_c == '00') { $qiv_c = 0; } // extract gold/silver/copper from single gold number $uv_gold["Value"] = str_pad($uv_gold["Value"], 4, "0", STR_PAD_LEFT); $uv_g = substr($uv_gold["Value"], 0, -4); if ($uv_g == '') { $uv_g = 0; } $uv_s = substr($uv_gold["Value"], -4, 2); if ($uv_s == '' || $uv_s == '00') { $uv_s = 0; } $uv_c = substr($uv_gold["Value"], -2); if ($uv_c == '' || $uv_c == '00') { $uv_c = 0; } $name_credits = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Name_Change_Credits'")); $race_credits = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Race_Change_Credits'")); $trans_credits = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Transfer_Credits'")); $hearth_credits = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Hearthstone_Credits'")); $achievement_point_points = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Achievement_Point_Points'")); $achievement_point_credits = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Achievement_Point_Credits'")); $output .= ' <form action="admin.php" method="get" id="form"> <div> <input type="hidden" name="section" value="pointsystem" /> <input type="hidden" name="subaction" value="savepoints" /> <input type="hidden" name="subsection" value="basic" /> </div> <table class="simple" id="admin_more"> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "fractional_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "fractional") . '</a>: </td> <td> <input type="checkbox" name="allowfractional" ' . ($allow_fractional["Value"] == 1 ? 'checked="checked"' : '') . ' /> </td> </tr> <tr> <td colspan="2"> <b>' . lang("admin", "recruitment") . '</b> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "credits_per_recruit_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "credits_per_recruit") . '</a>: </td> <td> <input type="text" name="creditsperrecruit" value="' . $credits_per_recruit["Value"] . '"/> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "recruit_reward_auto_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "recruit_reward_auto") . '</a>: </td> <td> <input type="checkbox" name="recruitrewardauto" ' . ($recruit_reward_auto["Value"] == 1 ? 'checked="checked"' : '') . ' /> </td> </tr> <tr> <td colspan="2"> <b>' . lang("admin", "newaccounts") . '</b> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "initial_credits_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "initial_credits") . '</a>: </td> <td> <input type="text" name="initialcredits" value="' . $initial_credits["Value"] . '"/> </td> </tr> <tr> <td colspan="2"> <b>' . lang("admin", "tool_qiv") . '</b> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "qiv_credits_per_gold_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "qiv_credits_per_gold") . '</a>: </td> <td> <input type="text" name="qiv_creditspergold_credits" value="' . $qiv_credits["Value"] . '" size="6"/> ' . lang("admin", "credits") . ' = <input type="text" name="qiv_creditspergold_gold" value="' . $qiv_g . '" size="6"/> <img src="../img/gold.gif" alt="gold" /> <input type="text" name="qiv_creditspergold_silver" value="' . $qiv_s . '" maxlength="2" size="6"/> <img src="../img/silver.gif" alt="gold" /> <input type="text" name="qiv_creditspergold_copper" value="' . $qiv_c . '" maxlength="2" size="6"/> <img src="../img/copper.gif" alt="gold" /> </td> </tr> <tr> <td colspan="2"> <b>' . lang("admin", "tool_uv") . '</b> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "uv_credits_per_gold_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "uv_credits_per_gold") . '</a>: </td> <td> <input type="text" name="uv_creditspergold_credits" value="' . $uv_credits["Value"] . '" size="6"/> ' . lang("admin", "credits") . ' = <input type="text" name="uv_creditspergold_gold" value="' . $uv_g . '" size="6"/> <img src="../img/gold.gif" alt="gold" /> <input type="text" name="uv_creditspergold_silver" value="' . $uv_s . '" maxlength="2" size="6"/> <img src="../img/silver.gif" alt="gold" /> <input type="text" name="uv_creditspergold_copper" value="' . $uv_c . '" maxlength="2" size="6"/> <img src="../img/copper.gif" alt="gold" /> </td> </tr> <tr> <td colspan="2"> <b>' . lang("admin", "tool_name") . '</b> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "name_credits_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "name_credits") . '</a>: </td> <td> <input type="text" name="namecredits" value="' . $name_credits["Value"] . '"/> </td> </tr> <tr> <td colspan="2"> <b>' . lang("admin", "tool_race") . '</b> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "race_credits_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "race_credits") . '</a>: </td> <td> <input type="text" name="racecredits" value="' . $race_credits["Value"] . '"/> </td> </tr> <tr> <td colspan="2"> <b>' . lang("admin", "tool_trans") . '</b> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "trans_credits_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "trans_credits") . '</a>: </td> <td> <input type="text" name="transcredits" value="' . $trans_credits["Value"] . '"/> </td> </tr> <tr> <td colspan="2"> <b>' . lang("admin", "tool_hearth") . '</b> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "hearth_credits_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "hearth_credits") . '</a>: </td> <td> <input type="text" name="hearthcredits" value="' . $hearth_credits["Value"] . '"/> </td> </tr> <tr> <td colspan="2"> <b>' . lang("admin", "achievement_points") . '</b> </td> </tr> <tr> <td class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "creds_per_achieve_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "creds_per_achieve") . '</a>: </td> <td> <input type="text" name="achievement_point_points" value="' . $achievement_point_points["Value"] . '" size="6"/> <span>' . lang("admin", "points") . ' = </span> <input type="text" name="achievement_point_credits" value="' . $achievement_point_credits["Value"] . '" size="6"/> <span>' . lang("admin", "credits") . '</span> </td> </tr> </table> <div> <input type="submit" name="save" value="' . lang("admin", "save") . '" /> </div> </form>'; } else { $allow_fractional = isset($_GET["allowfractional"]) ? 1 : 0; $credits_per_recruit = $sqlm->quote_smart($_GET["creditsperrecruit"]); $recruit_reward_auto = isset($_GET["recruitrewardauto"]) ? 1 : 0; $initial_credits = $sqlm->quote_smart($_GET["initialcredits"]); $qiv_credits = $sqlm->quote_smart($_GET["qiv_creditspergold_credits"]); $qiv_gold = $sqlm->quote_smart($_GET["qiv_creditspergold_gold"]); $qiv_silver = $sqlm->quote_smart($_GET["qiv_creditspergold_silver"]); $qiv_copper = $sqlm->quote_smart($_GET["qiv_creditspergold_copper"]); $uv_credits = $sqlm->quote_smart($_GET["uv_creditspergold_credits"]); $uv_gold = $sqlm->quote_smart($_GET["uv_creditspergold_gold"]); $uv_silver = $sqlm->quote_smart($_GET["uv_creditspergold_silver"]); $uv_copper = $sqlm->quote_smart($_GET["uv_creditspergold_copper"]); // pad $qiv_silver = str_pad($qiv_silver, 2, "0", STR_PAD_LEFT); $qiv_copper = str_pad($qiv_copper, 2, "0", STR_PAD_LEFT); $uv_silver = str_pad($uv_silver, 2, "0", STR_PAD_LEFT); $uv_copper = str_pad($uv_copper, 2, "0", STR_PAD_LEFT); // combine $qiv_money = $qiv_gold . $qiv_silver . $qiv_copper; $uv_money = $uv_gold . $uv_silver . $uv_copper; $name_credits = $sqlm->quote_smart($_GET["namecredits"]); $race_credits = $sqlm->quote_smart($_GET["racecredits"]); $trans_credits = $sqlm->quote_smart($_GET["transcredits"]); $hearth_credits = $sqlm->quote_smart($_GET["hearthcredits"]); $achievement_point_points = $sqlm->quote_smart($_GET["achievement_point_points"]); $achievement_point_credits = $sqlm->quote_smart($_GET["achievement_point_credits"]); $result = $sqlm->query("UPDATE config_misc SET Value='" . $allow_fractional . "' WHERE `Key`='Credits_Fractional'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $credits_per_recruit . "' WHERE `Key`='Credits_Per_Recruit'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $recruit_reward_auto . "' WHERE `Key`='Recruit_Reward_Auto'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $initial_credits . "' WHERE `Key`='New_Account_Credits'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $qiv_credits . "' WHERE `Key`='QIV_Credits'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $qiv_money . "' WHERE `Key`='QIV_Gold'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $uv_credits . "' WHERE `Key`='UV_Credits'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $uv_money . "' WHERE `Key`='UV_Gold'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $name_credits . "' WHERE `Key`='Name_Change_Credits'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $race_credits . "' WHERE `Key`='Race_Change_Credits'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $trans_credits . "' WHERE `Key`='Transfer_Credits'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $hearth_credits . "' WHERE `Key`='Hearthstone_Credits'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $achievement_point_points . "' WHERE `Key`='Achievement_Point_Points'"); $result = $sqlm->query("UPDATE config_misc SET Value='" . $achievement_point_credits . "' WHERE `Key`='Achievement_Point_Credits'"); redirect("admin.php?section=pointsystem&subsection=basic"); } break; case "coupons": $query = "SELECT * FROM point_system_coupons"; $result = $sqlm->query($query); $coupon_action = 0; if (isset($_GET["editcoupon"])) { $coupon_action = "edit"; } if (isset($_GET["delcoupon"])) { $coupon_action = "del"; } if (isset($_GET["addcoupon"])) { $coupon_action = "add"; } $sub_action = isset($_GET["subaction"]) ? $_GET["subaction"] : ''; $sqll = new SQL(); $sqll->connect($logon_db["addr"], $logon_db["user"], $logon_db["pass"], $logon_db["name"], $logon_db["encoding"]); if (!$coupon_action) { $output .= ' <form action="admin.php" method="get" id="form"> <div> <input type="hidden" name="section" value="pointsystem" /> <input type="hidden" name="subsection" value="coupons" /> </div> <table class="simple" id="admin_point_coupon_list"> <tr> <th style="width: 1%;"></th> <th style="width: 1%;"></th> <th style="width: 3%;">' . lang("admin", "coupon_id") . '</th> <th style="width: 15%;">' . lang("admin", "coupon_title") . '</th> <th style="width: 15%;">' . lang("admin", "coupon_target") . '</th> <th style="width: 15%;">' . lang("admin", "coupon_issued") . '</th> <!-- th width="15%">' . lang("admin", "coupon_expiration") . '</th --> <th style="width: 10%;">' . lang("admin", "coupon_credits") . '</th> <th style="width: 5%;">' . lang("admin", "coupon_money") . '</th> <th style="width: 5%;">' . lang("admin", "coupon_item") . '</th> <th style="width: 5%;">' . lang("admin", "coupon_count") . '</th> <th style="width: 5%;">' . lang("admin", "coupon_raffle") . '</th> <th style="width: 5%;">' . lang("admin", "coupon_usage") . '</th> <th style="width: 5%;">' . lang("admin", "enabled") . '</th> </tr>'; $color = "#EEEEEE"; while ($coupon = $sqlm->fetch_assoc($result)) { // determine target if ($coupon["target"] != 0) { if ($core == 1) { $target_query = "SELECT login FROM accounts WHERE acct='" . $coupon["target"] . "'"; } else { $target_query = "SELECT username AS login FROM account WHERE id='" . $coupon["target"] . "'"; } $target_result = $sqll->query($target_query); $target_result = $sqll->fetch_assoc($target_result); $target = $target_result["login"]; } else { $target = lang("admin", "coupon_public"); } // determine usage $usage_query = "SELECT COUNT(*) FROM point_system_coupon_usage WHERE coupon='" . $coupon["entry"] . "'"; $usage_result = $sqlm->query($usage_query); $usage_result = $sqlm->fetch_assoc($usage_result); $times_used = $usage_result["COUNT(*)"]; if ($coupon["usage_limit"] > -1) { $usage = $times_used . "/" . $coupon["usage_limit"]; } else { $usage = $times_used; } $output .= ' <tr> <td style="background-color:' . $color . '; text-align: center;"> <span> <a href="admin.php?section=pointsystem&subsection=coupons&sel_coupon=' . $coupon["entry"] . '&editcoupon=editcoupon" onmouseover="oldtoolTip(\'' . lang("admin", "edit") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()"> <img src="img/edit.png" alt="" /> </a> </span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span> <a href="admin.php?section=pointsystem&subsection=coupons&sel_coupon=' . $coupon["entry"] . '&delcoupon=deletecoupon" onmouseover="oldtoolTip(\'' . lang("admin", "remove") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()"> <img src="img/aff_cross.png" alt="" /> </a> </span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span>' . $coupon["entry"] . '</span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span>' . $coupon["title"] . '</span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span>' . $target . '</span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span>' . $coupon["date_issued"] . '</span> </td> <!-- td style="background-color:' . $color . '"> <span>' . $coupon["expiration"] . '</span> </td --> <td style="background-color:' . $color . '; text-align: center;"> <span>' . $coupon["credits"] . '</span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span>' . $coupon["money"] . '</span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span>' . $coupon["item_id"] . '</span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span>' . $coupon["item_count"] . '</span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span>' . $coupon["raffle_id"] . '</span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span>' . $usage . '</span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span><img src="img/' . ($coupon["enabled"] ? 'up' : 'down') . '.gif" alt="" /></span> </td> </tr>'; $color = $color == "#EEEEEE" ? "#FFFFFF" : "#EEEEEE"; } $output .= ' <tr> <td style="background-color:' . $color . '"> <a href="admin.php?section=pointsystem&subsection=coupons&addcoupon=addcoupon"> <img src="img/add.png" alt="" /> </a> </td> <td style="background-color:' . $color . '" colspan="13"> <a href="admin.php?section=pointsystem&subsection=coupons&addcoupon=addcoupon">' . lang("admin", "addcoupon") . '</a> </td> </tr> </table> </form>'; } else { if ($coupon_action == "edit") { $coupon_id = $sqlm->quote_smart($_GET["sel_coupon"]); if (is_numeric($coupon_id)) { if (!$sub_action) { $coupon = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM point_system_coupons WHERE `entry`='" . $coupon_id . "'")); // if money is negative, we make a note of that and make it positive $neg_money = false; if ($coupon["money"] < 0) { $neg_money = true; $coupon["money"] = $coupon["money"] * -1; } // extract gold/silver/copper from single gold number $coupon["money"] = str_pad($coupon["money"], 4, "0", STR_PAD_LEFT); $coupon_g = substr($coupon["money"], 0, -4); if ($coupon_g == '') { $coupon_g = 0; } $coupon_s = substr($coupon["money"], -4, 2); if ($coupon_s == '' || $coupon_s == '00') { $coupon_s = 0; } $coupon_c = substr($coupon["money"], -2); if ($coupon_c == '' || $coupon_c == '00') { $coupon_c = 0; } if ($core == 1) { $accounts_query = "SELECT *\n FROM accounts\n LEFT JOIN `" . $corem_db["name"] . "`.config_accounts ON accounts.login=`" . $corem_db["name"] . "`.config_accounts.Login COLLATE utf8_general_ci"; } else { $accounts_query = "SELECT *, id AS acct, username AS login\n FROM account\n LEFT JOIN `" . $corem_db["name"] . "`.config_accounts ON account.username=`" . $corem_db["name"] . "`.config_accounts.Login"; } $accounts_result = $sqll->query($accounts_query); $output .= ' <div> <form action="admin.php" method="get" id="form"> <fieldset id="admin_edit_coupon"> <div> <input type="hidden" name="section" value="pointsystem" /> <input type="hidden" name="subsection" value="coupons" /> <input type="hidden" name="editcoupon" value="editcoupon" /> <input type="hidden" name="subaction" value="savecoupon" /> <input type="hidden" name="sel_coupon" value="' . $coupon["entry"] . '" /> <input type="hidden" name="oldcreation" value="' . $coupon["date_issued"] . '" /> </div> <table> <tr> <td>' . lang("admin", "coupon_id") . ': </td> <td>' . $coupon["entry"] . '</td> </tr> <tr> <td>' . lang("admin", "coupon_target") . ': </td> <td> <select name="coupon_target"> <option value="0">' . lang("admin", "coupon_public") . '</option> <option value="-1" disabled="disabled">-</option>'; while ($row = $sqll->fetch_assoc($accounts_result)) { $output .= ' <option value="' . $row["acct"] . '" ' . ($row["acct"] == $coupon["target"] ? 'selected="selected"' : '') . '>' . $row["ScreenName"] . ' (' . $row["login"] . ')</option>'; } $output .= ' </select> </td> </tr> <tr> <td class="help"><a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "coupon_issued_tip") . '\',\'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "coupon_issued") . '</a>: </td> <td>' . $coupon["date_issued"] . '</td> </tr> <tr> <td class="help"><a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "coupon_usage_limit_tip") . '\',\'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "coupon_usage_limit") . '</a>: </td> <td> <input type="text" name="coupon_usage_limit" value="' . $coupon["usage_limit"] . '" class="admin_edit_coupon_fields" /> </td> </tr> <!-- tr> <td width="45%" class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "coupon_expiration_tip") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "coupon_expiration") . '</a>: </td> <td> <input type="text" name="coupon_expiration" value="' . $coupon["expiration"] . '" /> </td> </tr --> <tr> <td colspan="2"> <hr /> </td> </tr> <tr> <td colspan="2"> <b>' . lang("admin", "coupon_prize") . '</b> </td> </tr> <tr> <td class="help"><a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "coupon_credits_tip") . '\',\'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "coupon_credits") . '</a>: </td> <td> <input type="text" name="coupon_credits" value="' . $coupon["credits"] . '" class="admin_edit_coupon_fields" /> </td> </tr> <tr> <td>' . lang("admin", "coupon_money") . ': </td> <td> <input type="text" name="coupon_money_gold" value="' . $coupon_g . '" maxlength="6" size="6" /> <img src="../img/gold.gif" alt="gold" /> <input type="text" name="coupon_money_silver" value="' . $coupon_s . '" maxlength="2" size="3" /> <img src="../img/silver.gif" alt="gold" /> <input type="text" name="coupon_money_copper" value="' . $coupon_c . '" maxlength="2" size="3" /> <img src="../img/copper.gif" alt="gold" /> </td> </tr> <tr> <td class="help"><a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "coupon_cost_money_tip") . '\',\'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "coupon_cost_money") . '</a>:</td> <td> <input type="checkbox" name="coupon_neg_money" value="-1" size="12"' . ($neg_money ? ' checked="checked"' : '') . ' /> </td> </tr> <tr> <td class="help"><a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "coupon_item_tip") . '\',\'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "coupon_item") . '</a>:</td> <td> <input type="text" name="coupon_item" value="' . $coupon["item_id"] . '" class="admin_edit_coupon_fields" /> </td> </tr> <tr> <td>' . lang("admin", "coupon_count") . ':</td> <td> <input type="text" name="coupon_count" value="' . $coupon["item_count"] . '" class="admin_edit_coupon_fields" /> </td> </tr> <tr> <td colspan="2"> <hr /> </td> </tr> <tr> <td class="help"><a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "coupon_raffle_tip") . '\',\'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "coupon_raffle") . '</a>:</td> <td> <input type="text" name="coupon_raffle_id" value="' . $coupon["raffle_id"] . '" class="admin_edit_coupon_fields" /> </td> </tr> <tr> <td>' . lang("admin", "coupon_redemption_option") . ': </td> <td> <input type="radio" name="coupon_method" value="0" ' . ($coupon["redemption_option"] == 0 ? 'checked="checked"' : '') . ' />' . lang("admin", "coupon_redemption_option_both") . '<br /> <input type="radio" name="coupon_method" value="1" ' . ($coupon["redemption_option"] == 1 ? 'checked="checked"' : '') . '/>' . lang("admin", "coupon_redemption_option_single") . ' </td> </tr> <tr> <td colspan="2"> <hr /> </td> </tr> <tr> <td>' . lang("admin", "coupon_title") . ':</td> <td> <input type="text" name="coupon_title" value="' . $coupon["title"] . '" class="admin_edit_coupon_fields" /> </td> </tr> <tr> <td>' . lang("admin", "coupon_text") . ': </td> <td> <textarea name="coupon_text" rows="2" cols="32">' . $coupon["text"] . '</textarea> </td> </tr> <tr> <td colspan="2"> <hr /> </td> </tr> <tr> <td>' . lang("admin", "enabled") . ': </td> <td> <input type="checkbox" name="coupon_enabled" value="1" ' . ($coupon["enabled"] == 1 ? 'checked="checked"' : '') . ' /> </td> </tr> </table> </fieldset> <div> <input type="submit" name="savecoupon" value="' . lang("admin", "save") . '" /> </div> </form> </div>'; } else { // save coupon $coupon = $sqlm->quote_smart($_GET["sel_coupon"]); $coupon_target = $sqlm->quote_smart($_GET["coupon_target"]); $coupon_usage_limit = $sqlm->quote_smart($_GET["coupon_usage_limit"]); $coupon_old_creation = $sqlm->quote_smart($_GET["oldcreation"]); //$coupon_expiration = $sqlm->quote_smart($_GET["coupon_expiration"]); $coupon_credits = $sqlm->quote_smart($_GET["coupon_credits"]); $coupon_money_gold = $sqlm->quote_smart($_GET["coupon_money_gold"]); $coupon_money_silver = $sqlm->quote_smart($_GET["coupon_money_silver"]); $coupon_money_copper = $sqlm->quote_smart($_GET["coupon_money_copper"]); $coupon_neg_money = isset($_GET["coupon_neg_money"]) ? $sqlm->quote_smart($_GET["coupon_neg_money"]) : 1; $coupon_item = $sqlm->quote_smart($_GET["coupon_item"]); $coupon_count = $sqlm->quote_smart($_GET["coupon_count"]); $coupon_raffle_id = $sqlm->quote_smart($_GET["coupon_raffle_id"]); $coupon_method = $sqlm->quote_smart($_GET["coupon_method"]); $coupon_title = $sqlm->quote_smart($_GET["coupon_title"]); $coupon_text = $sqlm->quote_smart($_GET["coupon_text"]); $coupon_enabled = isset($_GET["coupon_enabled"]) ? 1 : 0; // pad $coupon_money_silver = str_pad($coupon_money_silver, 2, "0", STR_PAD_LEFT); $coupon_money_copper = str_pad($coupon_money_copper, 2, "0", STR_PAD_LEFT); // combine $coupon_money = $coupon_money_gold . $coupon_money_silver . $coupon_money_copper; // if the Coupon costs money then it'll be saved negative $coupon_money = $coupon_money * $coupon_neg_money; if ($coupon_old_creation == "0000-00-00 00:00:00") { $coupon_not_enabled = 1; } $query = "UPDATE point_system_coupons\n SET target='" . $coupon_target . "', " . ($coupon_enabled && $coupon_not_enabled ? "date_issued=NOW()," : "") . " usage_limit='" . $coupon_usage_limit . "',\n expiration=NOW(), credits='" . $coupon_credits . "', money='" . $coupon_money . "',\n item_id='" . $coupon_item . "', item_count='" . $coupon_count . "', raffle_id='" . $coupon_raffle_id . "',\n redemption_option='" . $coupon_method . "', title='" . $coupon_title . "', text='" . $coupon_text . "',\n enabled='" . $coupon_enabled . "'\n WHERE entry='" . $coupon . "'"; $sqlm->query($query); redirect("admin.php?section=pointsystem&subsection=coupons&editcoupon=editcoupon&sel_coupon=" . $coupon); } } else { redirect("admin.php?section=pointsystem&subsection=coupons&error=1"); } } elseif ($coupon_action == "del") { $coupon_id = $sqlm->quote_smart($_GET["sel_coupon"]); if (is_numeric($coupon_id)) { $result = $sqlm->query("DELETE FROM point_system_coupons WHERE `entry`='" . $coupon_id . "'"); redirect("admin.php?section=pointsystem&subsection=coupons"); } else { redirect("admin.php?section=pointsystem&subsection=coupons&error=1"); } } else { $result = $sqlm->query("INSERT INTO point_system_coupons (target, credits, money, item_id, item_count, title, text, usage_limit, redemption_option, raffle_id, enabled) VALUES ('0', '0', '0', '0', '0', '', '', '1', '0', '0', '0')"); redirect("admin.php?section=pointsystem&subsection=coupons"); } } break; case "raffles": $query = "SELECT * FROM point_system_raffles"; $result = $sqlm->query($query); $raffle_action = 0; if (isset($_GET["editraffle"])) { $raffle_action = "edit"; } if (isset($_GET["delraffle"])) { $raffle_action = "del"; } if (isset($_GET["addraffle"])) { $raffle_action = "add"; } $sub_action = isset($_GET["subaction"]) ? $_GET["subaction"] : ''; $sqll = new SQL(); $sqll->connect($logon_db["addr"], $logon_db["user"], $logon_db["pass"], $logon_db["name"], $logon_db["encoding"]); if (!$raffle_action) { $output .= ' <form action="admin.php" method="get" id="form"> <div> <input type="hidden" name="section" value="pointsystem" /> <input type="hidden" name="subsection" value="raffle" /> </div> <table class="simple" id="admin_point_coupon_list"> <tr> <th style="width: 1%;"></th> <th style="width: 1%;"></th> <th style="width: 3%;">' . lang("admin", "raffle_id") . '</th> <th style="width: 15%;">' . lang("admin", "raffle_title") . '</th> <th style="width: 15%;">' . lang("admin", "raffle_drawing") . '</th> <th style="width: 10%;">' . lang("admin", "raffle_credits") . '</th> <th style="width: 5%;">' . lang("admin", "raffle_money") . '</th> <th style="width: 5%;">' . lang("admin", "raffle_item") . '</th> <th style="width: 5%;">' . lang("admin", "raffle_count") . '</th> <th style="width: 5%;">' . lang("admin", "raffle_usage") . '</th> <th style="width: 5%;">' . lang("admin", "enabled") . '</th> <th style="width: 5%;">' . lang("admin", "raffle_completed") . '</th> </tr>'; $color = "#EEEEEE"; while ($raffle = $sqlm->fetch_assoc($result)) { // determine usage $tickets_query = "SELECT COUNT(*) FROM point_system_raffle_tickets WHERE raffle='" . $raffle["entry"] . "'"; $tickets_result = $sqlm->query($tickets_query); $tickets_result = $sqlm->fetch_assoc($tickets_result); $tickets_sold = $tickets_result["COUNT(*)"]; $output .= ' <tr> <td style="background-color:' . $color . '; text-align: center;"> <span> <a href="admin.php?section=pointsystem&subsection=raffles&sel_raffle=' . $raffle["entry"] . '&editraffle=editraffle" onmouseover="oldtoolTip(\'' . lang("admin", "edit") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()"> <img src="img/edit.png" alt="" /> </a> </span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span> <a href="admin.php?section=pointsystem&subsection=raffles&sel_raffle=' . $raffle["entry"] . '&delraffle=deleteraffle" onmouseover="oldtoolTip(\'' . lang("admin", "remove") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()"> <img src="img/aff_cross.png" alt="" /> </a> </span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span>' . $raffle["entry"] . '</span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span>' . $raffle["title"] . '</span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span>' . $raffle["drawing"] . '</span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span>' . $raffle["credits"] . '</span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span>' . $raffle["money"] . '</span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span>' . $raffle["item_id"] . '</span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span>' . $raffle["item_count"] . '</span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span>' . $tickets_sold . '</span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span><img src="img/' . ($raffle["enabled"] ? 'up' : 'down') . '.gif" alt="" /></span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span><img src="img/' . ($raffle["completed"] ? 'aff_tick.png' : '') . '" alt="" /></span> </td> </tr>'; $color = $color == "#EEEEEE" ? "#FFFFFF" : "#EEEEEE"; } $output .= ' <tr> <td style="background-color:' . $color . '"> <a href="admin.php?section=pointsystem&subsection=raffles&addraffle=addraffle"> <img src="img/add.png" alt="" /> </a> </td> <td style="background-color:' . $color . '" colspan="13"> <a href="admin.php?section=pointsystem&subsection=raffles&addraffle=addraffle">' . lang("admin", "addraffle") . '</a> </td> </tr> </table> </form>'; } else { if ($raffle_action == "edit") { $raffle_id = $sqlm->quote_smart($_GET["sel_raffle"]); if (is_numeric($raffle_id)) { if (!$sub_action) { $raffle = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM point_system_raffles WHERE `entry`='" . $raffle_id . "'")); // prize: extract gold/silver/copper from single gold number $raffle["money"] = str_pad($raffle["money"], 4, "0", STR_PAD_LEFT); $raffle_g = substr($raffle["money"], 0, -4); if ($raffle_g == '') { $raffle_g = 0; } $raffle_s = substr($raffle["money"], -4, 2); if ($raffle_s == '' || $raffle_s == '00') { $raffle_s = 0; } $raffle_c = substr($raffle["money"], -2); if ($raffle_c == '' || $raffle_c == '00') { $raffle_c = 0; } // cost: extract gold/silver/copper from single gold number $raffle["cost_money"] = str_pad($raffle["cost_money"], 4, "0", STR_PAD_LEFT); $raffle_cost_g = substr($raffle["cost_money"], 0, -4); if ($raffle_cost_g == '') { $raffle_cost_g = 0; } $raffle_cost_s = substr($raffle["cost_money"], -4, 2); if ($raffle_cost_s == '' || $raffle_cost_s == '00') { $raffle_cost_s = 0; } $raffle_cost_c = substr($raffle["cost_money"], -2); if ($raffle_cost_c == '' || $raffle_cost_c == '00') { $raffle_cost_c = 0; } $drawing = strtotime($raffle["drawing"]); $drawing_year = date("Y", $drawing); $drawing_month = date("m", $drawing); $drawing_day = date("d", $drawing); $drawing_hour = date("H", $drawing); $drawing_minute = date("i", $drawing); if ($drawing_year == 1969) { $drawing_year = date("Y"); } $output .= ' <div> <form action="admin.php" method="get" id="form"> <fieldset id="admin_edit_coupon"> <div> <input type="hidden" name="section" value="pointsystem" /> <input type="hidden" name="subsection" value="raffles" /> <input type="hidden" name="editraffle" value="editraffle" /> <input type="hidden" name="subaction" value="saveraffle" /> <input type="hidden" name="sel_raffle" value="' . $raffle["entry"] . '" /> </div> <table> <tr> <td>' . lang("admin", "raffle_id") . ': </td> <td>' . $raffle["entry"] . '</td> </tr> <tr> <td colspan="2"> <hr /> </td> </tr> <tr> <td>' . lang("admin", "raffle_drawing") . ': </td> <td>' . $raffle["drawing"] . '</td> </tr> <tr> <td>' . lang("admin", "raffle_drawing_year") . '-' . lang("admin", "raffle_drawing_month") . '-' . lang("admin", "raffle_drawing_day") . ': </td> <td> <input type="text" name="drawing_year" value="' . $drawing_year . '" maxlength="4" size="4" /> - <input type="text" name="drawing_month" value="' . $drawing_month . '" maxlength="2" size="2" /> - <input type="text" name="drawing_day" value="' . $drawing_day . '" maxlength="2" size="2" /> </td> </tr> <tr> <td class="help"><a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "raffle_time_tip") . '\',\'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "raffle_drawing_hour") . ' : ' . lang("admin", "raffle_drawing_minute") . '</a>: </td> <td> <input type="text" name="drawing_hour" value="' . $drawing_hour . '" maxlength="4" size="4" /> : <input type="text" name="drawing_minute" value="' . $drawing_minute . '" maxlength="2" size="2" /> </td> </tr> <tr> <td colspan="2"> <hr /> </td> </tr> <tr> <td colspan="2"> <b>' . lang("admin", "raffle_prize") . '</b> </td> </tr> <tr> <td>' . lang("admin", "raffle_credits") . ': </td> <td> <input type="text" name="raffle_credits" value="' . $raffle["credits"] . '" size="6" /> </td> </tr> <tr> <td>' . lang("admin", "raffle_money") . ': </td> <td> <input type="text" name="raffle_money_gold" value="' . $raffle_g . '" maxlength="6" size="6"/> <img src="../img/gold.gif" alt="gold" /> <input type="text" name="raffle_money_silver" value="' . $raffle_s . '" maxlength="2" size="6"/> <img src="../img/silver.gif" alt="gold" /> <input type="text" name="raffle_money_copper" value="' . $raffle_c . '" maxlength="2" size="6"/> <img src="../img/copper.gif" alt="gold" /> </td> </tr> <tr> <td class="help"><a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "coupon_item_tip") . '\',\'info_tooltip\')" onmouseout="oldtoolTip()">' . lang("admin", "raffle_item") . ':</a></td> <td> <input type="text" name="raffle_item" value="' . $raffle["item_id"] . '" size="6" /> </td> </tr> <tr> <td>' . lang("admin", "raffle_count") . ':</td> <td> <input type="text" name="raffle_count" value="' . $raffle["item_count"] . '" size="6" /> </td> </tr> <tr> <td colspan="2"> <hr /> </td> </tr> <tr> <td colspan="2" class="help"> <a href="#" onmouseover="oldtoolTip(\'' . lang("admin", "raffle_cost_tip") . '\',\'info_tooltip\')" onmouseout="oldtoolTip()"><b>' . lang("admin", "raffle_cost") . '</b></a> </td> </tr> <tr> <td>' . lang("admin", "raffle_credits") . ': </td> <td> <input type="text" name="raffle_cost_credits" value="' . $raffle["cost_credits"] . '" size="6" /> </td> </tr> <tr> <td>' . lang("admin", "raffle_money") . ': </td> <td> <input type="text" name="raffle_cost_gold" value="' . $raffle_cost_g . '" maxlength="6" size="6"/> <img src="../img/gold.gif" alt="gold" /> <input type="text" name="raffle_cost_silver" value="' . $raffle_cost_s . '" maxlength="2" size="6"/> <img src="../img/silver.gif" alt="gold" /> <input type="text" name="raffle_cost_copper" value="' . $raffle_cost_c . '" maxlength="2" size="6"/> <img src="../img/copper.gif" alt="gold" /> </td> </tr> <tr> <td colspan="2"> <hr /> </td> </tr> <tr> <td>' . lang("admin", "raffle_title") . ':</td> <td> <input type="text" name="raffle_title" value="' . $raffle["title"] . '" class="admin_edit_coupon_fields" /> </td> </tr> <tr> <td>' . lang("admin", "raffle_text") . ': </td> <td> <textarea name="raffle_text" rows="2" cols="32">' . $raffle["text"] . '</textarea> </td> </tr> <tr> <td colspan="2"> <hr /> </td> </tr> <tr> <td>' . lang("admin", "raffle_ticket_limit") . ':</td> <td> <input type="text" name="raffle_ticket_limit" value="' . $raffle["ticket_limit"] . '" size="6" /> </td> </tr> <tr> <td>' . lang("admin", "raffle_per_user") . ': </td> <td> <input type="text" name="raffle_per_user" value="' . $raffle["tickets_per_user"] . '" size="6" /> </td> </tr> <tr> <td colspan="2"> <hr /> </td> </tr> <tr> <td>' . lang("admin", "raffle_announce_acct") . ':</td> <td> <input type="text" name="raffle_announce_acct" value="' . $raffle["announce_acct"] . '" size="6" /> </td> </tr> <tr> <td colspan="2"> <hr /> </td> </tr> <tr> <td>' . lang("admin", "enabled") . ': </td> <td> <input type="checkbox" name="raffle_enabled" value="1" ' . ($raffle["enabled"] == 1 ? 'checked="checked"' : '') . ' /> </td> </tr> <tr> <td>' . lang("admin", "raffle_completed") . ': </td> <td><img src="img/' . ($raffle["completed"] ? 'aff_tick.png' : 'aff_cross.png') . '" alt="" /></td> </tr> </table> </fieldset> <div> <input type="submit" name="saveraffle" value="' . lang("admin", "save") . '" /> </div> </form> </div>'; } else { // save raffle $raffle = $sqlm->quote_smart($_GET["sel_raffle"]); $raffle_credits = $sqlm->quote_smart($_GET["raffle_credits"]); $raffle_money_gold = $sqlm->quote_smart($_GET["raffle_money_gold"]); $raffle_money_silver = $sqlm->quote_smart($_GET["raffle_money_silver"]); $raffle_money_copper = $sqlm->quote_smart($_GET["raffle_money_copper"]); $raffle_item = $sqlm->quote_smart($_GET["raffle_item"]); $raffle_count = $sqlm->quote_smart($_GET["raffle_count"]); $raffle_cost_credits = $sqlm->quote_smart($_GET["raffle_cost_credits"]); $raffle_cost_gold = $sqlm->quote_smart($_GET["raffle_cost_gold"]); $raffle_cost_silver = $sqlm->quote_smart($_GET["raffle_cost_silver"]); $raffle_cost_copper = $sqlm->quote_smart($_GET["raffle_cost_copper"]); $raffle_title = $sqlm->quote_smart($_GET["raffle_title"]); $raffle_text = $sqlm->quote_smart($_GET["raffle_text"]); $raffle_ticket_limit = $sqlm->quote_smart($_GET["raffle_ticket_limit"]); $raffle_per_user = $sqlm->quote_smart($_GET["raffle_per_user"]); $raffle_announce_acct = $sqlm->quote_smart($_GET["raffle_announce_acct"]); $raffle_enabled = isset($_GET["raffle_enabled"]) ? 1 : 0; // drawing $year = $sqlm->quote_smart($_GET["drawing_year"]); $month = $sqlm->quote_smart($_GET["drawing_month"]); $day = $sqlm->quote_smart($_GET["drawing_day"]); $hour = $sqlm->quote_smart($_GET["drawing_hour"]); $minute = $sqlm->quote_smart($_GET["drawing_minute"]); $drawing = $year . "-" . $month . "-" . $day . " " . $hour . ":" . $minute . ":00"; // prize // pad $raffle_money_silver = str_pad($raffle_money_silver, 2, "0", STR_PAD_LEFT); $raffle_money_copper = str_pad($raffle_money_copper, 2, "0", STR_PAD_LEFT); // combine $raffle_money = $raffle_money_gold . $raffle_money_silver . $raffle_money_copper; // cost // pad $raffle_cost_silver = str_pad($raffle_cost_silver, 2, "0", STR_PAD_LEFT); $raffle_cost_copper = str_pad($raffle_cost_copper, 2, "0", STR_PAD_LEFT); // combine $raffle_cost = $raffle_cost_gold . $raffle_cost_silver . $raffle_cost_copper; $query = "UPDATE point_system_raffles\n SET drawing='" . $drawing . "', credits='" . $raffle_credits . "', money='" . $raffle_money . "',\n item_id='" . $raffle_item . "', item_count='" . $raffle_count . "',\n title='" . $raffle_title . "', text='" . $raffle_text . "',\n cost_credits='" . $raffle_cost_credits . "', cost_money='" . $raffle_cost . "',\n ticket_limit='" . $raffle_ticket_limit . "', tickets_per_user='******',\n announce_acct='" . $raffle_announce_acct . "', enabled='" . $raffle_enabled . "'\n WHERE entry='" . $raffle . "'"; $sqlm->query($query); redirect("admin.php?section=pointsystem&subsection=raffles&editraffle=editraffle&sel_raffle=" . $raffle); } } else { redirect("admin.php?section=pointsystem&subsection=raffles&error=1"); } } elseif ($raffle_action == "del") { $raffle_id = $sqlm->quote_smart($_GET["sel_raffle"]); if (is_numeric($raffle_id)) { $result = $sqlm->query("DELETE FROM point_system_raffles WHERE `entry`='" . $raffle_id . "'"); redirect("admin.php?section=pointsystem&subsection=raffles"); } else { redirect("admin.php?section=pointsystem&subsection=raffles&error=1"); } } else { $result = $sqlm->query("INSERT INTO point_system_raffles (credits, money, item_id, item_count, title, text, cost_credits, cost_money, tickets_per_user, ticket_limit, announce_acct, winner, enabled, completed) VALUES ('0', '0', '0', '0', '', '', '0', '0', '1', '1', '1', '0', '0', '0')"); redirect("admin.php?section=pointsystem&subsection=raffles"); } } break; case "bags": $query = "SELECT * FROM point_system_prize_bags"; $result = $sqlm->query($query); $bag_action = 0; if (isset($_GET["editbag"])) { $bag_action = "edit"; } if (isset($_GET["delbag"])) { $bag_action = "del"; } if (isset($_GET["addbag"])) { $bag_action = "add"; } $sub_action = isset($_GET["subaction"]) ? $_GET["subaction"] : ''; $sqll = new SQL(); $sqll->connect($logon_db["addr"], $logon_db["user"], $logon_db["pass"], $logon_db["name"], $logon_db["encoding"]); if (!$bag_action) { $output .= ' <form action="admin.php" method="get" id="form"> <div> <input type="hidden" name="section" value="pointsystem" /> <input type="hidden" name="subsection" value="raffle" /> </div> <table class="simple" id="admin_point_bag_list"> <tr> <th style="width: 1%;"></th> <th style="width: 1%;"></th> <th style="width: 4%;">' . lang("admin", "bag_id") . '</th> <th style="width: 37%;">' . lang("admin", "bag_slots") . '</th> <th style="width: 37%;">' . lang("admin", "bag_owner") . '</th> <th style="width: 20%;">' . lang("admin", "bag_template") . '</th> </tr>'; $color = "#EEEEEE"; while ($bag = $sqlm->fetch_assoc($result)) { if ($core == 1) { $owner_query = "SELECT login FROM accounts WHERE acct='" . $bag["owner"] . "'"; } else { $owner_query = "SELECT username AS login FROM account WHERE id='" . $bag["owner"] . "'"; } $owner_result = $sqll->query($owner_query); if ($sqll->num_rows($owner_result) > 0) { $owner_result = $sqll->fetch_assoc($owner_result); $owner = $owner_result["login"]; } else { $owner = '<b>' . lang("admin", "bag_no_owner") . '</b>'; } $output .= ' <tr> <td style="background-color:' . $color . '; text-align: center;"> <span> <a href="admin.php?section=pointsystem&subsection=bags&sel_bag=' . $bag["entry"] . '&editbag=editbag" onmouseover="oldtoolTip(\'' . lang("admin", "edit") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()"> <img src="img/edit.png" alt="" /> </a> </span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span> <a href="admin.php?section=pointsystem&subsection=bags&sel_bag=' . $bag["entry"] . '&delbag=deletebag" onmouseover="oldtoolTip(\'' . lang("admin", "remove") . '\', \'info_tooltip\')" onmouseout="oldtoolTip()"> <img src="img/aff_cross.png" alt="" /> </a> </span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span>' . $bag["entry"] . '</span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span>' . $bag["slots"] . '</span> </td> <td style="background-color:' . $color . '; text-align: center;"> <span>' . $owner . '</span> </td> <td style="background-color:' . $color . '; text-align: center;">'; if ($bag["is_template"]) { $output .= ' <span> <img src="img/star.png" alt="" /> </span>'; } else { $output .= ' '; } $output .= ' </td> </tr>'; $color = $color == "#EEEEEE" ? "#FFFFFF" : "#EEEEEE"; } $output .= ' <tr> <td style="background-color:' . $color . '"> <a href="admin.php?section=pointsystem&subsection=bags&addbag=addbag"> <img src="img/add.png" alt="" /> </a> </td> <td style="background-color:' . $color . '" colspan="13"> <a href="admin.php?section=pointsystem&subsection=bags&addbag=addbag">' . lang("admin", "addbag") . '</a> </td> </tr> </table> </form>'; } else { if ($bag_action == "edit") { $bag_id = $sqlm->quote_smart($_GET["sel_bag"]); if (is_numeric($bag_id)) { if (!$sub_action) { $bag = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM point_system_prize_bags WHERE `entry`='" . $bag_id . "'")); if ($core == 1) { $owner_query = "SELECT login FROM accounts WHERE acct='" . $bag["owner"] . "'"; } else { $owner_query = "SELECT username AS login FROM account WHERE id='" . $bag["owner"] . "'"; } $owner_result = $sqll->query($owner_query); if ($sqll->num_rows($owner_result) > 0) { $owner_result = $sqll->fetch_assoc($owner_result); $owner = $owner_result["login"]; } else { $owner = '<b>' . lang("admin", "bag_no_owner") . '</b>'; } $output .= ' <div> <form action="admin.php" method="get" id="form"> <fieldset> <div> <input type="hidden" name="section" value="pointsystem" /> <input type="hidden" name="subsection" value="bags" /> <input type="hidden" name="editbag" value="editbag" /> <input type="hidden" name="subaction" value="savebag" /> <input type="hidden" name="sel_bag" value="' . $bag["entry"] . '" /> </div> <table id="admin_edit_coupon"> <tr> <td>' . lang("admin", "bag_id") . ': </td> <td>' . $bag["entry"] . '</td> </tr> <tr> <td>' . lang("admin", "bag_owner") . ': </td> <td>' . $owner . '</td> </tr> <tr> <td>' . lang("admin", "bag_template") . ': </td> <td> <input type="checkbox" name="is_template" value="1"' . ($bag["is_template"] ? ' checked="checked"' : '') . ' /> </td> </tr> <tr> <td colspan="2"> <hr /> </td> </tr> <tr> <td>' . lang("admin", "bag_slots") . ': </td> <td> <select name="slots"> <option value="4" ' . ($bag["slots"] == 4 ? 'selected="selected"' : '') . '>4</option> <option value="6" ' . ($bag["slots"] == 6 ? 'selected="selected"' : '') . '>6</option> <option value="8" ' . ($bag["slots"] == 8 ? 'selected="selected"' : '') . '>8</option> <option value="10" ' . ($bag["slots"] == 10 ? 'selected="selected"' : '') . '>10</option> <option value="12" ' . ($bag["slots"] == 12 ? 'selected="selected"' : '') . '>12</option> <option value="14" ' . ($bag["slots"] == 14 ? 'selected="selected"' : '') . '>14</option> <option value="16" ' . ($bag["slots"] == 16 ? 'selected="selected"' : '') . '>16</option> <option value="18" ' . ($bag["slots"] == 18 ? 'selected="selected"' : '') . '>18</option> <option value="20" ' . ($bag["slots"] == 20 ? 'selected="selected"' : '') . '>20</option> <option value="22" ' . ($bag["slots"] == 22 ? 'selected="selected"' : '') . '>22</option> <option value="24" ' . ($bag["slots"] == 24 ? 'selected="selected"' : '') . '>24</option> <option value="26" ' . ($bag["slots"] == 26 ? 'selected="selected"' : '') . '>26</option> <option value="28" ' . ($bag["slots"] == 28 ? 'selected="selected"' : '') . '>28</option> <option value="30" ' . ($bag["slots"] == 30 ? 'selected="selected"' : '') . '>30</option> <option value="32" ' . ($bag["slots"] == 32 ? 'selected="selected"' : '') . '>32</option> <option value="34" ' . ($bag["slots"] == 34 ? 'selected="selected"' : '') . '>34</option> <option value="36" ' . ($bag["slots"] == 36 ? 'selected="selected"' : '') . '>36</option> </select> </td> </tr> <tr> <td colspan="2"> <hr /> </td> </tr> <tr> <td valign="top" align="center"> <span>' . lang("admin", "bag_simulation") . '</span> <div class="bag" style="width:' . 4 * 43 . 'px;height:' . ceil($bag["slots"] / 4) * 41 . 'px;">'; $dsp = $bag["slots"] % 4; if ($dsp) { $output .= ' <div class="no_slot"></div>'; } // get bag items $items_query = "SELECT item_id, slot, item_count FROM point_system_prize_bag_items WHERE `bag`='" . $bag_id . "'"; $items_result = $sqlm->query($items_query); // create a empty bag array and fill it with nothing $items = array(); for ($i = 0; $i < $bag["slots"]; $i++) { $items[] = array("item_id" => 0, "slot" => 0, "item_count" => 0); } while ($item = $sqlm->fetch_assoc($items_result)) { $item["item_count"] = $item["item_count"] == 1 ? "" : $item["item_count"]; // this_is_junk: style left hardcoded because it's calculated. $output .= ' <div class="bag_slot" style="left:' . ($item["slot"] + $dsp) % 4 * 44 . 'px;top:' . (floor(($item["slot"] + $dsp) / 4) * 41 + 3) . 'px;"> <img src="' . get_item_icon($item["item_id"]) . '" alt="" class="item_img" />'; $output .= ' <div class="points_bag_quantity_shadow">' . $item["item_count"] . '</div> <div class="points_bag_quantity">' . $item["item_count"] . '</div>'; $output .= ' </div>'; $item["item_count"] = $item["item_count"] == "" ? 1 : $item["item_count"]; $items[$item["slot"]] = $item; } $output .= ' </div> </td> <td> <table> <tr> <td>' . lang("admin", "bag_slot") . '</td> <td align="center">' . lang("admin", "bag_item") . '</td> <td align="center">' . lang("admin", "bag_item_count") . '</td> </tr>'; for ($i = 0; $i < $bag["slots"]; $i++) { $output .= ' <tr> <td>' . ($i + 1) . ': </td> <td> <input type="text" name="slot_' . $i . '" value="' . $items[$i]["item_id"] . '" size="7" /> </td> <td> <input type="text" name="slot_count_' . $i . '" value="' . $items[$i]["item_count"] . '" size="7" /> </td> </tr>'; } $output .= ' </table> </td> </tr> </table> </fieldset> <div> <input type="submit" name="savebag" value="' . lang("admin", "save") . '" /> </div> </form> </div>'; } else { // save prize bag & items $bag_id = $_GET["sel_bag"]; $slots = $_GET["slots"]; $is_template = isset($_GET["is_template"]) ? 1 : 0; $items = array(); $item_counts = array(); for ($i = 0; $i < $slots; $i++) { if ($_GET["slot_" . $i] != 0) { $items[] = $_GET["slot_" . $i]; $item_counts[] = $_GET["slot_count_" . $i]; } } // update bag $query = "UPDATE point_system_prize_bags SET slots='" . $slots . "', is_template='" . $is_template . "' WHERE entry='" . $bag_id . "'"; $sqlm->query($query); // delete existing items $query = "DELETE FROM point_system_prize_bag_items WHERE bag='" . $bag_id . "'"; $sqlm->query($query); for ($i = 0; $i < count($items); $i++) { $query = "INSERT INTO point_system_prize_bag_items (bag, slot, item_id, item_count) VALUES ('" . $bag_id . "', '" . $i . "', '" . $items[$i] . "', '" . $item_counts[$i] . "')"; $sqlm->query($query); } redirect("admin.php?section=pointsystem&subsection=bags&editbag=editbag&sel_bag=" . $bag_id); } } else { redirect("admin.php?section=pointsystem&subsection=bags&error=1"); } } elseif ($bag_action == "del") { $bag_id = $sqlm->quote_smart($_GET["sel_bag"]); if (is_numeric($bag_id)) { $result = $sqlm->query("DELETE FROM point_system_prize_bags WHERE `entry`='" . $bag_id . "'"); $result = $sqlm->query("DELETE FROM point_system_prize_bag_items WHERE `bag`='" . $bag_id . "'"); redirect("admin.php?section=pointsystem&subsection=bags"); } else { redirect("admin.php?section=pointsystem&subsection=bags&error=1"); } } else { $result = $sqlm->query("INSERT INTO point_system_prize_bags (slots, owner) VALUES ('4', '0')"); redirect("admin.php?section=pointsystem&subsection=bags"); } } break; case "achieve": $output .= 'TO DO'; } $output .= ' </div>'; }