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


PHP Store::encryptEmail方法代码示例

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


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

示例1: addEvent

 private function addEvent($type, $id, $email, $datetime)
 {
     echo 'Adding ' . strtoupper($type) . ' to campaign ' . $id . ' with date of ' . $datetime . ' and email of ' . $email . "\r\n";
     $StoreModel = new Store();
     $encryptedEmail = $StoreModel->encryptEmail($email);
     // Look for this email address in store table
     $StoreRows = Store::model()->with('store2contact')->findAll(array('condition' => 'email = :email', 'params' => array(':email' => $encryptedEmail)));
     // collect our warehouse_ids up to match in campaign_contact table.
     $warehouseIDs = [];
     if (sizeof($StoreRows)) {
         // Save 1 suppression row for every instance of the email address in the store table - use store_id
         foreach ($StoreRows as $Store) {
             if ($Store->store2contact != null) {
                 $warehouseIDs[] = $Store->store2contact->contact_warehouse_id;
             }
         }
         $Contacts = null;
         // check for contact
         if (sizeof($warehouseIDs) && is_numeric($id)) {
             //Bounces
             if ($type === 'bounce') {
                 $Contacts = CampaignContact::model()->updateAll(array('bounced' => $datetime), "campaign_id = :campaign_id AND warehouse_id IN (" . implode(',', $warehouseIDs) . ") AND bounced IS NULL", array(':campaign_id' => $id));
             } else {
                 $Contacts = CampaignContact::model()->updateAll(array('opened' => $datetime), "campaign_id = :campaign_id AND warehouse_id IN (" . implode(',', $warehouseIDs) . ") AND opened IS NULL", array(':campaign_id' => $id));
             }
         }
         echo 'Updated ' . sizeof($Contacts) . ' contact';
     } else {
         echo 'Campaign contact not found' . "\r\n";
     }
     echo "\r\n";
 }
开发者ID:newga,项目名称:newga,代码行数:32,代码来源:legacyCampaignEventsCommand.php

示例2: authenticate

 public function authenticate()
 {
     // Try to get user from User table - this will be an administrator
     $User = User::model()->findByAttributes(array('email' => strtolower($this->username), 'verified' => 1, 'mothballed' => 0));
     if (!is_null($User)) {
         // We have an admin user
         if (isset($User->password)) {
             if ($User->password === hash('sha256', $this->password . SHASALT)) {
                 $this->errorCode = self::ERROR_NONE;
                 $this->_id = $User->id;
                 $this->userType = 'admin';
             } else {
                 $this->errorCode = self::ERROR_PASSWORD_INVALID;
             }
         }
     } else {
         // For encryption
         $Store = new Store();
         $Criteria = new CDbCriteria();
         $Criteria->condition = "\n\t\t\t\temail = :email AND \n\t\t\t\torigin_organisation_id = :origin_organisation_id AND \n\t\t\t\tpassword IS NOT NULL \n\t\t\t";
         $Criteria->params = array(':email' => $Store->encryptEmail($this->username), ':origin_organisation_id' => 10);
         $Store = Store::model()->with('store2contact', 'store2contact.accession')->find($Criteria);
         if (!is_null($Store)) {
             // We have a user from THE LIST
             // Does the password match?
             if ($Store->store2contact->accession->password === hash('sha256', $this->password . SHASALT)) {
                 $this->errorCode = self::ERROR_NONE;
                 $this->_id = $Store->id;
                 $this->userType = 'contact';
             } else {
                 $this->errorCode = self::ERROR_PASSWORD_INVALID;
             }
         }
     }
     return !$this->errorCode;
 }
开发者ID:newga,项目名称:newga,代码行数:36,代码来源:UserIdentity.php

