// | | // | Free Software Foundation, Inc. | // | 51 Franklin Street, Suite 330 | // | Boston, MA 02110-1301, USA. | // +----------------------------------------------------------------------+ // | Authors: Dave Anderson <*****@*****.**> | // +----------------------------------------------------------------------+ require_once dirname(__FILE__) . '/../../init.php'; $tpl = new Template_Helper(); $tpl->setTemplate('manage/email_alias.tpl.html'); Auth::checkAuthentication(APP_COOKIE, null, true); $role_id = Auth::getCurrentRole(); if ($role_id < User::getRoleID('manager')) { $tpl->setTemplate('permission_denied.tpl.html'); $tpl->displayTemplate(); exit; } $usr_id = $_REQUEST['id']; if (@$_POST['cat'] == 'save') { $res = User::addAlias($usr_id, trim($_POST['alias'])); Misc::mapMessages($res, array(true => array(ev_gettext('Thank you, the alias was added successfully.'), Misc::MSG_INFO), false => array(ev_gettext('An error occurred while trying to add the alias.'), Misc::MSG_ERROR))); } elseif (@$_POST['cat'] == 'remove') { foreach ($_POST['item'] as $aliastmp) { $res = User::removeAlias($usr_id, $aliastmp); } Misc::mapMessages($res, array(true => array(ev_gettext('Thank you, the alias was removed successfully.'), Misc::MSG_INFO), false => array(ev_gettext('An error occurred while trying to remove the alias.'), Misc::MSG_ERROR))); } $tpl->assign('list', User::getAliases($usr_id)); $tpl->assign('username', User::getFullName($usr_id)); $tpl->assign('id', $usr_id); $tpl->displayTemplate();
private function updateAliases($usr_id, $aliases) { foreach ($aliases as $alias) { User::addAlias($usr_id, $alias); } }