} catch (Horde_Exception $e) {
$notification->push($e);
Horde::url('search.php', true)->redirect();
}
/* We create the vbook and redirect before we try to search
* since we are not displaying the search results on this page
* anyway. */
$vname = $vars->vbook_name;
if (empty($vname)) {
$notification->push(_("You must provide a name for virtual address books."), 'horde.error');
Horde::url('search.php', true)->redirect();
}
/* Create the vbook. */
$params = array('name' => $vname, 'params' => serialize(array('type' => 'vbook', 'source' => $source, 'criteria' => $criteria)));
try {
$share = Turba::createShare(strval(new Horde_Support_Randomid()), $params);
$vid = $share->getName();
} catch (Horde_Share_Exception $e) {
$notification->push(sprintf(_("There was a problem creating the virtual address book: %s"), $e->getMessage()), 'horde.error');
Horde::url('search.php', true)->redirect();
}
$notification->push(sprintf(_("Successfully created virtual address book \"%s\""), $vname), 'horde.success');
Horde::url('browse.php', true)->add('source', $vid)->redirect();
}
/* Perform a search. */
if ($search_mode == 'duplicate') {
try {
$duplicates = $driver->searchDuplicates();
$view = new Turba_View_Duplicates($duplicates, $driver, $vars->type, $vars->dupe);
$page_output->addScriptFile('tables.js', 'horde');
} catch (Exception $e) {