示例#1
0
文件: contact.php 项目: lmcro/fcms
 function displayContactFormSubmit()
 {
     $subject = $_POST['subject'];
     $email = $_POST['email'];
     $name = $_POST['name'];
     $msg = $_POST['msg'];
     $email_headers = getEmailHeaders($name, $email);
     if (!mail(getContactEmail(), $subject, "{$msg}\r\n-{$name}", $email_headers)) {
         $this->displayHeader();
         $this->displayFooter();
     }
     $_SESSION['ok'] = '<p>' . cleanOutput($msg) . '<br/>- ' . cleanOutput($name) . '</p>';
     header("Location: contact.php");
 }
示例#2
0
文件: familynews.php 项目: lmcro/fcms
    /**
     * displayAddNewsSubmit 
     * 
     * @return void
     */
    function displayAddNewsSubmit()
    {
        $sql = "INSERT INTO `fcms_news`\n                    (`title`, `news`, `user`, `created`, `updated`)\n                VALUES\n                    (?, ?, ? ,NOW(), NOW())";
        $params = array($_POST['title'], $_POST['post'], $this->fcmsUser->id);
        $newNewsId = $this->fcmsDatabase->insert($sql, $params);
        if ($newNewsId === false) {
            $this->displayHeader();
            $this->fcmsError->displayError();
            $this->displayFooter();
            return;
        }
        // Email members
        $sql = "SELECT u.`email`, s.`user` \n                FROM `fcms_user_settings` AS s, `fcms_users` AS u \n                WHERE `email_updates` = '1'\n                AND u.`id` = s.`user`";
        $rows = $this->fcmsDatabase->getRows($sql);
        if ($rows === false) {
            $this->displayHeader();
            $this->fcmsError->displayError();
            $this->displayFooter();
            return;
        }
        if (count($rows) > 0) {
            $name = getUserDisplayName($this->fcmsUser->id);
            $url = getDomainAndDir();
            $email_headers = getEmailHeaders();
            foreach ($rows as $r) {
                $to = getUserDisplayName($r['user']);
                $subject = sprintf(T_('%s has added %s to his/her Family News'), $name, $_POST['title']);
                $email = $r['email'];
                $msg = T_('Dear') . ' ' . $to . ',

' . $subject . '

' . $url . 'familynews.php?getnews=' . $this->fcmsUser->id . '

----
' . T_('To stop receiving these notifications, visit the following url and change your \'Email Update\' setting to No:') . '

' . $url . 'settings.php

';
                mail($email, $subject, $msg, $email_headers);
            }
        }
        $user = (int) $this->fcmsUser->id;
        header("Location: familynews.php?getnews={$user}&newsid={$newNewsId}");
    }
示例#3
0
 /**
  * displayMassEmailSubmit 
  * 
  * @return void
  */
 function displayMassEmailSubmit()
 {
     $this->displayHeader();
     $requiredFields = array('subject', 'email', 'name', 'msg');
     $missingRequired = false;
     foreach ($requiredFields as $field) {
         if (!isset($_POST[$field])) {
             $missingRequired = true;
         }
     }
     if ($missingRequired) {
         $this->fcmsBook->displayMassEmailForm($_POST['emailaddress'], $_POST['email'], $_POST['name'], $_POST['subject'], $_POST['msg'], 'Yes');
         $this->displayFooter();
         return;
     }
     $emailHeaders = getEmailHeaders($_POST['name'], $_POST['email']);
     foreach ($_POST['emailaddress'] as $email) {
         mail($email, $_POST['subject'], $_POST['msg'] . "\r\n-" . $_POST['name'], $emailHeaders);
     }
     displayOkMessage(T_('Email has been sent.'));
     $this->fcmsBook->displayAddressList('members');
     $this->displayFooter();
 }
