public static function disable() { if ($_GET['id']) { $paramquery = $_GET; unset($paramquery['action']); unset($paramquery['id']); $params = http_build_query($paramquery, '', '&'); if (SystemHandler::disable_module($_GET['id'])) { Common_IO::step_proceed($params, "Disable", "Operation Successful", null); } else { Common_IO::step_proceed($params, "Disable", "Operation Failed", null); } } else { } }
/** * @throws ProjectIDMissingException * @throws ProjectSecurityAccessDeniedException */ public static function quota() { global $project_security; if ($_GET['project_id']) { if ($project_security->is_access(7, false) == true) { $project_id = $_GET['project_id']; $project = new Project($project_id); if ($_GET['nextpage'] == 1) { if (is_numeric($_POST['quota'])) { $page_1_passed = true; } else { $page_1_passed = false; $error = "You must enter a value"; } } else { $page_1_passed = false; $error = ""; } if ($page_1_passed == false) { $template = new HTMLTemplate("project/admin/quota.html"); $paramquery = $_GET; $paramquery['nextpage'] = "1"; $params = http_build_query($paramquery, '', '&'); $template->set_var("params", $params); $template->set_var("error", $error); if ($_POST['name']) { $template->set_var("quota", $_POST['quota']); } else { $template->set_var("quota", trim($project->get_quota())); } $template->output(); } else { $paramquery = $_GET; unset($paramquery['nextpage']); $paramquery['run'] = "admin"; $params = http_build_query($paramquery); if ($project->set_quota($_POST['quota'])) { Common_IO::step_proceed($params, "Change Quota", "Operation Successful", null); } else { Common_IO::step_proceed($params, "Change Quota", "Operation Failed", null); } } } else { throw new ProjectSecurityAccessDeniedException(); } } else { throw new ProjectIDMissingException(); } }
/** * @throws GroupIDMissingException */ public static function rename() { if ($_GET['id']) { $group = new Group($_GET['id']); if ($_GET['nextpage'] == 1) { if ($_POST['name']) { if (Group::exist_name($_POST['name']) == true) { $page_1_passed = false; $error = "This name is already allocated."; } else { $page_1_passed = true; } } else { $page_1_passed = false; $error = "You must enter a name."; } } elseif ($_GET['nextpage'] > 1) { $page_1_passed = true; } else { $page_1_passed = false; $error = ""; } if ($page_1_passed == false) { $template = new HTMLTemplate("base/user/admin/group/rename.html"); $paramquery = $_GET; $paramquery['nextpage'] = "1"; $params = http_build_query($paramquery, '', '&'); $template->set_var("params", $params); $template->set_var("error", $error); if ($_POST['username']) { $template->set_var("name", $_POST['name']); } else { $template->set_var("name", $group->get_name()); } $template->output(); } else { $paramquery = $_GET; $paramquery['action'] = "detail"; unset($paramquery['nextpage']); $params = http_build_query($paramquery, '', '&'); if ($group->set_name($_POST['name'])) { Common_IO::step_proceed($params, "Rename User", "Operation Successful", null); } else { Common_IO::step_proceed($params, "Rename User", "Operation Failed", null); } } } else { throw new GroupIDMissingException(); } }
/** * @throws SystemMessageIDMissingException */ public static function edit() { if ($_GET['id']) { $system_message = new SystemMessage($_GET['id']); if ($_GET['nextpage'] == 1) { $page_1_passed = true; if (!$_POST['content']) { $page_1_passed = false; $error = "You must enter a text"; } } else { $page_1_passed = false; $error = ""; } if ($page_1_passed == false) { $template = new HTMLTemplate("base/admin/system_message/edit.html"); $paramquery = $_GET; $paramquery['nextpage'] = "1"; $params = http_build_query($paramquery, '', '&'); $template->set_var("params", $params); if ($error) { $template->set_var("error", $error); } else { $template->set_var("error", ""); } $content = str_replace("\\", "", $system_message->get_content()); if ($_POST['content']) { $template->set_var("content", $_POST['content']); } else { $template->set_var("content", $content); } $template->output(); } else { $paramquery = $_GET; unset($paramquery['nextpage']); unset($paramquery['action']); $params = http_build_query($paramquery); if ($system_message->set_content($_POST['content'])) { Common_IO::step_proceed($params, "Add System Message", "Operation Successful", null); } else { Common_IO::step_proceed($params, "Add System Message", "Operation Failed", null); } } } else { throw new SystemMessageIDMissingException(); } }
/** * @throws FileIDMissingException * @throws FileVersionIDMissingException * @throws DataSecurityAccessDeniedException */ public static function delete_version() { if ($_GET['file_id']) { if ($_GET['version']) { $file = File::get_instance($_GET['file_id']); if ($file->is_delete_access()) { if ($_GET['sure'] != "true") { $template = new HTMLTemplate("data/file_delete_version.html"); $paramquery = $_GET; $paramquery['sure'] = "true"; $params = http_build_query($paramquery); $template->set_var("yes_params", $params); $paramquery = $_GET; $paramquery['action'] = "file_detail"; unset($paramquery['sure']); $params = http_build_query($paramquery); $template->set_var("no_params", $params); $template->output(); } else { $file = File::get_instance($_GET['file_id']); if (($return_value = $file->delete_version($_GET['version'])) != 0) { if ($return_value == 1) { $paramquery = $_GET; $paramquery['action'] = "file_detail"; unset($paramquery['sure']); unset($paramquery['version']); $params = http_build_query($paramquery); } else { $paramquery = $_GET; unset($paramquery['sure']); unset($paramquery['action']); unset($paramquery['file_id']); $params = http_build_query($paramquery); } Common_IO::step_proceed($params, "Delete File", "Operation Successful", null); } else { $paramquery = $_GET; $paramquery['action'] = "file_detail"; unset($paramquery['sure']); $params = http_build_query($paramquery); Common_IO::step_proceed($params, "Delete File", "Operation Failed", null); } } } else { throw new DataSecurityAccessDeniedException(); } } else { throw new FileVersionIDMissingException(); } } else { throw new FileIDMissingException(); } }
/** * @throws EquipmentCategoryIDMissingException */ public static function edit() { if ($_GET['id']) { $equipment_cat = new EquipmentCat($_GET['id']); if ($_GET['nextpage'] == 1) { $page_1_passed = true; if ($_POST['name']) { if (EquipmentCat::exist_name($_POST['name']) == true and $equipment_cat->get_name() != $_POST['name']) { $page_1_passed = false; $error = "This name already exists"; } } else { $page_1_passed = false; $error = "You must enter a name"; } } else { $page_1_passed = false; $error = ""; } if ($page_1_passed == false) { $template = new HTMLTemplate("equipment/admin/equipment_cat/edit.html"); $paramquery = $_GET; $paramquery['nextpage'] = "1"; $params = http_build_query($paramquery, '', '&'); $template->set_var("params", $params); if ($error) { $template->set_var("error", $error); } else { $template->set_var("error", ""); } if ($_POST['name']) { $template->set_var("name", $_POST['name']); } else { $template->set_var("name", $equipment_cat->get_name()); } $template->output(); } else { $paramquery = $_GET; unset($paramquery['nextpage']); unset($paramquery['action']); $params = http_build_query($paramquery); if ($equipment_cat->set_name($_POST['name'])) { Common_IO::step_proceed($params, "Edit Equipment Category", "Operation Successful", null); } else { Common_IO::step_proceed($params, "Edit Equipment Category", "Operation Failed", null); } } } else { throw new EquipmentCategoryIDMissingException(); } }
/** * @throws ProjectStatusIDMissingException */ public static function edit() { if ($_GET['id']) { $project_status = new ProjectStatus($_GET['id']); if ($_GET['nextpage'] == 1) { $page_1_passed = true; if (!$_POST['name']) { $page_1_passed = false; $error = "You must enter a name"; } } else { $page_1_passed = false; $error = ""; } if ($page_1_passed == false) { $template = new HTMLTemplate("project/admin/project_status/edit.html"); $paramquery = $_GET; $paramquery['nextpage'] = "1"; $params = http_build_query($paramquery, '', '&'); $template->set_var("params", $params); if ($error) { $template->set_var("error", $error); } else { $template->set_var("error", ""); } if ($_POST['name']) { $template->set_var("name", $_POST['name']); } else { $template->set_var("name", $project_status->get_name()); } $template->output(); } else { $paramquery = $_GET; unset($paramquery['nextpage']); unset($paramquery['action']); $params = http_build_query($paramquery); if ($project_status->set_name($_POST['name'])) { Common_IO::step_proceed($params, "Edit Project Status", "Operation Successful", null); } else { Common_IO::step_proceed($params, "Edit Project Status", "Operation Failed", null); } } } else { throw new ProjectStatusIDMissingException(); } }
/** * @throws OrganisationUnitIDMissingException */ public static function toogle_visible() { if ($_GET['id']) { $organisation_unit = new OrganisationUnit($_GET['id']); $paramquery = $_GET; unset($paramquery['action']); unset($paramquery['id']); $params = http_build_query($paramquery, '', '&'); if ($organisation_unit->get_hidden() == true) { $hidden = false; } else { $hidden = true; } if ($organisation_unit->set_hidden($hidden)) { Common_IO::step_proceed($params, "Upwards", "Operation Successful", null); } else { Common_IO::step_proceed($params, "Upwards", "Operation Failed", null); } } else { throw new OrganisationUnitIDMissingException(); } }
/** * @throws SampleTemplateIDMissingException */ public static function delete() { if ($_GET['id']) { if ($_GET['sure'] != "true") { $template = new HTMLTemplate("sample/admin/sample_template/delete.html"); $paramquery = $_GET; $paramquery['sure'] = "true"; $params = http_build_query($paramquery); $template->set_var("yes_params", $params); $paramquery = $_GET; unset($paramquery['sure']); unset($paramquery['action']); unset($paramquery['id']); $params = http_build_query($paramquery, '', '&'); $template->set_var("no_params", $params); $template->output(); } else { $paramquery = $_GET; unset($paramquery['sure']); unset($paramquery['action']); unset($paramquery['id']); $params = http_build_query($paramquery, '', '&'); $sample_template = new SampleTemplate($_GET['id']); if ($sample_template->delete()) { Common_IO::step_proceed($params, "Delete Sample Template", "Operation Successful", null); } else { Common_IO::step_proceed($params, "Delete Sample Template", "Operation Failed", null); } } } else { throw new SampleTemplateIDMissingException(); } }
/** * @throws BaseModuleNavigationIDMissingException */ public static function downwards() { if ($_GET['id']) { $module_navigation = new ModuleNavigation($_GET['id']); $paramquery = $_GET; unset($paramquery['action']); unset($paramquery['id']); $params = http_build_query($paramquery, '', '&'); if ($module_navigation->downwards()) { Common_IO::step_proceed($params, "Downwards", "Operation Successful", null); } else { Common_IO::step_proceed($params, "Downwards", "Operation Failed", null); } } else { throw new BaseModuleNavigationIDMissingException(); } }
/** * @throws ProjectTaskIDMissingException * @throws ProjectSecuriyAccessDeniedException */ public static function edit_end() { global $project_security; if ($_GET['id']) { if ($project_security->is_access(3, false) == true) { $project_task = new ProjectTask($_GET['id']); if (!$_GET['nextpage']) { $template = new HTMLTemplate("project/tasks/edit_end.html"); $paramquery = $_GET; $paramquery['nextpage'] = "1"; $params = http_build_query($paramquery, '', '&'); $template->set_var("params", $params); if ($_POST['enddate']) { $template->set_var("enddate", $_POST['enddate']); } else { $template->set_var("enddate", $project_task->get_end_date()); } if ($project_task->get_uf_end_time() != -1) { $time = explode(":", $project_task->get_uf_end_time()); if ($_POST['wholeday'] == 1) { $template->set_var("whole_day_checked", "checked"); } else { $template->set_var("whole_day_checked", ""); } if ($_POST['time1']) { $template->set_var("time1", $_POST['time1']); } else { $template->set_var("time1", $time[0]); } if ($_POST['time2']) { $template->set_var("time2", $_POST['time2']); } else { $template->set_var("time2", $time[1]); } } else { if ($_POST['wholeday'] == 1 or !$_POST['wholeday']) { $template->set_var("whole_day_checked", "checked"); } else { $template->set_var("whole_day_checked", ""); } if ($_POST['time1']) { $template->set_var("time1", $_POST['time1']); } else { $template->set_var("time1", ""); } if ($_POST['time2']) { $template->set_var("time2", $_POST['time2']); } else { $template->set_var("time2", ""); } } $template->set_var("error0", ""); $template->set_var("error1", ""); $template->output(); } else { $paramquery = $_GET; unset($paramquery['nextpage']); $paramquery['run'] = "task_detail"; $params = http_build_query($paramquery, '', '&'); if ($_POST['wholeday'] == 1) { $time = null; $whole_day = true; } else { $time = $_POST['time1'] . ":" . $_POST['time2'] . ":00"; $whole_day = false; } if ($project_task->set_end($_POST['enddate'], $time, $whole_day)) { Common_IO::step_proceed($params, "Change End Date/Time", "Operation Successful", null); } else { Common_IO::step_proceed($params, "Change End Date/Time", "Operation Failed", null); } } } else { throw new ProjectSecuriyAccessDeniedException(); } } else { throw new ProjectTaskIDMissingException(); } }
/** * @throws UserIDMissingException */ public static function change_quota() { if ($_GET['id']) { $user = new User($_GET['id']); $user_data = new DataUserData($_GET['id']); if ($_GET['nextpage'] == 1) { if (is_numeric($_POST['quota'])) { $page_1_passed = true; } else { $page_1_passed = false; $error = "You must enter a valid quota."; } } elseif ($_GET['nextpage'] > 1) { $page_1_passed = true; } else { $page_1_passed = false; $error = ""; } if ($page_1_passed == false) { $template = new HTMLTemplate("data/admin/user/change_user_quota.html"); $paramquery = $_GET; $paramquery['nextpage'] = "1"; $params = http_build_query($paramquery, '', '&'); $template->set_var("params", $params); $template->set_var("error", $error); if ($_POST['quota']) { $template->set_var("mail", $_POST['quota']); } else { $template->set_var("quota", $user_data->get_quota()); } $template->output(); } else { if ($_GET['retrace']) { $params = http_build_query(Retrace::resolve_retrace_string($_GET['retrace']), '', '&'); } else { $paramquery['username'] = $_GET['username']; $paramquery['session_id'] = $_GET['session_id']; $paramquery['nav'] = "home"; $params = http_build_query($paramquery, '', '&'); } if ($user_data->set_quota($_POST['quota'])) { Common_IO::step_proceed($params, "Change User Quota", "Operation Successful", null); } else { Common_IO::step_proceed($params, "Change User Quota", "Operation Failed", null); } } } else { throw new UserIDMissingException(); } }
/** * @throws UserIDMissingException */ public static function change_timezone() { if ($_GET['id']) { $user = new User($_GET['id']); $regional = new Regional($_GET['id']); if ($_GET['nextpage'] == 1) { $page_1_passed = true; } else { $page_1_passed = false; } if ($page_1_passed == false) { $template = new HTMLTemplate("base/user/admin/user/change_timezone.html"); $paramquery = $_GET; $paramquery['nextpage'] = "1"; $params = http_build_query($paramquery, '', '&'); $template->set_var("params", $params); $timezone_array = Timezone::list_timezones(); $result = array(); $counter = 0; if (is_array($timezone_array)) { foreach ($timezone_array as $key => $value) { $timezone = new Timezone($value); $result[$counter]['value'] = $value; $result[$counter]['content'] = $timezone->get_name(); if ($value == $regional->get_timezone_id()) { $result[$counter]['selected'] = "selected='selected'"; } else { $result[$counter]['selected'] = ""; } $counter++; } } $template->set_var("option", $result); $template->output(); } else { $paramquery = $_GET; $paramquery['action'] = "detail"; unset($paramquery['nextpage']); $params = http_build_query($paramquery, '', '&'); if ($user->set_timezone_id($_POST['timezone'])) { Common_IO::step_proceed($params, "Change Timezone", "Operation Successful", null); } else { Common_IO::step_proceed($params, "Change Timezone", "Operation Failed", null); } } } else { throw new UserIDMissingException(); } }
public static function change_password_on_login() { global $user; $no_error = false; if ($_GET['nextpage'] == 1) { $no_error = true; if (!$_POST['new_password_1']) { $no_error = false; $error[1] = "<br /><span class='formError'>this field cannot be empty</span>"; } else { $error[1] = ""; } if (!$_POST['new_password_2']) { $no_error = false; $error[2] = "<br /><span class='formError'>this field cannot be empty</span>"; } else { $error[2] = ""; } if ($_POST['new_password_1'] and $_POST['new_password_2'] and $_POST['new_password_1'] != $_POST['new_password_2']) { $no_error = false; $error[2] = "<br /><span class='formError'>the new passwords are not equal</span>"; } elseif (!$error[2]) { $error[2] = ""; } } else { $error[0] = ""; $error[1] = ""; $error[2] = ""; } if ($no_error == true) { $paramquery = array(); $paramquery['username'] = $_GET['username']; $paramquery['session_id'] = $_GET['session_id']; $params = http_build_query($paramquery); if ($user->set_password_on_login($_POST['new_password_1'])) { Common_IO::step_proceed($params, "Change Password Succesful", "Password Changed", null); } else { Common_IO::step_proceed($params, "Change Password Failed", "Password Changed", null); } } else { $template = new HTMLTemplate("base/user/user_change_password_on_login.html"); $paramquery = $_GET; $paramquery['nextpage'] = 1; $params = http_build_query($paramquery); $template->set_var("params", $params); $template->set_var("error_0", $error[0]); $template->set_var("error_1", $error[1]); $template->set_var("error_2", $error[2]); $template->output(); } }
/** * @throws EquipmentTypeIDMissingException */ public static function change_location() { if ($_GET['id']) { if ($_GET['nextpage'] == 1) { $page_1_passed = true; } else { $page_1_passed = false; } if ($page_1_passed == false) { $template = new HTMLTemplate("equipment/admin/equipment_type/change_location.html"); $paramquery = $_GET; $paramquery['nextpage'] = "1"; $params = http_build_query($paramquery, '', '&'); $template->set_var("params", $params); $location_array = Location::list_entries(); $result = array(); $counter = 1; $location = new Location($value); $result[0]['value'] = 0; $result[0]['content'] = "none"; foreach ($location_array as $key => $value) { $location = new Location($value); $result[$counter]['value'] = $value; $result[$counter]['content'] = $location->get_name(true); $counter++; } $template->set_var("option", $result); $template->output(); } else { $equipment_type = new EquipmentType($_GET['id']); $paramquery = $_GET; $paramquery['action'] = "detail"; unset($paramquery['nextpage']); $params = http_build_query($paramquery, '', '&'); if ($equipment_type->set_location_id($_POST['location'])) { Common_IO::step_proceed($params, "Equipment Type", "Operation Successful", null); } else { Common_IO::step_proceed($params, "Equipment Type", "Operation Failed", null); } } } else { throw new EquipmentTypeIDMissingException(); } }
/** * @throws SampleIDMissingException * @throws SampleSecurityAccessDeniedException */ public static function set_availability() { global $sample_security; if ($_GET['sample_id']) { if ($sample_security->is_access(2, false)) { if ($_GET['sure'] != "true") { $template = new HTMLTemplate("sample/set_availability.html"); $paramquery = $_GET; $paramquery['sure'] = "true"; $params = http_build_query($paramquery); $template->set_var("yes_params", $params); $paramquery = $_GET; unset($paramquery['nextpage']); unset($paramquery['id']); $paramquery['run'] = "admin_permission"; $params = http_build_query($paramquery); $template->set_var("no_params", $params); $template->output(); } else { $sample = new Sample($_GET['sample_id']); $paramquery = $_GET; unset($paramquery['nextpage']); unset($paramquery['sure']); $paramquery['run'] = "detail"; $params = http_build_query($paramquery); if ($sample->get_availability() == true) { if ($sample->set_availability(false)) { Common_IO::step_proceed($params, "Delete Permission", "Operation Successful", null); } else { Common_IO::step_proceed($params, "Delete Permission", "Operation Failed", null); } } else { if ($sample->set_availability(true)) { Common_IO::step_proceed($params, "Delete Permission", "Operation Successful", null); } else { Common_IO::step_proceed($params, "Delete Permission", "Operation Failed", null); } } } } else { throw new SampleSecurityAccessDeniedException(); } } else { throw new SampleIDMissingException(); } }
/** * @throws SampleIDMissingException * @throws SampleSecurityAccessDeniedException * @throws SamplePermissionOrganisationUnitIDMissingException */ public static function ou_permission_delete() { global $user; if ($_GET['sample_id']) { if ($_GET['id']) { $sample_id = $_GET['sample_id']; $sample = new Sample($sample_id); $sample_security = new SampleSecurity($sample_id); if ($sample->get_owner_id() == $user->get_user_id() or $user->is_admin() == true) { if ($_GET['sure'] != "true") { $template = new HTMLTemplate("sample/int_admin/ou_permission_delete.html"); $paramquery = $_GET; $paramquery['sure'] = "true"; $params = http_build_query($paramquery); $template->set_var("yes_params", $params); $paramquery = $_GET; unset($paramquery['nextpage']); unset($paramquery['sure']); $paramquery['nav'] = "sample"; $paramquery['run'] = "admin_permission_ou"; $params = http_build_query($paramquery); $template->set_var("no_params", $params); $template->output(); } else { $paramquery = $_GET; unset($paramquery['nextpage']); unset($paramquery['sure']); $paramquery['nav'] = "sample"; $paramquery['run'] = "admin_permission_ou"; $params = http_build_query($paramquery); $entry_id = $sample_security->get_entry_by_organisation_unit_id($_GET['id']); if ($sample_security->delete_organisation_unit($entry_id)) { Common_IO::step_proceed($params, "Delete Sample", "Operation Successful", null); } else { Common_IO::step_proceed($params, "Delete Sample", "Operation Failed", null); } } } else { throw new SampleSecurityAccessDeniedException(); } } else { throw new SamplePermissionOrganisationUnitIDMissingException(); } } else { throw new SampleIDMissingException(); } }