/** @deprecated */ function clash_cancel(w2p_Core_CAppUI $AppUI) { trigger_error(__FUNCTION__ . " has been deprecated in v3.2 and will be removed in v5.0. There is no replacement.", E_USER_NOTICE); $AppUI->redirect('m=events'); }
$updatekey = preg_replace("/[^A-Za-z0-9]/", "", $updatekey); $contact_id = CContact::getContactByUpdatekey($updatekey); $company_id = intval(w2PgetParam($_REQUEST, 'company_id', 0)); $company_name = w2PgetParam($_REQUEST, 'company_name', null); // check permissions for this record if (!$contact_id) { echo $AppUI->_('You are not authorized to use this page. If you should be authorized please contact') . ' ' . $w2Pconfig['company_name'] . ' ' . $AppUI->_('to give you another valid link, thank you.'); exit; } // load the record data $msg = ''; $row = new CContact(); if (!$row->load($contact_id) && $contact_id > 0) { $AppUI->setMsg('Contact'); $AppUI->setMsg('invalidID', UI_MSG_ERROR, true); $AppUI->redirect(); } else { //TODO: replace with the proper canEdit() if ($row->contact_private && $row->contact_owner != $AppUI->user_id && $row->contact_owner && $contact_id != 0) { // check only owner can edit $AppUI->redirect(ACCESS_DENIED); } } // setup the title block $ttl = $contact_id > 0 ? 'Edit Contact' : 'Add Contact'; $company_detail = $row->getCompanyDetails(); $dept_detail = $row->getDepartmentDetails(); if ($contact_id == 0 && $company_id > 0) { $company_detail['company_id'] = $company_id; $company_detail['company_name'] = $company_name; echo $company_name;
} $email = w2PgetParam($_POST, 'contact_email', 0); $contact = new CContact(); $result = $contact->loadAll(null, "contact_email = '{$email}'"); if (count($result)) { header('Location: newuser.php?msg=existing-email'); } if (!$user->bind($_POST)) { $AppUI->setMsg($user->getError(), UI_MSG_ERROR); header('Location: newuser.php?msg=user'); } if (!$contact->bind($_POST)) { $AppUI->setMsg($contact->getError(), UI_MSG_ERROR); header('Location: newuser.php?msg=contact'); } $result = $contact->store(); if (count($contact->getError())) { header('Location: newuser.php?msg=contact'); } else { $user->user_contact = $contact->contact_id; $result = $user->store(null, true); if (count($user->getError())) { header('Location: newuser.php?msg=user'); } else { notifyNewExternalUser($contact->contact_email, $contact->contact_first_name, $user->user_username, $_POST['user_password']); notifyHR(w2PgetConfig('admin_email', '*****@*****.**'), 'w2P System Human Resources', $contact->contact_email, $contact->contact_first_name, $user->user_username, $_POST['user_password'], $user->user_id); $AppUI->setMsg('The User Administrator has been notified to grant you access to the system and an email message was sent to you with your login info. Thank you.', UI_MSG_OK); } } $AppUI->redirect();
$updatekey = w2PgetParam($_GET, 'updatekey', 0); $contact_id = CContact::getContactByUpdatekey($updatekey); $company_id = intval(w2PgetParam($_REQUEST, 'company_id', 0)); $company_name = w2PgetParam($_REQUEST, 'company_name', null); // check permissions for this record if (!$contact_id) { echo $AppUI->_('You are not authorized to use this page. If you should be authorized please contact') . ' ' . $w2Pconfig['company_name'] . ' ' . $AppUI->_('to give you another valid link, thank you.'); exit; } // load the record data $msg = ''; $row = new CContact(); if (!$row->load($contact_id) && $contact_id > 0) { $AppUI->setMsg('Contact'); $AppUI->setMsg('invalidID', UI_MSG_ERROR, true); $AppUI->redirect(); } else { if ($row->contact_private && $row->contact_owner != $AppUI->user_id && $row->contact_owner && $contact_id != 0) { // check only owner can edit $AppUI->redirect('m=public&a=access_denied'); } } $df = $AppUI->getPref('SHDATEFORMAT'); $df .= ' ' . $AppUI->getPref('TIMEFORMAT'); // setup the title block $ttl = $contact_id > 0 ? 'Edit Contact' : 'Add Contact'; $company_detail = $row->getCompanyDetails(); $dept_detail = $row->getDepartmentDetails(); if ($contact_id == 0 && $company_id > 0) { $company_detail['company_id'] = $company_id; $company_detail['company_name'] = $company_name;