示例#4
0
文件: register.php 项目: lmcro/fcms
    /**
     * handleAutoActivation 
     * 
     * @param string $email    email address to send email to
     * @param string $subject  subject of email
     * @param int    $id       id of user being activated
     * @param string $sitename sitename
     * 
     * @return void
     */
    function handleAutoActivation($email, $subject, $id, $sitename)
    {
        $code = uniqid('');
        //bug in some versions of php, needs some value here
        $sql = "UPDATE `fcms_users` \n                SET `activate_code` = ?\n                WHERE `id` = ?";
        if (!$this->fcmsDatabase->update($sql, array($code, $id))) {
            $this->fcmsError->displayError();
            $this->displayFooter();
            die;
        }
        $message = T_('Please click the following link to activate your account') . ':

' . getDomainAndDir() . 'activate.php?uid=' . $id . '&code=' . $code;
        echo '
            <div id="msg">
                <h1>' . T_('Congratulations and Welcome') . '</h1>
                <p>
                    ' . sprintf(T_('You have been successfully registered at %s.'), $sitename) . ' 
                    ' . sprintf(T_('Your account information has been emailed to %s.'), $email) . '<br/>
                    <b>' . T_('Please remember your username and password for this site.') . '</b>
                </p>
                <p>' . T_('Unfortunately you must activate your account before you can <a href="index.php">login</a> and begin using the site') . '</p>
            </div>';
        mail($email, $subject, $message, getEmailHeaders());
    }
示例#5
0
#!/usr/bin/php -q
<?php 
require_once dirname(dirname(__FILE__)) . '/test/lib/utils.php';
require_once TEST . 'lib/Test-More.php';
require_once INC . 'config_inc.php';
require_once INC . 'utils.php';
diag("getEmailHeaders");
plan(4);
$header = getEmailHeaders('Bob', '*****@*****.**');
$headers = explode("\r\n", $header);
is($headers[0], 'From: Bob <*****@*****.**>', 'from');
is($headers[1], 'Reply-To: bob@mail.com', 'reply-to');
is($headers[2], 'Content-Type: text/plain; charset=UTF-8;', 'content charset');
is($headers[3], 'MIME-Version: 1.0', 'mime');
示例#6
0
文件: recipes.php 项目: lmcro/fcms
    /**
     * displayAddRecipeSubmit 
     * 
     * @return void
     */
    function displayAddRecipeSubmit()
    {
        $name = strip_tags($_POST['name']);
        $category = (int) $_POST['category'];
        $ingredients = strip_tags($_POST['ingredients']);
        $directions = strip_tags($_POST['directions']);
        $thumbnail = 'no_recipe.jpg';
        $uploadsPath = getUploadsAbsolutePath();
        // Upload Recipe Image
        if (isset($_FILES['thumbnail']) && $_FILES['thumbnail']['name'] && $_FILES['thumbnail']['error'] < 1) {
            $this->fcmsImage->destination = $uploadsPath . 'upimages/';
            $this->fcmsImage->uniqueName = true;
            $thumbnail = $this->fcmsImage->upload($_FILES['thumbnail']);
            if ($this->fcmsImage->error == 1) {
                $this->displayHeader();
                echo '
    <p class="error-alert">
        ' . sprintf(T_('Thumbnail [%s] is not a supported type. Thumbnails must be of type (.jpg, .jpeg, .gif, .bmp or .png).'), $this->img->name) . '
    </p>';
                $this->displayFooter();
                return;
            }
            $this->fcmsImage->resize(100, 100);
            if ($this->fcmsImage->error > 0) {
                $this->displayHeader();
                echo '
    <p class="error-alert">
        ' . T_('There was an error uploading your thumbnail.') . '
    </p>';
                $this->displayFooter();
                return;
            }
        }
        $sql = "INSERT INTO `fcms_recipes` \n                    (`name`, `thumbnail`, `category`, `ingredients`, `directions`, `user`, `date`) \n                VALUES\n                    (?, ?, ?, ?, ?, ?, NOW())";
        $params = array($name, $thumbnail, $category, $ingredients, $directions, $this->fcmsUser->id);
        $rec_id = $this->fcmsDatabase->insert($sql, $params);
        if ($rec_id === false) {
            $this->displayHeader();
            $this->fcmsError->displayError();
            $this->displayFooter();
            return;
        }
        // Email members
        $sql = "SELECT u.`email`, s.`user` \n                FROM `fcms_user_settings` AS s, `fcms_users` AS u \n                WHERE `email_updates` = '1'\n                AND u.`id` = s.`user`";
        $rows = $this->fcmsDatabase->getRows($sql);
        if ($rows === false) {
            $this->displayHeader();
            $this->fcmsError->displayError();
            $this->displayFooter();
            return;
        }
        if (count($rows) > 0) {
            foreach ($rows as $r) {
                $recipeUser = getUserDisplayName($this->fcmsUser->id);
                $to = getUserDisplayName($r['user']);
                $subject = sprintf(T_('%s has added the recipe: %s'), $recipeUser, $name);
                $email = $r['email'];
                $url = getDomainAndDir();
                $email_headers = getEmailHeaders();
                $msg = T_('Dear') . ' ' . $to . ',

' . $subject . '

' . $url . 'recipes.php?category=' . $category . '

----
' . T_('To stop receiving these notifications, visit the following url and change your \'Email Update\' setting to No:') . '

' . $url . 'settings.php

';
                mail($email, $subject, $msg, $email_headers);
            }
        }
        header("Location: recipes.php?category={$category}&id={$rec_id}");
    }
