예제 #1
0
<?php

require_once dirname(__FILE__) . '/../module.inc.php';
$submitted = io::post('submit');
$name = io::post('name');
$description = io::post('description');
$property = io::post('property');
$expression = io::post('expression');
$mapping = array();
//get all properties (contact metadata)
$allContactMetadata = $api->contactmetadata(array('Limit' => '-1'));
if (isset($api->_response_code) && $api->_response_code === MailjetAPI::MAILJET_STATUS_CODE_OK_GET) {
    $properties = array();
    foreach ($allContactMetadata->Data as $key => $oProperty) {
        $properties[$oProperty->Name] = $oProperty->Name;
        $mapping[$oProperty->Name] = $oProperty->Datatype;
    }
}
$errors = array();
$created = false;
if ($submitted) {
    if (empty($name) || empty($expression)) {
        $errors[] = 'Veuillez remplir tous les champs obligatoires';
    }
    $typeProperty = $mapping[$property];
    switch ($typeProperty) {
        case 'str':
            $expression = '"' . $expression . '"';
            break;
        case 'int':
            if ($expression !== '0' && intval($expression) === 0) {
예제 #2
0
$immediateSending = io::post('immediateSending');
if ($immediateSending) {
    $response = $api->newsletterSend($params);
    if (isset($api->_response_code) && $api->_response_code === MailjetAPI::MAILJET_STATUS_CODE_OK_POST) {
        $sent = true;
    } elseif (isset($api->_response_code) && $api->_response_code === MailjetAPI::MAILJET_STATUS_CODE_OK_ERROR) {
        $msg = 'Erreur pendant la programmation de l\'envoi.';
        $immediateErrors[] = $msg;
    } else {
        $immediateErrors[] = 'Erreur interne pendant la programmation de l\'envoi.';
    }
}
$programmed = io::post('programmedSending');
if ($programmed) {
    $date = io::post('date_submit');
    $time = io::post('time');
    if (empty($date) || empty($time)) {
        $programmedErrors[] = 'Veuillez remplir la date et l\'heure';
    }
    if (empty($programmedErrors)) {
        $dateProgrammed = date_create($date . ' ' . $time)->format('c');
        // now we can programme the newsletter sending
        $params = array('method' => 'POST', 'ID' => $campaignId, 'Date' => $dateProgrammed);
        $response = $api->newsletterSchedule($params);
        if (isset($api->_response_code) && $api->_response_code === MailjetAPI::MAILJET_STATUS_CODE_OK_POST) {
            $programmedSuccess = true;
        } elseif (isset($api->_response_code) && $api->_response_code === MailjetAPI::MAILJET_STATUS_CODE_OK_ERROR) {
            $msg = 'Erreur pendant la programmation de l\'envoi.';
            $programmedErrors[] = $msg;
        } else {
            $programmedErrors[] = 'Erreur interne pendant la programmation de l\'envoi.';
예제 #3
0
<?php

require_once dirname(__FILE__) . '/../module.inc.php';
$listId = io::get('id');
// Get the list using the listId (passed by parameters)
$list = $api->contactslist(array('method' => 'VIEW', 'ID' => $listId))->Data[0];
// to get all contacts of the list, we use Limit = -1
$contacts = $api->contact(array('method' => 'GET', 'ContactsList' => $listId, 'Limit' => '-1'));
$submitted = io::post('submit');
$errors = array();
$updated = false;
if ($submitted) {
    $label = io::post('label');
    $listId = io::post('id');
    if (empty($label)) {
        $errors[] = 'Veuillez remplir tous les champs obligatoires';
    }
    if (empty($errors)) {
        $response = $api->contactslist(array('method' => 'PUT', 'unique' => $listId, 'Name' => $label));
        if (isset($api->_response_code) && $api->_response_code === MailjetAPI::MAILJET_STATUS_CODE_OK_PUT) {
            $updated = true;
        }
    }
} else {
    if ($list) {
        // List's id (not listId), make with numbers and characters
        $name = $list->Address;
        // List's name
        $label = $list->Name;
    }
}
예제 #4
0
     if (!$archive->hasError()) {
         $cms_message .= $cms_language->getMessage(MESSAGE_PAGE_MODULE_EXTRACT_DONE) . "\n";
     } else {
         $cms_message .= $cms_language->getMessage(MESSAGE_PAGE_MODULE_EXTRACT_ERROR) . "\n";
         break;
     }
     unset($archive);
     $file = new CMS_file(PATH_TMP_FS . '/export.xml');
     if (!$file->exists()) {
         $cms_message .= $cms_language->getMessage(MESSAGE_PAGE_MODULE_NO_EXPORT) . "\n";
         break;
     }
     $importDatas = $file->getContent();
     $format = 'xml';
 } elseif (io::post('import')) {
     $importDatas = io::post('import');
     if ($format == 'php') {
         //try to eval PHP Array
         try {
             $importDatas = eval('return ' . $importDatas . ';');
         } catch (Exception $e) {
         }
     }
 } else {
     $cms_message .= $cms_language->getMessage(MESSAGE_PAGE_MODULE_ERROR_NO_IMPORT_DATA) . "\n";
     break;
 }
 if (!$importDatas) {
     $cms_message .= $cms_language->getMessage(MESSAGE_PAGE_MODULE_ERROR_NO_IMPORT_DATA) . "\n";
     break;
 }
$oembedDefinitionId = io::request("definition");
$oembedDefinition = CMS_polymod_oembed_definition_catalog::getById($oembedDefinitionId);
if (!$oembedDefinition) {
    $oembedDefinition = new CMS_polymod_oembed_definition();
}
if ($moduleCodename) {
    $polymod = CMS_modulesCatalog::getByCodename($moduleCodename);
}
$cms_message = "";
switch ($_POST["cms_action"]) {
    case "validate":
        $oembedDefinition->setObjectdefinition(io::post('objectdefinition'));
        $oembedDefinition->setCodename(io::post('codename'));
        $oembedDefinition->setHtml(io::post('html'));
        $oembedDefinition->setParameter(io::post('parameter'));
        $oembedDefinition->setLabel(io::post('label'));
        if ($oembedDefinition->validate()) {
            $oembedDefinition->writeToPersistence();
        } else {
            $errors = $oembedDefinition->getValidationFailures();
            foreach ($errors as $error) {
                $cms_message .= "\n" . $error;
            }
        }
        break;
    case "switchexplanation":
        break;
}
$dialog = new CMS_dialog();
$dialog->setTitle("Cr&eacute;ation / modification d'une d&eacute;finition oembed", 'picto_modules.gif');
$dialog->setBacklink("modules_admin.php?moduleCodename=" . $moduleCodename . "&object=" . $objectDefinition->getID());
예제 #6
0
    $status = $campaign->Status;
}
$errors = array();
$updated = false;
if ($submitted) {
    $campaignId = io::post('id');
    $title = io::post('title');
    $subject = io::post('subject');
    $footer = io::post('footer');
    $from = io::post('from');
    $from_name = io::post('from_name');
    $lang = io::post('lang');
    $list_id = io::post('list_id');
    $permalink = io::post('permalink');
    $reply_to = io::post('reply_to');
    $segment_id = io::post('segment_id');
    if (empty($title) || empty($subject) || empty($list_id) || empty($lang) || empty($from) || empty($from_name) || empty($footer)) {
        $errors[] = 'Veuillez remplir tous les champs obligatoires';
    } elseif (!filter_var($from, FILTER_VALIDATE_EMAIL)) {
        $errors[] = 'Veuillez saisir un email d\'expéditeur valide';
    } elseif ($reply_to != '' && !filter_var($reply_to, FILTER_VALIDATE_EMAIL)) {
        $errors[] = 'Veuillez saisir un email de réponse valide';
    }
    if (empty($errors)) {
        $params = array('method' => 'PUT', 'unique' => $campaignId, 'Title' => $title, 'Subject' => $subject, 'ContactsListID' => $list_id, 'Locale' => $lang, 'SenderEmail' => $from, 'SenderName' => $from_name, 'Footer' => $footer, 'Permalink' => $permalink, 'ReplyEmail' => $reply_to);
        if ($segment_id !== '') {
            $params['SegmentationID'] = $segment_id;
        }
        $response = $api->newsletter($params);
        if (isset($api->_response_code) && $api->_response_code === MailjetAPI::MAILJET_STATUS_CODE_OK_GET) {
            $updated = true;
예제 #7
0
$validateContentSubmitted = io::post('validate-content');
if ($validateContentSubmitted) {
    $params = array('method' => 'PUT', 'ID' => $campaignId, 'Html-part' => $htmlVersion, 'Text-part' => $textVersion);
    $response = $api->newsletterDetailContent($params);
    if (isset($api->_response_code) && $api->_response_code === MailjetAPI::MAILJET_STATUS_CODE_OK_VIEW) {
        $contentOk = true;
    } elseif (isset($api->_response_code) && $api->_response_code === MailjetAPI::MAILJET_STATUS_CODE_OK_ERROR) {
        $errors[] = 'Erreur pendant l\'envoi du code source de l\'email à Mailjet.';
    } else {
        $errors[] = 'Erreur interne pendant l\'envoi du code source de l\'email à Mailjet.';
    }
}
$testEmail = io::post('test-email');
if ($testEmail) {
    $recipient = io::post('test-recipient');
    $name = io::post('name-recipient');
    if (!filter_var($recipient, FILTER_VALIDATE_EMAIL)) {
        $errors[] = 'Veuillez saisir un email valide.';
    } else {
        $params = array("method" => "POST", "ID" => $campaignId, "Recipients" => json_decode('[
          {
            "Email": "' . $recipient . '",
            "Name": "' . $name . '"
          }
        ]', true));
        $response = $api->newsletterTest($params);
        if (isset($api->_response_code) && $api->_response_code === MailjetAPI::MAILJET_STATUS_CODE_OK_POST) {
            $testMailOk = true;
        } elseif (isset($api->_response_code) && $api->_response_code === MailjetAPI::MAILJET_STATUS_CODE_OK_ERROR) {
            $msg = 'Erreur pendant l\'envoi du mail de test.';
            $errors[] = $msg;
예제 #8
0
    $content .= '<label>
							<input type="checkbox" name="options[]" value="' . $param . '"' . (in_array($param, $options) ? ' checked="checked"' : '') . ' />
							' . $label . '
						</label><br />';
}
$content .= '	</fieldset>
				<fieldset>
					<legend>Inclure une description</legend>
					<textarea style="width:100%;height:150px;" name="desc">' . io::htmlspecialchars(io::post('desc')) . '</textarea>
				</fieldset><br /><br />
				<input type="submit" class="admin_input_submit" value="' . $cms_language->getMessage(MESSAGE_PAGE_EXPORT_MODULE) . '" />
			</form>';
switch (io::post('action')) {
    case 'export':
        if (io::post('desc')) {
            $options['description'] = io::post('desc');
        }
        //set export parameters
        $export->setParameters($options);
        //force default language loading to overwrite user language because datas is more accurate in default language
        $oldLanguage = $cms_language->getCode();
        $cms_language = CMS_languagesCatalog::getDefaultLanguage(false);
        //export datas
        $exportDatas = $export->export($format);
        //reload user language
        $cms_language = CMS_languagesCatalog::getByCode($oldLanguage);
        switch ($format) {
            case 'php':
                $content .= '
				<br /><a name="exportDatas"></a>
				<fieldset>
예제 #9
0
<?php

require_once dirname(__FILE__) . '/../module.inc.php';
$submitted = io::post('submit');
$label = io::post('label');
//$name = io::post('name');
$errors = array();
$created = false;
if ($submitted) {
    if (empty($label)) {
        $errors[] = 'Veuillez remplir tous les champs obligatoires';
    }
    if (empty($errors)) {
        $params = array('method' => 'POST', 'Name' => $label);
        $response = $api->contactslist($params);
        if ($api->_response_code === MailjetAPI::MAILJET_STATUS_CODE_OK_POST) {
            $created = true;
            $id = $response->Data[0]->ID;
        }
    }
}
?>
<!DOCTYPE html>
<html lang="en">
	<?php 
include dirname(__FILE__) . '/../partials/head.php';
?>

	<body>
		<div id="header">
			<h1><a href="index.php"><?php 
예제 #10
0
<?php

require_once dirname(__FILE__) . '/../module.inc.php';
$contactFilterId = io::get('id');
$contactFilter = $api->contactfilter(array("method" => "VIEW", "ID" => $contactFilterId));
if ($contactFilter) {
    $contactFilter = $contactFilter->Data[0];
}
$submitted = io::post('submit');
$errors = array();
$deleted = false;
if ($submitted) {
    $contactFilterId = io::post('id');
    if (empty($errors)) {
        $response = $api->contactfilter(array('method' => 'DELETE', 'ID' => $contactFilterId));
        echo '<pre>';
        var_dump($api);
        echo '</pre>';
        if (isset($api->_response_code) && $api->_response_code === MailjetAPI::MAILJET_STATUS_CODE_OK_DELETE) {
            $deleted = true;
        }
    }
} else {
    if ($contactFilter) {
        $name = $contactFilter->Name;
        $description = $contactFilter->Description != '' ? $contactFilter->Description : '-';
        $expression = $contactFilter->Expression;
    }
}
?>
<!DOCTYPE html>