Esempio n. 1
0
<?php

require_once dirname(__FILE__) . '/../module.inc.php';
$contactFilterId = io::get('id');
$mapping = array();
$contactFilter = $api->contactfilter(array("method" => "VIEW", "ID" => $contactFilterId));
if ($contactFilter) {
    $contactFilter = $contactFilter->Data[0];
}
$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;
    }
}
$submitted = io::post('submit');
$name = io::post('name');
$description = io::post('description');
$property = io::post('property');
$expression = io::post('expression');
$errors = array();
$updated = false;
if ($submitted) {
    if (empty($name) || empty($expression)) {
        $errors[] = 'Veuillez remplir tous les champs obligatoires';
    }
    $typeProperty = $mapping[$property];
    switch ($typeProperty) {
        case 'str':
Esempio n. 2
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;
    }
}
Esempio n. 3
0
// *******************************************************************************
//disactive HTML compression
define("ENABLE_HTML_COMPRESSION", false);
//only cms_rc needed in this case : no extra loading
define('APPLICATION_USER_TYPE', 'file');
require_once dirname(__FILE__) . '/cms_rc.php';
$replace = array('..' => '', '\\' => '', '/' => '');
//Get image vars
$image = io::get('image');
$location = io::get('location') && isset($_SERVER["HTTP_REFERER"]) && strpos($_SERVER["HTTP_REFERER"], "automne/admin") !== false ? io::get('location') : RESOURCE_DATA_LOCATION_PUBLIC;
$location = in_array($location, array(RESOURCE_DATA_LOCATION_EDITED, RESOURCE_DATA_LOCATION_EDITION, RESOURCE_DATA_LOCATION_PUBLIC)) ? $location : '';
$module = io::get('module') ? io::get('module') : 'standard';
$module = in_array($module, CMS_modulesCatalog::getAllCodenames()) ? $module : '';
$x = io::get('x', 'io::isPositiveInteger');
$y = io::get('y', 'io::isPositiveInteger');
$crop = io::get('crop') && $x && $y ? true : false;
if ($image != io::htmlspecialchars(str_replace(array_keys($replace), $replace, $image))) {
    $image = '';
}
//missing datas : send 404
if (!$image || !$module || !$location) {
    //send 404 headers
    header('HTTP/1.x 404 Not Found', true, 404);
    //send image 404
    if (file_exists(PATH_REALROOT_FS . '/img/404.png')) {
        CMS_file::downloadFile(PATH_REALROOT_FS . '/img/404.png');
        exit;
    }
}
//resized image
$pathInfo = pathinfo($image);
Esempio n. 4
0
<?php

require_once dirname(__FILE__) . '/../module.inc.php';
$campaignId = io::get('id');
$newsletter = null;
$response = $api->newsletter(array('method' => 'VIEW', 'ID' => $campaignId));
if (isset($api->_response_code) && $api->_response_code === MailjetAPI::MAILJET_STATUS_CODE_OK_VIEW) {
    $newsletter = $response->Data[0];
}
$date = '';
$time = '';
$programmedErrors = array();
$immediateErrors = array();
$archived = false;
$programmedSuccess = false;
$sent = false;
// get the html as known by Mailjet
$params = array('method' => 'VIEW', 'ID' => $campaignId);
$response = $api->newsletterDetailContent($params);
if (isset($api->_response_code) && $api->_response_code === MailjetAPI::MAILJET_STATUS_CODE_OK_VIEW) {
    $attribut = 'Html-part';
    $mailjetHtml = $response->Data[0]->{$attribut};
}
$params = array('method' => 'POST', 'ID' => $campaignId);
$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.';
Esempio n. 5
0
$parameters['public'] = true;
$parameters['cache'] = false;
$parameters['pageID'] = CURRENT_PAGE;
$definitionParsing = new CMS_polymod_definition_parsing($transformedDefinition, true, CMS_polymod_definition_parsing::BLOCK_PARAM_MODE, $parameters['module']);
$compiledDefinition = $definitionParsing->getContent(CMS_polymod_definition_parsing::OUTPUT_PHP, $parameters);
$urlParts = parse_url($url);
if (!isset($urlParts['query'])) {
    die("Incorrect parameters");
}
parse_str($urlParts['query']);
$parameterName = $oembedDefinition->getParameter();
$embededObject = CMS_poly_object_catalog::getObjectByID(${$parameterName}, false, true);
if (!$embededObject) {
    die("Incorrect parameters");
}
// get label
ob_start();
eval(sensitiveIO::stripPHPTags($compiledDefinition));
$data = ob_get_contents();
ob_end_clean();
$html = array('html' => $data, 'title' => $embededObject->getLabel(), 'height' => io::get('height'), 'width' => io::get('width'));
$oembed = CMS_polymod_oembed_definition::getResults($html);
if ($format === 'json') {
    print json_encode($oembed, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT);
} elseif ($format === 'xml') {
    $output = "<?xml version=\"1.0\" encoding=\"utf-8\">\n";
    $output .= "<oembed>\n";
    $output .= CMS_polymod_oembed_definition::format_xml_elements($oembed);
    $output .= "</oembed>";
    print $output;
}
Esempio n. 6
0
// +----------------------------------------------------------------------+
/**
 * File used to frame oembed HTML objects
 * Ideally this frame should use another domain from website to avoid XSS
 *
 * @package Automne
 * @subpackage oembed
 * @author Sébastien Pauchet <*****@*****.**>
 */
