private function onCareerPortalTweak() { if ($this->_realAccessLevel < ACCESS_LEVEL_SA && !$_SESSION['CATS']->hasUserCategory('careerportal')) { CommonErrors::fatal(COMMONERROR_PERMISSION, $this); return; //$this->fatal(ERROR_NO_PERMISSION); } if (!isset($_GET['p'])) { CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid page.'); } $page = $_GET['p']; $careerPortalSettings = new CareerPortalSettings($this->_siteID); switch ($page) { case 'new': $origName = 'Blank Page'; $duplicateName = $this->getTrimmedInput('newName', $_POST); /* Copy default templates or existing customized templates from orig to duplicate. */ $templateSource1 = $careerPortalSettings->getAllFromDefaultTemplate($origName); $templateSource2 = $careerPortalSettings->getAllFromCustomTemplate($origName); $templateSource = array_merge($templateSource1, $templateSource2); foreach ($templateSource as $setting) { $careerPortalSettings->setForTemplate($setting['setting'], $setting['value'], $duplicateName); } break; case 'duplicate': $origName = $this->getTrimmedInput('origName', $_POST); $duplicateName = $this->getTrimmedInput('duplicateName', $_POST); if (empty($origName) || empty($duplicateName)) { CommonErrors::fatal(COMMONERROR_MISSINGFIELDS, $this, 'Required fields are missing.'); } /* Copy default templates or existing customized templates from orig to duplicate. */ $templateSource1 = $careerPortalSettings->getAllFromDefaultTemplate($origName); $templateSource2 = $careerPortalSettings->getAllFromCustomTemplate($origName); $templateSource = array_merge($templateSource1, $templateSource2); foreach ($templateSource as $setting) { $careerPortalSettings->setForTemplate($setting['setting'], $setting['value'], $duplicateName); } break; case 'delete': //FIXME: Input validation. $delName = $_POST['delName']; $careerPortalSettings->deleteCustomTemplate($delName); break; case 'setAsActive': //FIXME: Input validation. $activeName = $_POST['activeName']; $careerPortalSettings->set('activeBoard', $activeName); break; } CATSUtility::transferRelativeURI('m=settings&a=careerPortalSettings'); }