Esempio n. 1
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) {