delete_contact_notification_command($_GET['contact_notification_command_id']); $success = "Command Deleted"; unset($_GET['command_id']); unset($tempData); } else if($_GET['request'] == "delete" && $_GET['section'] == 'groups') { $lilac->get_contact_membership_list($_GET['contact_id'], $tempGroupList); $numOfGroups = count($tempGroupList); if($numOfGroups > 1) { $c = new Criteria(); $c->add(NagiosContactGroupMemberPeer::CONTACT, $_GET['contact_id']); $c->add(NagiosContactGroupMemberPeer::CONTACTGROUP, $_GET['contactgroup_id']); $membership = NagiosContactGroupMemberPeer::doSelectOne($c); if($membership) { $membership->delete(); $success = "Membership Deleted."; } } else { $error = "There must be at least one contact group!"; } } else if($_GET['request'] == "delete" && $_GET['section'] == 'general') { $lilac->get_contact_list($tempList); $numOfContacts = count($tempList); if($numOfContacts > 1) { $lilac->delete_contact($_GET['contact_id']); $success = "Contact deleted."; unset($tempData); unset($_GET['contact_id']); } else { $error = "There must be at least one contact in the system."; } } else if($_GET['request'] == "delete" && $_GET['section'] == 'addresses') { // !!!!!!!!!!!!!! This is where we do dependency error checking $lilac->delete_contact_address($_GET['contactaddress_id']); $success = "Contact address deleted."; unset($tempData); } } if(isset($_POST['request'])) { // Load Up The Session Data if(count($_POST['contact_manage'])) { foreach($_POST['contact_manage'] as $key=>$value) { $tempData[$key] = $value; } } if($_POST['request'] == 'add_contact') { // Error check! if(count($tempData)) { foreach($tempData as $tempVariable) $tempVariable = trim($tempVariable); } // We have checkboxes, let's verify the data against POST if(!isset($_POST['contact_manage']['host_notification_options_down'])) $tempData['host_notification_options_down'] = 0; if(!isset($_POST['contact_manage']['host_notification_options_unreachable'])) $tempData['host_notification_options_unreachable'] = 0; if(!isset($_POST['contact_manage']['host_notification_options_recovery'])) $tempData['host_notification_options_recovery'] = 0; if(!isset($_POST['contact_manage']['host_notification_options_flapping'])) $tempData['host_notification_options_flapping'] = 0; if(!isset($_POST['contact_manage']['host_notification_options_scheduled_downtime'])) $tempData['host_notification_options_scheduled_downtime'] = 0; if(!isset($_POST['contact_manage']['service_notification_options_warning'])) $tempData['service_notification_options_warning'] = 0; if(!isset($_POST['contact_manage']['service_notification_options_unknown'])) $tempData['service_notification_options_unknown'] = 0; if(!isset($_POST['contact_manage']['service_notification_options_critical'])) $tempData['service_notification_options_critical'] = 0; if(!isset($_POST['contact_manage']['service_notification_options_recovery'])) $tempData['service_notification_options_recovery'] = 0; if(!isset($_POST['contact_manage']['service_notification_options_flapping'])) $tempData['service_notification_options_flapping'] = 0; if(!isset($_POST['contact_manage']['can_submit_commands'])) $tempData['can_submit_commands'] = 0; if(!isset($_POST['contact_manage']['retain_status_information'])) $tempData['retain_status_information'] = 0; if(!isset($_POST['contact_manage']['retain_nonstatus_information'])) $tempData['retain_nonstatus_information'] = 0; if(!isset($_POST['contact_manage']['host_notifications_enabled'])) $tempData['host_notifications_enabled'] = 0; if(!isset($_POST['contact_manage']['service_notifications_enabled'])) $tempData['service_notifications_enabled'] = 0; // Field Error Checking if($tempData['contact_name'] == '' || $tempData['alias'] == '') { $addError = 1; $error = "Fields shown are required and cannot be left blank."; } else { // Check for pre-existing contact with same name if($lilac->contact_exists($tempData['contact_name'])) { $error = "A contact with that name already exists!"; } else { $tempContactGroup = $tempData['contact_group']; unset($tempData['contact_group']); // All is well for error checking, add the contact into the db. $contact = $lilac->add_contact($tempData); $success = "Contact added"; if( $tempContactGroup && $tempContactGroup != 0) { $contactGroup = NagiosContactGroupPeer::retrieveByPK($tempContactGroup); if($contactGroup && $contact) { $contactGroupMember = new NagiosContactGroupMember(); $contactGroupMember->setContact($contact->getId()); $contactGroupMember->setContactgroup($contactGroup->getId()); $contactGroupMember->save(); } } unset($_GET['contact_add']); } } } else if($_POST['request'] == 'modify_contact') { // Error check! if(count($tempData)) { foreach($tempData as $tempVariable) $tempVariable = trim($tempVariable); } // We have checkboxes, let's verify the data against POST if(!isset($_POST['contact_manage']['host_notification_options_down'])) $tempData['host_notification_options_down'] = 0; if(!isset($_POST['contact_manage']['host_notification_options_unreachable'])) $tempData['host_notification_options_unreachable'] = 0; if(!isset($_POST['contact_manage']['host_notification_options_recovery'])) $tempData['host_notification_options_recovery'] = 0; if(!isset($_POST['contact_manage']['host_notification_options_flapping'])) $tempData['host_notification_options_flapping'] = 0; if(!isset($_POST['contact_manage']['host_notification_options_scheduled_downtime'])) $tempData['host_notification_options_scheduled_downtime'] = 0; if(!isset($_POST['contact_manage']['service_notification_options_warning'])) $tempData['service_notification_options_warning'] = 0; if(!isset($_POST['contact_manage']['service_notification_options_unknown'])) $tempData['service_notification_options_unknown'] = 0; if(!isset($_POST['contact_manage']['service_notification_options_critical'])) $tempData['service_notification_options_critical'] = 0; if(!isset($_POST['contact_manage']['service_notification_options_recovery'])) $tempData['service_notification_options_recovery'] = 0; if(!isset($_POST['contact_manage']['service_notification_options_flapping'])) $tempData['service_notification_options_flapping'] = 0; if(!isset($_POST['contact_manage']['can_submit_commands'])) $tempData['can_submit_commands'] = 0; if(!isset($_POST['contact_manage']['retain_status_information'])) $tempData['retain_status_information'] = 0; if(!isset($_POST['contact_manage']['retain_nonstatus_information'])) $tempData['retain_nonstatus_information'] = 0; if(!isset($_POST['contact_manage']['host_notifications_enabled'])) $tempData['host_notifications_enabled'] = 0; if(!isset($_POST['contact_manage']['service_notifications_enabled'])) $tempData['service_notifications_enabled'] = 0; // Field Error Checking if($tempData['contact_name'] == '' || $tempData['alias'] == '') { $addError = 1; $error = "Fields shown are required and cannot be left blank."; } else { if($tempData['contact_name'] != $tempContactInfo->getName() && $lilac->contact_exists($tempData['contact_name'])) { $error = "A contact with that name already exists!"; } else { // All is well for error checking, modify the contact. $lilac->modify_contact($_POST['contact_id'], $tempData); // Remove session data unset($tempData); $success = "Contact modified."; unset($_GET['edit']); } $_GET['section'] = "general"; } } else if($_POST['request'] == 'add_notification_command') { if($lilac->contact_has_notification_command($_GET['contact_id'], $tempData['notification_add'])) { $error = "That notification command already exists in that list!"; unset($tempData); } else { $lilac->add_contacts_notification_command($_GET['contact_id'], $tempData['notification_add']); $success = "Notification Command added."; unset($tempData); } } else if($_POST['request'] == 'add_member_command') { if($lilac->contactgroup_has_member($tempData['group_add']['contactgroup_id'], $_GET['contact_id'])) { $error = "That member already exists in that list!"; unset($tempData); } else { $lilac->add_contactgroup_member($tempData['group_add']['contactgroup_id'], $_GET['contact_id']); $success = "New Group membership added."; unset($tempData); } } else if($_POST['request'] == 'contact_address_add') { // All is well for error checking, modify the contact. $lilac->add_contact_address($_GET['contact_id'], $tempData); // Remove session data unset($tempData); $success = "Contact Address added."; } } if(isset($_GET['contact_id'])) { $tempContactInfo = NagiosContactPeer::retrieveByPK($_GET['contact_id']); if(!$tempContactInfo) { header("Location: welcome.php"); } } $lilac->get_contact_list($contact_list); $numOfContacts = count($contact_list); $lilac->return_period_list($tempList); $period_list = array(); foreach($tempList as $tempPeriod) { $period_list[] = array("timeperiod_id" => $tempPeriod->getId(), "timeperiod_name" => $tempPeriod->getName()); } print_header("Contact Editor"); ?> 'General', 'notification' => 'Notification Commands', 'groups' => 'Group Membership', 'addresses' => 'Addresses' ); // PLACEHOLDER TO PUT CONTACT INFO print_window_header("Contact Info for " . $tempContactInfo->getName(), "100%"); print_subnav($subnav, $_GET['section'], "section", $_SERVER['PHP_SELF'] . "?contact_id=" . $tempContactInfo->getId()); if($_GET['section'] == 'general') { ?>
Contact Name: getName();?> Description: getAlias();?> Email: getEmail();?> Pager: getPager();?> Can Submit Commands:getCanSubmitCommands()) ? "Yes" : "No";?> Retain Status Information:getRetainStatusInformation()) ? "Yes" : "No";?> Retain Non-Status Information:getRetainNonstatusInformation()) ? "Yes" : "No";?> Host Notifications Enabled:getHostNotificationsEnabled()) ? "Yes" : "No";?> Service Notifications Enabled:getServiceNotificationsEnabled()) ? "Yes" : "No";?> Host Notification Period: return_period_name($tempContactInfo->getHostNotificationPeriod());?> Service Notification Period: return_period_name($tempContactInfo->getServiceNotificationPeriod());?> Host Notification On: getHostNotificationOnDown() && !$tempContactInfo->getHostNotificationOnUnreachable() && !$tempContactInfo->getHostNotificationOnRecovery() && !$tempContactInfo->getHostNotificationOnFlapping() && !$tempContactInfo->getHostNotificationOnScheduledDowntime()) { print("None"); } else { if($tempContactInfo->getHostNotificationOnDown()) { print("Down"); if($tempContactInfo->getHostNotificationOnUnreachable() || $tempContactInfo->getHostNotificationOnRecovery() || $tempContactInfo->getHostNotificationOnFlapping() || $tempContactInfo->getHostNotificationOnScheduledDowntime()) print(","); } if($tempContactInfo->getHostNotificationOnUnreachable()) { print("Unreachable"); if($tempContactInfo->getHostNotificationOnRecovery() || $tempContactInfo->getHostNotificationOnFlapping() || $tempContactInfo->getHostNotificationOnScheduledDowntime()) print(","); } if($tempContactInfo->getHostNotificationOnRecovery()) { print("Recovery"); if($tempContactInfo->getHostNotificationOnFlapping() || $tempContactInfo->getHostNotificationOnScheduledDowntime()) print(","); } if($tempContactInfo->getHostNotificationOnFlapping()) { print("Flapping"); if($tempContactInfo->getHostNotificationOnScheduledDowntime()) print(","); } if($tempContactInfo->getHostNotificationOnScheduledDowntime()) { print("Scheduled Downtime"); } } ?> Service Notification On: getServiceNotificationOnWarning() && !$tempContactInfo->getServiceNotificationOnUnknown() && !$tempContactInfo->getServiceNotificationOnCritical() && !$tempContactInfo->getServiceNotificationOnRecovery()) print("None"); else { if($tempContactInfo->getServiceNotificationOnWarning()) { print("Warning"); if($tempContactInfo->getServiceNotificationOnUnknown() || $tempContactInfo->getServiceNotificationOnCritical() || $tempContactInfo->getServiceNotificationOnRecovery()) print(","); } if($tempContactInfo->getServiceNotificationOnUnknown()) { print("Unknown"); if($tempContactInfo->getServiceNotificationOnCritical() || $tempContactInfo->getServiceNotificationOnRecovery()) print(","); } if($tempContactInfo->getServiceNotificationOnCritical()) { print("Critical"); if($tempContactInfo->getServiceNotificationOnRecovery() || $tempContactInfo->getServiceNotificationOnFlapping()) print(","); } if($tempContactInfo->getServiceNotificationOnRecovery()) { print("Recovery"); if($tempContactInfo->getServiceNotificationOnFlapping()) print(","); } if($tempContactInfo->getServiceNotificationOnFlapping()) { print("Flapping"); } } ?> [ Edit ] |
|
|
|
Contact Name | Description |
getName();?> | getAlias();?> |