private function handleMaintMode() { if (array_key_exists("nren_maint_mode", $_POST)) { $mode = $_POST['nren_maint_mode']; unset($_POST['nren_maint_mode']); if ($this->person->getNREN()->setMaintMode(Input::sanitizeMaintMode($mode))) { if ($this->person->getNREN()->getMaintMode() === 'y') { Framework::success_output($this->translateTag('l10n_nren_maint_mode_success', 'portal_config')); } else { Framework::success_output($this->translateTag('l10n_nren_maint_normal_success', 'portal_config')); } } else { if ($this->person->getNREN()->getMaintMode() === 'y') { Framework::error_output($this->translateTag('l10n_nren_maint_mode_failure', 'portal_config')); } else { Framework::error_output($this->translateTag('l10n_nren_maint_normal_failure', 'portal_config')); } } } }
function testMaintMode() { $this->assertEqual(Input::sanitizeMaintMode('y'), 'y'); $this->assertNotEqual(Input::sanitizeMaintMode('y'), 'n'); $this->assertNotEqual(Input::sanitizeMaintMode('n'), 'y'); $this->assertEqual(Input::sanitizeMaintMode('æ'), ''); $this->assertEqual(Input::sanitizeMaintMode('<asdfasdfasdf'), ''); $this->assertEqual(Input::sanitizeMaintMode('<asdfasdfasdfn'), 'n'); }
/** * getMaintMode() * * FIXME */ public function getMaintMode() { return Input::sanitizeMaintMode($this->data['maint_mode']); }