Пример #1
0
             }
         }
         if ($ab->get_user_companies($GO_SECURITY->user_id, $addressbook_id) > 0) {
             while ($ab->next_record()) {
                 $GO_SECURITY->copy_acl($addressbook['acl_write'], $ab->f('acl_write'));
             }
         }
     }
     break;
 case 'save':
     $name = smart_addslashes(trim($_POST['name']));
     if ($name == '') {
         $feedback = '<p class="Error">' . $error_missing_field . '</p>';
     } else {
         if ($addressbook_id > 0) {
             $existing_addressbook = $ab->get_addressbook_by_name($name);
             if ($existing_addressbook && $existing_addressbook['id'] != $addressbook_id) {
                 $feedback = '<p class="Error">' . $ab_addressbook_exists . '</p>';
             } elseif (!$ab->update_addressbook($_POST['addressbook_id'], $name)) {
                 $feedback = '<p class="Error">' . $strSaveError . '</p>';
             } elseif ($_POST['close'] == 'true') {
                 header('Location: ' . $return_to);
                 exit;
             }
         } else {
             if ($ab->get_addressbook_by_name($name)) {
                 $feedback = '<p class="Error">' . $ab_addressbook_exists . '</p>';
             } elseif (!($addressbook_id = $ab->add_addressbook($GO_SECURITY->user_id, $name))) {
                 $feedback = '<p class="Error">' . $strSaveError . '</p>';
             } elseif ($_POST['close'] == 'true') {
                 header('Location: ' . $return_to);
Пример #2
0
        }
        $subscribed_addressbooks->add_value($ab->f('id'), $ab->f('name'));
    }
}
//get the given addressbook_id
if ($addressbook_id > 0) {
    $addressbook = $ab->get_addressbook($addressbook_id);
}
//if there was no or a read only addressbook given then change to the first writable
if (!isset($addressbook) || !$GO_SECURITY->has_permission($GO_SECURITY->user_id, $addressbook['acl_write'])) {
    //there is no writable addressbook so add one
    if (!isset($first_writable_ab)) {
        $ab_name = $_SESSION['GO_SESSION']['name'];
        $new_ab_name = $ab_name;
        $x = 1;
        while ($ab->get_addressbook_by_name($new_ab_name)) {
            $new_ab_name = $ab_name . ' (' . $x . ')';
            $x++;
        }
        $subscribed_addressbook_id = $ab->add_addressbook($GO_SECURITY->user_id, $new_ab_name);
        $subscribed_addressbooks->add_value($subscribed_addressbook_id, $new_ab_name);
    }
}
if ($addressbook_id > 0) {
    $subscribed_addressbook_id = $addressbook_id;
}
$old_subscribed_addressbook_id = $subscribed_addressbook_id;
if (isset($first_writable_ab) && (!isset($subscribed_addressbook_id) || $subscribed_addressbook_id == 0)) {
    $subscribed_addressbook_id = $first_writable_ab;
}
$datepicker = new date_picker();