Example #1
0
     $mailtpl->setVariable('your_email', $yourEmail);
     $mailtpl->setVariable('receivers_name', $receiversName);
     $mailtpl->setVariable('receivers_email', $receiversEmail);
     $mailtpl->setVariable('comment', $comment);
     $mailtext = $mailtpl->fetch('design:content/tipafriendmail.tpl');
     if ($mailtpl->hasVariable('content_type')) {
         $mail->setContentType($mailtpl->variable('content_type'));
     }
     $mail->setBody($mailtext);
     // mail was sent ok
     if (eZMailTransport::send($mail)) {
         $tpl->setVariable('action', 'confirm');
         $request = eZTipafriendRequest::create($receiversEmail);
         $request->store();
         // Increase tipafriend count for this node
         $counter = eZTipafriendCounter::create($NodeID);
         $counter->store();
         // Prevent user from sending tipafriend mail to same user on same node again for the rest of session
         $sessionSentTipList = $NodeID . '|' . $receiversEmail;
         if ($http->hasSessionVariable('ezpContentTipafriendList')) {
             $sessionSentTipList = $http->sessionVariable('ezpContentTipafriendList') . ',' . $sessionSentTipList;
         }
         $http->setSessionVariable('ezpContentTipafriendList', $sessionSentTipList);
     } else {
         $tpl->setVariable('action', 'error');
     }
     if ($http->hasPostVariable('RedirectBack') && $http->postVariable('RedirectBack') == 1) {
         $Module->redirectTo($node->attribute('url_alias'));
         return;
     }
 }