<?php /* ADMIN $Id: do_user_aed.php,v 1.13 2005/03/11 00:46:46 gregorerhardt Exp $ */ include $AppUI->getModuleClass('contacts'); $del = isset($_REQUEST['del']) ? $_REQUEST['del'] : FALSE; $obj = new CUser(); $contact = new CContact(); if (!$obj->bind($_POST)) { $AppUI->setMsg($obj->getError(), UI_MSG_ERROR); $AppUI->redirect(); } if (!$contact->bind($_POST)) { $AppUI->setMsg($contact->getError(), UI_MSG_ERROR); $AppUI->redirect(); } // prepare (and translate) the module name ready for the suffix $AppUI->setMsg('User'); // !User's contact information not deleted - left for history. if ($del) { if ($msg = $obj->delete()) { $AppUI->setMsg($msg, UI_MSG_ERROR); $AppUI->redirect(); } else { $AppUI->setMsg("deleted", UI_MSG_ALERT, true); $AppUI->redirect('', -1); } return; } $isNewUser = !$_REQUEST['user_id']; if ($isNewUser) { // check if a user with the param Username already exists
<?php /* CONTACTS $Id: do_contact_aed.php 5872 2009-04-25 00:09:56Z merlinyoda $ */ if (!defined('DP_BASE_DIR')) { die('You should not access this file directly.'); } $obj = new CContact(); $msg = ''; if (!$obj->bind($_POST)) { $AppUI->setMsg($obj->getError(), UI_MSG_ERROR); $AppUI->redirect(); } $del = dPgetParam($_POST, 'del', 0); // prepare (and translate) the module name ready for the suffix $AppUI->setMsg('Contact'); if ($del) { if ($msg = $obj->delete()) { $AppUI->setMsg($msg, UI_MSG_ERROR); $AppUI->redirect(); } else { $AppUI->setMsg("deleted", UI_MSG_ALERT, true); $AppUI->redirect("m=contacts"); } } else { $isNotNew = @$_POST['contact_id']; if ($msg = $obj->store()) { $AppUI->setMsg($msg, UI_MSG_ERROR); } else { $AppUI->setMsg($isNotNew ? 'updated' : 'added', UI_MSG_OK, true); } $AppUI->redirect();
$result = $user->loadAll(null, "user_username = '******'"); if (count($result)) { header('Location: newuser.php?msg=existing-user'); } $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); }