示例#7
0
文件: documents.php 项目: lmcro/fcms
    /**
     * displayAddDocumentSubmit 
     * 
     * @return void
     */
    function displayAddDocumentSubmit()
    {
        $doc = $_FILES['doc']['name'];
        $doc = cleanFilename($doc);
        $desc = $_POST['desc'];
        $mime = $_FILES['doc']['type'];
        $result = $this->fcmsDocument->uploadDocument($_FILES['doc'], $doc);
        if ($result === false) {
            $this->displayHeader();
            $this->fcmsError->displayError();
            $this->displayFooter();
            return;
        }
        $sql = "INSERT INTO `fcms_documents` (\n                    `name`, `description`, `mime`, `user`, `date`\n                ) VALUES(\n                    ?, ?, ?, ?, NOW()\n                )";
        $params = array($doc, $desc, $mime, $this->fcmsUser->id);
        if (!$this->fcmsDatabase->insert($sql, $params)) {
            $this->displayHeader();
            $this->fcmsError->displayError();
            $this->displayFooter();
            return;
        }
        // Email members
        $sql = "SELECT u.`email`, s.`user` \n                FROM `fcms_user_settings` AS s, `fcms_users` AS u \n                WHERE `email_updates` = '1'\n                AND u.`id` = s.`user`";
        $rows = $this->fcmsDatabase->getRows($sql);
        if (count($rows) > 0) {
            $name = getUserDisplayName($this->fcmsUser->id);
            $url = getDomainAndDir();
            $subject = sprintf(T_('%s has added a new document (%s).'), $name, $doc);
            $email_headers = getEmailHeaders();
            foreach ($rows as $r) {
                $to = getUserDisplayName($r['user']);
                $email = $r['email'];
                $msg = T_('Dear') . ' ' . $to . ',

' . $subject . '

' . $url . 'documents.php


----
' . T_('To stop receiving these notifications, visit the following url and change your \'Email Update\' setting to No:') . '

' . $url . 'settings.php

';
                mail($email, $subject, $msg, $email_headers);
            }
        }
        $_SESSION['ok'] = 1;
        header("Location: documents.php");
    }
示例#8
0
    /**
     * emailMembersNewPhotos 
     * 
     * @param int $categoryId 
     * 
     * @return void
     */
    function emailMembersNewPhotos($categoryId)
    {
        $sql = "SELECT u.`email`, s.`user` \n                FROM `fcms_user_settings` AS s, `fcms_users` AS u \n                WHERE `email_updates` = '1'\n                AND u.`id` = s.`user`";
        $rows = $this->fcmsDatabase->getRows($sql);
        if ($rows === false) {
            $this->fcmsError->displayError();
            $this->displayFooter();
            return;
        }
        if (count($rows) > 0) {
            $name = getUserDisplayName($this->fcmsUser->id);
            $subject = sprintf(T_('%s has added a new photo.'), $name);
            $url = getDomainAndDir();
            $emailHeaders = getEmailHeaders();
            foreach ($rows as $r) {
                $to = getUserDisplayName($r['user']);
                $email = $r['email'];
                $msg = T_('Dear') . ' ' . $to . ',

' . $subject . '

' . $url . 'index.php?uid=' . $this->fcmsUser->id . '&cid=' . $category . '

----
' . T_('To stop receiving these notifications, visit the following url and change your \'Email Update\' setting to No:') . '

' . $url . 'settings.php

';
                mail($email, $subject, $msg, $emailHeaders);
            }
        }
    }
