diff --git a/addressbook/inc/class.boaddressbook.inc.php b/addressbook/inc/class.boaddressbook.inc.php index 0b0de05228..f179daa7d4 100644 --- a/addressbook/inc/class.boaddressbook.inc.php +++ b/addressbook/inc/class.boaddressbook.inc.php @@ -286,13 +286,11 @@ return array(0 => array('No access' => 'No access')); } - function add_vcard() + function add_vcard($uploadedfile='') { - global $uploadedfile; - if($uploadedfile == 'none' || $uploadedfile == '') { - Header('Location: ' . $GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.uivcard.in&action=GetFile')); + return False; } else { @@ -317,13 +315,15 @@ $entry['access'] = 'private'; $entry['tid'] = 'n'; /* _debug_array($entry);exit; */ + $this->so->add_entry($entry); $ab_id = $this->get_lastid(); /* Delete the temp file. */ unlink($filename); unlink($filename . '.info'); - Header('Location: ' . $GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.uiaddressbook.view&ab_id=' . $ab_id)); + + return (int)$ab_id; } } diff --git a/addressbook/inc/class.uivcard.inc.php b/addressbook/inc/class.uivcard.inc.php index 74d49c9a51..c9f902d17e 100644 --- a/addressbook/inc/class.uivcard.inc.php +++ b/addressbook/inc/class.uivcard.inc.php @@ -34,7 +34,7 @@ function uivcard() { - $this->template = $GLOBALS['phpgw']->template; + $this->template = &$GLOBALS['phpgw']->template; $this->contacts = CreateObject('phpgwapi.contacts'); $this->browser = CreateObject('phpgwapi.browser'); $this->vcard = CreateObject('phpgwapi.vcard'); @@ -43,6 +43,7 @@ function in() { + $uploadedfile = get_var('uploadedfile','FILES'); $action = get_var('action',array('POST','GET')); $GLOBALS['phpgw']->common->phpgw_header(); @@ -50,6 +51,15 @@ echo '
'; + if($uploadedfile) + { + $ab_id = $this->bo->add_vcard($uploadedfile); + if($done) + { + Header('Location: ' . $GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.uiaddressbook.view&ab_id=' . $ab_id)); + } + } + if($action == 'GetFile') { echo '' . lang('Address book - VCard in') . '
'); - $this->template->set_var('action_url',$GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.boaddressbook.add_vcard')); + $this->template->set_var('action_url',$GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.uivcard.in')); $this->template->set_var('lang_access',lang('Access')); $this->template->set_var('lang_groups',lang('Which groups')); $this->template->set_var('access_option',$access_option);