} elseif ($_POST['catorder'] == "first") { // "(no other categories)" selected, check to see if there are actually no other categories $result = $mysqli->query("SELECT * FROM " . $dbprefix . "consolecategory WHERE adminoption = '0'"); $num_rows = $result->num_rows; if ($num_rows > 0) { $countErrors++; $dispError .= " <b>·</b> You selected an invalid category order. (category)<br>"; } else { $intNewOrderSpot = 1; } } else { if ($_POST['beforeafter'] != "before" and $_POST['beforeafter'] != "after") { $countErrors++; $dispError .= " <b>·</b> You selected an invalid category order. (before/after)<br>"; } else { $intNewOrderSpot = $consoleCatObj->makeRoom($_POST['beforeafter']); } } if ($countErrors == 0) { if ($consoleCatObj->addNew(array("name", "ordernum"), array($_POST['catname'], $intNewOrderSpot))) { echo "\n\t\t\t<div style='display: none' id='successBox'>\n\t\t\t\t<p align='center'>\n\t\t\t\t\tSuccessfully Added New Console Category!\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t\t\n\t\t\t<script type='text/javascript'>\n\t\t\t\tpopupDialog('Add New Console Category', '" . $MAIN_ROOT . "members', 'successBox');\n\t\t\t</script>\n\t\t\t"; } } else { $_POST = filterArray($_POST); $_POST['submit'] = false; } } if (!$_POST['submit']) { $countCategories = 0; $result = $mysqli->query("SELECT * FROM " . $dbprefix . "consolecategory WHERE adminoption = '0' ORDER BY ordernum DESC"); while ($row = $result->fetch_assoc()) {
// Checking Console Categories First $arrConsoleCategoryIDs = array(); $arrCheckConsoleCategories = array(); $result = $mysqli->query("SELECT * FROM " . $_POST['tableprefix'] . "consolecategory ORDER BY ordernum DESC"); while ($row = $result->fetch_assoc()) { $arrCheckConsoleCategories[] = $row['name']; if (in_array($row['name'], $arrConsoleCategories)) { $tempCatID = array_search($row['name'], $arrConsoleCategories); $arrConsoleCategoryIDs[$tempCatID] = $row['consolecategory_id']; } } $pmCatID = ""; foreach ($arrConsoleCategories as $consoleCategory) { if (!in_array($consoleCategory, $arrCheckConsoleCategories)) { $consoleCatObj->selectByOrder(1); $newOrderNum = $consoleCatObj->makeRoom("after"); $consoleCatObj->addNew(array("name", "ordernum"), array($consoleCategory, $newOrderNum)); $tempCatID = array_search($consoleCategory, $arrConsoleCategories); $arrConsoleCategoryIDs[$tempCatID] = $consoleCatObj->get_info("consolecategory_id"); $consoleCatObj->resortOrder(); if ($consoleCategory == "Private Messages") { $pmCatID = $arrConsoleCategoryIDs[$tempCatID]; } } } // Checking Console Options $arrColumns = array("consolecategory_id", "pagetitle", "filename", "sortnum", "defaultconsole", "hide", "sep"); foreach ($arrConsoleOptionNames as $key => $consoleOptionName) { $checkConsole = $consoleOptionObj->findConsoleIDByName($consoleOptionName); if ($checkConsole === false) { $tempCatID = $arrConsoleCategoryIDs[$arrConsoleOptionInfo[$key]['category']];