当前位置: 首页>>代码示例>>PHP>>正文


PHP Store::decryptEmail方法代码示例

本文整理汇总了PHP中Store::decryptEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP Store::decryptEmail方法的具体用法?PHP Store::decryptEmail怎么用?PHP Store::decryptEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Store的用法示例。


在下文中一共展示了Store::decryptEmail方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 public function run($args)
 {
     exit;
     $command = Yii::app()->db->createCommand("\n\t\t\n\t\tSELECT a.id, s.email FROM accession a\n\t\t\nINNER JOIN store2contact s2c ON s2c.id = a.store2contact_id \n\nLEFT JOIN store s ON s.id = s2c.store_id\n\nLEFT JOIN suppression_list sl ON sl.store2contact_id = s2c.id\n\nLEFT JOIN suppression_list sl2 ON sl2.warehouse_id = s2c.contact_warehouse_id\n\nWHERE a.terms_agreed IS NOT NULL AND sl.id IS NULL AND sl2.id IS NULL\n\t\t\n\t\t");
     $results = $command->queryAll();
     $rows = [];
     $Store = new Store();
     foreach ($results as $result) {
         $email = $Store->decryptEmail($result['email']);
         if (strlen($email)) {
             $rows[] = $result['id'] . ',' . $email;
         }
     }
     $csv = 'Acceded Report Generated ' . date('Y-m-d H:i:s') . "\n";
     $csv .= implode("\n", $rows);
     $myFile = Yii::app()->basePath . "/../../protected-file-uploads/misc/acceded.csv";
     $fh = fopen($myFile, 'w') or die("can't open file");
     fwrite($fh, $csv);
     fclose($fh);
 }
开发者ID:newga,项目名称:newga,代码行数:20,代码来源:accededReportCommand.php