示例#9
0
    /**
     * displayNewPostSubmit 
     * 
     * @return void
     */
    function displayNewPostSubmit()
    {
        $post = $_POST['post'];
        $threadId = (int) $_POST['thread_id'];
        // Update Thread info
        $sql = "UPDATE `fcms_board_threads` \n                SET `updated` = NOW(), \n                    `updated_by` = ?\n                WHERE `id` = ?";
        if (!$this->fcmsDatabase->update($sql, array($this->fcmsUser->id, $threadId))) {
            $this->displayHeader();
            $this->fcmsError->displayError();
            $this->displayFooter();
            return;
        }
        // Insert new Post
        $sql = "INSERT INTO `fcms_board_posts`\n                    (`date`, `thread`, `user`, `post`)\n                VALUES\n                    (NOW(), ?, ?, ?)";
        $params = array($threadId, $this->fcmsUser->id, $post);
        if (!$this->fcmsDatabase->insert($sql, $params)) {
            $this->displayHeader();
            $this->fcmsError->displayError();
            $this->displayFooter();
            return;
        }
        // Email members
        $sql = "SELECT u.`email`, s.`user` \n                FROM `fcms_user_settings` AS s, `fcms_users` AS u \n                WHERE `email_updates` = '1'\n                AND u.`id` = s.`user`";
        $rows = $this->fcmsDatabase->getRows($sql);
        if (count($rows) > 0) {
            $name = getUserDisplayName($this->fcmsUser->id);
            $sql = "SELECT `subject` \n                    FROM `fcms_board_threads` \n                    WHERE `id` = ?";
            $threadInfo = $this->fcmsDatabase->getRow($sql, $threadId);
            if ($threadInfo === false) {
                $this->displayHeader();
                $this->fcmsError->displayError();
                $this->displayFooter();
                return;
            }
            $threadSubject = $threadInfo['subject'];
            $pos = strpos($threadSubject, '#ANOUNCE#');
            if ($pos !== false) {
                $threadSubject = substr($threadSubject, 9, strlen($threadSubject) - 9);
            }
            $emailHeaders = getEmailHeaders();
            $subject = sprintf(T_('%s has replied to the thread: %s'), $name, $threadSubject);
            $url = getDomainAndDir();
            foreach ($rows as $r) {
                $email = $r['email'];
                $to = getUserDisplayName($r['user']);
                $msg = T_('Dear') . ' ' . $to . ',

' . $subject . '

' . $url . 'messageboard.php?thread=' . $threadId . '

----
' . T_('To stop receiving these notifications, visit the following url and change your \'Email Update\' setting to No:') . '

' . $url . 'settings.php

';
                mail($email, $subject, $msg, $emailHeaders);
            }
        }
        header("Location: messageboard.php?thread={$threadId}");
    }
示例#10
0
文件: index.php 项目: lmcro/fcms
    /**
     * displayActivateMemberSubmit 
     * 
     * @return void
     */
    function displayActivateMemberSubmit()
    {
        $id = (int) $_GET['activate'];
        $sitename = getSiteName();
        // Get Member info
        $sql = "SELECT `id`, `activity`, `joindate`, `fname`, `lname`, `email` \n                FROM `fcms_users` \n                WHERE `id` = ?";
        $member = $this->fcmsDatabase->getRow($sql, $id);
        if ($member === false) {
            $this->fcmsError->displayError();
            $this->displayFooter();
            return;
        }
        // User is being activated for first time (just joined)
        if ($member['joindate'] == '0000-00-00 00:00:00') {
            $sql = "UPDATE `fcms_users` \n                    SET `activated` = 1, \n                        `joindate` = NOW()\n                    WHERE `id` = ?";
        } else {
            $sql = "UPDATE `fcms_users` \n                    SET `activated` = 1\n                    WHERE `id` = ?";
        }
        if (!$this->fcmsDatabase->update($sql, $id)) {
            $this->fcmsError->displayError();
            $this->displayFooter();
            return;
        }
        $subject = $sitename . ': ' . T_('Account Activated');
        $message = $member['fname'] . ' ' . $member['lname'] . ', 

' . sprintf(T_('Your account at %s has been activated by the administrator.'), $sitename);
        mail($member['email'], $subject, $message, getEmailHeaders());
        $_SESSION['activate_success'] = 1;
        header("Location: index.php");
    }
