Beispiel #1
0
        $msg = Pommo::_T('subscription request');
        $pending['type'] = 'confirm';
        // normalize for PommoHelperMessages::sendMessage
        break;
    case "change":
        $msg = Pommo::_T('record update request');
        $pending['type'] = 'update';
        // normalize for PommoHelperMessages::sendMessage
        break;
    case "password":
        $msg = Pommo::_T('password change request');
        break;
    default:
        Pommo::redirect('login.php?badPendingType=TRUE');
}
// check if user wants to reconfirm or cancel their request
if (!empty($_POST)) {
    if (isset($_POST['reconfirm'])) {
        Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/messages.php');
        PommoHelperMessages::sendMessage(array('to' => $input['Email'], 'code' => $pending['code'], 'type' => $pending['type']));
    } elseif (isset($_POST['cancel'])) {
        if (PommoPending::cancel($pending)) {
            $logger->addMsg(sprintf(Pommo::_T('Your %s has been cancelled.'), $msg));
        }
    }
    $smarty->assign('nodisplay', TRUE);
} else {
    $logger->addMsg(sprintf(Pommo::_T('Your %s is still pending. To complete this request, please review the confirmation email sent to %s.'), $msg, $input['Email']));
}
$smarty->display('user/pending.tpl');
Pommo::kill();
Beispiel #2
0
} 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;
Beispiel #3
0
 *********************************/
Pommo::requireOnce($pommo->_baseDir . 'inc/classes/template.php');
$smarty = new PommoTemplate();
// make sure email/login is valid
$subscriber = current(PommoSubscriber::get(array('email' => empty($_REQUEST['email']) ? '0' : $_REQUEST['email'], 'status' => 1)));
if (empty($subscriber)) {
    Pommo::redirect('login.php');
}
// see if an anctivation email was sent to this subscriber in the last 2 minutes;
$query = "\n\tSELECT \n\t\t*\n\tFROM \n\t\t" . $dbo->table['scratch'] . "\n\tWHERE\n\t\t`type`=1\n\t\tAND `int`=%i\n\t\tAND `time` > (NOW() - INTERVAL 2 MINUTE)\n\tLIMIT 1";
$query = $dbo->prepare($query, array($subscriber['id']));
$test = $dbo->query($query, 0);
// attempt to send activation code if once has not recently been sent
if (empty($test)) {
    $code = PommoSubscriber::getActCode($subscriber);
    if (PommoHelperMessages::sendMessage(array('to' => $subscriber['email'], 'code' => $code, 'type' => 'activate'))) {
        $smarty->assign('sent', true);
        // timestamp this activation email
        $query = "\n\t\t\tINSERT INTO " . $dbo->table['scratch'] . "\n\t\t\tSET\n\t\t\t\t`type`=1,\n\t\t\t\t`int`=%i";
        $query = $dbo->prepare($query, array($subscriber['id']));
        $dbo->query($query);
        // remove ALL activation email timestamps older than 2 minutes
        $query = "\n\t\t\tDELETE FROM \n\t\t\t\t" . $dbo->table['scratch'] . "\n\t\t\tWHERE\n\t\t\t\t`type`=1\n\t\t\t\tAND `time` < (NOW() - INTERVAL 2 MINUTE)";
        $query = $dbo->prepare($query, array());
        $dbo->query($query);
    }
} else {
    $smarty->assign('sent', false);
}
$smarty->assign('email', $subscriber['email']);
$smarty->display('user/activate.tpl');
Beispiel #4
0
                PommoHelperMessages::notify($notices, $subscriber, 'pending', $comments);
            }
            if ($config['site_confirm']) {
                Pommo::redirect($config['site_confirm']);
            }
        } else {
            $smarty->assign('back', TRUE);
            // delete the subscriber
            PommoSubscriber::delete($id);
        }
    }
} else {
    // no email confirmation required
    if (!PommoSubscriber::add($subscriber)) {
        $logger->addErr('Error adding subscriber! Please contact the administrator.');
        $smarty->assign('back', TRUE);
    } else {
        // send/print welcome message
        PommoHelperMessages::sendMessage(array('to' => $subscriber['email'], 'type' => 'subscribe'));
        $subscriber['registered'] = date("F j, Y, g:i a", $subscriber['registered']);
        if ($comments || isset($notices['subscribe']) && $notices['subscribe'] == 'on') {
            PommoHelperMessages::notify($notices, $subscriber, 'subscribe', $comments);
        }
        // redirect
        if ($config['site_success']) {
            Pommo::redirect($config['site_success']);
        }
    }
}
$smarty->display('user/process.tpl');
Pommo::kill();