// generate captcha $captcha = substr(md5(rand()), 0, 4); $view->assign('captcha', $captcha); } elseif ($_POST['captcha'] == $_POST['realdeal']) { // user inputted captcha matched. Reset password require_once Pommo::$_baseDir . 'classes/Pommo_Pending.php'; require_once Pommo::$_baseDir . 'classes/Pommo_Helper_Messages.php'; // see if there is already a pending request for the administrator // [subscriber id == 0] if (Pommo_Pending::isPending(0)) { $input = urlencode(serialize(array('adminID' => TRUE, 'Email' => Pommo::$_config['admin_email']))); Pommo::redirect(Pommo::$_http . Pommo::$_baseUrl . 'pending.php?input=' . $input); } // create a password change request, send confirmation mail $subscriber = array('id' => 0); $code = Pommo_Pending::add($subscriber, 'password'); Pommo_Helper_Messages::sendMessage(array('to' => Pommo::$_config['admin_email'], 'code' => $code, 'type' => 'password')); $view->assign('captcha', FALSE); } else { // captcha did not match $logger->addMsg(Pommo::_T('Captcha did not match. Try again.')); } } elseif (!Pommo::$_hasConfigFile && $_POST['configure']) { // Try to connect to database with data entered from the user. // I am not using /inc/classes/db.php because it kills the proccess when // connection is not possible // TODO: db.php shouldnt kill the process $link = @mysql_connect($_POST['dbhost'], $_POST['dbuser'], $_POST['dbpass']); if (!$link) { // Could not connect $configErrors[] = 'Could not connect to host. Check your settings
$view->assign('d', $subscriber['data']); } // check for an update + validate new subscriber info (also converts dates to ints) if (!empty($_POST['update']) && Pommo_Validate::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 (!Pommo_Helper::isEmail($_POST['newemail'])) { $logger->addErr(Pommo::_T('Invalid Email Address')); } elseif (Pommo_Helper::isDupe($_POST['newemail'])) { $logger->addMsg(Pommo::_T('Email address already exists. Duplicates are not allowed.')); } else { $newsub['email'] = $_POST['newemail']; $code = Pommo_Pending::add($newsub, 'change'); if (!$code) { die('Failed to Generate Pending Subscriber Code'); } require_once Pommo::$_baseDir . 'classes/Pommo_Helper_Messages.php'; Pommo_Helper_Messages::sendMessage(array('to' => $newsub['email'], 'code' => $code, 'type' => 'update')); if (isset($notices['update']) && $notices['update'] == 'on') { Pommo_Helper_Messages::notify($notices, $newsub, 'update'); } } } elseif (!Pommo_Subscribers::update($newsub, 'REPLACE_ACTIVE')) { $logger->addErr('Error updating subscriber.'); } else { // update successful $logger->addMsg(Pommo::_T('Your records have been updated.')); require_once Pommo::$_baseDir . 'classes/Pommo_Helper_Messages.php';