contact.php

来自「groupoffice」· PHP 代码 · 共 632 行 · 第 1/2 页

PHP
632 行
字号
	if (!$write_permission && !$GO_SECURITY->has_permission($GO_SECURITY->user_id, $contact["acl_read"])) {		Header("Location: ".$GO_CONFIG->host."error_docs/403.php");		exit ();	}	if (!$write_permission) {		$require = 'show_contact.inc';	}	$birthday = $contact['birthday'] > 0 ? db_date_to_date($contact['birthday']) : '';	$addressbook_id = isset ($_REQUEST['addressbook_id']) ? $_REQUEST['addressbook_id'] : $contact['addressbook_id'];}if (isset ($_REQUEST['user_id']) && $_REQUEST['user_id'] > 0) {	$contact = $GO_USERS->get_user($_REQUEST['user_id']);	if ($ab->user_is_contact($GO_SECURITY->user_id, $_REQUEST['user_id'])) {		$feedback = $contact_exist_warning;		$contact['source_id'] = "";	} else {		$contact['source_id'] = $_REQUEST['user_id'];	}	$contact['address_no'] = isset ($_REQUEST['address_no']) ? $_REQUEST['address_no'] : '';	$contact['comment'] = isset ($_REQUEST['comment']) ? $_REQUEST['comment'] : '';	$contact['company_name'] = $contact['company'];	$contact['company_id'] = $ab->get_company_id_by_name($contact['company'], $addressbook_id );	$contact['group_id'] = isset ($_REQUEST['group_id']) ? $_REQUEST['group_id'] : '';	$birthday = $contact['birthday'] > 0 ? db_date_to_date($contact['birthday']) : '';	$require = 'edit_contact.inc';	//}elseif (($contact_id == 0 || $task != '') && $task != 'save_custom_fields')}elseif ($contact_id == 0 || $task == 'save') {	$require = 'edit_contact.inc';;	$contact['first_name'] = isset ($_REQUEST['first_name']) ? smart_stripslashes($_REQUEST['first_name']) : '';	$contact['middle_name'] = isset ($_REQUEST['middle_name']) ? smart_stripslashes($_REQUEST['middle_name']) : '';	$contact['last_name'] = isset ($_REQUEST['last_name']) ? smart_stripslashes($_REQUEST['last_name']) : '';	$contact['initials'] = isset ($_REQUEST['initials']) ? smart_stripslashes($_REQUEST['initials']) : '';	$contact['title'] = isset ($_REQUEST['title']) ? smart_stripslashes($_REQUEST['title']) : '';	$contact['sex'] = isset ($_REQUEST['sex']) ? smart_stripslashes($_REQUEST['sex']) : 'M';	$birthday = isset ($_REQUEST['birthday']) ? smart_stripslashes($_REQUEST['birthday']) : '';	$contact['email'] = isset ($_REQUEST['email']) ? smart_stripslashes($_REQUEST['email']) : '';	$contact['email2'] = isset ($_REQUEST['email2']) ? smart_stripslashes($_REQUEST['email2']) : '';	$contact['email3'] = isset ($_REQUEST['email3']) ? smart_stripslashes($_REQUEST['email3']) : '';	$contact['work_phone'] = isset ($_REQUEST['work_phone']) ? smart_stripslashes($_REQUEST['work_phone']) : '';	$contact['home_phone'] = isset ($_REQUEST['home_phone']) ? smart_stripslashes($_REQUEST['home_phone']) : '';	$contact['fax'] = isset ($_REQUEST['fax']) ? smart_stripslashes($_REQUEST['fax']) : '';	$contact['work_fax'] = isset ($_REQUEST['work_fax']) ? smart_stripslashes($_REQUEST['work_fax']) : '';	$contact['cellular'] = isset ($_REQUEST['cellular']) ? smart_stripslashes($_REQUEST['cellular']) : '';	$contact['country'] = isset ($_REQUEST['country']) ? smart_stripslashes($_REQUEST['country']) : '';	$contact['state'] = isset ($_REQUEST['state']) ? smart_stripslashes($_REQUEST['state']) : '';	$contact['address'] = isset ($_REQUEST['address']) ? smart_stripslashes($_REQUEST['address']) : '';	$contact['address_no'] = isset ($_REQUEST['address_no']) ? smart_stripslashes($_REQUEST['address_no']) : '';	$contact['city'] = isset ($_REQUEST['city']) ? smart_stripslashes($_REQUEST['city']) : '';	$contact['zip'] = isset ($_REQUEST['zip']) ? smart_stripslashes($_REQUEST['zip']) : '';	if ($contact['zip'] != '' && $contact['address'] == '' && $contact['city'] == '' && $addressinfo = $ab->get_addressinfo($contact['zip'])) {		$contact['address'] = $addressinfo['street'];		$contact['city'] = $addressinfo['city'];	}	$contact['department'] = isset ($_REQUEST['department']) ? smart_stripslashes($_REQUEST['department']) : '';	$contact['function'] = isset ($_REQUEST['function']) ? smart_stripslashes($_REQUEST['function']) : '';	$contact['comment'] = isset ($_REQUEST['comment']) ? smart_stripslashes($_REQUEST['comment']) : '';	$contact['color'] = isset ($_REQUEST['color']) ? smart_stripslashes($_REQUEST['color']) : '000000';	$contact['source_id'] = isset ($_REQUEST['source_id']) ? $_REQUEST['source_id'] : '';	$contact['group_id'] = isset ($_REQUEST['group_id']) ? $_REQUEST['group_id'] : '';		if(isset($_REQUEST['company_id']) && !is_array($_REQUEST['company_id']))	{		$contact['company_id'] = $_REQUEST['company_id'];	}else	{		$contact['company_id'] = isset ($contact['company_id']) ? $contact['company_id'] : 0;	}}if ($task == 'update') {	$contact = $GO_USERS->get_user($contact['source_id']);	$contact["source_id"] = $_REQUEST['source_id'];	$contact['comment'] = $_REQUEST['comment'];	$contact['group_id'] = $_REQUEST['group_id'];	$contact['addressbook_id'] = $_REQUEST['addressbook_id'];	$contact['company_id'] = $_REQUEST['company_id'];	$contact['address_no'] = $_REQUEST['address_no'];	$birthday = $contact['birthday'] > 0 ? db_date_to_date($contact['birthday']) : '';}$birthday_picker = new date_picker('birthday', $_SESSION['GO_SESSION']['date_format'], $birthday);$GO_HEADER['head'] = $birthday_picker->get_header();$overlib = new overlib();$GO_HEADER['head'] .= $overlib->get_header();$form = new form('contact_form');//set this var if the user wants to ignore that a similar contact already exists.if(isset($ignore)){	$form->add_html_element(new input('hidden', 'ignore', 'true'));}$form->add_html_element(new input('hidden', 'source_id', $contact["source_id"]));$form->add_html_element(new input('hidden', 'task', '', false));$form->add_html_element(new input('hidden', 'close', 'false'));$form->add_html_element(new input('hidden', 'return_to', $return_to));$form->add_html_element(new input('hidden', 'link_back', $link_back));$form->add_html_element(new input('hidden', 'contact_id', $contact_id, false));$form->add_html_element(new input('hidden', 'goto_url', '', false));if (isset ($vcf_file)) {	$form->add_html_element(new input('hidden', 'vcf_file', $vcf_file));}if ($popup) {	$form->add_html_element(new input('hidden', 'popup', 'true'));}if (isset ($_REQUEST['return_contact_id'])) {	$form->add_html_element(new input('hidden', 'return_contact_id', '1'));}$title = $contact_id > 0 ? $ab_contact : $contacts_add;$menu = new button_menu();$tabstrip = new tabstrip('contact_tabstrip_'.$contact_id, $title, '120', 'contact_form', 'vertical');$tabstrip->set_attribute('style', 'width:100%');$tabstrip->set_return_to($return_to);$active_tab = isset ($_REQUEST['active_tab']) ? $_REQUEST['active_tab'] : null;if (isset ($active_tab)) {	$tabstrip->set_active_tab($active_tab);}if ($contact_id > 0) {			$tabstrip->add_tab('profile', $contact_profile);	if ($contact['email'] != '') {		$middle_name = $contact['middle_name'] == '' ? '' : $contact['middle_name'].' ';		$name = $contact['first_name'].' '.$middle_name.$contact['last_name'];		$full_email = '"'.$name.'" <'.$contact['email'].'>';				$menu->add_button('ab_email', $ab_send_message, get_mail_to_href(addslashes($full_email), $contact_id));					if (isset ($GO_MODULES->modules['email']) && $GO_MODULES->modules['email']['read_permission']) {			$menu->add_button('ml_search', $ab_search_sender, 				$GO_MODULES->modules['email']['url'].'index.php?task=set_search_query&from='.$contact['email'].'&return_to='.urlencode($link_back));			}	}	if ($templates_plugin) {		if ($tp->has_oo_templates($GO_SECURITY->user_id)) {			$menu->add_button('new_letter', $ab_oo_doc, 				"javascript:popup('".$GO_MODULES->url.'templates/download_oo_template.php?contact_id='.$contact_id."','','');");			}		if ($contact['email'] != '' && $tp->get_mailing_groups($GO_SECURITY->user_id) && $write_permission) {			$tabstrip->add_tab('mailings', $ab_mailings);		}	}	$projects_module = isset ($GO_MODULES->modules['projects']) ? $GO_MODULES->modules['projects'] : false;	$notes_module = isset ($GO_MODULES->modules['notes']) ? $GO_MODULES->modules['notes'] : false;	$calendar_module = isset ($GO_MODULES->modules['calendar']) ? $GO_MODULES->modules['calendar'] : false;	$todos_module = isset ($GO_MODULES->modules['todos']) ? $GO_MODULES->modules['todos'] : false;	if ($write_permission) {		if ($projects_module && $projects_module['read_permission']) {						$menu->add_button('pr_new_project', $strNewProject, 				'javascript:activate_linking(\''.$projects_module['url'].'project.php?contact_id='.					$contact_id.'&return_to='.rawurlencode($link_back).'\');');					}		if ($notes_module && $notes_module['read_permission']) {			$menu->add_button('ab_notes', $strNewNote, 				'javascript:activate_linking(\''.$notes_module['url'].'note.php?contact_id='.$contact_id.'&return_to='.rawurlencode($link_back).'\');');					}		if ($calendar_module && $calendar_module['read_permission']) {			$menu->add_button('cal_compose', $strNewEvent, 				'javascript:activate_linking(\''.$calendar_module['url'].'index.php?contact_id='.$contact_id.'&link_back='.rawurlencode($link_back).'\');');					if ($todos_module && $todos_module['read_permission']) {				$menu->add_button(					'todos_new', 					$strNewTodo,					'javascript:activate_linking(\''.$GO_MODULES->modules['calendar']['url'].						'event.php?todo=1&contact_id='.$contact_id.'&return_to='.rawurlencode($link_back).'\');'				);				}		}		if (isset($GO_MODULES->modules['filesystem']) && 			$GO_MODULES->modules['filesystem']['read_permission']) {				$menu->add_button(					'upload', 					$strUpload, 					'javascript:activate_linking(\''.$GO_MODULES->modules['filesystem']['url'].						'?return_to='.rawurlencode($link_back).'\');'					);			}	}	$tabstrip->add_tab('links', $strLinks);	if(isset($GO_MODULES->modules['custom_fields']))	{		require_once($GO_MODULES->modules['custom_fields']['class_path'].'custom_fields.class.inc');		$cf = new custom_fields();				if($cf->get_authorized_categories(2, $GO_SECURITY->user_id))		{			while($cf->next_record())			{				$tabstrip->add_tab($cf->f('id'), $cf->f('name'));			}		}	}		if($GO_LINKS->get_active_link())	{		$menu->add_button('link', $strCreateLink, "javascript:document.contact_form.task.value='create_link';document.contact_form.submit();");	}else	{		$menu->add_button('link', $strCreateLink, "javascript:activate_linking('');");	}		if($tabstrip->get_active_tab_id() == 'links')	{		$links_list = new links_list($contact['link_id'], 'contact_form', $link_back);			$GO_HEADER['head'] .= $links_list->get_header();					$menu->add_button(			'unlink', 			$cmdUnlink, 			$links_list->get_unlink_handler());						$menu->add_button(			'delete_big', 			$cmdDelete, 			$links_list->get_delete_handler());	}}if($tabstrip->get_active_tab_id() == 'profile' || $tabstrip->get_active_tab_id() == ''){	$GO_HEADER['body_arguments'] = 'onload="document.contact_form.first_name.focus();"';}require_once ($GO_THEME->theme_path."header.inc");$form->add_html_element($menu);if ($tabstrip->get_active_tab_id() > 0) {	$catagory_id = $tabstrip->get_active_tab_id();	$active_tab_id = 'custom_fields';} else {	$active_tab_id = $tabstrip->get_active_tab_id();}switch ($active_tab_id) {	case 'mailings' :		require_once ($templates_plugin['path'].'mailing_groups.inc');		break;	case 'custom_fields' :			$form->add_html_element(new input('hidden', 'link_id', $contact['link_id']));			if($cf_table = $cf->get_fields_table($tabstrip->get_active_tab_id(), $contact['link_id']))			{				$tabstrip->add_html_element($cf_table);								if ($write_permission) {					$tabstrip->add_html_element(new button($cmdOk, "javascript:_save('save_custom_fields', 'true');"));					$tabstrip->add_html_element(new button($cmdApply, "javascript:_save('save_custom_fields', 'false')"));								}						}			$tabstrip->add_html_element(new button($cmdClose, "javascript:document.location='".$return_to."';"));		break;	case 'links' :			$tabstrip->add_html_element($links_list);		break;	default :		if ($vcard_count > 0 && $contact_id == 0) {			if ($record = $vcard->get_vcard_contact(0)) {				$contact = $record['contact'];				$contact['addressbook_id'] = $addressbook_id;				$birthday = !empty ($contact['birthday']) ? date("d-m-Y", strtotime($contact['birthday'])) : "";			}		}		require_once ($require);		break;}$form->add_html_element($tabstrip);echo $form->get_html();?><script type="text/javascript" language="javascript">function _save(task, close){	document.forms[0].close.value=close;	document.forms[0].task.value=task;	document.forms[0].submit();}function activate_linking(goto_url){	document.contact_form.goto_url.value=goto_url;	document.contact_form.task.value='activate_linking';	document.contact_form.submit();}</script><?phprequire_once ($GO_THEME->theme_path."footer.inc");?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?