private function _postProcessCheckToken() { // If credentials are set and remote addr do not match with the one in database, we regenerate token if (Configuration::get('MAILJET_API_KEY') != '' && Configuration::get('MAILJET_SECRET_KEY') != '' && Configuration::get('MAILJET_TOKEN_IP') != pSQL($_SERVER['REMOTE_ADDR'])) { // Test credentials $mailjet = new MailjetAPI(); $mailjet->apiKey = pSQL(Configuration::get('MAILJET_API_KEY')); $mailjet->secretKey = pSQL(Configuration::updateValue('MAILJET_SECRET_KEY')); $params = array('src' => version_compare(_PS_VERSION_, '1.5', '>') ? 'prestashop-1.5' : 'prestashop-1.4', 'apikey' => $mailjet->apiKey, 'allowed_access' => array('campaigns', 'contacts', 'stats', 'preferences')); // Display error or confirmation message if (!$mailjet->sendRequest('apiKeyauthenticate', $params, 'POST')) { $this->_html .= $this->displayError($this->l('MailJet did not recognised your credentials, please try again.')); } else { Configuration::updateValue('MAILJET_TOKEN', pSQL($mailjet->_response->token)); Configuration::updateValue('MAILJET_TOKEN_IP', pSQL($_SERVER['REMOTE_ADDR'])); } } }
<th>Sujet</th> <th>Date de création</th> <th>Date d'envoi</th> <th>Actions</th> </tr> </thead> <tbody> <?php foreach ($campaigns as $campaign) { ?> <tr> <td><span class="label label-<?php echo MailjetAPI::getStatusClass($campaign['status']); ?> "><?php echo MailjetAPI::getStatus($campaign['status']); ?> </span></td> <td><?php echo $campaign['title']; ?> </td> <td><?php echo $campaign['subject']; ?> </td> <td><?php echo isset($campaign['createdAt']) && $campaign['createdAt'] != 0 ? date_create($campaign['createdAt'])->format('d/m/Y') : '-'; ?> </td> <td><?php
</div> <?php } ?> <div class="widget-box"> <div class="widget-title"> <span class="icon"> <i class="icon-th"></i> </span> <h5>Modification des propriétés du segment</h5> <span class="label label-<?php echo MailjetAPI::getStatusClass($contactFilter->Status); ?> "> <?php echo MailjetAPI::getStatus($contactFilter->Status); ?> </span> </div> <div class="widget-content nopadding"> <?php foreach ($errors as $message) { ?> <div class="alert alert-danger"> <button class="close" data-dismiss="alert">×</button> <strong><?php echo $message; ?> </div> <?php }
</div> <?php } ?> <div class="widget-box"> <div class="widget-title"> <span class="icon"> <i class="icon-th"></i> </span> <h5>Modification des propriétés de la campagne</h5> <span class="label label-<?php echo MailjetAPI::getStatusClass($campaign->Status); ?> "> <?php echo MailjetAPI::getStatus($campaign->Status); ?> </span> </div> <div class="widget-content nopadding"> <?php foreach ($errors as $message) { ?> <div class="alert alert-danger"> <button class="close" data-dismiss="alert">×</button> <strong><?php echo $message; ?> </div> <?php }