示例#1
0
    header('Pragma: no-cache');
    exit;
}
$post = trim(Tools::file_get_contents('php://input'));
/* mail("*****@*****.**", "callback ajax mailjet", $post.print_r($_POST, true).print_r($_GET, true)); */
/* die(); */
require_once _PS_ROOT_DIR_ . '/config/config.inc.php';
$method = Tools::getValue('method');
$back_office_method = Tools::getValue('back_office_method');
if (in_array($method, $back_office_method)) {
    define('_PS_ADMIN_DIR_', true);
}
require_once _PS_MODULE_DIR_ . 'mailjet/mailjet.php';
$method = Tools::isSubmit('method') ? Tools::getValue('method') : '';
$token = Tools::isSubmit('token') ? Tools::getValue('token') : '';
$mj = new Mailjet();
$result = array();
MailJetLog::write(MailJetLog::$file, 'New request sent');
if ($mj->getToken() != Tools::getValue('token')) {
    $result['error'] = $mj->l('Bad token sent');
} else {
    if (!method_exists($mj, $method)) {
        $result['error'] = $mj->l('Method requested doesn\'t exist:') . ' ' . $method;
    } else {
        $result = $mj->{$method}();
    }
}
$message = isset($result['error']) ? $result['error'] : 'Success with method: ' . $method;
MailJetLog::write(MailJetLog::$file, $message);
header('Content-Type: application/json');
die(Tools::jsonEncode($result));
示例#2
0
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
 * versions in the future. If you wish to customize PrestaShop for your
 * needs please refer to http://www.prestashop.com for more information.
 *
 * @author    PrestaShop SA <*****@*****.**>
 * @copyright 2007-2015 PrestaShop SA
 * @license   http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 * International Registered Trademark & Property of PrestaShop SA
*/
require_once dirname(__FILE__) . '/../../config/config.inc.php';
require_once dirname(__FILE__) . '/../../init.php';
require_once _PS_MODULE_DIR_ . 'mailjet/mailjet.php';
$mailjet = new Mailjet();
if (Tools::getValue('token') != $mailjet->getToken()) {
    die('No hackers allowed here ! ;-)');
}
function utf8Outtags($text)
{
    $notags = strip_tags($text);
    $utf8 = htmlentities($notags);
    preg_match_all('/&([0-9A-Za-z]+);/', $utf8, $res);
    foreach ($res[0] as $preg) {
        $text = str_replace(html_entity_decode($preg), $preg, $text);
    }
    return $text;
}
function findCode($code)
{
    if (version_compare(_PS_VERSION_, '1.5', '>=')) {