Exemple #1
0
/**
 * =======================================
 *		M A S S   M A I L
 * =======================================
 */
if (!defined('IN_NLB3')) {
    echo 'NLB3 Denies Direct Access';
    exit;
}
$ets->page_body = '';
$USESKIN = skin_basic;
$ets_outter->main_title = $config->get('site_name') . ": " . $l['title-acp-massmail'];
$ets_outter->page_title = $l['title-acp-massmail'];
include_once 'system/nlb_mail.class.php';
$mail = new nlb_mail($db);
$text = new text($_POST, array('subject', 'message'));
if (!$mail->Active) {
    // can't send emails!
    $ets->page_body = $l['acp-mail-disabled'];
} else {
    $baddata = false;
    if (!empty($_POST)) {
        $text->validate();
        if ($text->is_missing_required) {
            $baddata = true;
        } else {
            $text->MakeClean('trim', 'slash_if_needed');
            $c = $text->clean;
            $message = stripslashes($c['message']);
            $subject = stripslashes($c['subject']);
Exemple #2
0
         $ets->page_body .= $input_form;
         $ets->page_body .= '<p><a href="' . script_path . 'login.php?action=forgot">';
         $ets->page_body .= $l['log-forgot-text'] . '</a></p>';
     }
     break;
 case 'logout':
     $ets_outter->main_title = $config->get('site_name') . ": " . $l['title-logout'];
     $ets_outter->page_title = $l['title-logout'];
     $user->logout();
     $ets->page_body = $l['log-out'];
     break;
 case 'forgot':
     $ets_outter->main_title = $config->get('site_name') . ": " . $l['title-forgot'];
     $ets_outter->page_title = $l['title-forgot'];
     $ets->page_body = '';
     $mail = new nlb_mail($db);
     if (!$mail->Active) {
         $ets->page_body = $l['log-forgot-off'];
         break;
         // exit the big switch()
     }
     $err = array();
     if (!empty($_POST)) {
         if (!isset($_POST['username']) || empty($_POST['username'])) {
             $err[] = $l['log-bad-user'];
             // bad username
         } else {
             $username = slash_if_needed($_POST['username']);
             if (!$user->userExists($username)) {
                 $err[] = $l['log-bad-user'];
             } else {
    /**
     * @return bool
     * @param object nlb_config $config
     * @desc Force a user to validate his email address. Returns true if sent, false otherwise
     * @date 02-08-04
     */
    function validateEmail(&$config)
    {
        global $l;
        $mail = new nlb_mail($this->sql);
        if ($mail->Active) {
            // make code.
            $code = md5(uniqid(rand(), true));
            $link = build_link('index.php', array('action' => 'validate', 'code' => $code));
            $link = full_url . $link;
            $body = $l['validation_email'];
            $body = str_replace("%LINK%", $link, $body);
            $body = str_replace("%SITE%", $config->get('site_name'), $body);
            $body = str_replace("%USER%", $this->get('username'), $body);
            $mail->AddAddress($this->get('email'), $this->get('username'));
            $mail->Subject = $l['validation_subject'];
            $mail->Body = $body;
            if (!$mail->Send()) {
                // mail was not sent, must set user to valid.
                $this->set('valid', 1);
                $this->updateDB();
                return false;
            }
            // add record in validation table.
            $this->sql->query(' # Add validation row
			INSERT INTO `nlb3_validate` ( `validate_id` , `owner_id` , `code` , `date` )
			VALUES (
			"", "' . $this->id . '", "' . $code . '", "' . time() . '"
			);');
            $this->set('valid', 0);
            $this->updateDB();
            return true;
        }
        // Server is not sending email's, assume user gave a good email.
        $this->set('valid', 1);
        $this->updateDB();
        return false;
    }