示例#11
0
    /**
     * displayStatusUpdateSubmit 
     * 
     * @return void
     */
    function displayStatusUpdateSubmit()
    {
        $status = $_POST['status'];
        $parent = 0;
        // Submited blank form?
        if (empty($_POST['status'])) {
            header("Location: home.php");
            return;
        }
        if (isset($_POST['parent'])) {
            $parent = (int) $_POST['parent'];
        }
        // Insert new status
        $sql = "INSERT INTO `fcms_status`\n                    (`user`, `status`, `parent`, `created`, `updated`)\n                VALUES\n                    (?, ?, ?, NOW(), NOW())";
        $params = array($this->fcmsUser->id, $status, $parent);
        if (!$this->fcmsDatabase->insert($sql, $params)) {
            $this->displayHeader();
            $this->fcmsError->displayError();
            $this->displayFooter();
            return;
        }
        // If replying, update the orig status updated date, so it bumps up to the top of the list
        if ($parent > 0) {
            $sql = "UPDATE `fcms_status`\n                    SET `updated` = NOW()\n                    WHERE `id` = ?\n                    LIMIT 1;";
            if (!$this->fcmsDatabase->update($sql, $parent)) {
                $this->displayHeader();
                $this->fcmsError->displayError();
                $this->displayFooter();
                return;
            }
        }
        // Post to facebook
        if (isset($_POST['update_fb'])) {
            $data = getFacebookConfigData();
            // Send status to facebook
            if (!empty($data['fb_app_id']) && !empty($data['fb_secret'])) {
                $facebook = new Facebook(array('appId' => $data['fb_app_id'], 'secret' => $data['fb_secret']));
                // Check if the user is logged in and authed
                $user = $facebook->getUser();
                if ($user) {
                    try {
                        $statusUpdate = $facebook->api('/me/feed', 'post', array('message' => $_POST['status'], 'cb' => ''));
                    } catch (FacebookApiException $e) {
                        printr($e);
                    }
                }
            }
        }
        // Email members
        $sql = "SELECT u.`email`, s.`user` \n                FROM `fcms_user_settings` AS s, `fcms_users` AS u \n                WHERE `email_updates` = '1'\n                AND u.`id` = s.`user`";
        $rows = $this->fcmsDatabase->getRows($sql);
        if ($rows === false) {
            $this->displayHeader();
            $this->fcmsError->displayError();
            $this->displayFooter();
            return;
        }
        if (count($rows) > 0) {
            $url = getDomainAndDir();
            $headers = getEmailHeaders();
            $name = getUserDisplayName($this->fcmsUser->id);
            foreach ($rows as $r) {
                $to = getUserDisplayName($r['user']);
                $subject = sprintf(T_('%s added a new status update.'), $name);
                $email = $r['email'];
                $msg = T_('Dear') . ' ' . $to . ',

' . $subject . '

' . $url . 'home.php

----
' . T_('To stop receiving these notifications, visit the following url and change your \'Email Update\' setting to No:') . '

' . $url . 'settings.php

';
                mail($email, $subject, $msg, $headers);
            }
        }
        header("Location: home.php");
    }