示例3: actionImportUnsubcribes

 public function actionImportUnsubcribes()
 {
     $this->pageTitle = ' Import unsubscribes | ' . Yii::app()->name;
     $this->breadcrumbs = array('Import unsubscribes');
     ini_set('auto_detect_line_endings', true);
     if (isset($_POST['import'])) {
         if (!strlen($_POST['organisation_id'])) {
             Yii::app()->user->setFlash('error', 'Choose an organisation');
         } else {
             //print_r($_FILES);
             //exit();
             if (!strlen($_FILES['csv']['name'])) {
                 Yii::app()->user->setFlash('error', 'Choose a file');
             } else {
                 $dupeCount = 0;
                 $suppressionCount = 0;
                 $emailsChecked = array();
                 $emailDupeCount = 0;
                 $totalCount = 0;
                 $noRecordCount = 0;
                 if (($handle = fopen($_FILES['csv']['tmp_name'], "r")) !== FALSE) {
                     while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
                         if (sizeof($data) > 1) {
                             Yii::app()->user->setFlash('error', 'File should only contain 1 column');
                             break;
                         } else {
                             $totalCount++;
                             $Store = new Store();
                             $email = strtolower(trim(mb_convert_encoding($data[0], 'UTF-8')));
                             if (in_array($email, $emailsChecked)) {
                                 $emailDupeCount++;
                                 continue;
                             }
                             //add email to emails checked
                             $emailsChecked[] = $email;
                             //print $Store->encryptEmail(trim(mb_convert_encoding($data[0], 'UTF-8')));exit();
                             // Check for matching email in store table
                             $StoreRows = Store::model()->with('store2contact')->findAll(array('condition' => 'origin_organisation_id = :org_id AND email = :email', 'params' => array(':email' => $Store->encryptEmail($email), ':org_id' => (int) $_POST['organisation_id'])));
                             if (sizeof($StoreRows)) {
                                 foreach ($StoreRows as $Store) {
                                     if (is_null($Store->store2contact)) {
                                         continue;
                                     }
                                     // Check for existing based on store2contact id
                                     $Suppression = SuppressionList::model()->find(array('condition' => 'store2contact_id = :store2contact_id', 'params' => array(':store2contact_id' => $Store->store2contact->id)));
                                     if (is_null($Suppression)) {
                                         $Suppression = new SuppressionList();
                                         $Suppression->type = SuppressionList::TYPE_UNSUBSCRIBE;
                                         // always save the store id against this row
                                         $Suppression->store_id = $Store->id;
                                         $Suppression->store2contact_id = $Store->store2contact->id;
                                         //We DO NOT need the warehouse id, we're not supressing from everything.
                                         //$Suppression->warehouse_id = $Store->store2contact->contact_warehouse_id;
                                         $Suppression->date = date('Y-m-d H:i:s');
                                         if ($Suppression->save()) {
                                             $suppressionCount++;
                                         }
                                         $Store->contact_email = 0;
                                         $Store->save(true, array("contact_email"));
                                     } else {
                                         $dupeCount++;
                                     }
                                 }
                             } else {
                                 $noRecordCount++;
                             }
                         }
                     }
                     Yii::app()->user->setFlash('success', $suppressionCount . ' suppression rows saved. ' . $dupeCount . ' were already suppressed. Number of duplicate emails was ' . $emailDupeCount . '. Total number of rows processed was ' . $totalCount . '. We could not find a match for ' . $noRecordCount . '.');
                     $this->refresh();
                 }
                 fclose($handle);
             }
         }
     }
     $this->render('importUnsubcribes', array());
 }
开发者ID:newga,项目名称:newga,代码行数:77,代码来源:DataController.php

示例4: actionOpen

 public function actionOpen()
 {
     // See http://documentation.mailgun.com/user_manual.html#webhooks
     // Mail so we know we have received the opened webhook
     // Set up authorisation
     $authString = $_POST['timestamp'] . $_POST['token'];
     $authHash = hash_hmac('sha256', $authString, Yii::app()->params['mailgun']['key']);
     // Check Auth
     if ($authHash === $_POST['signature']) {
         // Huzzah! Authorized HTTP POST from Mailgun
         $uniques = array();
         $StoreModel = new Store();
         // Encrypt the email so we can find a match
         $openedEmailAddress = $StoreModel->encryptEmail($_POST['recipient']);
         // Look for this email address in store table
         $StoreRows = Store::model()->with('store2contact')->findAll(array('condition' => 'email = :email', 'params' => array(':email' => $openedEmailAddress)));
         // collect our warehouse_ids up to match in campaign_contact table.
         $warehouseIDs = [];
         if (sizeof($StoreRows)) {
             // Save 1 suppression row for every instance of the email address in the store table - use store_id
             foreach ($StoreRows as $Store) {
                 // expired? No store to contact. Skip
                 if (!is_null($Store->store2contact)) {
                     $warehouseIDs[] = $Store->store2contact->contact_warehouse_id;
                 }
             }
             // check for campaign_contacts.
             if (sizeof($warehouseIDs) && is_numeric($_POST['campaign_id']) && is_numeric($_POST['group_id'])) {
                 // it's a bounce of a campaign email. Mark against the row.
                 CampaignContact::model()->updateAll(array('opened' => date('Y-m-d H:i:s', $_POST['timestamp'])), "campaign_id = :campaign_id AND group_id = :group_id AND warehouse_id IN (" . implode(',', array_filter($warehouseIDs)) . ") AND opened IS NULL", array(':campaign_id' => $_POST['campaign_id'], ':group_id' => $_POST['group_id']));
             }
             header("HTTP/1.0 200 Ok");
             exit;
         } else {
             header("HTTP/1.0 404 Not Found");
             exit('Not Found');
         }
     } else {
         // Go away
         sleep(5);
         header("HTTP/1.0 401 Unauthorized");
         exit('Unauthorized');
     }
 }
开发者ID:newga,项目名称:newga,代码行数:44,代码来源:MailgunController.php


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