Esempio n. 1
0
 /**
  * Send a email for a invitation request.
  *
  * @param string $siteTitle Name of the admin's website.
  * @param string $siteEmail Email of the admin's website.
  * @param string $serverURL Address of the admin's website.
  * @param int    $userID    ID of the user sending the request.
  * @param string $emailTo   Email of the person to send the request.
  *
  * @return string
  */
 public function sendInvite($siteTitle, $siteEmail, $serverURL, $userID, $emailTo)
 {
     $sender = $this->getById($userID);
     $token = $this->hashSHA1(uniqid());
     $subject = $siteTitle . " Invitation";
     $url = $serverURL . "register?invitecode=" . $token;
     if (!is_null($sender['firstname']) || $sender['firstname'] != '') {
         $contents = $sender["firstname"] . " " . $sender["lastname"] . " has sent an invite to join " . $siteTitle . " to this email address.<br>To accept the invitation click <a href=\"{$url}\">this link</a>\n";
     } else {
         $contents = $sender["username"] . " has sent an invite to join " . $siteTitle . " to this email address.<br>To accept the invitation click <a href=\"{$url}\">this link</a>\n";
     }
     Misc::sendEmail($emailTo, $subject, $contents, $siteEmail);
     $this->addInvite($userID, $token);
     return $url;
 }
Esempio n. 2
0
    case 'submit':
        if ($captcha->getError() === false) {
            $email = $_POST['email'];
            if ($email == '') {
                $page->smarty->assign('error', "Missing Email");
            } else {
                // Check users exists and send an email.
                $ret = $page->users->getByEmail($email);
                if (!$ret) {
                    $sent = "true";
                    break;
                } else {
                    // Generate a forgottenpassword guid, store it in the user table.
                    $guid = md5(uniqid());
                    $page->users->updatePassResetGuid($ret["id"], $guid);
                    // Send the email
                    Misc::sendEmail($ret["email"], $page->settings->getSetting('title') . " Forgotten Password Request", "Someone has requested a password reset for this email address.<br>To reset the password use <a href=\"" . $page->serverurl . "forgottenpassword?action=reset&guid={$guid}\">this link</a>\n", $page->settings->getSetting('email'));
                    $sent = "true";
                    break;
                }
            }
        }
        break;
}
$page->smarty->assign(['email' => $email, 'confirmed' => $confirmed, 'sent' => $sent]);
$page->title = "Forgotten Password";
$page->meta_title = "Forgotten Password";
$page->meta_keywords = "forgotten,password,signup,registration";
$page->meta_description = "Forgotten Password";
$page->content = $page->smarty->fetch('forgottenpassword.tpl');
$page->render();
Esempio n. 3
0
use nzedb\utility\Misc;
use nzedb\Captcha;
$captcha = new Captcha($page);
$msg = '';
if (isset($_POST["useremail"])) {
    if ($captcha->getError() === false) {
        // Send the contact info and report back to user.
        $email = $_POST["useremail"];
        $mailto = $page->settings->getSetting('email');
        $mailsubj = "Contact Form Submitted";
        $mailbody = "Values submitted from contact form:<br/>";
        //@TODO take this loop out, it's not safe.
        while (list($key, $val) = each($_POST)) {
            if ($key != 'submit') {
                $mailbody .= "{$key} : {$val}<br/>";
            }
        }
        if (!preg_match("/\n/i", $_POST["useremail"])) {
            Misc::sendEmail($mailto, $mailsubj, $mailbody, $email);
        }
        $msg = "<h2 style='text-align:center;'>Thank you for getting in touch with " . $page->settings->getSetting('title') . ".</h2>";
    }
}
$page->smarty->assign("msg", $msg);
$page->title = "Contact " . $page->settings->getSetting('title');
$page->meta_title = "Contact " . $page->settings->getSetting('title');
$page->meta_keywords = "contact us,contact,get in touch,email";
$page->meta_description = "Contact us at " . $page->settings->getSetting('title') . " and submit your feedback";
$page->content = $page->smarty->fetch('contact.tpl');
$page->render();