示例#12
0
文件: calendar.php 项目: lmcro/fcms
    /**
     * displayInvitationSubmit 
     * 
     * @return void
     */
    function displayInvitationSubmit()
    {
        $this->displayHeader();
        $calendarId = (int) $_POST['calendar'];
        // make sure the user submitted atleast one email address
        if (!isset($_POST['all-members']) && !isset($_POST['email']) && !isset($_POST['non-member-emails'])) {
            $error = T_('You must invite at least one guest.');
            displayInvitationForm($calendarId, $error);
            return;
        }
        // Get any invitations already sent for this event
        $invitations = $this->getInvitations($calendarId, true);
        if ($invitations === false) {
            $this->fcmsError->displayError();
            $this->displayFooter();
            return;
        }
        if (!isset($invitations['_current_user'])) {
            // add the current user (host) to the invite as attending
            $sql = "INSERT INTO `fcms_invitation` \n                        (`event_id`, `user`, `created`, `updated`, `attending`)\n                    VALUES \n                        (?, ?, NOW(), NOW(), 1)";
            $params = array($calendarId, $this->fcmsUser->id);
            if (!$this->fcmsDatabase->insert($sql, $params)) {
                $this->fcmsError->displayError();
                $this->displayFooter();
                return;
            }
        }
        // Get the calendar event title
        $sql = "SELECT `title` \n                FROM `fcms_calendar` \n                WHERE `id` = ?";
        $r = $this->fcmsDatabase->getRow($sql, $calendarId);
        if ($r === false) {
            $this->fcmsError->displayError();
            $this->displayFooter();
            return;
        }
        $title = $r['title'];
        $invitees = array();
        $nonMembers = array();
        $members = array();
        // get emails from textarea
        if (isset($_POST['non-member-emails'])) {
            $nonMembers = explode("\n", $_POST['non-member-emails']);
        }
        // get any members that have been invited
        if (isset($_POST['all-members'])) {
            $sql = "SELECT `id`, `email` \n                    FROM `fcms_users` \n                    WHERE `activated` > 0\n                    AND `phpass` != 'NONMEMBER'\n                    AND `id` != ?";
            $rows = $this->fcmsDatabase->getRows($sql, $this->fcmsUser->id);
            if ($rows === false) {
                $this->fcmsError->displayError();
                $this->displayFooter();
                return;
            }
            foreach ($rows as $r) {
                array_push($members, array('id' => $r['id'], 'email' => $r['email']));
            }
        } elseif (isset($_POST['member'])) {
            foreach ($_POST['member'] as $id) {
                array_push($members, array('id' => $id, 'email' => $_POST["id{$id}"]));
            }
        }
        // merge all emails into one big list
        $invitees = array_merge($nonMembers, $members);
        // Create the invite and send the emails to each invitee
        foreach ($invitees as $invitee) {
            if (empty($invitee)) {
                continue;
            }
            // create a code for this user
            $code = uniqid('');
            $user = 0;
            $email = '';
            $toEmail = '';
            $toName = '';
            $fromName = getUserDisplayName($this->fcmsUser->id);
            $url = getDomainAndDir();
            // member
            if (is_array($invitee)) {
                $user = (int) $invitee['id'];
                $toEmail = rtrim($invitee['email']);
                $toName = getUserDisplayName($user);
                $email = null;
                $url .= 'calendar.php?event=' . $calendarId;
            } else {
                $user = 0;
                $toEmail = rtrim($invitee);
                $toName = $toEmail;
                $email = $toEmail;
                $url .= 'invitation.php?event=' . $calendarId . '&code=' . $code;
            }
            // Skip email address that have already been invited
            if (isset($invitations[$toEmail])) {
                continue;
            }
            // add an invitation to db
            $sql = "INSERT INTO `fcms_invitation` \n                        (`event_id`, `user`, `email`, `created`, `updated`, `code`)\n                    VALUES \n                        (?, ?, ?, NOW(), NOW(), ?)";
            $params = array($calendarId, $user, $email, $code);
            if (!$this->fcmsDatabase->insert($sql, $params)) {
                $this->fcmsError->displayError();
                $this->displayFooter();
                return;
            }
            // Send email invitation
            $subject = sprintf(T_pgettext('%s is the title of an event', 'Invitation: %s'), $title);
            $msg = sprintf(T_pgettext('%s is the name of a person, like Dear Bob,', 'Dear %s,'), $toName) . '

' . sprintf(T_pgettext('The first %s is the name of a person, the second is the title of an event', '%s has invited you to %s.'), $fromName, $title) . '

' . T_('Please visit the link below to view the rest of this invitation.') . '

' . $url . '

----
' . T_('This is an automated response, please do not reply.') . '

';
            $email_headers = getEmailHeaders();
            mail($toEmail, $subject, $msg, $email_headers);
        }
        displayOkMessage();
        $this->fcmsCalendar->displayEvent($calendarId);
        $this->displayFooter();
    }