define('APPLICATION_EXEC_TYPE', 'frame');
require_once dirname(__FILE__) . '/../../cms_rc_frontend.php';
//Check parameter
if (!io::get('params')) {
    die('Missing parameter.');
}
$params = io::get('params');
$params = @base64_decode($params);
if (!$params) {
    die('Incorrect parameter.');
}
$params = @unserialize($params);
if (!is_array($params) || !isset($params['url']) || !isset($params['maxwidth']) || !isset($params['maxheight'])) {
    die('Incorrect parameter.');
}
//load oembed object
$oembed = new CMS_oembed($params['url'], $params['maxwidth'], $params['maxheight']);
$title = $html = '';
if (!$oembed->hasProvider()) {
    $title = $html = 'Media not handled ...';
} else {
    $title = $oembed->getTitle();
 public static function getObjectName()
 {
     $page = CMS_tree::getPageByID(CURRENT_PAGE);
     $oembedDefinition = CMS_polymod_oembed_definition_catalog::getByCodename($page->getCodename());
     $parameterName = $oembedDefinition->getParameter();
     if (io::get($parameterName) && ($embededObject = CMS_poly_object_catalog::getObjectByID(io::get($parameterName), false, true))) {
         return $embededObject->getLabel();
     }
     return '';
 }
Esempio n. 8
0
		body div {
			text-align:			center;
		}
		p {
			margin:				0px;
			padding:			0px;
		}
		img {
			border:				0;
			cursor:				pointer;
		}
	</style>
</head>
<body>
	<?php 
if (io::get('popup') === "true" && $dimensions[0] > 20) {
    echo '
		<!-- resize popup to image size -->
		<script language="Javascript">
			var sizeX = (screen.availWidth >' . ($dimensions[0] + POPUP_ADD_X_SIZE) . ') ? ' . ($dimensions[0] + POPUP_ADD_X_SIZE) . ':screen.availWidth;
			var sizeY = (screen.availHeight>' . ($dimensions[1] + POPUP_ADD_Y_SIZE) . ') ? ' . ($dimensions[1] + POPUP_ADD_Y_SIZE) . ':screen.availHeight;
			window.resizeTo(sizeX,sizeY);
		</script>
		';
}
?>
	<div>
		<?php 
echo $html;
?>
		<p><?php 
Esempio n. 9
0
<?php

define("ENABLE_HTTP_COMPRESSION", false);
require_once dirname(__FILE__) . '/../cms_rc_frontend.php';
$url = urldecode(io::get('url'));
$format = io::get('format');
$page = CMS_tree::analyseURL($url);
if (!$page) {
    header('HTTP/1.x 404 Not Found', true, 404);
    exit;
}
$oembedDefinition = CMS_polymod_oembed_definition_catalog::getByCodename($page->getCodename());
if (!$oembedDefinition) {
    header('HTTP/1.x 404 Not Found', true, 404);
    exit;
}
$pageLang = $page->getLanguage(true);
$cms_language = new CMS_language($pageLang);
define('CURRENT_PAGE', $page->getID());
$website = $page->getWebsite();
$htmlDefinition = $oembedDefinition->getHtml();
$module = CMS_poly_object_catalog::getModuleCodenameForObjectType($oembedDefinition->getObjectdefinition());
$polymodModule = CMS_modulesCatalog::getByCodename($module);
$transformedDefinition = $polymodModule->convertDefinitionString($htmlDefinition, false);
$parameters = array();
$parameters['module'] = CMS_poly_object_catalog::getModuleCodenameForObjectType($oembedDefinition->getObjectdefinition());
$parameters['objectID'] = $oembedDefinition->getObjectdefinition();
$parameters['public'] = true;
$parameters['cache'] = false;
$parameters['pageID'] = CURRENT_PAGE;
$definitionParsing = new CMS_polymod_definition_parsing($transformedDefinition, true, CMS_polymod_definition_parsing::BLOCK_PARAM_MODE, $parameters['module']);