public function updateBandAdvertisement($bandID, $advertisementID, $memberID, $changeKey, $advertisementTypeID, $dbConnection) { $processed = false; try { if (stripos($changeKey, AdvertisementEditConstants::BAND_INPUT_CHANGE_KEY) !== false) { BandAdvertisementController::deleteBandAdvertisement($advertisementID); if ($advertisementTypeID == '2') { $bandID = $_POST[AdvertisementEditConstants::BAND_INPUT_ID]; if ($bandID != 'defaultValue') { if (BandMemberController::isBandMemberAdmin($bandID, $memberID, $dbConnection)) { BandAdvertisementController::createBandAdvertisement($bandID, $advertisementID, $dbConnection); } } } $processed = true; } } catch (Exception $ex) { $processed = false; echo 'Caught exception: ' . $ex->getMessage(); } return $processed; }
//Get the current user's ID and details. $memberID = LoginController::getLoggedInMemberID($dbConnection); if ($memberID != null) { if (isset($_POST[AdvertisementCreateConstants::SUBMISSION_KEY_INPUT])) { $submissionKey = $_POST[AdvertisementCreateConstants::SUBMISSION_KEY_INPUT]; echo "Submission Key " . $submissionKey; if (MemberSubmissionController::checkSubmissionKey($memberID, $submissionKey, $dbConnection)) { $inputMemberID = $_POST[AdvertisementCreateConstants::MEMBER_ID_INPUT]; $encryptedID = $_POST[AdvertisementCreateConstants::ENCRYPTED_ID_INPUT]; if (AdvertisementController::processAdvertisementCreateSecurityCheck($memberID, $inputMemberID, $encryptedID)) { $advertisementID = AdvertisementController::createAdvertisement($memberID, $_POST[AdvertisementCreateConstants::FOR_INPUT_ID], $_POST[AdvertisementCreateConstants::SUMMARY_INPUT_ID], $_POST[AdvertisementCreateConstants::DESCRIPTION_INPUT_ID], $_POST[AdvertisementCreateConstants::INSPIRATIONS_INPUT_ID], $_POST[AdvertisementCreateConstants::BAND_INPUT_ID], $_POST[LocationConstants::LOCATION_COUNTRY_INPUT_ID], $_POST[LocationConstants::LOCATION_STATE_INPUT_ID], $_POST[LocationConstants::LOCATION_CITY_INPUT_ID], $_POST[LocationConstants::LOCATION_REGION_INPUT_ID], $dbConnection); if ($advertisementID > 0) { //If advertisement is for a position in a band. if ($_POST[AdvertisementCreateConstants::FOR_INPUT_ID] == 2) { $bandID = $_POST[AdvertisementCreateConstants::BAND_INPUT_ID]; if (BandMemberController::isBandMemberAdmin($bandID, $memberID, $dbConnection)) { BandAdvertisementController::createBandAdvertisement($bandID, $advertisementID, $dbConnection); } } if (AdvertisementGenreController::createAdvertisementGenres($advertisementID, $memberID, $_POST[AdvertisementCreateConstants::GENRE_INPUT_ID], $dbConnection)) { $positionCount = $_POST[AdvertisementCreateConstants::POSITION_COUNT_ID]; echo "Position Count : " . $positionCount; $positionList = null; for ($i = 1; $i <= $positionCount; $i++) { $position = new AdvertisementPosition(); $position->setVariable(AdvertisementPosition::ADVERTISEMENT_ID, $advertisementID); $position->setVariable(AdvertisementPosition::POSITION_NUMBER, $i); $position->setVariable(AdvertisementPosition::INSTRUMENT_ID, $_POST[AdvertisementPositionConstants::POSITION_TYPE_INPUT_ID . $i]); $position->setVariable(AdvertisementPosition::DURATION_ID, $_POST[AdvertisementPositionConstants::POSITION_DURATION_INPUT_ID . $i]); $position->setVariable(AdvertisementPosition::EXPERIENCE_ID, $_POST[AdvertisementPositionConstants::POSITION_EXP_INPUT_ID . $i]); $position->setVariable(AdvertisementPosition::GENDER_ID, $_POST[AdvertisementPositionConstants::POSITION_GENDER_INPUT_ID . $i]);
$bandID = null; $dbConnection = null; $processed = false; try { $dbConnection = DatabaseUtilities::getDatabaseConnection(); //Get the current user's ID and details. $memberID = LoginController::getLoggedInMemberID($dbConnection); if ($memberID == null) { $error = true; $errorCode = 1; } else { $bandID = $_POST[EditBandProfileConstants::BAND_ID_INPUT]; $inputMemberID = $_POST[EditBandProfileConstants::MEMBER_ID_INPUT]; $encryptedID = $_POST[EditBandProfileConstants::ENCRYPTED_ID_INPUT]; $key = $_POST[EditBandProfileConstants::KEY]; if (BandMemberController::processBandMemberSecurityCheck($memberID, $inputMemberID, $encryptedID, $bandID, $key)) { if (isset($_POST[EditBandMemberConstants::BAND_MEMBER_EDIT_ID])) { $admin = BandMemberDao::selectBandMemberAdmin($bandID, $memberID, $dbConnection); } $bandMembers = BandMemberDao::selectBandMembers($bandID, $dbConnection); if ($bandMembers != null) { $processed = true; require_once $config->getIncludeURL(Config::INCLUDES_PATH, "views%ajax%band_member_instruments_view.php"); } } } } catch (Exception $ex) { $processed = false; } $dbConnection = null; if (!$processed) {