コード例 #1
0
 function getmethodsbycampaigngatewayAction()
 {
     $this->checkLogin();
     AF::setJsonHeaders('json');
     $gateway_id = AF::get($_POST, 'gateway_id', false);
     if (!$gateway_id) {
         Message::echoJsonError(__('incorrect_gateway_id'));
     }
     $campaign_id = AF::get($_POST, 'campaign_id', false);
     $model = new Campaign();
     if (!$model->fillFromDbPk($campaign_id)) {
         Message::echoJsonError(__('incorrect_campaign_id'));
     }
     $result = ProfileGateways::getMethodsByProfileGateway($model->profile_id, $gateway_id);
     if (count($result)) {
         Message::echoJsonSuccess(array('message' => array('data' => $result)));
     } else {
         Message::echoJsonError('No Valid Payment Methods For the Selected Campaign and Gateway');
     }
     exit;
 }
コード例 #2
0
 function emailAction()
 {
     $model = new CampaignEmail();
     if (isset($_POST['ajax'])) {
         if (isset($_POST['model']) && $_POST['model'] == 'prospects') {
             // Uncomment the following line if AJAX validation is needed
             $this->performAjaxValidation($model);
             $model->fillFromArray($_POST);
             /*
             $model->user_id_created = $this->user->user_id;
             $model->user_id_updated = $this->user->user_id;
             $model->updated = 'NOW():sql';
             $model->created = 'NOW():sql';
             $model->model_uset_id = $this->user->user_id;
             */
             if ($model->save()) {
                 Message::echoJsonSuccess();
             } else {
                 Message::echoJsonError(__('prospects_email_not_created') . ' ' . $model->errors2string);
             }
             die;
         }
         if (isset($_POST['model']) && $_POST['model'] == 'campaigns') {
             $campaignModel = new Campaign();
             $campaignModel->setIsNewRecord(false);
             $campaignID = AF::get($_POST, 'campaign_id');
             $campaignModel->fillFromDbPk($campaignID);
             $campaignModel->smtp_id = AF::get($_POST, 'smtp_id');
             $campaignModel->user_id_updated = $this->user->user_id;
             $campaignModel->updated = 'NOW():sql';
             if ($campaignModel->save(false)) {
                 Message::echoJsonSuccess(__('campaign_updated'));
             } else {
                 Message::echoJsonError(__('campaign_no_updated'));
             }
             die;
         }
     }
     $clearArray = array();
     $this->filter($clearArray);
     $pagination = new Pagination(array('action' => $this->action, 'controller' => $this->controller, 'params' => $this->params, 'ajax' => true));
     $models = AFActiveDataProvider::models('CampaignEmail', $this->params, $pagination);
     $dataProvider = $models->getAll();
     $filterFields = $models->getoutFilterFields($clearArray);
     // set ajax table
     if (AF::isAjaxRequestModels()) {
         $this->view->includeFile('_email_table', array('application', 'views', 'prospects'), array('access' => $this->access, 'controller' => $this->controller, 'dataProvider' => $dataProvider, 'pagination' => $pagination, 'filterFields' => $filterFields));
         die;
     }
     $templates = Template::model()->cache()->findAllInArray();
     $smtps = Smtp::model()->cache()->findAllInArray();
     $campaignID = AF::get($this->params, 'campaign_id');
     $campaignModel = new Campaign();
     $campaignModel->fillFromDbPk($campaignID);
     Assets::js('jquery.form');
     $this->addToPageTitle(__('prospect_email'));
     $this->render('email', array('dataProvider' => $dataProvider, 'pagination' => $pagination, 'models' => $models, 'campaignModel' => $campaignModel, 'templates' => $templates, 'smtps' => $smtps, 'filterFields' => $filterFields));
 }
コード例 #3
0
<?php

$tProspectEmailID = isset($_GET['prospect_email_id']) ? $_GET['prospect_email_id'] : false;
$code = isset($_GET['code']) ? $_GET['code'] : false;
if (!$tProspectEmailID && !$code) {
    die;
}
@(include_once '../settings/autoload.php');
//$msql = SafeMySQL::getInstance();
$prospectEmailID = base_convert($tProspectEmailID, 36, 10);
$prospectEmailModel = new ProspectEmail();
$prospectEmailModel->fillFromDbPk($prospectEmailID);
$campaignModel = new Campaign();
$campaignModel->fillFromDbPk($prospectEmailModel->campaign_id);
if (!$prospectEmailModel->checkCode($code)) {
    header('Location: http://' . $campaignModel->url);
    die;
}
if ($prospectEmailModel->isFlag('click')) {
    header('Location: http://' . $campaignModel->url . '?ei=' . $tProspectEmailID . '&ec=' . $code);
    die;
}
$prospectEmailModel->addFlags('open');
$prospectEmailModel->addFlags('click');
$prospectEmailModel->save();
header('Location: http://' . $campaignModel->url . '?ei=' . $tProspectEmailID . '&ec=' . $code);
die;