Пример #1
0
    } else {
        $existing_group = $ab->get_group_by_name($addressbook_id, $name);
        if ($group_id > 0) {
            if (!$existing_group) {
                $ab->change_group_name($group_id, $name);
                header('Location: ' . $return_to);
                exit;
            } else {
                if ($existing_group['id'] != $group_id) {
                    $feedback = "<p class=\"Error\">" . $ab_group_exists . "</p>";
                }
            }
        } else {
            if ($existing_group) {
                $feedback = "<p class=\"Error\">" . $ab_group_exists . "</p>";
            } elseif (!$ab->add_group($_POST['addressbook_id'], $name)) {
                $feedback = "<p class=\"Error\">" . $strSaveError . "</p>";
            } else {
                header('Location: ' . $return_to);
                exit;
            }
        }
    }
}
if ($group_id > 0 && ($group = $ab->get_group($group_id))) {
    $name = $group['name'];
    //create a tabbed window
    $tabtable = new tabtable('group', $contacts_group, '400', '120', '120', '', true);
} else {
    $tabtable = new tabtable('group', $ab_new_group, '400', '120', '120', '', true);
    $name = isset($_REQUEST['name']) ? smart_strip($_REQUEST['name']) : '';
Пример #2
0
 while (!feof($fp)) {
     $record = fgetcsv($fp, 4096, ',', '"');
     if (is_array($record)) {
         foreach ($record as $i => $j) {
             $record[$i] = $vnconv->vnconv($record[$i]);
         }
     }
     if ($_POST['import_type'] == 'contacts') {
         if (isset($record[$_POST['first_name']]) && $record[$_POST['first_name']] != "" || isset($record[$_POST['last_name']]) && $record[$_POST['last_name']] != '') {
             if ($group_mode == 'file') {
                 $group_name = trim($record[$_POST['group_record']]);
                 if (isset($contact_groups[stripslashes($group_name)])) {
                     $group_id = $contact_groups[$group_name];
                 } else {
                     $ab2 = new addressbook();
                     $group_id = $ab2->add_group($_POST['addressbook_id'], $group_name);
                     $contact_groups[$group_name] = $group_id;
                 }
             }
             $title = isset($record[$_POST['title']]) ? addslashes(trim($record[$_POST['title']])) : '';
             $first_name = isset($record[$_POST['first_name']]) ? addslashes(trim($record[$_POST['first_name']])) : '';
             $middle_name = isset($record[$_POST['middle_name']]) ? addslashes(trim($record[$_POST['middle_name']])) : '';
             $last_name = isset($record[$_POST['last_name']]) ? addslashes(trim($record[$_POST['last_name']])) : '';
             $initials = isset($record[$_POST['initials']]) ? addslashes(trim($record[$_POST['initials']])) : '';
             $sex = isset($record[$_POST['sex']]) ? addslashes(trim($record[$_POST['sex']])) : 'M';
             $birthday = isset($record[$_POST['birthday']]) ? addslashes(trim($record[$_POST['birthday']])) : '';
             $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];
             }
             $work_phone = isset($record[$_POST['work_phone']]) ? addslashes(trim($record[$_POST['work_phone']])) : '';