示例2: run

 public function run($args)
 {
     $campaignSuccess = false;
     $configs = Yii::app()->db->createCommand("SELECT * FROM `config` WHERE `key` IN ('host', 'https')")->queryAll();
     if (sizeof($configs) < 2) {
         throw new CException("\n\n\n===\nDomain or HTTPS config not yet set. View any admin area page in a browser to remedy this.\n===\n\n");
     }
     foreach ($configs as $config) {
         $configParams[$config['key']] = $config['value'];
     }
     date_default_timezone_set("Europe/London");
     print "Getting campaigns to process \n";
     $CampaignCollection = Campaign::model()->findAll(array('with' => array('query', 'groups' => array('with' => array('email_template'))), "condition" => "processing = 0 AND status = :status AND invite = 0", "params" => array(":status" => Campaign::STATUS_QUEUED)));
     print count($CampaignCollection) . ' campaigns to process' . "\n";
     $campaignIDs = [];
     foreach ($CampaignCollection as $Campaign) {
         $campaignIDs[] = $Campaign->id;
         print "Will process Campaign ID: " . $Campaign->id . " \n";
     }
     $command = Yii::app()->db->createCommand();
     $command->update('campaign', array("processing" => 1), array('in', 'id', $campaignIDs));
     foreach ($CampaignCollection as $Campaign) {
         /* sending logic */
         /* create mailgun campaign id */
         $mailgunApi = new MailgunCampaign(Yii::app()->params['insiderEmailDomain'], Yii::app()->params['mailgun']['key']);
         // Check if the campaign ID exists
         try {
             $checkCampaignResponse = $mailgunApi->getCampaign(Yii::app()->params['insiderEmailDomain'], $Campaign->id);
         } catch (Exception $e) {
             $checkCampaignResponse = false;
         }
         if (!$checkCampaignResponse) {
             $mailgunCampaignResponse = $mailgunApi->createCampaign(Yii::app()->params['insiderEmailDomain'], array("name" => $Campaign->name, "id" => $Campaign->id));
         } else {
             $mailgunCampaignResponse['campaign'] = $checkCampaignResponse;
         }
         /* Example Response
         			Array
         			(
         				[message] => Campaign created
         				[campaign] => Array
         					(
         						[clicked_count] => 0
         						[opened_count] => 0
         						[submitted_count] => 0
         						[unsubscribed_count] => 0
         						[bounced_count] => 0
         						[id] => 691
         						[name] => Hicks 2
         						[created_at] => Tue, 24 Feb 2015 13:34:25 GMT
         						[delivered_count] => 0
         						[complained_count] => 0
         						[dropped_count] => 0
         					)
         
         			)
         			*/
         $Store = new Store();
         /* loop groups */
         /* load & render template (campaign_group) */
         foreach ($Campaign->groups as $CampaignGroup) {
             $mailgunApi = new MailgunApi(Yii::app()->params['insiderEmailDomain'], Yii::app()->params['mailgun']['key']);
             $mailgunApi->enableTracking();
             $mailgunApi->enableOpensTracking();
             $mailgunApi->enableClicksTracking();
             $message = $mailgunApi->newMessage();
             $message->setFrom(Yii::app()->params['fromEmail'], Yii::app()->name);
             $message->setSubject($CampaignGroup->subject);
             $message->setCampaignId($mailgunCampaignResponse['campaign']['id']);
             $message->setHtml($CampaignGroup->email_template->parsedHtml($configParams));
             // send variables to mailgun so that bounces and opens are easier to deal with.
             $message->addVar('campaign_id', $Campaign->id);
             $message->addVar('group_id', $CampaignGroup->id);
             //get contacts
             $CampaignContactCollection = CampaignContact::model()->findAll(array('with' => array('contact2outcomes' => array('index' => 'campaign_outcome_id')), "condition" => "\n\t\t\t\t\t\tgroup_id = :groupid\n\t\t\t\t\t\tAND `t`.`status` = 0\n\t\t\t\t\t", "params" => array(":groupid" => $CampaignGroup->id), 'index' => 'warehouse_id'));
             echo sizeof($CampaignContactCollection);
             // get the contact rows for the above campaigncontact rows
             $Criteria = new CDbCriteria();
             $Criteria->index = 'contact_warehouse_id';
             $Contacts = CleanWarehouse::model()->findAllByPk(array_keys($CampaignContactCollection), $Criteria);
             $chunkedCampaignContacts = array_chunk($CampaignContactCollection, 1000, true);
             foreach ($chunkedCampaignContacts as $campaign1000) {
                 //echo 'C';
                 $transaction = $Campaign->dbConnection->beginTransaction();
                 $campaign1000IDs = array();
                 $sentCount = 0;
                 $message->resetTo();
                 foreach ($campaign1000 as $warehouse_id => $CampaignContact) {
                     //echo '.';
                     $campaign1000IDs[] = $CampaignContact->id;
                     $thisContact = $Contacts[$warehouse_id];
                     $standardTags = array('first_name' => $thisContact->first_name, 'last_name' => $Store->decryptLastName($thisContact->last_name), 'email' => $Store->decryptEmail($thisContact->email), 'insider_unsubscribe' => 'http' . ($configParams['https'] ? 's' : '') . '://' . $configParams['host'] . Yii::app()->urlManager->createUrl('data/campaignUnsubscribe', array('campaign_id' => $Campaign->id, 'campaign_hash' => $Campaign->hash, 'campaign_contact_id' => $CampaignContact->id, 'campaign_contact_hash' => $CampaignContact->hash)), 'warehouse_id' => $warehouse_id);
                     $campaignTags = $CampaignGroup->email_template->returnOutcomeTagsToUrls($configParams, $Campaign, $CampaignContact->contact2outcomes);
                     $parsedTagsArray = array_merge($standardTags, $campaignTags);
                     if (ENVIRONMENT === 'PRODUCTION') {
                         $message->addTo($Store->decryptEmail($thisContact->email), $thisContact->first_name . ' ' . $Store->decryptLastName($thisContact->last_name), $parsedTagsArray);
                     } else {
                         $message->addTo("email@example.com", $thisContact->first_name . ' ' . $Store->decryptLastName($thisContact->last_name), $parsedTagsArray);
                     }
                     $sentCount++;
//.........这里部分代码省略.........
开发者ID:newga,项目名称:newga,代码行数:101,代码来源:campaignQueueCommand.php

示例3: actionDownload

 public function actionDownload($id)
 {
     // do not include log info in generated file
     foreach (Yii::app()->log->routes as $route) {
         if ($route instanceof CProfileLogRoute) {
             $route->enabled = false;
         }
     }
     // download (filtered) results of a query
     $Query = Query::model()->findByAttributes(array('id' => $id));
     if (is_null($Query)) {
         throw new CHttpException('404', 'File not found');
     }
     $result = $Query->run(array('*'), (int) Yii::app()->user->organisation_id ? (int) Yii::app()->user->organisation_id : null);
     if (!sizeof($result['rows'])) {
         throw new CHttpException('404', 'Results not found');
     }
     $cleanQueryName = preg_replace(array("@[^a-z0-9\\-\\s]@i", "@\\s+@", "@\\-{2,}@"), array("", "-", "-"), $Query->name) . '-' . date("Y-m-d");
     $csv = fopen('php://output', 'w');
     header("Expires: Tue, 03 Jul 2001 06:00:00 GMT");
     header("Cache-Control: max-age=0, no-cache, must-revalidate, proxy-revalidate");
     header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
     header('Content-Encoding: UTF-8');
     header('Content-type: text/csv; charset=UTF-8');
     // disposition / encoding on response body
     header("Content-Disposition: attachment;filename=" . $cleanQueryName . ".csv");
     header("Content-Transfer-Encoding: binary");
     $columns = array('contact_warehouse_id', 'salutation', 'first_name', 'last_name', 'email', 'phone', 'mobile', 'address_line_1', 'address_line_2', 'address_line_3', 'address_line_4', 'address_town', 'address_postcode', 'address_county');
     // header row
     fputcsv($csv, $columns);
     $Store = new Store();
     foreach ($result['rows'] as $row) {
         $data = array();
         foreach ($columns as $column) {
             switch ($column) {
                 case 'email':
                     $data[$column] = $Store->decryptEmail($row[$column]);
                     break;
                 case 'last_name':
                     $data[$column] = $Store->decryptLastName($row[$column]);
                     break;
                 case 'phone':
                     $data[$column] = $Store->decryptPhone($row[$column]);
                     if (strlen($data[$column]) && mb_substr($data[$column], 0, 1, 'utf-8') != 0) {
                         // add a zero to anything missing one
                         $data[$column] = '0' . $data[$column];
                     }
                     break;
                 case 'mobile':
                     $data[$column] = $Store->decryptMobile($row[$column]);
                     if (strlen($data[$column]) && mb_substr($data[$column], 0, 1, 'utf-8') != 0) {
                         // add a zero to anything missing one
                         $data[$column] = '0' . $data[$column];
                     }
                     break;
                 case 'address_line_1':
                     $data[$column] = $Store->decryptAddress1($row[$column]);
                     break;
                 default:
                     $data[$column] = $row[$column];
             }
         }
         fputcsv($csv, $data);
     }
     fclose($csv);
     exit;
 }
开发者ID:newga,项目名称:newga,代码行数:67,代码来源:QueryController.php


注:本文中的Store::decryptEmail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。