示例#1
0
 //translate the given birthdayto gmt unix time
 $birthday = date_to_db_date($_POST['birthday']);
 $group_id = isset($_POST['group_id']) ? $_POST['group_id'] : '0';
 if ($_POST['contact_id'] > 0) {
     if ($ab->update_contact($_POST['contact_id'], $_POST['addressbook_id'], $first_name, $middle_name, $last_name, $initials, $title, $_POST['sex'], $birthday, $email, $work_phone, $home_phone, $fax, $cellular, $country, $state, $city, $zip, $address, $company_id, $work_fax, $department, $function, $comment, $group_id, $_POST['color'])) {
         if ($_POST['close'] == 'true') {
             header('Location: ' . $return_to);
             exit;
         }
     } else {
         $feedback = "<p class=\"Error\">" . $strSaveError . "</p>";
     }
 } else {
     $acl_read = $GO_SECURITY->get_new_acl('contact read');
     $acl_write = $GO_SECURITY->get_new_acl('contact write');
     if ($acl_read > 0 && $acl_write > 0 && ($contact_id = $ab->add_contact($_POST['source_id'], $GO_SECURITY->user_id, $_POST['addressbook_id'], $first_name, $middle_name, $last_name, $_POST['initials'], $_POST['title'], $_POST['sex'], $birthday, $email, $work_phone, $home_phone, $fax, $cellular, $country, $state, $city, $zip, $address, $company_id, $work_fax, $department, $function, $comment, $group_id, $_POST['color'], $acl_read, $acl_write))) {
         if ($addressbook = $ab->get_addressbook($addressbook_id)) {
             $GO_SECURITY->copy_acl($addressbook['acl_read'], $acl_read);
             $GO_SECURITY->copy_acl($addressbook['acl_write'], $acl_write);
         }
         $link_back .= '&contact_id=' . $contact_id;
         if ($_POST['close'] == 'true') {
             header('Location: ' . $return_to);
             exit;
         }
     } else {
         $GO_SECURITY->delete_acl($acl_read);
         $GO_SECURITY->delete_acl($acl_write);
         $feedback = "<p class=\"Error\">" . $strSaveError . "</p>";
     }
 }
示例#2
0
         $state = isset($record[$_POST['state']]) ? addslashes(trim($record[$_POST['state']])) : '';
         $city = isset($record[$_POST['city']]) ? addslashes(trim($record[$_POST['city']])) : '';
         $zip = isset($record[$_POST['zip']]) ? addslashes(trim($record[$_POST['zip']])) : '';
         $address = isset($record[$_POST['address']]) ? addslashes(trim($record[$_POST['address']])) : '';
         $company_name = isset($record[$_POST['company_name']]) ? addslashes(trim($record[$_POST['company_name']])) : '';
         $department = isset($record[$_POST['department']]) ? addslashes(trim($record[$_POST['department']])) : '';
         $function = isset($record[$_POST['function']]) ? addslashes(trim($record[$_POST['function']])) : '';
         $acl_read = $GO_SECURITY->get_new_acl('contact read');
         $acl_write = $GO_SECURITY->get_new_acl('contact write');
         if ($acl_read > 0 && $acl_write > 0) {
             if ($company_name != '') {
                 $company_id = $ab->get_company_id_by_name($company_name, $_POST['addressbook_id']);
             } else {
                 $company_id = 0;
             }
             if ($ab->add_contact("", $GO_SECURITY->user_id, $_POST['addressbook_id'], $first_name, $middle_name, $last_name, $initials, $title, $sex, $birthday, $email, $work_phone, $home_phone, $fax, $cellular, $country, $state, $city, $zip, $address, $company_id, $work_fax, $department, $function, '', $group_id, '', $acl_read, $acl_write)) {
                 $GO_SECURITY->copy_acl($addressbook['acl_read'], $acl_read);
                 $GO_SECURITY->copy_acl($addressbook['acl_write'], $acl_write);
             } else {
                 $GO_SECURITY->delete_acl($acl_read);
                 $GO_SECURITY->delete_acl($acl_write);
             }
         }
     }
 } else {
     if (isset($record[$_POST['name']]) && $record[$_POST['name']] != '') {
         $name = addslashes(trim($record[$_POST['name']]));
         if (!$ab->get_company_by_name($_POST['addressbook_id'], $name)) {
             $email = isset($record[$_POST['email']]) ? addslashes(trim($record[$_POST['email']])) : '';
             if (preg_match("/(\\b)([\\w\\.\\-]+)(@)([\\w\\.-]+)([A-Za-z]{2,4})\\b/i", $email, $matches)) {
                 $email = $matches[0];