$member->select($_SESSION['btUsername']); $profileCatObj = new ProfileCategory($mysqli); $profileObj = new ProfileOption($mysqli); $cID = $consoleObj->findConsoleIDByName("Manage Profile Options"); $consoleObj->select($cID); $_GET['cID'] = $cID; if ($member->authorizeLogin($_SESSION['btPassword'])) { $memberInfo = $member->get_info_filtered(); $selectedOption = ""; $addSQL = ""; if ($member->hasAccess($consoleObj) && $profileCatObj->select($_POST['catID'])) { if ($_POST['oID'] != "" and $profileObj->SELECT($_POST['oID'])) { $addSQL = " AND profileoption_id != '" . $_POST['oID'] . "'"; $profileOptionInfo = $profileObj->get_info_filtered(); if ($profileOptionInfo['profilecategory_id'] == $_POST['catID']) { $arrAssociates = $profileCatObj->getAssociateIDs("ORDER BY sortnum"); $highestIndex = count($arrAssociates) - 1; $arrFlipped = array_flip($arrAssociates); if ($highestIndex > 0) { if ($arrFlipped[$_POST['oID']] == $highestIndex) { $temp = $highestIndex - 1; $selectedOption = $arrAssociates[$temp]; } else { $temp = $arrFlipped[$_POST['oID']] + 1; $selectedConsole = $arrAssociates[$temp]; } } } } $profileCatInfo = $profileCatObj->get_info_filtered(); $result = $mysqli->query("SELECT * FROM " . $dbprefix . "profileoptions WHERE profilecategory_id = '" . $profileCatInfo['profilecategory_id'] . "'" . $addSQL . " ORDER BY sortnum");
$profileOptionInfo = $profileOptionObj->get_info_filtered(); echo "\n\n<script type='text/javascript'>\n\$(document).ready(function() {\n\$('#breadCrumb').html(\"<a href='" . $MAIN_ROOT . "'>Home</a> > <a href='" . $MAIN_ROOT . "members'>My Account</a> > <a href='" . $MAIN_ROOT . "members/console.php?cID=" . $cID . "'>Manage Profile Options</a> > " . $profileOptionInfo['name'] . "\");\n});\n</script>\n"; $dispError = ""; if ($_POST['submit']) { // Check Option Name if (trim($_POST['optionname']) == "") { $countErrors++; $dispError .= " <b>·</b> You must give the profile option a name.<br>"; } // Check Category if (!$profileCatObj->select($_POST['optioncategory'])) { $countErrors++; $dispError .= " <b>·</b> You selected an invalid profile category.<br>"; } else { // Check Order $arrProfileOptionIDs = $profileCatObj->getAssociateIDs(); $blnOrderCheck1 = $_POST['optionorder'] == "first" && count($arrProfileOptionIDs) > 1 && $profileOptionInfo['profilecategory_id'] == $_POST['optioncategory']; $blnOrderCheck2 = !in_array($_POST['optionorder'], $arrProfileOptionIDs) && $_POST['optionorder'] != "first"; $blnOrderCheck3 = !$profileOptionObj->select($_POST['optionorder']) && $_POST['optionorder'] != "first"; $blnOrderCheck4 = $_POST['optionorder'] == "first" && $_POST['optioncategory'] != $profileOptionInfo['profilecategory_id'] && count($arrProfileOptionIDs) > 0; if ($blnOrderCheck1 || $blnOrderCheck2 || $blnOrderCheck3 || $blnOrderCheck4) { $countErrors++; $dispError .= " <b>·</b> You selected an invalid profile option order.<br>"; } elseif ($_POST['optionorder'] == "first") { $intNewSortNum = 1; } else { if ($_POST['beforeafter'] == "before" || $_POST['beforeafter'] == "after") { $intNewSortNum = $profileOptionObj->makeRoom($_POST['beforeafter']); } else { $countErrors++; $dispError .= " <b>·</b> You selected an invalid profile option order.<br>";
include_once "../../../../_setup.php"; include_once "../../../../classes/member.php"; include_once "../../../../classes/rank.php"; include_once "../../../../classes/consoleoption.php"; include_once "../../../../classes/profilecategory.php"; $consoleObj = new ConsoleOption($mysqli); $member = new Member($mysqli); $member->select($_SESSION['btUsername']); $profileCatObj = new ProfileCategory($mysqli); $cID = $consoleObj->findConsoleIDByName("Manage Profile Categories"); $_GET['cID'] = $cID; $consoleObj->select($cID); if ($member->authorizeLogin($_SESSION['btPassword'])) { $memberInfo = $member->get_info_filtered(); if ($member->hasAccess($consoleObj) && $profileCatObj->select($_POST['catID'])) { define('MEMBERRANK_ID', $memberInfo['rank_id']); $profileCatInfo = $profileCatObj->get_info_filtered(); $arrCats = $profileCatObj->getAssociateIDs(); if (count($arrCats) > 0) { echo "<div id='newDeleteMessage' style='display: none'><p align='center'>There are currently profile options with the profile category <b>" . $profileCatInfo['name'] . "</b>. Please move all profile options out of this category before deleting it.</p></div>"; echo "\n\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\t\$(document).ready(function() {\n\t\t\t\t\t\t\$('#deleteMessage').dialog('close');\n\t\t\t\t\t\t\$('#newDeleteMessage').dialog({\n\t\t\t\t\t\t\n\t\t\t\t\t\t\ttitle: 'Manage Profile Categories - Delete',\n\t\t\t\t\t\t\tmodal: true,\n\t\t\t\t\t\t\tzIndex: 9999,\n\t\t\t\t\t\t\tresizable: false,\n\t\t\t\t\t\t\tshow: 'scale',\n\t\t\t\t\t\t\twidth: 400,\n\t\t\t\t\t\t\tbuttons: {\n\t\t\t\t\t\t\t\t'OK': function() {\n\t\t\t\t\t\t\t\t\t\$(this).dialog('close');\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\n\t\t\t\t\t});\n\t\t\t\t</script>\n\t\t\t"; } elseif ($_POST['confirm'] == "1") { $profileCatObj->delete(); include "main.php"; } else { echo "<p align='center'>Are you sure you want to delete the profile category <b>" . $profileCatInfo['name'] . "</b>?"; } } elseif (!$profileCatObj->select($_POST['catID'])) { echo "<p align='center'>Unable find the selected profile category. Please try again or contact the website administrator.</p>"; } }
$mainGamePlayed = array("maingame" => array("type" => "select", "sortorder" => $i++, "display_name" => "Main Game", "value" => $memberInfo['maingame_id'], "db_name" => "maingame_id", "attributes" => array("class" => "textBox formInput"))); foreach ($arrGames as $gameID) { $gameObj->select($gameID); $mainGameOptions[$gameID] = $gameObj->get_info_filtered("name"); $gamesPlayedOptions["game_" . $gameID] = array("type" => "checkbox", "sortorder" => $i++, "attributes" => array("class" => "textBox formInput", "style" => "margin-left: 10px"), "value" => $member->playsGame($gameID), "options" => array("1" => $gameObj->get_info_filtered("name"))); } $mainGamePlayed['maingame']['options'] = $mainGameOptions; $arrComponents = array_merge($arrComponents, $arrSocialMediaComponents, $arrBirthdayComponents, $gamesPlayedSection, $mainGamePlayed, $gamesPlayedOptions); } // Set up Custom Profile Options $customCount = 1; $arrCustomOptions = array(); $result = $mysqli->query("SELECT * FROM " . $dbprefix . "profilecategory ORDER BY ordernum DESC"); while ($row = $result->fetch_assoc()) { $profileCategoryObj->select($row['profilecategory_id']); $arrProfileOptions = $profileCategoryObj->getAssociateIDs("ORDER BY sortnum"); $arrCustomOptions['customsection_' . $customCount] = array("type" => "section", "options" => array("section_title" => $profileCategoryObj->get_info_filtered("name") . ":"), "sortorder" => $i++); $customCount++; foreach ($arrProfileOptions as $profileOptionID) { $profileOptionObj->select($profileOptionID); $profileOptionValue = $member->getProfileValue($profileOptionID, true); $arrSelectOptions = array(); if ($profileOptionObj->isSelectOption()) { $arrSelectOptions = $profileOptionObj->getSelectValues(); $inputType = "select"; } else { $inputType = "text"; } $arrCustomOptions["custom_" . $profileOptionID] = array("display_name" => $profileOptionObj->get_info_filtered("name"), "type" => $inputType, "attributes" => array("class" => "textBox formInput"), "sortorder" => $i++, "options" => $arrSelectOptions, "value" => $profileOptionValue); } }
include_once $prevFolder . "classes/profileoption.php"; $profileCatObj = new ProfileCategory($mysqli); $profileOptionObj = new ProfileOption($mysqli); if ($_POST['submit']) { // Check Option Name if (trim($_POST['optionname']) == "") { $countErrors++; $dispError .= " <b>·</b> You must give the profile option a name.<br>"; } // Check Category if (!$profileCatObj->select($_POST['optioncategory'])) { $countErrors++; $dispError .= " <b>·</b> You selected an invalid profile category.<br>"; } else { // Check Order $arrProfileOptionIDs = $profileCatObj->getAssociateIDs(); $blnOrderCheck1 = $_POST['optionorder'] == "first" && count($arrProfileOptionIDs) > 0; $blnOrderCheck2 = !in_array($_POST['optionorder'], $arrProfileOptionIDs) && $_POST['optionorder'] != "first"; $blnOrderCheck3 = !$profileOptionObj->select($_POST['optionorder']) && $_POST['optionorder'] != "first"; if ($blnOrderCheck1 || $blnOrderCheck2 || $blnOrderCheck3) { $countErrors++; $dispError .= " <b>·</b> You selected an invalid profile option order.<br>"; } elseif ($_POST['optionorder'] == "first") { $intNewSortNum = 1; } else { if ($_POST['beforeafter'] == "before" || $_POST['beforeafter'] == "after") { $intNewSortNum = $profileOptionObj->makeRoom($_POST['beforeafter']); } else { $countErrors++; $dispError .= " <b>·</b> You selected an invalid profile option order.<br>"; }