function OnPageLoad()
 {
     echo '<h1>Subscribed to ' . Html::Encode($this->o_review_item->GetTitle() ? $this->o_review_item->GetTitle() : ' page') . '</h1>';
     # Confirm subscription to user
     $b_title = (bool) $this->o_review_item->GetTitle();
     echo new XhtmlElement('p', 'You have subscribed to ' . Html::Encode($b_title ? "'" . $this->o_review_item->GetTitle() . "'" : 'the page you selected') . '. You will get an email alert every time someone adds a comment.');
     echo new XhtmlElement('p', 'If you want to stop getting these email alerts, sign in to ' . Html::Encode($this->GetSettings()->GetSiteName()) . ' and delete your subscription from the email alerts page.');
     # Links suggesting what to do next
     $o_whatnext = new XhtmlElement('ul');
     if ($this->o_review_item->GetNavigateUrl()) {
         $o_whatnext->AddControl(new XhtmlElement('li', new XhtmlAnchor('Go back to ' . Html::Encode($b_title ? $this->o_review_item->GetTitle() : 'the page you came from'), $this->o_review_item->GetNavigateUrl())));
     }
     $o_whatnext->AddControl(new XhtmlElement('li', new XhtmlAnchor("Email alerts", $this->GetSettings()->GetUrl('EmailAlerts'))));
     echo $o_whatnext;
 }
 function SendCommentsSubscriptions(ReviewItem $review_item, ForumMessage $message)
 {
     # get all subscriptions for this item
     if (AuthenticationManager::GetUser()->IsSignedIn() and $review_item->GetId()) {
         $s_person = $this->GetSettings()->GetTable('User');
         $s_sub = $this->GetSettings()->GetTable('EmailSubscription');
         # join to item's table to get the title, regardless of message title
         $s_sql = '';
         switch ($review_item->GetType()) {
             case ContentType::STOOLBALL_MATCH:
                 $matches = $this->GetSettings()->GetTable('Match');
                 $s_sql = "SELECT {$matches}.match_title AS title, {$s_person}.email\n\t\t\t\t\tFROM ({$s_person} INNER JOIN {$s_sub} ON {$s_person}.user_id = {$s_sub}.user_id AND {$s_sub}.item_type = " . ContentType::STOOLBALL_MATCH . ")\n\t\t\t\t\tINNER JOIN {$matches} ON {$s_sub}.item_id = {$matches}.match_id AND {$s_sub}.item_type = " . ContentType::STOOLBALL_MATCH . "\n\t\t\t\t\tWHERE {$s_sub}.item_id = " . Sql::ProtectNumeric($review_item->GetId()) . " AND {$s_person}.user_id <> " . Sql::ProtectNumeric(AuthenticationManager::GetUser()->GetId());
                 break;
         }
         if ($s_sql) {
             # if there's at least one person, build email
             require_once 'Zend/Mail.php';
             $email = new Zend_Mail('UTF-8');
             if ($this->GetEmailAddresses($s_sql, $email)) {
                 $o_filter = new BadLanguageFilter();
                 $s_title = $o_filter->Filter($this->s_review_item_title);
                 unset($o_filter);
                 $s_title = StringFormatter::PlainText($s_title);
                 # send the email
                 $email->addTo($this->GetSettings()->GetSubscriptionEmailTo());
                 $email->setFrom($this->GetSettings()->GetSubscriptionEmailFrom(), $this->GetSettings()->GetSubscriptionEmailFrom());
                 $email->setSubject("Email alert: '" . $s_title . "'");
                 $email->setBodyText($this->GetHeader() . trim(AuthenticationManager::GetUser()->GetName()) . ' has just commented on a page at ' . $this->GetSettings()->GetSiteName() . ' for which you subscribed to an email alert.' . "\n\n" . "The page is called '" . $s_title . "' - here's an excerpt of the new comments:\n\n" . $message->GetExcerpt() . "\n\n" . 'View the new comments at' . "\n" . $review_item->GetNavigateUrl() . '#message' . $message->GetId() . $this->GetFooter());
                 try {
                     $email->send();
                 } catch (Zend_Mail_Transport_Exception $e) {
                     # Do nothing - email not that important so, if it fails, fail silently rather than raising a fatal error
                 }
             }
         }
     }
 }