示例#1
0
文件: PageEdit.php 项目: r4mp/Foodle
    protected function sendMail()
    {
        if (!$this->user->notification('newfoodle', FALSE)) {
            error_log('Foodle was updated, but mail notification was not sent because of users preferences');
            return;
        }
        error_log('Foodle was updated, sending notification!');
        $profileurl = FoodleUtils::getUrl() . 'profile/';
        $url = FoodleUtils::getUrl() . 'foodle/' . $this->foodle->identifier;
        $name = $this->foodle->name;
        $to = $this->user->email;
        $mail = '
		
Hi, your response to the Foodle named <i>' . htmlspecialchars($name) . '</i> was successfully updated.</p>

You may re-enter the Foodle link below to update your response, and view other responses:

* [Edit your Foodle response](' . $url . ')
* [View responses of other participants](' . $url . '#responses)

### Did you know

You may also create new Foodles on your own, and invite others to respond.

* [Go to Foodl.org to create a new Foodle.](http://foodl.org)

		';
        $mailer = new Foodle_EMail($to, 'Updated foodle: ' . htmlspecialchars($name), 'Foodl.org <*****@*****.**>');
        $mailer->setBody($mail);
        $mailer->send();
        #echo '<pre>'; print_r($mail); exit;
    }
示例#2
0
    public function execute()
    {
        $text = '
Below follows the latest updates on Foodles you have created.

		';
        foreach ($this->updates as $foodleid => $res) {
            $url = FoodleUtils::getUrl() . 'foodle/' . $res['foodle']->identifier;
            $text .= '
## ' . htmlspecialchars($res['foodle']->name) . '

';
            if (empty($res['updates']['responses'])) {
                $text .= "\n\nNo new responses was registered for this Foodle.\n";
            } else {
                $text .= "\n";
                foreach ($res['updates']['responses'] as $response) {
                    $text .= '* ' . $response->statusline() . "\n";
                }
                $text .= "\n";
            }
            if (empty($res['updates']['discussion'])) {
                $text .= "\nNo new discussion entries was registered for this Foodle.\n";
            } else {
                $text .= "\n";
                foreach ($res['updates']['discussion'] as $discussion) {
                    #print_r($discussion);
                    $text .= "* " . date('l H:i', $discussion['createdu']) . ' ' . $discussion['username'] . " added a discussion entry.\n";
                }
                $text .= "\n";
            }
            $text .= "\n[Go to this foodle to view all responses](" . htmlspecialchars($url) . ")\n\n";
        }
        $profileurl = FoodleUtils::getUrl() . 'profile';
        $text .= '

## Setup your e-mail notification preferences

You can turn of this e-mail notification, and configure other notification messages <a href="' . htmlspecialchars($profileurl) . '">from your Foodle preference page</a>:

	' . htmlspecialchars($profileurl);
        $to = $this->user->email;
        // $to = '*****@*****.**';
        $mailer = new Foodle_EMail($to, 'Daily Foodle status update', 'Foodl.org <*****@*****.**>');
        $mailer->setBody($text);
        $mailer->send();
    }
示例#3
0
    protected function sendMail($foodle)
    {
        if (!$this->user->notification('newfoodle', FALSE)) {
            error_log('Foodle was updated, but mail notification was not sent because of users preferences');
            return;
        }
        error_log('Foodle was updated, sending notification!');
        $profileurl = FoodleUtils::getUrl() . 'profile/';
        $url = FoodleUtils::getUrl() . 'foodle/' . $foodle->identifier;
        $name = $foodle->name;
        $to = $this->user->email;
        $mail = '
Hi, your new Foodle named <i>' . htmlspecialchars($name) . '</i> was successfully created.

You may visit your Foodle link below to update your response, and view other responses:

* [Edit your Foodle response](' . $url . ')
* [View responses of other participants](' . $url . '#responses)

If you want so invite others to respond to this Foodle, you should share the link below:

	' . htmlspecialchars($url) . '


### Notifications

You can turn of this e-mail notification, and configure other notification messages <a href="' . htmlspecialchars($profileurl) . '">from your Foodle preference page</a>:

	' . htmlspecialchars($profileurl) . '


### Did you know

You may also create new Foodles on your own, and invite others to respond.

* [Go to Foodl.org to create a new Foodle.](http://foodl.org)

		';
        $mailer = new Foodle_EMail($to, 'New foodle: ' . htmlspecialchars($name), 'Foodl.org <*****@*****.**>');
        $mailer->setBody($mail);
        $mailer->send();
        #echo '<pre>'; print_r($mail); exit;
    }
示例#4
0
文件: FixDate.php 项目: r4mp/Foodle
    protected function sendFixDateMail($user, $foodle)
    {
        if (!$this->user->notification('invite', TRUE)) {
            error_log('Foodle response was added, but mail notification was not sent because of users preferences');
            return;
        }
        error_log('Sending Foodle fixdate to ' . $user->email);
        $profileurl = FoodleUtils::getUrl() . 'profile/';
        $url = FoodleUtils::getUrl() . 'foodle/' . $foodle->identifier;
        $name = 'Date and time set for ' . $foodle->name;
        if (empty($user->email)) {
            error_log('Was not able to send e-mail notification to ' . $user->userid . ' because email address was missing');
            return;
        }
        $to = $user->email;
        //		$to = '*****@*****.**';
        $datetimetext = '';
        $extralinks = '';
        if (!empty($foodle->datetime)) {
            $tz = new TimeZone($this->db, NULL, $user);
            $icalurl = FoodleUtils::getUrl() . 'foodle/' . $foodle->identifier . '?output=ical';
            $datetimetext = "\n\n### Date and time\n\n" . $foodle->datetimeText($tz->getTimeZone());
            $extralinks = "\n* Import to your calendar using the attached calendar file";
        }
        $mail = $foodle->descr . '

### Confirm your participation

* [Please confirm your participation on this event](' . $url . ')
* [View confirmation of other participants](' . $url . '#responses)' . $extralinks . '

' . $datetimetext . '

### Did you know

You may also create new Foodles on your own, and invite others to respond.

* [Go to Foodl.org to create a new Foodle.](http://foodl.org)

		';
        $mailer = new Foodle_EMail($to, htmlspecialchars($name), 'Foodl.org <*****@*****.**>');
        $mailer->setBody($mail);
        if (!empty($foodle->datetime)) {
            $url = FoodleUtils::getUrl() . 'foodle/' . $foodle->identifier . '?output=ical';
            $ics = file_get_contents($url);
            $mailer->send(array(array('data' => $ics, 'file' => 'foodl-invitation.ics', 'type' => 'calendar/text')));
        } else {
            $mailer->send();
        }
    }