示例#1
0
 public function assertBodyHasTrackingImage($message = null)
 {
     $tt = InlineEmail::TRACKTAG;
     include realpath(Yii::app()->basePath . '/../webConfig.php');
     $url = Yii::app()->getAbsoluteBaseUrl();
     $image = "<img src=\"" . rtrim($url, '/') . "/index.php/actions/emailOpened?uid={$this->eml->uniqueId}&type=open\"/>";
     $fullImage = InlineEmail::insertedPattern('track', $image);
     $this->assertEquals($image, $this->eml->trackingImage, 'Failed asserting that the tracking image is as expected. ' . $message);
     $this->assertTrue(strpos($this->eml->message, $fullImage) !== false, 'Failed asserting that the body contains the tracking image; body =' . $this->eml->message . $message);
     $this->assertRegExp(InlineEmail::UIDREGEX, $this->eml->trackingImage, 'Failed asserting that the tracking image has a unique id.' . $message);
     preg_match(InlineEmail::UIDREGEX, $this->eml->trackingImage, $matchId);
     $this->assertEquals($this->eml->uniqueId, $matchId[1], "Failed asserting that the UID in the image tracking tag matches the one in the model." . $message);
 }
示例#2
0
文件: _view.php 项目: dsyman2/X2CRM
     if ($data->complete == 'Yes') {
         echo ' <b>' . Yii::t('workflow', 'Completed') . '</b> ' . Formatter::formatLongDateTime($data->completeDate);
     } else {
         echo ' <b>' . Yii::t('workflow', 'Started') . '</b> ' . Formatter::formatLongDateTime($data->createDate);
     }
     if (isset($data->actionDescription)) {
         echo '<br>' . CHtml::encode($data->actionDescription);
     }
 } elseif ($type == 'webactivity') {
     if (!empty($data->actionDescription)) {
         echo CHtml::encode($data->actionDescription), '<br>';
     }
     echo date('Y-m-d H:i:s', $data->completeDate);
 } elseif (in_array($data->type, array('email', 'emailFrom', 'email_quote', 'email_invoice', 'emailOpened', 'emailOpened_quote', 'emailOpened_invoice'))) {
     $legacy = false;
     if (!preg_match(InlineEmail::insertedPattern('ah', '(.*)', 1, 'mis'), $data->actionDescription, $matches)) {
         // Legacy pattern:
         preg_match('/<b>(.*?)<\\/b>(.*)/mis', $data->actionDescription, $matches);
         $legacy = true;
     }
     if (!empty($matches)) {
         $header = $matches[1];
         $body = '';
     } else {
         if (empty($data->subject)) {
             $header = "No subject found";
             $body = "(Error displaying email)";
         } else {
             $header = $data->subject . "<br>";
             $body = $data->actionDescription;
         }
示例#3
0
 public function actionViewEmail($id)
 {
     $this->redirectOnNullModel = false;
     $action = $this->loadModel($id);
     if (!Yii::app()->user->isGuest || Yii::app()->user->checkAccess(ucfirst($action->associationType) . 'View')) {
         header('Content-Type: text/html; charset=utf-8');
         if (!Yii::app()->user->isGuest) {
             echo preg_replace('/<\\!--BeginOpenedEmail-->(.*?)<\\!--EndOpenedEmail-->/s', '', $action->actionDescription);
         } else {
             // Strip out the action header since it's being viewed directly:
             $actionHeaderPattern = InlineEmail::insertedPattern('ah', '(.*)', 1, 'mis');
             if (!preg_match($actionHeaderPattern, $action->actionDescription, $matches)) {
                 // Legacy action header
                 echo preg_replace('/<b>(.*?)<\\/b>(.*)/mis', '', $action->actionDescription);
             } else {
                 // Current action header
                 echo preg_replace($actionHeaderPattern, '', $action->actionDescription);
             }
         }
     }
 }