mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-27 09:09:04 +01:00
Removing files
This commit is contained in:
parent
4f57aa39b1
commit
120c6d79a1
@ -1,232 +0,0 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* phpGroupWare - addressbook *
|
||||
* http://www.phpgroupware.org *
|
||||
* Written by Joseph Engo <jengo@phpgroupware.org> *
|
||||
* -------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
if ($submit || $AddVcard)
|
||||
{
|
||||
$phpgw_info['flags'] = array(
|
||||
'noheader' => True,
|
||||
'nonavbar' => True
|
||||
);
|
||||
}
|
||||
|
||||
$phpgw_info['flags']['currentapp'] = 'addressbook';
|
||||
$phpgw_info['flags']['enable_contacts_class'] = True;
|
||||
$phpgw_info['flags']['enable_config_class'] = True;
|
||||
$phpgw_info['flags']['enable_country_class'] = True;
|
||||
include('../header.inc.php');
|
||||
|
||||
$t = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
|
||||
$t->set_file(array('add' => 'add.tpl'));
|
||||
|
||||
$contacts = CreateObject('phpgwapi.contacts');
|
||||
|
||||
// Read in user custom fields, if any
|
||||
$phpgw->preferences->read_repository();
|
||||
$customfields = array();
|
||||
while (list($col,$descr) = @each($phpgw_info['user']['preferences']['addressbook']))
|
||||
{
|
||||
if ( substr($col,0,6) == 'extra_' )
|
||||
{
|
||||
$field = ereg_replace('extra_','',$col);
|
||||
$field = ereg_replace(' ','_',$field);
|
||||
$customfields[$field] = ucfirst($field);
|
||||
}
|
||||
}
|
||||
|
||||
if ($AddVcard)
|
||||
{
|
||||
Header('Location: ' . $phpgw->link('/addressbook/vcardin.php'));
|
||||
}
|
||||
else if ($add_email)
|
||||
{
|
||||
$named = explode(' ', $name);
|
||||
for ($i=count($named);$i>=0;$i--) { $names[$i] = $named[$i]; }
|
||||
if ($names[2])
|
||||
{
|
||||
$fields['n_given'] = $names[0];
|
||||
$fields['n_middle'] = $names[1];
|
||||
$fields['n_family'] = $names[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
$fields['n_given'] = $names[0];
|
||||
$fields['n_family'] = $names[1];
|
||||
}
|
||||
$fields['email'] = $add_email;
|
||||
addressbook_form('','add.php','Add',$fields,'',$cat_id);
|
||||
}
|
||||
else if (!$submit && !$add_email)
|
||||
{
|
||||
// Default
|
||||
addressbook_form("","add.php","Add","",$customfields,$cat_id);
|
||||
}
|
||||
elseif ($submit && $fields)
|
||||
{
|
||||
// This came from the view form, Copy entry
|
||||
$extrafields = array(
|
||||
'ophone' => 'ophone',
|
||||
'address2' => 'address2',
|
||||
'address3' => 'address3'
|
||||
);
|
||||
$qfields = $contacts->stock_contact_fields + $extrafields + $customfields;
|
||||
$addnew = unserialize(rawurldecode($fields));
|
||||
$addnew['note'] .= "\nCopied from ".$phpgw->accounts->id2name($addnew['owner']).", record #".$addnew['id'].".";
|
||||
$addnew['owner'] = $phpgw_info['user']['account_id'];
|
||||
$addnew['id'] = '';
|
||||
|
||||
if ($addnew['tid']) { addressbook_add_entry($addnew['owner'],$addnew,'','',$addnew['tid']); }
|
||||
else { addressbook_add_entry($addnew['owner'],$addnew); }
|
||||
|
||||
$fields = addressbook_read_last_entry($qfields);
|
||||
$newid = $fields[0]['id'];
|
||||
Header("Location: "
|
||||
. $phpgw->link('/addressbook/edit.php',"ab_id=$newid&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id"));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!$bday_month && !$bday_day && !$bday_year)
|
||||
{
|
||||
$bday = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strlen ($bday_day) == 1)
|
||||
{
|
||||
$bday_day = '0' . $bday_day;
|
||||
}
|
||||
$bday = "$bday_month/$bday_day/$bday_year";
|
||||
}
|
||||
|
||||
if ($url == "http://")
|
||||
{
|
||||
$url = "";
|
||||
}
|
||||
|
||||
$fields['org_name'] = $company;
|
||||
$fields['org_unit'] = $department;
|
||||
$fields['n_given'] = $firstname;
|
||||
$fields['n_family'] = $lastname;
|
||||
$fields['n_middle'] = $middle;
|
||||
$fields['n_prefix'] = $prefix;
|
||||
$fields['n_suffix'] = $suffix;
|
||||
if ($prefix) { $pspc = ' '; }
|
||||
if ($middle) { $mspc = ' '; } else { $nspc = ' '; }
|
||||
if ($suffix) { $sspc = ' '; }
|
||||
$fields['fn'] = $prefix.$pspc.$firstname.$nspc.$mspc.$middle.$mspc.$lastname.$sspc.$suffix;
|
||||
$fields['email'] = $email;
|
||||
$fields['email_type'] = $email_type;
|
||||
$fields['email_home'] = $hemail;
|
||||
$fields['email_home_type'] = $hemail_type;
|
||||
$fields['title'] = $title;
|
||||
$fields['tel_work'] = $wphone;
|
||||
$fields['tel_home'] = $hphone;
|
||||
$fields['tel_fax'] = $fax;
|
||||
$fields['tel_pager'] = $pager;
|
||||
$fields['tel_cell'] = $mphone;
|
||||
$fields['tel_msg'] = $msgphone;
|
||||
$fields['tel_car'] = $carphone;
|
||||
$fields['tel_video'] = $vidphone;
|
||||
$fields['tel_isdn'] = $isdnphone;
|
||||
$fields['adr_one_street'] = $bstreet;
|
||||
$fields['adr_one_locality'] = $bcity;
|
||||
$fields['adr_one_region'] = $bstate;
|
||||
$fields['adr_one_postalcode'] = $bzip;
|
||||
$fields['adr_one_countryname'] = $bcountry;
|
||||
|
||||
reset($contacts->adr_types);
|
||||
$typed = '';
|
||||
while (list($type,$val) = each($contacts->adr_types))
|
||||
{
|
||||
$ftype = 'one_'.$type;
|
||||
eval("if (\$\$ftype=='on') { \$typed .= \$type . ';'; }");
|
||||
}
|
||||
$fields['adr_one_type'] = substr($typed,0,-1);
|
||||
|
||||
$fields['address2'] = $address2;
|
||||
$fields['address3'] = $address3;
|
||||
|
||||
$fields['adr_two_street'] = $hstreet;
|
||||
$fields['adr_two_locality'] = $hcity;
|
||||
$fields['adr_two_region'] = $hstate;
|
||||
$fields['adr_two_postalcode'] = $hzip;
|
||||
$fields['adr_two_countryname'] = $hcountry;
|
||||
|
||||
reset($contacts->adr_types);
|
||||
$typed = '';
|
||||
while (list($type,$val) = each($contacts->adr_types))
|
||||
{
|
||||
$ftype = 'two_'.$type;
|
||||
eval("if (\$\$ftype=='on') { \$typed \.= \$type . ';'; }");
|
||||
}
|
||||
$fields['adr_two_type'] = substr($typed,0,-1);
|
||||
|
||||
reset($customfields);
|
||||
while (list($name,$val) = each($customfields))
|
||||
{
|
||||
$cust = '';
|
||||
eval("if (\$name\) { \$cust \.= \$\$name; }");
|
||||
if ($cust) { $fields[$name] = $cust; }
|
||||
}
|
||||
|
||||
$fields['ophone'] = $ophone;
|
||||
$fields['tz'] = $timezone;
|
||||
$fields['bday'] = $bday;
|
||||
$fields['url'] = $url;
|
||||
$fields['pubkey'] = $pubkey;
|
||||
$fields['note'] = $notes;
|
||||
$fields['label'] = $label;
|
||||
|
||||
if ($access == True)
|
||||
{
|
||||
$fields['access'] = 'private';
|
||||
}
|
||||
else
|
||||
{
|
||||
$fields['access'] = 'public';
|
||||
}
|
||||
|
||||
if (is_array($cat_id))
|
||||
{
|
||||
$fields['cat_id'] = count($cat_id) > 1 ? ','.implode(',',$cat_id).',' : $cat_id[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
$fields['cat_id'] = $cat_id;
|
||||
}
|
||||
|
||||
addressbook_add_entry($phpgw_info['user']['account_id'],$fields,$fields['access'],$fields['cat_id']);
|
||||
$ab_id = addressbook_get_lastid();
|
||||
$referer = urlencode($referer);
|
||||
Header("Location: "
|
||||
. $phpgw->link("/addressbook/view.php","ab_id=$ab_id&order=$order&sort=$sort&filter=$filter&start=$start&cat_id=$cat_id&referer=$referer"));
|
||||
$phpgw->common->phpgw_exit();
|
||||
}
|
||||
|
||||
$t->set_var('ab_id',$ab_id);
|
||||
$t->set_var('sort',$sort);
|
||||
$t->set_var('order',$order);
|
||||
$t->set_var('filter',$filter);
|
||||
$t->set_var('query',$query);
|
||||
$t->set_var('start',$start);
|
||||
$t->set_var('cat_id',$cat_id);
|
||||
|
||||
$t->set_var('lang_ok',lang('ok'));
|
||||
$t->set_var('lang_clear',lang('clear'));
|
||||
$t->set_var('lang_cancel',lang('cancel'));
|
||||
$t->set_var('cancel_url',$phpgw->link('/addressbook/index.php'));
|
||||
$t->parse('out','add');
|
||||
$t->pparse('out','add');
|
||||
|
||||
$phpgw->common->phpgw_footer();
|
||||
?>
|
@ -1,66 +0,0 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* phpGroupWare - addressbook *
|
||||
* http://www.phpgroupware.org *
|
||||
* Written by Joseph Engo <jengo@phpgroupware.org> *
|
||||
* -------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
$phpgw_info['flags'] = array(
|
||||
'noheader' => True,
|
||||
'nonavbar' => True,
|
||||
'currentapp' => 'addressbook'
|
||||
);
|
||||
|
||||
include('../header.inc.php');
|
||||
|
||||
if (! $ab_id)
|
||||
{
|
||||
Header('Location: ' . $phpgw->link('/addressbook/index.php'));
|
||||
}
|
||||
|
||||
$contacts = CreateObject('phpgwapi.contacts');
|
||||
$fields = $contacts->read_single_entry($ab_id,array('owner' => 'owner'));
|
||||
//$record_owner = $fields[0]['owner'];
|
||||
|
||||
if (! $contacts->check_perms($contacts->grants[$fields[0]['owner']],PHPGW_ACL_DELETE) && $fields[0]['owner'] != $phpgw_info['user']['account_id'])
|
||||
{
|
||||
Header('Location: '
|
||||
. $phpgw->link('/addressbook/index.php',"cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id"));
|
||||
$phpgw->common->phpgw_exit();
|
||||
}
|
||||
|
||||
$t = new Template(PHPGW_APP_TPL);
|
||||
$t->set_file(array('delete' => 'delete.tpl'));
|
||||
|
||||
if ($confirm != 'true')
|
||||
{
|
||||
$phpgw->common->phpgw_header();
|
||||
echo parse_navbar();
|
||||
|
||||
$t->set_var('lang_sure',lang('Are you sure you want to delete this entry ?'));
|
||||
$t->set_var('no_link',$phpgw->link('/addressbook/index.php',
|
||||
"ab_id=$ab_id&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id"));
|
||||
$t->set_var('lang_no',lang('NO'));
|
||||
$t->set_var('yes_link',$phpgw->link('/addressbook/delete.php',
|
||||
"ab_id=$ab_id&confirm=true&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id"));
|
||||
$t->set_var('lang_yes',lang('YES'));
|
||||
$t->pparse('out','delete');
|
||||
|
||||
$phpgw->common->phpgw_footer();
|
||||
}
|
||||
else
|
||||
{
|
||||
$contacts->account_id = $phpgw_info['user']['account_id'];
|
||||
$contacts->delete($ab_id);
|
||||
|
||||
@Header('Location: ' . $phpgw->link('/addressbook/index.php',
|
||||
"cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id"));
|
||||
}
|
||||
?>
|
@ -1,232 +0,0 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* phpGroupWare - addressbook *
|
||||
* http://www.phpgroupware.org *
|
||||
* Written by Joseph Engo <jengo@phpgroupware.org> *
|
||||
* -------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
$phpgw_info['flags'] = array(
|
||||
'noheader' => True,
|
||||
'nonavbar' => True,
|
||||
'currentapp' => 'addressbook',
|
||||
'enable_contacts_class' => True,
|
||||
'enable_config_class' => True,
|
||||
'enable_country_class' => True
|
||||
);
|
||||
|
||||
include('../header.inc.php');
|
||||
|
||||
$contacts = CreateObject('phpgwapi.contacts');
|
||||
|
||||
// First, make sure they have permission to this entry
|
||||
$check = addressbook_read_entry($ab_id,array('owner' => 'owner'));
|
||||
|
||||
if ( !$contacts->check_perms($contacts->grants[$check[0]['owner']],PHPGW_ACL_EDIT) && ($check[0]['owner'] != $phpgw_info['user']['account_id']) )
|
||||
{
|
||||
Header("Location: "
|
||||
. $phpgw->link('/addressbook/index.php',"cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id"));
|
||||
$phpgw->common->phpgw_exit();
|
||||
}
|
||||
|
||||
if (!$ab_id)
|
||||
{
|
||||
Header("Location: "
|
||||
. $phpgw->link('/addressbook/index.php',"cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id"));
|
||||
$phpgw->common->phpgw_exit();
|
||||
}
|
||||
|
||||
if (!$submit)
|
||||
{
|
||||
$phpgw->common->phpgw_header();
|
||||
echo parse_navbar();
|
||||
}
|
||||
|
||||
// Read in user custom fields, if any
|
||||
$customfields = array();
|
||||
while (list($col,$descr) = @each($phpgw_info['user']['preferences']['addressbook']))
|
||||
{
|
||||
if ( substr($col,0,6) == 'extra_' )
|
||||
{
|
||||
$field = ereg_replace('extra_','',$col);
|
||||
$field = ereg_replace(' ','_',$field);
|
||||
$customfields[$field] = ucfirst($field);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$submit)
|
||||
{
|
||||
// merge in extra fields
|
||||
$extrafields = array(
|
||||
'ophone' => 'ophone',
|
||||
'address2' => 'address2',
|
||||
'address3' => 'address3'
|
||||
);
|
||||
|
||||
$qfields = $contacts->stock_contact_fields + $extrafields + $customfields;
|
||||
$fields = addressbook_read_entry($ab_id,$qfields);
|
||||
addressbook_form('edit','edit.php',lang('Edit'),$fields[0],$customfields);
|
||||
|
||||
$t = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
|
||||
$t->set_file(array("edit" => "edit.tpl"));
|
||||
|
||||
$t->set_var('th_bg',$phpgw_info['theme']['th_bg']);
|
||||
$t->set_var('ab_id',$ab_id);
|
||||
$t->set_var('sort',$sort);
|
||||
$t->set_var('order',$order);
|
||||
$t->set_var('filter',$filter);
|
||||
$t->set_var('query',$query);
|
||||
$t->set_var('start',$start);
|
||||
$t->set_var('cat_id',$cat_id);
|
||||
$t->set_var('tid',$tid);
|
||||
$t->set_var('lang_ok',lang('ok'));
|
||||
$t->set_var('lang_clear',lang('clear'));
|
||||
$t->set_var('lang_cancel',lang('cancel'));
|
||||
$t->set_var('lang_submit',lang('submit'));
|
||||
$t->set_var('cancel_link','<form method="POST" action="' . $phpgw->link("/addressbook/index.php") . '">');
|
||||
|
||||
if (($contacts->grants[$check[0]['owner']] & PHPGW_ACL_DELETE) || $check[0]['owner'] == $phpgw_info['user']['account_id'])
|
||||
{
|
||||
$t->set_var('delete_link','<form method="POST" action="'.$phpgw->link("/addressbook/delete.php") . '">');
|
||||
$t->set_var('delete_button','<input type="submit" name="delete" value="' . lang('Delete') . '">');
|
||||
}
|
||||
|
||||
$t->pfp('out','edit');
|
||||
$phpgw->common->phpgw_footer();
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($url == "http://")
|
||||
{
|
||||
$url = "";
|
||||
}
|
||||
if (!$bday_month && !$bday_day && !$bday_year)
|
||||
{
|
||||
$bday = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strlen ($bday_day) == 1)
|
||||
{
|
||||
$bday_day = "0".$bday_day;
|
||||
}
|
||||
$bday = "$bday_month/$bday_day/$bday_year";
|
||||
}
|
||||
|
||||
$fields['org_name'] = $company;
|
||||
$fields['org_unit'] = $department;
|
||||
$fields['n_given'] = $firstname;
|
||||
$fields['n_family'] = $lastname;
|
||||
$fields['n_middle'] = $middle;
|
||||
$fields['n_prefix'] = $prefix;
|
||||
$fields['n_suffix'] = $suffix;
|
||||
if ($prefix) { $pspc = ' '; }
|
||||
if ($middle) { $mspc = ' '; } else { $nspc = ' '; }
|
||||
if ($suffix) { $sspc = ' '; }
|
||||
$fields['fn'] = $prefix.$pspc.$firstname.$nspc.$mspc.$middle.$mspc.$lastname.$sspc.$suffix;
|
||||
$fields['email'] = $email;
|
||||
$fields['email_type'] = $email_type;
|
||||
$fields['email_home'] = $hemail;
|
||||
$fields['email_home_type'] = $hemail_type;
|
||||
|
||||
$fields['title'] = $title;
|
||||
$fields['tel_work'] = $wphone;
|
||||
$fields['tel_home'] = $hphone;
|
||||
$fields['tel_fax'] = $fax;
|
||||
$fields['tel_pager'] = $pager;
|
||||
$fields['tel_cell'] = $mphone;
|
||||
$fields['tel_msg'] = $msgphone;
|
||||
$fields['tel_car'] = $carphone;
|
||||
$fields['tel_video'] = $vidphone;
|
||||
$fields['tel_isdn'] = $isdnphone;
|
||||
$fields['tel_prefer'] = $tel_prefer;
|
||||
|
||||
$fields['adr_one_street'] = $bstreet;
|
||||
$fields['adr_one_locality'] = $bcity;
|
||||
$fields['adr_one_region'] = $bstate;
|
||||
$fields['adr_one_postalcode'] = $bzip;
|
||||
$fields['adr_one_countryname'] = $bcountry;
|
||||
|
||||
reset($contacts->adr_types);
|
||||
$typed = '';
|
||||
while (list($type,$val) = each($contacts->adr_types))
|
||||
{
|
||||
$ftype = 'one_'.$type;
|
||||
eval("if (\$\$ftype=='on') { \$typed .= \$type . ';'; }");
|
||||
}
|
||||
$fields['adr_one_type'] = substr($typed,0,-1);
|
||||
|
||||
$fields['address2'] = $address2;
|
||||
$fields['address3'] = $address3;
|
||||
|
||||
$fields['adr_two_street'] = $hstreet;
|
||||
$fields['adr_two_locality'] = $hcity;
|
||||
$fields['adr_two_region'] = $hstate;
|
||||
$fields['adr_two_postalcode'] = $hzip;
|
||||
$fields['adr_two_countryname'] = $hcountry;
|
||||
|
||||
reset($contacts->adr_types);
|
||||
$typed = '';
|
||||
while (list($type,$val) = each($contacts->adr_types))
|
||||
{
|
||||
$ftype = 'two_'.$type;
|
||||
eval("if (\$\$ftype=='on') { \$typed .= \$type . ';'; }");
|
||||
}
|
||||
$fields["adr_two_type"] = substr($typed,0,-1);
|
||||
|
||||
reset($customfields);
|
||||
while (list($name,$val) = each($customfields))
|
||||
{
|
||||
$cust = '';
|
||||
eval("if (\$name\) { \$cust \.= \$\$name; }");
|
||||
if ($cust) { $fields[$name] = $cust; }
|
||||
}
|
||||
|
||||
$fields['ophone'] = $ophone;
|
||||
$fields['tz'] = $timezone;
|
||||
$fields['bday'] = $bday;
|
||||
$fields['url'] = $url;
|
||||
$fields['pubkey'] = $pubkey;
|
||||
$fields['note'] = $notes;
|
||||
$fields['label'] = $label;
|
||||
|
||||
if ($access == True || $access == 'private')
|
||||
{
|
||||
$fields['access'] = 'private';
|
||||
}
|
||||
else
|
||||
{
|
||||
$fields['access'] = 'public';
|
||||
}
|
||||
|
||||
if (is_array($cat_id))
|
||||
{
|
||||
$fields['cat_id'] = count($cat_id) > 1 ? ','.implode(',',$cat_id).',' : $cat_id[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
$fields['cat_id'] = $cat_id;
|
||||
}
|
||||
|
||||
if (($contacts->grants[$check[0]['owner']] & PHPGW_ACL_EDIT) && $check[0]['owner'] != $phpgw_info['user']['account_id'])
|
||||
{
|
||||
$userid = $check[0]['owner'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$userid = $phpgw_info['user']['account_id'];
|
||||
}
|
||||
|
||||
addressbook_update_entry($ab_id,$userid,$fields,$fields['access'],$fields['cat_id'],$tid);
|
||||
$referer = urlencode($referer);
|
||||
Header("Location: "
|
||||
. $phpgw->link('/addressbook/view.php',"ab_id=$ab_id&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id&referer=$referer"));
|
||||
$phpgw->common->phpgw_exit();
|
||||
}
|
||||
?>
|
@ -1,165 +0,0 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* phpGroupWare - addressbook *
|
||||
* http://www.phpgroupware.org *
|
||||
* Written by Joseph Engo <jengo@phpgroupware.org> *
|
||||
* -------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
if ($download == 'on')
|
||||
{
|
||||
$phpgw_info['flags'] = array(
|
||||
'noheader' => True,
|
||||
'nonavbar' => True
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$phpgw_info['flags'] = array(
|
||||
'noheader' => False,
|
||||
'nonavbar' => False
|
||||
);
|
||||
}
|
||||
|
||||
$phpgw_info['flags']['currentapp'] = 'addressbook';
|
||||
$phpgw_info['flags']['enable_contacts_class'] = True;
|
||||
$phpgw_info['flags']['enable_browser_class'] = True;
|
||||
include('../header.inc.php');
|
||||
|
||||
if (!$convert)
|
||||
{
|
||||
$t = new Template(PHPGW_APP_TPL);
|
||||
$t->set_file(array('export' => 'export.tpl'));
|
||||
|
||||
$dir_handle=opendir(PHPGW_APP_ROOT . SEP . 'export');
|
||||
$i=0; $myfilearray='';
|
||||
while ($file = readdir($dir_handle))
|
||||
{
|
||||
#echo "<!-- ".is_file($phpgw_info["server"]["app_root"].$sep."conv".$sep.$file)." -->";
|
||||
if ((substr($file, 0, 1) != '.') && is_file(PHPGW_APP_ROOT . SEP . 'export' . SEP . $file) )
|
||||
{
|
||||
$myfilearray[$i] = $file;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
closedir($dir_handle);
|
||||
sort($myfilearray);
|
||||
for ($i=0;$i<count($myfilearray);$i++)
|
||||
{
|
||||
$fname = ereg_replace('_',' ',$myfilearray[$i]);
|
||||
$conv .= ' <option value="'.$myfilearray[$i].'">'.$fname.'</option>'."\n";
|
||||
}
|
||||
|
||||
$t->set_var('lang_cancel',lang('Cancel'));
|
||||
$t->set_var('lang_cat',lang('Select Category'));
|
||||
$t->set_var('cat_link',cat_option($cat_id,False,False));
|
||||
$t->set_var('cancel_url',$phpgw->link('/addressbook/index.php'));
|
||||
$t->set_var('navbar_bg',$phpgw_info['theme']['navbar_bg']);
|
||||
$t->set_var('navbar_text',$phpgw_info['theme']['navbar_text']);
|
||||
$t->set_var('export_text',lang('Export from Addressbook'));
|
||||
$t->set_var('action_url',$phpgw->link('/addressbook/export.php'));
|
||||
$t->set_var('filename',lang('Export file name'));
|
||||
$t->set_var('conv',$conv);
|
||||
$t->set_var('debug',lang(''));
|
||||
$t->set_var('download',lang('Submit'));
|
||||
$t->set_var('start',$start);
|
||||
$t->set_var('sort',$sort);
|
||||
$t->set_var('order',$order);
|
||||
$t->set_var('filter',$filter);
|
||||
$t->set_var('query',$query);
|
||||
$t->set_var('cat_id',$cat_id);
|
||||
$t->pparse('out','export');
|
||||
|
||||
$phpgw->common->phpgw_footer();
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($conv_type == 'none')
|
||||
{
|
||||
$phpgw_info['flags']['noheader'] = False;
|
||||
$phpgw_info['flags']['noheader'] = True;
|
||||
$phpgw->common->phpgw_header();
|
||||
echo parse_navbar();
|
||||
echo lang('<b>No conversion type <none> could be located.</b> Please choose a conversion type from the list');
|
||||
echo ' <a href="'.$phpgw->link('/addressbook/export.php',
|
||||
"sort=$sort&order=$order&filter=$filter&start=$start&query=$query&cat_id=$cat_id")
|
||||
. '">'.lang('OK').'</a>';
|
||||
$phpgw->common->phpgw_footer();
|
||||
$phpgw->common->phpgw_exit();
|
||||
}
|
||||
else
|
||||
{
|
||||
include (PHPGW_APP_ROOT . SEP . 'export' . SEP . $conv_type);
|
||||
$buffer=array();
|
||||
$contacts = new export_conv;
|
||||
|
||||
// Read in user custom fields, if any
|
||||
$customfields = array();
|
||||
while (list($col,$descr) = @each($phpgw_info['user']['preferences']['addressbook']))
|
||||
{
|
||||
if ( substr($col,0,6) == 'extra_' )
|
||||
{
|
||||
$field = ereg_replace('extra_','',$col);
|
||||
$field = ereg_replace(' ','_',$field);
|
||||
$customfields[$field] = ucfirst($field);
|
||||
}
|
||||
}
|
||||
$extrafields = array(
|
||||
'ophone' => 'ophone',
|
||||
'address2' => 'address2',
|
||||
'address3' => 'address3'
|
||||
);
|
||||
if ($contacts->type != 'vcard')
|
||||
{
|
||||
$contacts->qfields = $contacts->stock_contact_fields;# + $extrafields;# + $customfields;
|
||||
}
|
||||
|
||||
if (!empty($cat_id))
|
||||
{
|
||||
$buffer = $contacts->export_start_file($buffer,$cat_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$buffer = $contacts->export_start_file($buffer);
|
||||
}
|
||||
|
||||
for ($i=0;$i<count($contacts->ids);$i++)
|
||||
{
|
||||
$buffer = $contacts->export_start_record($buffer);
|
||||
while( list($name,$value) = each($contacts->currentrecord) )
|
||||
{
|
||||
$buffer = $contacts->export_new_attrib($buffer,$name,$value);
|
||||
}
|
||||
$buffer = $contacts->export_end_record($buffer);
|
||||
}
|
||||
|
||||
// Here, buffer becomes a string suitable for printing
|
||||
$buffer = $contacts->export_end_file($buffer);
|
||||
|
||||
$tsvfilename = $phpgw_info['server']['temp_dir'].$sep.$tsvfilename;
|
||||
}
|
||||
|
||||
if ( ($download == 'on') || ($o->type == 'pdb') )
|
||||
{
|
||||
// filename, default application/octet-stream, length of file, default nocache True
|
||||
$phpgw->browser->content_header($tsvfilename,'application/octet-stream',strlen($buffer));
|
||||
echo $buffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<pre>\n";
|
||||
echo $buffer;
|
||||
echo "\n</pre>\n";
|
||||
echo '<a href="'.$phpgw->link('/addressbook/index.php',
|
||||
"sort=$sort&order=$order&filter=$filter&start=$start&query=$query&cat_id=$cat_id")
|
||||
. '">'.lang('OK').'</a>';
|
||||
$phpgw->common->phpgw_footer();
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,222 +0,0 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* phpGroupWare - addressbook *
|
||||
* http://www.phpgroupware.org *
|
||||
* Written by Joseph Engo <jengo@phpgroupware.org> *
|
||||
* -------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
$phpgw_info['flags'] = array(
|
||||
'currentapp' => 'addressbook',
|
||||
'enable_contacts_class' => True,
|
||||
'enable_browser_class' => True
|
||||
);
|
||||
include('../header.inc.php');
|
||||
|
||||
if (!$convert)
|
||||
{
|
||||
$t = new Template(PHPGW_APP_TPL);
|
||||
$t->set_file(array('import' => 'import.tpl'));
|
||||
|
||||
$dir_handle=opendir(PHPGW_APP_ROOT . SEP . 'import');
|
||||
$i=0; $myfilearray='';
|
||||
while ($file = readdir($dir_handle))
|
||||
{
|
||||
//echo "<!-- ".is_file($phpgw_info["server"]["app_root"].$sep."import".$sep.$file)." -->";
|
||||
if ((substr($file, 0, 1) != '.') && is_file(PHPGW_APP_ROOT . SEP . 'import' . SEP . $file) )
|
||||
{
|
||||
$myfilearray[$i] = $file;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
closedir($dir_handle);
|
||||
sort($myfilearray);
|
||||
for ($i=0;$i<count($myfilearray);$i++)
|
||||
{
|
||||
$fname = ereg_replace('_',' ',$myfilearray[$i]);
|
||||
$conv .= '<OPTION VALUE="' . $myfilearray[$i].'">' . $fname . '</OPTION>';
|
||||
}
|
||||
|
||||
$t->set_var('lang_cancel',lang('Cancel'));
|
||||
$t->set_var('lang_cat',lang('Select Category'));
|
||||
$t->set_var('cancel_url',$phpgw->link('/addressbook/index.php'));
|
||||
$t->set_var('navbar_bg',$phpgw_info['theme']['navbar_bg']);
|
||||
$t->set_var('navbar_text',$phpgw_info['theme']['navbar_text']);
|
||||
$t->set_var('import_text',lang('Import from LDIF, CSV, or VCard'));
|
||||
$t->set_var('action_url',$phpgw->link('/addressbook/import.php'));
|
||||
$t->set_var('cat_link',cat_option($cat_id,True,False));
|
||||
$t->set_var('tsvfilename','');
|
||||
$t->set_var('conv',$conv);
|
||||
$t->set_var('debug',lang('Debug output in browser'));
|
||||
$t->set_var('filetype',lang('LDIF'));
|
||||
$t->set_var('download',lang('Submit'));
|
||||
$t->set_var('start',$start);
|
||||
$t->set_var('sort',$sort);
|
||||
$t->set_var('order',$order);
|
||||
$t->set_var('filter',$filter);
|
||||
$t->set_var('query',$query);
|
||||
$t->set_var('cat_id',$cat_id);
|
||||
$t->pparse('out','import');
|
||||
$phpgw->common->phpgw_footer();
|
||||
}
|
||||
else
|
||||
{
|
||||
include (PHPGW_APP_ROOT . SEP. 'import' . SEP . $conv_type);
|
||||
|
||||
if ($private == '') { $private = 'public'; }
|
||||
$row=0;
|
||||
$buffer=array();
|
||||
$contacts = new import_conv;
|
||||
$buffer = $contacts->import_start_file($buffer);
|
||||
$fp=fopen($tsvfile,'r');
|
||||
if ($contacts->type == 'csv')
|
||||
{
|
||||
while ($data = fgetcsv($fp,8000,','))
|
||||
{
|
||||
$num = count($data);
|
||||
$row++;
|
||||
if ($row == 1)
|
||||
{
|
||||
// Changed here to ignore the header, set to our array
|
||||
while(list($lhs,$rhs) = each($contacts->import))
|
||||
{
|
||||
$header[] = $lhs;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$buffer = $contacts->import_start_record($buffer);
|
||||
for ($c=0; $c<$num; $c++ )
|
||||
{
|
||||
//Send name/value pairs along with the buffer
|
||||
if ($contacts->import[$header[$c]] != '' && $data[$c] != '')
|
||||
{
|
||||
$buffer = $contacts->import_new_attrib($buffer, $contacts->import[$header[$c]],$data[$c]);
|
||||
}
|
||||
}
|
||||
$buffer = $contacts->import_end_record($buffer,$private);
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($contacts->type == 'ldif')
|
||||
{
|
||||
while ($data = fgets($fp,8000))
|
||||
{
|
||||
$url = "";
|
||||
list($name,$value,$extra) = split(':', $data);
|
||||
if (substr($name,0,2) == 'dn')
|
||||
{
|
||||
$buffer = $contacts->import_start_record($buffer);
|
||||
}
|
||||
|
||||
$test = trim($value);
|
||||
if ($name && !empty($test) && $extra)
|
||||
{
|
||||
// Probable url string
|
||||
$url = $test;
|
||||
$value = $extra;
|
||||
}
|
||||
elseif ($name && empty($test) && $extra)
|
||||
{
|
||||
// Probable multiline encoding
|
||||
$newval = base64_decode(trim($extra));
|
||||
$value = $newval;
|
||||
//echo $name.':'.$value;
|
||||
}
|
||||
|
||||
if ($name && $value)
|
||||
{
|
||||
$test = split(',mail=',$value);
|
||||
if ($test[1])
|
||||
{
|
||||
$name = "mail";
|
||||
$value = $test[1];
|
||||
}
|
||||
if ($url)
|
||||
{
|
||||
$name = "homeurl";
|
||||
$value = $url. ':' . $value;
|
||||
}
|
||||
//echo '<br>'.$j.': '.$name.' => '.$value;
|
||||
if ($contacts->import[$name] != '' && $value != '')
|
||||
{
|
||||
$buffer = $contacts->import_new_attrib($buffer, $contacts->import[$name],$value);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$buffer = $contacts->import_end_record($buffer,$private);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while ($data = fgets($fp,8000))
|
||||
{
|
||||
$data = trim($data); // RB 2001/05/07 added for Lotus Organizer
|
||||
while (substr($data,-1) == '=') { // '=' at end-of-line --> line to be continued with next line
|
||||
$data = substr($data,0,-1) . trim(fgets($fp,8000));
|
||||
}
|
||||
if (strstr($data,';ENCODING=QUOTED-PRINTABLE')) { // RB 2001/05/07 added for Lotus Organizer
|
||||
$data = quoted_printable_decode(str_replace(';ENCODING=QUOTED-PRINTABLE','',$data));
|
||||
}
|
||||
list($name,$value) = explode(':', $data,2); // RB 2001/05/09 to allow ':' in Values (not only in URL's)
|
||||
|
||||
if (strtolower(substr($name,0,5)) == 'begin')
|
||||
{
|
||||
$buffer = $contacts->import_start_record($buffer);
|
||||
}
|
||||
if ($name && $value)
|
||||
{
|
||||
reset($contacts->import);
|
||||
while ( list($fname,$fvalue) = each($contacts->import) )
|
||||
{
|
||||
if ( strstr(strtolower($name), $contacts->import[$fname]) )
|
||||
{
|
||||
$buffer = $contacts->import_new_attrib($buffer,$name,$value);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$buffer = $contacts->import_end_record($buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fclose($fp);
|
||||
$buffer = $contacts->import_end_file($buffer,$private,$cat_id);
|
||||
|
||||
if ($download == '')
|
||||
{
|
||||
if($conv_type == 'Debug LDAP' || $conv_type == 'Debug SQL' )
|
||||
{
|
||||
// filename, default application/octet-stream, length of file, default nocache True
|
||||
$phpgw->browser->content_header($tsvfilename,'',strlen($buffer));
|
||||
echo $buffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<pre>$buffer</pre>";
|
||||
echo '<a href="'.$phpgw->link('/addressbook/index.php',
|
||||
"sort=$sort&order=$order&filter=$filter&start=$start&query=$query&cat_id=$cat_id")
|
||||
. '">'.lang("OK").'</a>';
|
||||
$phpgw->common->phpgw_footer();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<pre>$buffer</pre>";
|
||||
echo '<a href="'.$phpgw->link('/addressbook/index.php',
|
||||
"sort=$sort&order=$order&filter=$filter&start=$start&query=$query&cat_id=$cat_id")
|
||||
. '">'.lang("OK").'</a>';
|
||||
$phpgw->common->phpgw_footer();
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,32 +0,0 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* phpGroupWare - Addressbook *
|
||||
* http://www.phpgroupware.org *
|
||||
* Written by Joseph Engo <jengo@phpgroupware.org> *
|
||||
* -------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
$phpgw_info['flags'] = array(
|
||||
'currentapp' => 'addressbook',
|
||||
'enable_contact_class' => True,
|
||||
'noheader' => True,
|
||||
'nonavbar' => True
|
||||
);
|
||||
include('../header.inc.php');
|
||||
|
||||
//if($access == "group")
|
||||
// $access = $n_groups;
|
||||
//echo $access . "<BR>";
|
||||
|
||||
//parsevcard($filename,$access);
|
||||
// Delete the temp file.
|
||||
unlink($filename);
|
||||
unlink($filename . '.info');
|
||||
Header('Location: ' . $phpgw->link('/addressbook/index.php','cd=14'));
|
||||
?>
|
@ -1,95 +0,0 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* phpGroupWare - E-Mail *
|
||||
* http://www.phpgroupware.org *
|
||||
* This file written by Joseph Engo <jengo@phpgroupware.org> *
|
||||
+ and Miles Lott <miloschjengo@phpgroupware.org> *
|
||||
* -------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
if ($action == 'Load Vcard')
|
||||
{
|
||||
$phpgw_info['flags'] = array(
|
||||
'noheader' => True,
|
||||
'nonavbar' => True,
|
||||
'currentapp' => 'addressbook',
|
||||
'enable_contacts_class' => True
|
||||
);
|
||||
include('../header.inc.php');
|
||||
}
|
||||
else
|
||||
{
|
||||
$phpgw_info['flags'] = array(
|
||||
'currentapp' => 'addressbook',
|
||||
'enable_contacts_class' => True
|
||||
);
|
||||
include('../header.inc.php');
|
||||
echo '<body bgcolor="' . $phpgw_info['theme']['bg_color'] . '">';
|
||||
}
|
||||
|
||||
$uploaddir = $phpgw_info['server']['temp_dir'] . SEP;
|
||||
|
||||
if ($action == 'Load Vcard')
|
||||
{
|
||||
if($uploadedfile == 'none' || $uploadedfile == '')
|
||||
{
|
||||
Header('Location: ' . $phpgw->link('/addressbook/vcardin.php','action=GetFile'));
|
||||
}
|
||||
else
|
||||
{
|
||||
srand((double)microtime()*1000000);
|
||||
$random_number = rand(100000000,999999999);
|
||||
$newfilename = md5("$uploadedfile, $uploadedfile_name, "
|
||||
. time() . getenv("REMOTE_ADDR") . $random_number );
|
||||
|
||||
copy($uploadedfile, $uploaddir . $newfilename);
|
||||
$ftp = fopen($uploaddir . $newfilename . '.info','w');
|
||||
fputs($ftp,"$uploadedfile_type\n$uploadedfile_name\n");
|
||||
fclose($ftp);
|
||||
|
||||
$filename = $uploaddir . $newfilename;
|
||||
|
||||
$vcard = CreateObject('phpgwapi.vcard');
|
||||
$entry = $vcard->in_file($filename);
|
||||
/* _debug_array($entry);exit; */
|
||||
$contacts = CreateObject('phpgwapi.contacts');
|
||||
$contacts->add($phpgw_info['user']['account_id'],$entry);
|
||||
|
||||
/* Delete the temp file. */
|
||||
unlink($filename);
|
||||
unlink($filename . '.info');
|
||||
Header('Location: ' . $phpgw->link('/addressbook/', 'cd=14'));
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'GetFile')
|
||||
{
|
||||
echo '<b><center>You must select a vcard. (*.vcf)</b></center><br><br>';
|
||||
}
|
||||
|
||||
$t = new Template(PHPGW_APP_TPL);
|
||||
$t->set_file(array('vcardin' => 'vcardin.tpl'));
|
||||
|
||||
$vcard_header = '<p> <b>' . lang('Address book - VCard in') . '</b><hr><p>';
|
||||
|
||||
$t->set_var(vcard_header,$vcard_header);
|
||||
$t->set_var(action_url,$phpgw->link('/addressbook/vcardin.php'));
|
||||
$t->set_var(lang_access,lang('Access'));
|
||||
$t->set_var(lang_groups,lang('Which groups'));
|
||||
$t->set_var(access_option,$access_option);
|
||||
|
||||
$t->set_var(group_option,$group_option);
|
||||
|
||||
$t->pparse('out','vcardin');
|
||||
|
||||
if ($action != 'Load Vcard')
|
||||
{
|
||||
$phpgw->common->phpgw_footer();
|
||||
}
|
||||
?>
|
@ -1,158 +0,0 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* phpGroupWare - addressbook *
|
||||
* http://www.phpgroupware.org *
|
||||
* Written by Joseph Engo <jengo@phpgroupware.org> *
|
||||
* -------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
if ($nolname || $nofname)
|
||||
{
|
||||
$phpgw_info['flags'] = array(
|
||||
'noheader' => False,
|
||||
'nonavbar' => False,
|
||||
'noappheader' => False,
|
||||
'noappfooter' => False
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$phpgw_info['flags'] = array(
|
||||
'noheader' => True,
|
||||
'nonavbar' => True,
|
||||
'noappheader' => True,
|
||||
'noappfooter' => True
|
||||
);
|
||||
}
|
||||
|
||||
$phpgw_info['flags']['enable_contacts_class'] = True;
|
||||
$phpgw_info['flags']['enable_browser_class'] = True;
|
||||
$phpgw_info['flags']['currentapp'] = 'addressbook';
|
||||
include('../header.inc.php');
|
||||
|
||||
if (!$ab_id)
|
||||
{
|
||||
Header('Location: ' . $phpgw->link('/addressbook/index.php'));
|
||||
$phpgw->common->phpgw_exit();
|
||||
}
|
||||
|
||||
$contacts = CreateObject('phpgwapi.contacts');
|
||||
|
||||
// First, make sure they have permission to this entry
|
||||
$check = addressbook_read_entry($ab_id,array('owner' => 'owner'));
|
||||
$perms = $contacts->check_perms($contacts->grants[$check[0]['owner']],PHPGW_ACL_READ);
|
||||
|
||||
if ( (!$perms) && ($check[0]['owner'] != $phpgw_info['user']['account_id']) )
|
||||
{
|
||||
Header("Location: "
|
||||
. $phpgw->link('/addressbook/index.php',"cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id"));
|
||||
$phpgw->common->phpgw_exit();
|
||||
}
|
||||
|
||||
$extrafields = array('address2' => 'address2');
|
||||
$qfields = $contacts->stock_contact_fields + $extrafields;
|
||||
|
||||
$fieldlist = addressbook_read_entry($ab_id,$qfields);
|
||||
$fields = $fieldlist[0];
|
||||
|
||||
$email = $fields['email'];
|
||||
$emailtype = $fields['email_type'];
|
||||
if (!$emailtype)
|
||||
{
|
||||
$fields['email_type'] = 'INTERNET';
|
||||
}
|
||||
$hemail = $fields['email_home'];
|
||||
$hemailtype = $fields['email_home_type'];
|
||||
if (!$hemailtype)
|
||||
{
|
||||
$fields['email_home_type'] = 'INTERNET';
|
||||
}
|
||||
$firstname = $fields['n_given'];
|
||||
$lastname = $fields['n_family'];
|
||||
|
||||
if(!$nolname && !$nofname)
|
||||
{
|
||||
/* First name and last must be in the vcard. */
|
||||
if($lastname == '')
|
||||
{
|
||||
/* Run away here. */
|
||||
Header('Location: ' . $phpgw->link('/addressbook/vcardout.php',
|
||||
"nolname=1&ab_id=$ab_id&start=$start&order=$order&filter=$filter&query=$query&sort=$sort&cat_id=$cat_id"));
|
||||
}
|
||||
if($firstname == '')
|
||||
{
|
||||
Header('Location: ' . $phpgw->link('/addressbook/vcardout.php',
|
||||
"nofname=1&ab_id=$ab_id&start=$start&order=$order&filter=$filter&query=$query&sort=$sort&cat_id=$cat_id"));
|
||||
}
|
||||
|
||||
if ($email)
|
||||
{
|
||||
$fn = explode('@',$email);
|
||||
$filename = sprintf("%s.vcf", $fn[0]);
|
||||
}
|
||||
elseif ($hemail)
|
||||
{
|
||||
$fn = explode('@',$hemail);
|
||||
$filename = sprintf("%s.vcf", $fn[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$fn = strtolower($firstname);
|
||||
$filename = sprintf("%s.vcf", $fn);
|
||||
}
|
||||
|
||||
// create vcard object
|
||||
$vcard = CreateObject('phpgwapi.vcard');
|
||||
// set translation variable
|
||||
$myexport = $vcard->export;
|
||||
// check that each $fields exists in the export array and
|
||||
// set a new array to equal the translation and original value
|
||||
while( list($name,$value) = each($fields) )
|
||||
{
|
||||
if ($myexport[$name] && ($value != "") )
|
||||
{
|
||||
//echo '<br>'.$name."=".$fields[$name]."\n";
|
||||
$buffer[$myexport[$name]] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
// create a vcard from this translated array
|
||||
$entry = $vcard->out($buffer);
|
||||
// print it using browser class for headers
|
||||
// filename, mimetype, no length, default nocache True
|
||||
$phpgw->browser->content_header($filename,'text/x-vcard');
|
||||
echo $entry;
|
||||
$phpgw->common->exit;
|
||||
} /* !nolname && !nofname */
|
||||
|
||||
if($nofname)
|
||||
{
|
||||
echo '<br><br><center>';
|
||||
echo lang("This person's first name was not in the address book.") .'<br>';
|
||||
echo lang('Vcards require a first name entry.') . '<br><br>';
|
||||
echo '<a href="' . $phpgw->link('/addressbook/index.php',
|
||||
"order=$order&start=$start&filter=$filter&query=$query&sort=$sort&cat_id=$cat_id") . '">' . lang('OK') . '</a>';
|
||||
echo '</center>';
|
||||
}
|
||||
|
||||
if($nolname)
|
||||
{
|
||||
echo '<br><br><center>';
|
||||
echo lang("This person's last name was not in the address book.") . '<br>';
|
||||
echo lang('Vcards require a last name entry.') . '<br><br>';
|
||||
echo '<a href="' . $phpgw->link('/addressbook/index.php',
|
||||
"order=$order&start=$start&filter=$filter&query=$query&sort=$sort&cat_id=$cat_id") . '">' . lang('OK') . '</a>';
|
||||
echo '</center>';
|
||||
}
|
||||
|
||||
if($nolname || $nofname)
|
||||
{
|
||||
$phpgw->common->phpgw_footer();
|
||||
}
|
||||
?>
|
@ -1,321 +0,0 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* phpGroupWare - addressbook *
|
||||
* http://www.phpgroupware.org *
|
||||
* Written by Joseph Engo <jengo@phpgroupware.org> *
|
||||
* -------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
$phpgw_info['flags'] = array(
|
||||
'noheader' => True,
|
||||
'nonavbar' => True,
|
||||
'currentapp' => 'addressbook',
|
||||
'enable_contacts_class' => True,
|
||||
'enable_nextmatchs_class' => True
|
||||
);
|
||||
|
||||
include('../header.inc.php');
|
||||
|
||||
$contacts = CreateObject("phpgwapi.contacts");
|
||||
|
||||
// First, make sure they have permission to this entry
|
||||
$check = addressbook_read_entry($ab_id,array('owner' => 'owner'));
|
||||
$perms = $contacts->check_perms($contacts->grants[$check[0]['owner']],PHPGW_ACL_READ);
|
||||
|
||||
if ( (!$perms) && ($check[0]['owner'] != $phpgw_info['user']['account_id']) )
|
||||
{
|
||||
Header("Location: "
|
||||
. $phpgw->link('/addressbook/index.php',"cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id"));
|
||||
$phpgw->common->phpgw_exit();
|
||||
}
|
||||
|
||||
if (!$ab_id)
|
||||
{
|
||||
Header("Location: " . $phpgw->link('/addressbook/index.php'));
|
||||
}
|
||||
elseif (!$submit && $ab_id)
|
||||
{
|
||||
$phpgw->common->phpgw_header();
|
||||
echo parse_navbar();
|
||||
}
|
||||
|
||||
$t = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
|
||||
$t->set_file(array('view_t' => 'view.tpl'));
|
||||
$t->set_block('view_t','view_header','view_header');
|
||||
$t->set_block('view_t','view_row','view_row');
|
||||
$t->set_block('view_t','view_footer','view_footer');
|
||||
$t->set_block('view_t','view_buttons','view_buttons');
|
||||
|
||||
$customfields = array();
|
||||
while (list($col,$descr) = @each($phpgw_info['user']['preferences']['addressbook']))
|
||||
{
|
||||
if ( substr($col,0,6) == 'extra_' )
|
||||
{
|
||||
$field = ereg_replace('extra_','',$col);
|
||||
$field = ereg_replace(' ','_',$field);
|
||||
$customfields[$field] = ucfirst($field);
|
||||
}
|
||||
}
|
||||
|
||||
while ($column = each($contacts->stock_contact_fields))
|
||||
{
|
||||
if (isset($phpgw_info['user']['preferences']['addressbook'][$column[0]]) &&
|
||||
$phpgw_info['user']['preferences']['addressbook'][$column[0]])
|
||||
{
|
||||
$columns_to_display[$column[0]] = True;
|
||||
$colname[$column[0]] = $column[0];
|
||||
}
|
||||
}
|
||||
|
||||
// No prefs?
|
||||
if (!$columns_to_display )
|
||||
{
|
||||
$columns_to_display = array(
|
||||
'n_given' => 'n_given',
|
||||
'n_family' => 'n_family',
|
||||
'org_name' => 'org_name',
|
||||
'tel_work' => 'tel_work',
|
||||
'tel_home' => 'tel_home',
|
||||
'email' => 'email',
|
||||
'email_home' => 'email_home'
|
||||
);
|
||||
while ($column = each($columns_to_display))
|
||||
{
|
||||
$colname[$column[0]] = $column[1];
|
||||
}
|
||||
$noprefs = " - " . lang('Please set your preferences for this app');
|
||||
}
|
||||
|
||||
// merge in extra fields
|
||||
$extrafields = array(
|
||||
'ophone' => 'ophone',
|
||||
'address2' => 'address2',
|
||||
'address3' => 'address3'
|
||||
);
|
||||
$qfields = $contacts->stock_contact_fields + $extrafields + $customfields;
|
||||
|
||||
$fields = addressbook_read_entry($ab_id,$qfields);
|
||||
|
||||
$record_owner = $fields[0]['owner'];
|
||||
|
||||
if ($fields[0]["access"] == 'private')
|
||||
{
|
||||
$access_check = lang('private');
|
||||
}
|
||||
else
|
||||
{
|
||||
$access_check = lang('public');
|
||||
}
|
||||
|
||||
$t->set_var('lang_viewpref',lang("Address book - view") . $noprefs);
|
||||
|
||||
@reset($qfields);
|
||||
while (list($column,$null) = @each($qfields)) // each entry column
|
||||
{
|
||||
if(display_name($colname[$column]))
|
||||
{
|
||||
$t->set_var('display_col',display_name($colname[$column]));
|
||||
}
|
||||
elseif(display_name($column))
|
||||
{
|
||||
$t->set_var('display_col',display_name($column));
|
||||
}
|
||||
else
|
||||
{
|
||||
$t->set_var('display_col',ucfirst($column));
|
||||
}
|
||||
$ref = $data = "";
|
||||
if ($fields[0][$column])
|
||||
{
|
||||
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
|
||||
$t->set_var('th_bg',$tr_color);
|
||||
$coldata = $fields[0][$column];
|
||||
// Some fields require special formatting.
|
||||
if ( ($column == 'note' || $column == 'pubkey') && $coldata )
|
||||
{
|
||||
$datarray = explode ("\n",$coldata);
|
||||
if ($datarray[1])
|
||||
{
|
||||
while (list($key,$info) = each ($datarray))
|
||||
{
|
||||
if ($key)
|
||||
{
|
||||
$data .= '</td></tr><tr bgcolor="'.$tr_color.'"><td width="30%"> </td><td width="70%">' .$info;
|
||||
}
|
||||
else
|
||||
{ // First row, don't close td/tr
|
||||
$data .= $info;
|
||||
}
|
||||
}
|
||||
$data .= "</tr>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$data = $coldata;
|
||||
}
|
||||
}
|
||||
elseif($column == 'label' && $coldata)
|
||||
{
|
||||
$data .= $contacts->formatted_address($fields[0]['id'],'',False);
|
||||
}
|
||||
elseif ($column == "url" && $coldata)
|
||||
{
|
||||
$ref = '<a href="' . $coldata . '" target="_new">';
|
||||
$data = $coldata . '</a>';
|
||||
}
|
||||
elseif ( (($column == "email") || ($column == "email_home")) && $coldata)
|
||||
{
|
||||
if ($phpgw_info["user"]["apps"]["email"])
|
||||
{
|
||||
$ref='<a href="' . $phpgw->link("/email/compose.php","to="
|
||||
. urlencode($coldata)) . '" target="_new">';
|
||||
}
|
||||
else
|
||||
{
|
||||
$ref = '<a href="mailto:'.$coldata.'">';
|
||||
}
|
||||
$data = $coldata."</a>";
|
||||
}
|
||||
else
|
||||
{ // But these do not
|
||||
$ref = ""; $data = $coldata;
|
||||
}
|
||||
|
||||
if (!$data)
|
||||
{
|
||||
$t->set_var('ref_data'," ");
|
||||
}
|
||||
else
|
||||
{
|
||||
$t->set_var('ref_data',$ref . $data);
|
||||
}
|
||||
$t->parse('cols','view_row',True);
|
||||
}
|
||||
}
|
||||
// Following cleans up view_row, since we were only using it to fill {cols}
|
||||
$t->set_var('view_row','');
|
||||
|
||||
$fields['cat_id'] = is_array($cat_id) ? implode(',',$cat_id) : $cat_id;
|
||||
|
||||
$cat = CreateObject('phpgwapi.categories');
|
||||
$cats = explode(',',$fields[0]['cat_id']);
|
||||
if ($cats[1])
|
||||
{
|
||||
while (list($key,$contactscat) = each($cats))
|
||||
{
|
||||
if ($contactscat)
|
||||
{
|
||||
$catinfo = $cat->return_single($contactscat);
|
||||
$catname .= $catinfo[0]['name'] . '; ';
|
||||
}
|
||||
}
|
||||
if (!$cat_id)
|
||||
{
|
||||
$cat_id = $cats[0];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$fields[0]['cat_id'] = ereg_replace(',','',$fields[0]['cat_id']);
|
||||
$catinfo = $cat->return_single($fields[0]['cat_id']);
|
||||
$catname = $catinfo[0]['name'];
|
||||
if (!$cat_id)
|
||||
{
|
||||
$cat_id = $fields[0]['cat_id'];
|
||||
}
|
||||
}
|
||||
|
||||
if (!$catname) { $catname = lang('none'); }
|
||||
|
||||
// These are in the footer
|
||||
$t->set_var('lang_owner',lang('Record owner'));
|
||||
$t->set_var('owner',$phpgw->common->grab_owner_name($record_owner));
|
||||
$t->set_var('lang_access',lang("Record access"));
|
||||
$t->set_var('access',$access_check);
|
||||
$t->set_var('lang_category',lang('Category'));
|
||||
$t->set_var('catname',$catname);
|
||||
|
||||
$sfields = rawurlencode(serialize($fields[0]));
|
||||
|
||||
function html_input_hidden($vars)
|
||||
{
|
||||
if (!is_array($vars)) { return ''; }
|
||||
while (list($name,$value) = each($vars))
|
||||
{
|
||||
if ($value != '') // dont need to send all the empty vars
|
||||
{
|
||||
$html .= "<input type=hidden name=\"$name\" value=\"$value\">\n";
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
function html_submit_button($name,$lang)
|
||||
{
|
||||
return "<input type=\"submit\" name=\"$name\" value=\"".lang($lang)."\">\n";
|
||||
}
|
||||
|
||||
function phpgw_link($url,$vars='')
|
||||
{
|
||||
global $phpgw;
|
||||
if (is_array( $vars ))
|
||||
{
|
||||
while(list($name,$value) = each($vars))
|
||||
{
|
||||
if ($value != '') // dont need to send all the empty vars
|
||||
{
|
||||
$v[] = "$name=$value";
|
||||
}
|
||||
}
|
||||
$vars = implode('&',$v);
|
||||
}
|
||||
return $phpgw->link($url,$vars);
|
||||
}
|
||||
|
||||
function html_1button_form($name,$lang,$hidden_vars,$url,$url_vars='',$method='POST')
|
||||
{
|
||||
$html = "<form method=\"$method\" action=\"".phpgw_link($url,$url_vars)."\">\n";
|
||||
$html .= html_input_hidden($hidden_vars);
|
||||
$html .= html_submit_button($name,$lang);
|
||||
$html .= "</form>\n";
|
||||
return $html;
|
||||
}
|
||||
|
||||
$common_vars = array('sort' => $sort,'order' => $order,'filter' => $filter,'start' => $start); // common vars for all buttons
|
||||
|
||||
if (($contacts->grants[$record_owner] & PHPGW_ACL_EDIT) || ($record_owner == $phpgw_info['user']['account_id']))
|
||||
{
|
||||
$extra_vars = array('cd' => 16,'query' => $query,'cat_id' => $cat_id);
|
||||
|
||||
if ($referer) $extra_vars += array( 'referer' => urlencode($referer));
|
||||
|
||||
$t->set_var('edit_button',html_1button_form('edit','Edit',array('ab_id' => $ab_id),'/addressbook/edit.php',
|
||||
$common_vars + $extra_vars));
|
||||
}
|
||||
$t->set_var('copy_button',html_1button_form('submit','copy',$common_vars+array( 'fields' => rawurlencode(serialize($fields[0]))),
|
||||
'/addressbook/add.php'));
|
||||
|
||||
if ($fields[0]['n_family'] && $fields[0]['n_given'])
|
||||
{
|
||||
$t->set_var('vcard_button',html_1button_form('VCardForm','VCard',$common_vars+array( 'ab_id' => $ab_id),'/addressbook/vcardout.php'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$t->set_var('vcard_button',lang('no vcard'));
|
||||
}
|
||||
|
||||
$t->set_var('done_button',html_1button_form('DoneForm','Done',$common_vars,
|
||||
$referer ? ereg_replace('/phpgroupware','',$referer) : '/addressbook/index.php',
|
||||
$common_vars + array('cd' => 16,'query' => $query)));
|
||||
$t->set_var('access_link',$access_link);
|
||||
|
||||
$t->pfp('out','view_t');
|
||||
|
||||
$phpgw->common->phpgw_footer();
|
||||
?>
|
Loading…
Reference in New Issue
Block a user