/** * Send user a nofication or approve request * * @param string $user Usersame * @param string $title Title of notification * @param string $body Content of notification * * @return boolean */ public function sendNotification($user, $title, $body) { $to = Folks::getUserEmail($user); if ($to instanceof PEAR_Error) { return $to; } $result = Folks::sendMail($to, $title, $body); if ($result instanceof PEAR_Error) { return $result; } if (!$GLOBALS['registry']->hasInterface('letter')) { return true; } return $GLOBALS['registry']->callByPackage('letter', 'sendMessage', array($user, array('title' => $title, 'content' => $body))); }
/* Validate the form. */ if ($form->validate()) { $form->getInfo(null, $info); /* Get user email. */ $email = Folks::getUserEmail($info['username']); if ($email instanceof PEAR_Error) { $notification->push($email); throw new Horde_Exception_AuthenticationFailure(); } /* Check the given values with the prefs stored ones. */ if (!empty($answer) && Horde_String::lower($answer) == Horde_String::lower($info['security_answer']) || empty($answer)) { /* Info matches, so reset the password. */ $password = $auth->resetPassword($info['username']); if ($password instanceof PEAR_Error) { $notification->push($password); throw new Horde_Exception_AuthenticationFailure(); } $body = sprintf(_("Your new password for %s is: %s. \n\n It was requested by %s on %s"), $registry->get('name', 'horde'), $password, $_SERVER['REMOTE_ADDR'], date('Ymd H:i:s')); Folks::sendMail($email, _("Your password has been reset"), $body); $notification->push(sprintf(_("Your password has been reset, check your email (%s) and log in with your new password."), $email), 'horde.success'); throw new Horde_Exception_AuthenticationFailure(); } else { /* Info submitted does not match what is in prefs, redirect user back * to login. */ $notification->push(_("Could not reset the password for the requested user. Some or all of the details are not correct. Try again or contact your administrator if you need further help."), 'horde.error'); } } $page_output->header(array('title' => $title)); require FOLKS_TEMPLATES . '/menu.inc'; require FOLKS_TEMPLATES . '/login/signup.php'; $page_output->footer();
* See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.horde.org/licenses/lgpl21. * * @author Duck <*****@*****.**> */ require_once __DIR__ . '/tabs.php'; $vars = Horde_Variables::getDefaultVariables(); $title = _("Forgot your username?"); $form = new Horde_Form($vars, $title); $form->setButtons(_("Send me my username")); $form->addVariable(_("Your email"), 'email', 'email', true); /* Validate the form. */ if ($form->validate()) { $form->getInfo(null, $info); $users = $folks_driver->getUsers(array('email' => $info['email'])); if ($users instanceof PEAR_Error) { $notification->push($users); } elseif (empty($users) || count($users) != 1) { $notification->push(_("Could not find any username with this email."), 'horde.warning'); } else { $users = current($users); $body = sprintf(_("Your username on %s %s is: %s. \n\n It was requested by %s on %s"), $registry->get('name', 'horde'), Horde::url($registry->get('webroot', 'horde'), true), $users['user_uid'], $_SERVER['REMOTE_ADDR'], date('Ymd H:i:s')); Folks::sendMail($info['email'], _("Your username was requested"), $body); $notification->push(sprintf(_("Your username was sent, check your email (%s)."), $users['user_email']), 'horde.success'); throw new Horde_Exception_AuthenticationFailure(); } } $page_output->header(array('title' => $title)); require FOLKS_TEMPLATES . '/menu.inc'; require FOLKS_TEMPLATES . '/login/signup.php'; $page_output->footer();
require_once FOLKS_BASE . '/lib/Friends.php'; $friends = Folks_Friends::singleton(); // Manage adding groups $form = new Horde_Form($vars, $title, 'invite'); $form->addVariable(_("Friend's e-mail"), 'email', 'email', true); $v =& $form->addVariable(_("Subject"), 'subject', 'text', true); $v->setDefault(sprintf(_("%s Invited to join %s."), ucfirst($GLOBALS['registry']->getAuth()), $registry->get('name', 'horde'))); $v =& $form->addVariable(_("Body"), 'body', 'longtext', true); try { $body = Horde::loadConfiguration('invite.php', 'body', 'folks'); $body = sprintf($body, $registry->get('name', 'horde'), Folks::getUrlFor('user', $GLOBALS['registry']->getAuth(), true), Horde::url('account/signup.php', true), $GLOBALS['registry']->getAuth()); } catch (Horde_Exception $e) { $body = $body->getMessage(); } $v->setDefault($body); if ($form->validate()) { $form->getInfo(null, $info); $result = Folks::sendMail($info['email'], $info['subject'], $info['body']); if ($result instanceof PEAR_Error) { $notification->push($result); } else { $notification->push(sprintf(_("Friend \"%s\" was invited to join %s."), $info['email'], $registry->get('name', 'horde')), 'horde.success'); } } $page_output->header(array('title' => $title)); require FOLKS_TEMPLATES . '/menu.inc'; echo $tabs->render('friends'); require FOLKS_TEMPLATES . '/edit/header.php'; require FOLKS_TEMPLATES . '/edit/invite.php'; require FOLKS_TEMPLATES . '/edit/footer.php'; $page_output->footer();