示例#13
0
文件: lostpw.php 项目: lmcro/fcms
            $i++;
        }
        $hasher = new PasswordHash(8, FALSE);
        $new_pass = $hasher->HashPassword($pass);
        // Set new PW
        $sql = "UPDATE `fcms_users` \n                SET `phpass` = ? \n                WHERE `email` = ?";
        if (!$fcmsDatabase->update($sql, array($new_pass, $_POST['email']))) {
            $fcmsError->displayError();
            displayForm();
            echo '</body></html>';
            return;
        }
        // Send email
        $subject = getSiteName() . " " . T_('Password Reset');
        $sitename = getSiteName();
        $email_headers = getEmailHeaders();
        $message = sprintf(T_('Your password at %s has been reset.'), $sitename) . " \n\n" . T_('New Password') . ": {$pass} \n\n" . T_('Thanks') . " \n" . sprintf(T_('The %s Webmaster'), $sitename) . "\n\n" . T_('This is an automated message, please do not reply.');
        mail($_POST['email'], $subject, $message, $email_headers);
        echo '
    <div class="err-msg">
        <p>' . T_('Your password has been reset, please check your email.') . '</p>
        <p><a href="index.php">' . T_('Continue') . '</a></p>
    </div>';
    }
} else {
    displayForm();
}
echo '
</body>
</html>';
/**
示例#14
0
文件: prayers.php 项目: lmcro/fcms
    /**
     * displayAddFormSubmit 
     * 
     * @return void
     */
    function displayAddFormSubmit()
    {
        $for = strip_tags($_POST['for']);
        $desc = strip_tags($_POST['desc']);
        $sql = "INSERT INTO `fcms_prayers`\n                    (`for`, `desc`, `user`, `date`) \n                VALUES\n                    (?, ?, ?, NOW())";
        $params = array($for, $desc, $this->fcmsUser->id);
        if (!$this->fcmsDatabase->insert($sql, $params)) {
            $this->displayHeader();
            $this->fcmsError->displayError();
            $this->displayFooter();
            return;
        }
        // Email members
        $sql = "SELECT u.`email`, s.`user`\n                FROM `fcms_user_settings` AS s, `fcms_users` AS u \n                WHERE `email_updates` = '1'\n                AND u.`id` = s.`user`";
        $rows = $this->fcmsDatabase->getRows($sql);
        if ($rows === false) {
            $this->displayHeader();
            $this->fcmsError->displayError();
            $this->displayFooter();
            return;
        }
        if (count($rows) > 0) {
            $name = getUserDisplayName($this->fcmsUser->id);
            $subject = sprintf(T_('%s added a new Prayer Concern for %s'), $name, $for);
            $url = getDomainAndDir();
            $email_headers = getEmailHeaders();
            foreach ($rows as $r) {
                $to = getUserDisplayName($r['user']);
                $email = $r['email'];
                $msg = T_('Dear') . ' ' . $to . ',

' . $subject . '

' . $url . 'prayers.php

----
' . T_('To stop receiving these notifications, visit the following url and change your \'Email Update\' setting to No:') . '

' . $url . 'settings.php

';
                mail($email, $subject, $msg, $email_headers);
            }
        }
        $_SESSION['success'] = 1;
        header("Location: prayers.php");
    }
示例#15
0
文件: members.php 项目: lmcro/fcms
    /**
     * displayActivateSubmit 
     * 
     * @return void
     */
    function displayActivateSubmit()
    {
        $this->displayHeader();
        // Get list of new members -- members with no activity and not activated
        $sql = "SELECT `id`, `activity`, `fname`, `lname`, `email` \n                FROM `fcms_users` \n                WHERE `activity` = '0000-00-00 00:00:00'\n                AND `activated` = 0";
        $rows = $this->fcmsDatabase->getRows($sql);
        if ($rows === false) {
            $this->fcmsError->displayError();
            $this->displayFooter();
            return;
        }
        foreach ($rows as $r) {
            $new_members[$r['id']] = $r;
        }
        // Loop through selected members
        foreach ($_POST['massupdate'] as $id) {
            $id = (int) $id;
            // Activate the member
            $sql = "UPDATE `fcms_users` \n                    SET `activated` = 1 \n                    WHERE `id` = ?";
            if (!$this->fcmsDatabase->update($sql, $id)) {
                $this->fcmsError->displayError();
                $this->displayFooter();
                return;
            }
            if (isset($new_members)) {
                // If they are a new member, then reset the joindate, and send email
                if (array_key_exists($id, $new_members)) {
                    $sql = "UPDATE `fcms_users` \n                            SET `joindate` = NOW() \n                            WHERE `id` = ?";
                    if (!$this->fcmsDatabase->update($sql, $id)) {
                        $this->fcmsError->displayError();
                        $this->displayFooter();
                        return;
                    }
                    $sitename = getSiteName();
                    $subject = getSiteName() . ': ' . T_('Account Activated');
                    $message = $new_members[$id]['fname'] . ' ' . $new_members[$id]['lname'] . ', 

' . sprintf(T_('Your account at %s has been activated by the administrator.'), $sitename);
                    mail($new_members[$id]['email'], $subject, $message, getEmailHeaders());
                }
            }
        }
        displayOkMessageAdmin();
        $this->fcmsAdminMembers->displayMemberList(1);
        $this->displayFooter();
    }