Beispiel #1
0
 function sendMail($row, $feed)
 {
     // determine if we want to send mail for this feed
     // #1 - who is the target for this mail?
     // the guy who is the "owner", e.g when I create a post
     // and you LIKE it, I should get a notification.
     // so "owner of entity" is the target of our mails.
     // if X created a post and Y liked it then X gets a mail
     // if Z likes the same post then also only X gets a mail
     // Y will not receive a mail.
     $verb = $row["verb"];
     $ownerId = $row["owner_id"];
     if ($verb == AppConstants::FOLLOW_VERB) {
         //mail target is the guy you are following
         $ownerId = $row["object_id"];
     }
     // #2 : I am not interested in receiving mails where
     // I am the subject or doer of deed!
     if (!empty($ownerId) && $ownerId != $row["subject_id"]) {
         // #3 - get my preference for this feed
         $preferenceDao = new \com\indigloo\sc\dao\Preference();
         $preferenceObj = $preferenceDao->get($ownerId);
         $flag = $this->getMailflag($preferenceObj, $verb);
         if ($flag) {
             $activityHtml = new \com\indigloo\sc\html\Activity();
             $emailData = $activityHtml->getEmailData($feed);
             if (empty($emailData)) {
                 $message = sprintf("ACTIVITY_ERROR : getting email data :id %d ", $row["id"]);
                 throw new \Exception($message);
             }
             $text = $emailData["text"];
             $html = $emailData["html"];
             $userDao = new \com\indigloo\sc\dao\User();
             $row = $userDao->getOnLoginId($ownerId);
             $name = $row["name"];
             $email = $row["email"];
             if (!empty($email)) {
                 $code = WebMail::sendActivityMail($name, $email, $text, $html);
                 if ($code > 0) {
                     $message = sprintf("ACTIVITY_ERROR : sending mail : id %d ", $row["id"]);
                     throw new \Exception($message);
                 }
             }
         }
         //condition:mail_flag
     }
     //condition:owner
 }
Beispiel #2
0
Datei: mails.php Projekt: rjha/sc
use com\indigloo\Configuration as Config;
use com\indigloo\sc\auth\Login;
use com\indigloo\ui\form\Message as FormMessage;
use com\indigloo\ui\form\Sticky;
use com\indigloo\Constants;
use com\indigloo\sc\Constants as AppConstants;
$gWeb = \com\indigloo\core\Web::getInstance();
$gSessionLogin = \com\indigloo\sc\auth\Login::getLoginInSession();
$loginId = $gSessionLogin->id;
$loginName = $gSessionLogin->name;
if (is_null($loginId)) {
    trigger_error("Error : NULL or invalid login_id", E_USER_ERROR);
}
$fUrl = Url::current();
$preferenceDao = new \com\indigloo\sc\dao\Preference();
$pData = $preferenceDao->get($loginId);
$checked = array();
$checked["follow"] = $pData->follow ? "checked" : "";
$checked["comment"] = $pData->comment ? "checked" : "";
$checked["bookmark"] = $pData->bookmark ? "checked" : "";
?>


<!DOCTYPE html>
<html>

    <head>
        <title> mail settings- <?php 
echo $loginName;
?>
  </title>