if (!in_array($_POST['newComponentType'], array_keys($typeOptions))) { $addAppForm->errors[] = "You selected an invalid component type.<br>"; } if (count($addAppForm->errors) == 0) { if ($appComponentObj->getHighestOrderNum() == "") { $componentOrderNum = $appComponentObj->validateOrder("first", "before"); } else { $appComponentObj->selectByOrder(1); $componentOrderNum = $appComponentObj->makeRoom("after"); } if ($_POST['newComponentRequired'] != 0) { $_POST['newComponentRequired'] = 1; } $arrColumns = array("name", "componenttype", "ordernum", "required", "tooltip"); $arrValues = array($_POST['newComponentName'], $_POST['newComponentType'], $componentOrderNum, $_POST['newComponentRequired'], $_POST['newComponentTooltip']); if ($appComponentObj->addNew($arrColumns, $arrValues)) { if ($_POST['newComponentType'] == "select" || $_POST['newComponentType'] == "multiselect") { $appComponentSelectOptionObj = new Basic($mysqli, "app_selectvalues", "appselectvalue_id"); $newComponentID = $appComponentObj->get_info("appcomponent_id"); foreach ($_SESSION['btAppComponent']['cOptions'] as $optionValue) { $appComponentSelectOptionObj->addNew(array("appcomponent_id", "componentvalue"), array($newComponentID, $optionValue)); } } elseif ($_POST['newComponentType'] == "profile") { $appComponentSelectOptionObj = new Basic($mysqli, "app_selectvalues", "appselectvalue_id"); $newComponentID = $appComponentObj->get_info("appcomponent_id"); $appComponentSelectOptionObj->addNew(array("appcomponent_id", "componentvalue"), array($newComponentID, $_POST['profileOptionID'])); } $member->logAction("Added a new member application component."); echo "\n\t\t\t\t\t<div id='addAppComponentSuccess' style='display: none'>\n\t\t\t\t\t\t<p class='main' align='center'>\n\t\t\t\t\t\t\tNew Member Application Component Added!<br><br>\n\t\t\t\t\t\t\tClick OK to continue modifying the member application.\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</div>\n\t\t\t\t\t\n\t\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\t\t\$(document).ready(function() {\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\$('#addAppComponentSuccess').dialog({\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\ttitle: 'Add Application Component',\n\t\t\t\t\t\t\t\tmodal: true,\n\t\t\t\t\t\t\t\tzIndex: 99999,\n\t\t\t\t\t\t\t\tshow: 'scale',\n\t\t\t\t\t\t\t\twidth: 450,\n\t\t\t\t\t\t\t\tresizable: false,\n\t\t\t\t\t\t\t\tbuttons: {\n\t\t\t\t\t\t\t\t\t'OK': function() {\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\$('#loadingSpiral').show();\n\t\t\t\t\t\t\t\t\t\t\$('#appComponentList').fadeOut(250);\n\t\t\t\t\t\t\t\t\t\t\$.post('" . $MAIN_ROOT . "members/include/membermanagement/include/appcomponentlist.php', { }, function(data) {\n\t\t\t\t\t\t\t\t\t\t\t\$('#appComponentList').html(data);\n\t\t\t\t\t\t\t\t\t\t\t\$('#loadingSpiral').hide();\n\t\t\t\t\t\t\t\t\t\t\t\$('#appComponentList').fadeIn(250);\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\$(this).dialog('close');\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\$('#appComponentForm').dialog('close');\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t});\n\t\t\t\t\t</script>\n\t\t\t\t\t\n\t\t\t\t"; } else { $addAppForm->errors[] = "nable to save information to the database. Please contact the website administrator.";
if ($_POST['submit']) { // Check Name if (trim($_POST['catname']) == "") { $dispError .= " <b>·</b> Category name may not be blank.<br>"; $countErrors++; } // Check Order $intNewOrderSpot = $categoryObj->validateOrder($_POST['displayorder'], $_POST['beforeafter']); if ($intNewOrderSpot === false) { $dispError .= " <b>·</b> You selected an invalid display order.<br>"; $countErrors++; } if ($countErrors == 0) { $arrColumns = array("name", "ordernum"); $arrValues = array($_POST['catname'], $intNewOrderSpot); if ($categoryObj->addNew($arrColumns, $arrValues)) { $forumCatInfo = $categoryObj->get_info_filtered(); 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 Forum Category: <b>" . $forumCatInfo['name'] . "</b>!\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 Forum Category', '" . $MAIN_ROOT . "members', 'successBox');\n\t\t\t</script>\n\t\t\t"; } else { $countErrors++; $dispError .= " <b>·</b> Unable to save category to the database. Please contact the website administrator.<br>"; } } if ($countErrors > 0) { $_POST = filterArray($_POST); $_POST['submit'] = false; } } if (!$_POST['submit']) { $orderoptions = ""; $result = $mysqli->query("SELECT * FROM " . $dbprefix . "forum_category ORDER BY ordernum DESC");
} } else { $uploadImg = new BTUpload($_POST['statusimageurl'], "status_", "../images/diplomacy/", array(".jpg", ".png", ".gif", ".bmp"), 4, true); if (!$uploadImg->uploadFile()) { $countErrors++; $dispError .= " <b>·</b> Unable to download status image from remote url. You may need to first download the image and upload normally.<br>"; } else { $statusImageURL = "images/diplomacy/" . $uploadImg->getUploadedFileName(); } //$statusImageURL = $_POST['statusimageurl']; } // If there are still no errors after uploading the image, add to db if ($countErrors == 0) { $arrColumns = array("name", "imageurl", "imagewidth", "imageheight", "ordernum"); $arrValues = array($_POST['statusname'], $statusImageURL, $_POST['imagewidth'], $_POST['imageheight'], $intNewOrderNum); if ($diplomacyStatusObj->addNew($arrColumns, $arrValues)) { echo "\n\t\t\t\t\n\t\t\t\t\t<div style='display: none' id='successBox'>\n\t\t\t\t\t\t<p align='center'>\n\t\t\t\t\t\t\tSuccessfully added the " . $diplomacyStatusObj->get_info_filtered("name") . " status to the diplomacy page!\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</div>\n\t\t\t\t\t\n\t\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\t\tpopupDialog('Add New Diplomacy Status', '" . $MAIN_ROOT . "members', 'successBox');\n\t\t\t\t\t</script>\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t"; $member->logAction("Added the " . $_POST['statusname'] . " status to the diplomacy page."); } else { $countErrors++; $dispError .= " <b>·</b> Unable to save information to the database. Please contact the website administrator.<br>"; } } } if ($countErrors > 0) { $_POST = filterArray($_POST); $_POST['submit'] = false; } } if (!$_POST['submit']) { $orderoptions = "";