//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(); $GO_HEADER['head'] = $datepicker->get_header(); //save switch ($task) { case 'save_company':
$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); exit; } } } break; case 'export': if ($_REQUEST['filetype'] == 'xls') { $addressbook = $ab->get_addressbook($addressbook_id); require $GO_CONFIG->class_path . "/phpvnconv/phpvnconv.class.inc"; $vnconv = new phpVnconv(); ini_set('include_path', ini_get('include_path') . ':' . $GO_CONFIG->class_path . 'pear/usr/lib/php'); require_once "Spreadsheet/Excel/Writer.php";
$ab->set_default_addressbook($GO_SECURITY->user_id, $_POST['default_addressbook_id']); $post_action = 'addressbooks'; break; } } $addressbook_id = isset($_REQUEST['addressbook_id']) ? $_REQUEST['addressbook_id'] : $ab->get_default_addressbook($GO_SECURITY->user_id); $is_treeview = isset($_REQUEST['treeview']) ? $_REQUEST['treeview'] : '0'; if (!$addressbook_id) { $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++; } $addressbook_id = $ab->add_addressbook($GO_SECURITY->user_id, addslashes($new_ab_name)); } $addressbook = $ab->get_addressbook($addressbook_id); $page_title = $lang_modules['contacts']; require $GO_THEME->theme_path . "header.inc"; ?> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td class="ModuleIcons"> <a class= <?php if (!isset($found) && $post_action == 'browse') { echo '"bold_small" '; $found = true; } else { echo '"small" ';