$email = $matches[0]; } $phone = isset($record[$_POST['phone']]) ? addslashes(trim($record[$_POST['phone']])) : ''; $fax = isset($record[$_POST['fax']]) ? addslashes(trim($record[$_POST['fax']])) : ''; $country = isset($record[$_POST['country']]) ? addslashes(trim($record[$_POST['country']])) : ''; $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']])) : ''; $homepage = isset($record[$_POST['homepage']]) ? addslashes(trim($record[$_POST['homepage']])) : ''; $bank_no = isset($record[$_POST['bank_no']]) ? addslashes(trim($record[$_POST['bank_no']])) : ''; $vat_no = isset($record[$_POST['vat_no']]) ? addslashes(trim($record[$_POST['vat_no']])) : ''; $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 ($ab->add_company($_POST['addressbook_id'], $GO_SECURITY->user_id, $name, '', '', '', $address, $zip, $city, $state, $country, $email, $phone, $fax, $homepage, $bank_no, $vat_no, $acl_read, $acl_write, 0)) { $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); } } } } } } fclose($fp); unlink($_POST['import_file']); echo $contacts_import_success; echo '<br /><br />';
$city = smart_addslashes($_POST["city"]); $zip = smart_addslashes($_POST["zip"]); $address = smart_addslashes($_POST["address"]); $department = smart_addslashes($_POST["department"]); $function = smart_addslashes($_POST["function"]); $comment = smart_addslashes($_POST["comment"]); if ($first_name == '' && $last_name == '') { $feedback = "<p class=\"Error\">" . $error_missing_field . "</p>"; } else { $company_name = isset($_POST['company_name']) ? smart_addslashes(trim($_POST['company_name'])) : ''; if (isset($_POST['company_name']) && $company_name == '') { $company_id = 0; } elseif ($company_name != '' && !($new_company_id = $ab->get_company_id_by_name($company_name, $addressbook_id))) { $acl_read = $GO_SECURITY->get_new_acl('company read'); $acl_write = $GO_SECURITY->get_new_acl('company write'); if ($acl_read > 0 && $acl_write > 0 && ($company_id = $ab->add_company($addressbook_id, $GO_SECURITY->user_id, $company_name, '', '', '', '', '', '', '', '', '', '', '', '', '', '', $acl_read, $acl_write, 0))) { 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); } } else { $GO_SECURITY->delete_acl($acl_read); $GO_SECURITY->delete_acl($acl_write); $feedback = "<p class=\"Error\">" . $strSaveError . "</p>"; } } elseif (isset($new_company_id) && $new_company_id != $company_id) { $company_id = $new_company_id; } //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 ($parent != 0) { $feedback = "<p class=\"Error\">" . $strParentCompanyError . "</p>"; } else { if ($ab->update_company($_POST['company_id'], $addressbook_id, $name, $shortname, $engname, $relation_date, $address, $zip, $city, $state, $country, $email, $phone, $fax, $homepage, $bank_no, $vat_no, $parent_id)) { if ($_POST['close'] == 'true') { header('Location: ' . $return_to); exit; } } else { $feedback = "<p class=\"Error\">" . $strSaveError . "</p>"; } } } else { $acl_read = $GO_SECURITY->get_new_acl('company read'); $acl_write = $GO_SECURITY->get_new_acl('company write'); if ($company_id = $ab->add_company($addressbook_id, $GO_SECURITY->user_id, $name, $shortname, $engname, $relation_date, $address, $zip, $city, $state, $country, $email, $phone, $fax, $homepage, $bank_no, $vat_no, $acl_read, $acl_write, $parent_id)) { 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); } /* 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>";