Example #1
0
 function action($mail)
 {
     $startdate["startdate_global"] = date("Y-m-d");
     $startdate["starttime_global"] = date("H:i:s");
     $startdate["startdate_noiter"] = date("Y-m-d");
     $startdate["starttime_noiter"] = date("H:i:s");
     $startdate["startdate_iter"] = date("Y-m-d");
     $startdate["starttime_iter"] = date("H:i:s");
     $mailClass = new Model_Mail();
     $sorts = $mailClass->getSorts();
     foreach ($sorts as $part) {
         $k = 0;
         foreach ($part as $parted) {
             if ($parted["type"] == "to") {
                 if ($parted["val"] == $mail["to"]) {
                     if ($parted["action"] == "remove") {
                         $this->emailTask = true;
                     } else {
                         if ($parted["action"] == "task") {
                             $sort = $mailClass->getSortByTo($parted["val"]);
                             $sort += $startdate;
                             $sort["task"] = "1";
                             $k++;
                         }
                     }
                 }
             }
             if ($parted["type"] == "from") {
                 if ($parted["val"] == $mail["mailbox"] . "@" . $mail["host"]) {
                     if ($parted["action"] == "remove") {
                         $this->emailTask = true;
                     } else {
                         if ($parted["action"] == "task") {
                             $sort = $mailClass->getSortByFrom($parted["val"]);
                             $sort += $startdate;
                             $sort["task"] = "1";
                             $k++;
                         }
                     }
                 }
             }
             if ($parted["type"] == "subject") {
                 if (mb_strpos($mail["subject"], $parted["val"]) !== false) {
                     if ($parted["action"] == "remove") {
                         $this->emailTask = true;
                     } else {
                         if ($parted["action"] == "task") {
                             $sort = $mailClass->getSortBySubject($parted["val"]);
                             $sort += $startdate;
                             $sort["task"] = "1";
                             $k++;
                         }
                     }
                 }
             }
         }
         if ($k == count($part)) {
             $this->mailInTask = true;
             $this->task = $sort;
         }
     }
 }