} elseif (!empty($_POST['resetPassword'])) { // TODO -- visit this function later // Check if a reset password request has been received // check that captcha matched if (!isset($_POST['captcha'])) { // generate captcha $captcha = substr(md5(rand()), 0, 4); $smarty->assign('captcha', $captcha); } elseif ($_POST['captcha'] == $_POST['realdeal']) { // user inputted captcha matched. Reset password Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/pending.php'); Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/messages.php'); // see if there is already a pending request for the administrator [subscriber id == 0] if (PommoPending::isPending(0)) { $input = urlencode(serialize(array('adminID' => TRUE, 'Email' => $pommo->_config['admin_email']))); Pommo::redirect($pommo->_http . $pommo->_baseUrl . 'user/pending.php?input=' . $input); } // create a password change request, send confirmation mail $subscriber = array('id' => 0); $code = PommoPending::add($subscriber, 'password'); PommoHelperMessages::sendMessage(array('to' => $pommo->_config['admin_email'], 'code' => $code, 'type' => 'password')); $smarty->assign('captcha', FALSE); } else { // captcha did not match $logger->addMsg(Pommo::_T('Captcha did not match. Try again.')); } } // referer (used to return user to requested page upon login success) $smarty->assign('referer', isset($_REQUEST['referer']) ? $_REQUEST['referer'] : $pommo->_baseUrl . 'admin/admin.php'); $smarty->display('index.tpl'); die;
$smarty->assign('d', $subscriber['data']); } // check for an update + validate new subscriber info (also converts dates to ints) if (!empty($_POST['update']) && PommoValidate::subscriberData($_POST['d'])) { $newsub = array('id' => $subscriber['id'], 'email' => $subscriber['email'], 'data' => $_POST['d']); if (!empty($_POST['newemail'])) { // if change in email, validate and send confirmation of update if ($_POST['newemail'] != $_POST['newemail2']) { $logger->addErr(Pommo::_T('Emails must match.')); } elseif (!PommoHelper::isEmail($_POST['newemail'])) { $logger->addErr(Pommo::_T('Invalid Email Address')); } elseif (PommoHelper::isDupe($_POST['newemail'])) { $logger->addMsg(Pommo::_T('Email address already exists. Duplicates are not allowed.')); } else { $newsub['email'] = $_POST['newemail']; $code = PommoPending::add($newsub, 'change'); if (!$code) { die('Failed to Generate Pending Subscriber Code'); } Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/messages.php'); PommoHelperMessages::sendMessage(array('to' => $newsub['email'], 'code' => $code, 'type' => 'update')); if (isset($notices['update']) && $notices['update'] == 'on') { PommoHelperMessages::notify($notices, $newsub, 'update'); } } } elseif (!PommoSubscriber::update($newsub, 'REPLACE_ACTIVE')) { $logger->addErr('Error updating subscriber.'); } else { // update successful $logger->addMsg(Pommo::_T('Your records have been updated.')); Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/messages.php');