function akismet_ContentActionHandler($module, $http, $objectID) { $object = eZContentObject::fetch($objectID); $version = $object->attribute('current'); if ($http->hasPostVariable('AkismetSubmitSpam')) { $user = eZUser::currentUser(); $accessResult = $user->hasAccessTo('akismet', 'submit'); if ($accessResult['accessWord'] === 'yes') { $mainNode = $object->attribute('main_node'); $module->redirectTo($mainNode->attribute('url_alias')); $akismetObject = new eZContentObjectAkismet(); $comment = $akismetObject->akismetInformationExtractor($version); if ($comment) { $akismet = new eZAkismet($comment); if ($akismet) { $feedback = $akismet->submitSpam(); $response[] = $feedback[1]; } else { $response[] = ezi18n('extension/contactivity/akismet/submit', "An error has occured, unable to submit spam to Akismet."); } } else { $response[] = ezi18n('extension/contactivity/akismet/submit', "An error has occured, unable to submit spam to Akismet."); } } $mainNode = $object->attribute('main_node'); $module->redirectTo($mainNode->attribute('url_alias')); return true; } }
/** * Validates the input from the object edit form concerning this attribute. * * @param mixed $http Class eZHTTPTool. * @param string $base Seems to be always 'ContentObjectAttribute'. * @param mixed $contentObjectAttribute Class eZContentObjectAttribute. * * @return int eZInputValidator::STATE_INVALID/STATE_ACCEPTED */ public function validateObjectAttributeHTTPInput($http, $base, $contentObjectAttribute) { if ($http->hasPostVariable($base . "_data_domain_" . $contentObjectAttribute->attribute("id"))) { $data = $http->postVariable($base . "_data_domain_" . $contentObjectAttribute->attribute("id")); $data = str_replace(" ", "", $data); if (!$contentObjectAttribute->validateIsRequired() && $data == "") { return eZInputValidator::STATE_ACCEPTED; } $withSubdomain = $contentObjectAttribute->contentClassAttribute()->attribute(self::SUBDOMAIN_FIELD); if ($withSubdomain == 1) { if (!ereg('^' . self::SUBDOMAIN_REGEXP . '$', $data)) { $contentObjectAttribute->setValidationError(ezi18n('kernel/classes/datatypes', 'No valid domain')); return eZInputValidator::STATE_INVALID; } } else { if (!ereg('^' . self::DOMAIN_REGEXP . '$', $data)) { $contentObjectAttribute->setValidationError(ezi18n('kernel/classes/datatypes', 'No valid domain')); return eZInputValidator::STATE_INVALID; } } return eZInputValidator::STATE_ACCEPTED; } else { return eZInputValidator::STATE_ACCEPTED; } return eZInputValidator::STATE_INVALID; }
/** * Validates the input from the object edit form concerning this attribute. * * @param mixed $http Class eZHTTPTool. * @param string $base Seems to be always 'ContentObjectAttribute'. * @param mixed $contentObjectAttribute Class eZContentObjectAttribute. * * @return int eZInputValidator::STATE_INVALID/STATE_ACCEPTED */ public function validateObjectAttributeHTTPInput($http, $base, $contentObjectAttribute) { if ($http->hasPostVariable($base . "_data_ipv4_" . $contentObjectAttribute->attribute("id"))) { $data = $http->postVariable($base . "_data_ipv4_" . $contentObjectAttribute->attribute("id")); $data = str_replace(" ", "", $data); $classAttribute = $contentObjectAttribute->contentClassAttribute(); if (!$contentObjectAttribute->validateIsRequired() && $data == "") { return eZInputValidator::STATE_ACCEPTED; } $ipParts = explode(".", $data); if (count($ipParts) !== 4) { $contentObjectAttribute->setValidationError(ezi18n('kernel/classes/datatypes', 'No valid IP v4 address')); return eZInputValidator::STATE_INVALID; } $this->IntegerValidator->setRange(0, 255); foreach ($ipParts as $ipPart) { $state = $this->IntegerValidator->validate($ipPart); if ($state !== 1) { $contentObjectAttribute->setValidationError(ezi18n('kernel/classes/datatypes', 'No valid IP v4 address')); return eZInputValidator::STATE_INVALID; } } return eZInputValidator::STATE_ACCEPTED; } else { return eZInputValidator::STATE_ACCEPTED; } return eZInputValidator::STATE_INVALID; }
public function eZXMLPublisherType() { if (class_exists('ezpI18n')) { $this->eZWorkflowEventType('ezxmlpublisher', ezpI18n::tr('extension/ezxmkinstaller', 'XML Publisher')); } else { include_once 'kernel/common/i18n.php'; $this->eZWorkflowEventType('ezxmlpublisher', ezi18n('extension/ezxmkinstaller', 'XML Publisher')); } $this->setTriggerTypes(array('content' => array('publish' => array('after')))); }
/** * i18n * Provides all i18n strings for use by TinyMCE and other javascript dialogs. * * @static * @param array $args * @param string $fileExtension * @return string returns json string with translation data */ public static function i18n($args, $fileExtension) { $lang = '-en'; $locale = eZLocale::instance(); if ($args && $args[0]) { $lang = $args[0]; } $i18nArray = array($lang => array('soextra' => array('font_size' => ezi18n('design/standard/soextra', "Font size"), 'font_class' => ezi18n('design/standard/soextra', "Font style"), 'class' => ezi18n('design/standard/soextra', "Element style"), 'remove_tag' => ezi18n('design/standard/soextra', 'Remove "%tag" tag', null, array('%tag' => '<tag>')), 'remove_tag_keep_contents' => ezi18n('design/standard/soextra', 'Remove "%tag" tag (keep contents)', null, array('%tag' => '<tag>')), 'cursor_before' => ezi18n('design/standard/soextra', 'Place cursor before "%tag"', null, array('%tag' => '<tag>')), 'cursor_after' => ezi18n('design/standard/soextra', 'Place cursor after "%tag"', null, array('%tag' => '<tag>'))))); $i18nString = json_encode($i18nArray); return 'tinyMCE.addI18n( ' . $i18nString . ' );'; }
/** * Abstract method to translate labels and eventually takes advantage of new 4.3 i18n API * @param $context * @param $message * @param $comment * @param $argument * @return string */ public static function translate($context, $message, $comment = null, $argument = null) { $translated = ''; // eZ Publish < 4.3 => use old i18n system if (eZPublishSDK::majorVersion() >= 4 && eZPublishSDK::minorVersion() < 3) { if (!function_exists('ezi18n')) { include_once 'kernel/common/i18n.php'; } $translated = ezi18n($context, $message, $comment, $argument); } else { $translated = ezpI18n::tr($context, $message, $comment, $argument); } return $translated; }
function get_zodiac_sign($month, $day) { // Check arguments for validity if ($month < 1 || $month > 12 || $day < 1 || $day > 31) { return array(); } // List of zodiac signs with start day (start month is array-index + 1) $signs = array(array("20" => "11"), array("19" => "12"), array("21" => "1"), array("20" => "2"), array("21" => "3"), array("22" => "4"), array("23" => "5"), array("23" => "6"), array("23" => "7"), array("24" => "8"), array("22" => "9"), array("22" => "10")); $name = array(1 => ezi18n('kernel/classes/datatypes', 'Aries'), 2 => ezi18n('kernel/classes/datatypes', 'Taurus'), 3 => ezi18n('kernel/classes/datatypes', 'Gemini'), 4 => ezi18n('kernel/classes/datatypes', 'Cancer'), 5 => ezi18n('kernel/classes/datatypes', 'Leo'), 6 => ezi18n('kernel/classes/datatypes', 'Virgio'), 7 => ezi18n('kernel/classes/datatypes', 'Libra'), 8 => ezi18n('kernel/classes/datatypes', 'Scorpio'), 9 => ezi18n('kernel/classes/datatypes', 'Sagittarius'), 10 => ezi18n('kernel/classes/datatypes', 'Capricorn'), 11 => ezi18n('kernel/classes/datatypes', 'Aquarius'), 12 => ezi18n('kernel/classes/datatypes', 'Pisces')); list($sign_start, $sign_name) = each($signs[(int) $month - 1]); if ($day < $sign_start) { list($sign_start, $sign_name) = each($signs[$month - 2 < 0 ? $month = 11 : ($month -= 2)]); } return array("Number" => $sign_name, "Name" => $name[$sign_name]); }
/** * Validate post data, these are then used by * {@link eZGmapLocationType::fetchObjectAttributeHTTPInput()} * * @param eZHTTPTool $http * @param string $base * @param eZContentObjectAttribute $contentObjectAttribute */ function validateObjectAttributeHTTPInput($http, $base, $contentObjectAttribute) { $latitude = ''; $longitude = ''; $classAttribute = $contentObjectAttribute->contentClassAttribute(); if ($http->hasPostVariable($base . '_data_gmaplocation_latitude_' . $contentObjectAttribute->attribute('id')) && $http->hasPostVariable($base . '_data_gmaplocation_longitude_' . $contentObjectAttribute->attribute('id'))) { $latitude = $http->postVariable($base . '_data_gmaplocation_latitude_' . $contentObjectAttribute->attribute('id')); $longitude = $http->postVariable($base . '_data_gmaplocation_longitude_' . $contentObjectAttribute->attribute('id')); } if ($latitude === '' || $longitude === '') { if (!$classAttribute->attribute('is_information_collector') && $contentObjectAttribute->validateIsRequired()) { $contentObjectAttribute->setValidationError(ezi18n('extension/ezgmaplocation/datatype', 'Missing Latitude/Longitude input.')); return eZInputValidator::STATE_INVALID; } } else { if (!is_numeric($latitude) || !is_numeric($longitude)) { $contentObjectAttribute->setValidationError(ezi18n('extension/ezgmaplocation/datatype', 'Invalid Latitude/Longitude input.')); return eZInputValidator::STATE_INVALID; } } return eZInputValidator::STATE_ACCEPTED; }
// // filter examples // //$filterArray[] = array( 'cjwnl_user.email' => array( 'OR', array( 'like', '%@%' ), array( 'like', '%abc@%' ) ) ); //$filterArray[] = array( 'cjwnl_user.email' => array( 'OR', array( 'AND', 'woldt', 'acd' ), array( 'like', '%abc@%' ) ) ); //$filterArray[] = array( 'cjwnl_user.last_name' => array( array( 'woldt', 'acd' ) ) ); //$filterArray[] = array( 'cjwnl_user.last_name' => array( 'AND', 'woldt', 'acd' ) ); //$filterArray[] = array( 'cjwnl_subscription.list_contentobject_id' => array( array( 132 , 109 ) ) ); //$filterArray[] = array( 'cjwnl_subscription.status' => CjwNewsletterSubscription::STATUS_APPROVED ); //$filterArray[] = array( 'cjwnl_user.email' => array( 'like', '%@%.de' ) ); // get wanted user email and filter by itself if ($http->hasVariable('SearchUserEmail')) { $searchUserEmail = trim($db->escapeString($http->variable('SearchUserEmail'))); $filterArray[] = array('cjwnl_user.email' => array('like', $searchUserEmail)); } // AND - all filter should match // OR - 1 one the filter should be match // AND-NOT - none of the filter should be matched $userListSearch = CjwNewsletterUser::fetchUserListByFilter($filterArray, $limit, $offset); $tpl->setVariable('user_list', $userListSearch); $tpl->setVariable('user_list_count', count($userListSearch)); $viewParameters = array('offset' => 0, 'namefilter' => ''); $searchParameters = array('search_user_email' => $searchUserEmail); $userParameters = $Params['UserParameters']; $viewParameters = array_merge($viewParameters, $userParameters); $viewParameters = array_merge($viewParameters, $searchParameters); $tpl->setVariable('view_parameters', $viewParameters); $Result = array(); $Result['content'] = $tpl->fetch($templateFile); $Result['path'] = array(array('url' => 'newsletter/index', 'text' => ezi18n('cjw_newsletter/path', 'Newsletter')), array('url' => false, 'text' => ezi18n('cjw_newsletter/user_list', 'Users')));
echo $mailboxItemObject->getRawMailMessageContent(); eZExecution::cleanExit(); } elseif ($http->hasVariable('DownloadRawMailContent')) { downloadFile($mailboxItemObject->getFilePath()); } else { $cjwNewsletterMailParserObject = new CjwNewsletterMailParser($mailboxItemObject); if (is_object($cjwNewsletterMailParserObject)) { $parseHeaderArray = $cjwNewsletterMailParserObject->parse(); } $tpl = templateInit(); $tpl->setVariable('mailbox_item', $mailboxItemObject); $tpl->setVariable('mailbox_item_raw_content', $mailboxItemObject->getRawMailMessageContent()); $tpl->setVariable('mailbox_header_hash', $parseHeaderArray); $Result = array(); $Result['content'] = $tpl->fetch($templateFile); $Result['path'] = array(array('url' => 'newsletter/mailbox_item_list', 'text' => ezi18n('cjw_newsletter/mailbox_item_view', 'Mailbox item list')), array('url' => false, 'text' => ezi18n('cjw_newsletter/mailbox_item_view', 'Mailbox item view'))); } // helpfunction /** * Passthrough file, and exit cleanly */ function downloadFile($filePath) { if (!file_exists($filePath)) { header("HTTP/1.1 404 Not Found"); eZExecution::cleanExit(); } ob_clean(); header("Pragma: public"); header("Expires: 0"); // set expiration time
<?php require_once 'kernel/common/template.php'; $newsletterIni = eZINI::instance('jajnewsletter.ini'); $subscriptionListsNode = $newsletterIni->variable('ContentSettings', 'SubscriptionListsNode'); $subscriptionUsersNode = $newsletterIni->variable('ContentSettings', 'SubscriptionUsersNode'); $http = eZHTTPTool::instance(); $offset = $Params['Offset']; if (!$offset) { $offset = 0; } $limit = 25; $viewParameters = array('offset' => $offset, 'limit' => $limit); $tpl = templateInit(); $tpl->setVariable('view_parameters', $viewParameters); $tpl->setVariable('subscription_lists_node', $subscriptionListsNode); $tpl->setVariable('subscription_users_node', $subscriptionUsersNode); $Result = array(); $Result['left_menu'] = "design:parts/jnewsletter/menu.tpl"; $Result['content'] = $tpl->fetch('design:newsletter/lists_list.tpl'); $Result['path'] = array(array('url' => false, 'text' => ezi18n('newsletter', 'Newsletter')));
} if ($http->hasPostVariable('Subscription_Salutation')) { $subscriptionDataArray['salutation'] = trim($http->postVariable('Subscription_Salutation')); } if ($http->hasPostVariable('Subscription_IdArray')) { $subscriptionDataArray['id_array'] = $http->postVariable('Subscription_IdArray'); } if ($http->hasPostVariable('Subscription_ListArray')) { $subscriptionDataArray['list_array'] = $http->postVariable('Subscription_ListArray'); } // $subscriptionDataArr['list_output_format_array'] = array(); foreach ($subscriptionDataArray['id_array'] as $listId) { if ($http->hasPostVariable("Subscription_OutputFormatArray_{$listId}")) { $subscriptionDataArray['list_output_format_array'][$listId] = $http->postVariable("Subscription_OutputFormatArray_{$listId}"); } else { $defaultOutputFormatId = 0; $subscriptionDataArray['list_output_format_array'][$listId] = array($defaultOutputFormatId); } } // TODO // required fields // update subscribe/ remove supscripions $subscriptionResultArray = CjwNewsletterSubscription::createSubscriptionByArray($subscriptionDataArray, CjwNewsletterUser::STATUS_PENDING, $subscribeOnlyMode = false, $context = 'configure'); $tpl->setVariable('changes_saved', true); } $newsletterUser = CjwNewsletterUser::fetchByHash($Params['UserHash']); $tpl->setVariable('newsletter_user', $newsletterUser); $Result = array(); $Result['content'] = $tpl->fetch('design:newsletter/configure.tpl'); $Result['path'] = array(array('url' => false, 'text' => ezi18n('cjw_newsletter/configure', 'Configure newsletter settings')));
<?php include_once 'kernel/common/template.php'; $Module = $Params['Module']; $nodeID = $Params['NodeID']; $node = eZContentObjectTreeNode::fetch($nodeID); if ($node instanceof eZContentObjectTreeNode) { $object = $node->object(); } else { $object = false; } if ($Module->isCurrentAction('Store')) { $placementList = $Module->actionParameter('PlacementList'); $db = eZDB::instance(); foreach ($placementList as $frontpageID => $zones) { foreach ($zones as $zoneID => $blocks) { foreach ($blocks as $blockID => $timestamp) { $itemCount = $db->arrayQuery("SELECT COUNT( * ) as count FROM ezm_pool\n WHERE block_id='" . $blockID . "'\n AND object_id='" . $object->attribute('id') . "'"); if ($itemCount[0]['count'] == 0) { $db->query("INSERT INTO ezm_pool ( block_id, object_id, node_id, priority, ts_publication )\n VALUES ( '" . $blockID . "',\n '" . $object->attribute('id') . "',\n '" . $node->attribute('node_id') . "',\n '0',\n '" . $timestamp . "' )"); } } } } $Module->redirectTo($node->urlAlias()); } $tpl = templateInit(); $tpl->setVariable('node', $node); $Result['path'] = array(array('url' => false, 'text' => ezi18n('ezflow/push', 'Push to block'))); $Result['content'] = $tpl->fetch('design:page/push.tpl');
function __construct() { $this->eZDataType( self::DATA_TYPE_STRING, ezi18n( 'kernel/classes/datatypes', "Solr Meta Data", 'Datatype name' ), array( 'serialize_supported' => true ) ); }
function customObjectAttributeHTTPAction($http, $action, $contentObjectAttribute, $parameters) { switch ($action) { case "send_preview": $module = $parameters['module']; var_dump($module->obj); //viewData() ); var_dump($obj); /* $classAttribute = $contentObjectAttribute->contentClassAttribute(); var_dump($http); var_dump($action); var_dump($contentObjectAttribute); var_dump //$classAttribute = $contentObjectAttribute->contentClassAttribute(); //$module = $classAttribute->currentModule(); $module = $parameters['module']; //var_dump($module); //var_dump($parameters); $ObjectVersion = 26; $ObjectID = 99; $contentObject = ezContentObjectVersion::fetchVersion( $ObjectVersion ,$ObjectID); $tpl =& templateInit(); $tpl->setVariable('object', $contentObject); //$tpl->setVariable('newsletter', $newsletter); $tpl->fetch( 'design:eznewsletter/newsletter_preview.tpl' ); */ /* $cacheFileArray = array( 'cache_dir' => false, 'cache_path' => false ); $NodeID = 101; //$Module = $Params['Module']; $tpl = templateInit(); $LanguageCode = $Params['Language']; $ViewMode = "full"; $Offset = $Params['Offset']; //$ini = eZINI::instance(); $Year = $Params['Year']; $Month = $Params['Month']; $Day = $Params['Day']; $viewParameters = array( 'offset' => $Offset, 'year' => $Year, 'month' => $Month, 'day' => $Day, 'namefilter' => false ); $viewParameters = array_merge( $viewParameters, $UserParameters ); $collectionAttributes = false; if ( isset( $Params['CollectionAttributes'] ) ) $collectionAttributes = $Params['CollectionAttributes']; $validation = array( 'processed' => false, 'attributes' => array() ); if ( isset( $Params['AttributeValidation'] ) ) $validation = $Params['AttributeValidation']; $localVars = array( "cacheFileArray", "NodeID", "Module", "tpl", "LanguageCode", "ViewMode", "Offset", "ini", "cacheFileArray", "viewParameters", "collectionAttributes", "validation" ); $args = compact( $localVars ); // the false parameter will disable generation of the 'binarydata' entry $data = eZNodeviewfunctions::contentViewGenerate( false, $args ); */ $tpl = templateInit(); $EditVersion = 26; $pathIdentificationString = ""; $ObjectID = 99; $parentNodeID = 2; $virtualNodeID = null; $pathString = ""; $depth = 2; $objectName = "OMG"; $node = new eZContentObjectTreeNode(); $node->setAttribute('contentobject_version', $EditVersion); $node->setAttribute('path_identification_string', $pathIdentificationString); $node->setAttribute('contentobject_id', $ObjectID); $node->setAttribute('parent_node_id', $parentNodeID); $node->setAttribute('main_node_id', $virtualNodeID); $node->setAttribute('path_string', $pathString); $node->setAttribute('depth', $depth); $node->setAttribute('node_id', $virtualNodeID); //$node->setAttribute( 'sort_field', $class->attribute( 'sort_field' ) ); //$node->setAttribute( 'sort_order', $class->attribute( 'sort_order' ) ); $node->setName($objectName); $node->setContentObject($contentObject); $contentObject = null; $LanguageCode = null; $viewParameters = array(); $contentObject = eZContentObject::fetch($ObjectID); $Result = eZNodeviewfunctions::generateNodeViewData($tpl, $node, $contentObject, $LanguageCode, 'full', 0); var_dump($Result); //var_dump( $module->run("versionview") ); $contentObjectAttribute->setValidationError(ezi18n('kernel/classes/datatypes', 'The email address is not valid.')); } }
*/ // Blacklist User by nl user id or by email // update all nessesarry status fields to blacklisted $module = $Params['Module']; $templateFile = 'design:newsletter/blacklist_item_list.tpl'; require_once 'kernel/common/i18n.php'; include_once 'kernel/common/template.php'; $http = eZHTTPTool::instance(); $tpl = templateInit(); $http = eZHTTPTool::instance(); $db = eZDB::instance(); $viewParameters = array('offset' => 0, 'namefilter' => ''); $userParameters = $Params['UserParameters']; $viewParameters = array_merge($viewParameters, $userParameters); $limit = 10; $limitArray = array(10, 10, 25, 50); $limitArrayKey = eZPreferences::value('admin_blacklist_item_list_limit'); // get user limit preference if (isset($limitArray[$limitArrayKey])) { $limit = $limitArray[$limitArrayKey]; } $blacklistItemList = CjwNewsletterBlacklistItem::fetchAllBlacklistItems($limit, $viewParameters['offset']); $blacklistItemListCount = CjwNewsletterBlacklistItem::fetchAllBlacklistItemsCount(); $tpl->setVariable('view_parameters', $viewParameters); $tpl->setVariable('blacklist_item_list', $blacklistItemList); $tpl->setVariable('blacklist_item_list_count', $blacklistItemListCount); $tpl->setVariable('limit', $limit); $Result = array(); $Result['content'] = $tpl->fetch($templateFile); $Result['path'] = array(array('url' => 'newsletter/index', 'text' => ezi18n('cjw_newsletter/path', 'Newsletter')), array('url' => false, 'text' => ezi18n('cjw_newsletter/blacklist_item_list', 'Blacklists')));
*/ require_once 'kernel/common/i18n.php'; include_once 'kernel/common/template.php'; $module = $Params['Module']; $http = eZHTTPTool::instance(); $tpl = templateInit(); $nodeId = (int) $Params['NodeId']; $node = eZContentObjectTreeNode::fetch($nodeId); if (!is_object($node)) { return $module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel'); } if (!$node->attribute('can_read')) { return $module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel'); } $viewParameters = array('offset' => 0, 'namefilter' => ''); if (is_array($Params['UserParameters'])) { $viewParameters = array_merge($viewParameters, $Params['UserParameters']); } $tpl->setVariable('view_parameters', $viewParameters); $tpl->setVariable('node', $node); $systemNode = $node->attribute('parent'); $Result = array(); if ($node->attribute('class_identifier') == 'cjw_newsletter_list_virtual') { $templateFile = 'design:newsletter/subscription_list_virtual.tpl'; } else { $templateFile = 'design:newsletter/subscription_list.tpl'; } $Result['node_id'] = $nodeId; $Result['content'] = $tpl->fetch($templateFile); $Result['path'] = array(array('url' => 'newsletter/index', 'text' => ezi18n('cjw_newsletter/path', 'Newsletter')), array('url' => $systemNode->attribute('url_alias'), 'text' => $systemNode->attribute('name')), array('url' => $node->attribute('url_alias'), 'text' => $node->attribute('name')), array('url' => false, 'text' => ezi18n('cjw_newsletter/subscription_list', 'Subscriptions')));
/** * Validates input on content object level * * (non-PHPdoc) * @see kernel/classes/eZDataType#validateObjectAttributeHTTPInput($http, $base, $objectAttribute) * @return EZ_INPUT_VALIDATOR_STATE */ function validateObjectAttributeHTTPInput($http, $base, $contentObjectAttribute) { $contentclassAttribute = $contentObjectAttribute->attribute('contentclass_attribute'); $inputValidationCheck = true; $validationErrorMesssageArray = array(); $prefix = $base . '_CjwNewsletterList_'; $postfix = '_' . $contentObjectAttribute->attribute('id'); // ContentObjectAttribute_CjwNewsletterList_MainSiteaccess_123 $postListData = array(); // set placeholders to detect if we should get the values from statick list $postListData['main_siteaccess'] = CjwNewsletterListVirtual::PARENT_LIST_VALUE_PLACEHOLDER_STRING; //$postListData['siteaccess_array'] = CjwNewsletterListVirtual::PARENT_LIST_VALUE_PLACEHOLDER_STRING; $postListData['output_format_array'] = CjwNewsletterListVirtual::PARENT_LIST_VALUE_PLACEHOLDER_STRING; $postListData['email_sender'] = CjwNewsletterListVirtual::PARENT_LIST_VALUE_PLACEHOLDER_STRING; $postListData['email_reply_to'] = CjwNewsletterListVirtual::PARENT_LIST_VALUE_PLACEHOLDER_STRING; $postListData['email_return_path'] = CjwNewsletterListVirtual::PARENT_LIST_VALUE_PLACEHOLDER_STRING; $postListData['email_sender_name'] = CjwNewsletterListVirtual::PARENT_LIST_VALUE_PLACEHOLDER_STRING; $postListData['email_receiver_test'] = CjwNewsletterListVirtual::PARENT_LIST_VALUE_PLACEHOLDER_STRING; $postListData['auto_approve_registered_user'] = CjwNewsletterListVirtual::PARENT_LIST_VALUE_PLACEHOLDER_NUMERIC; $postListData['skin_name'] = CjwNewsletterListVirtual::PARENT_LIST_VALUE_PLACEHOLDER_STRING; $postListData['personalize_content'] = CjwNewsletterListVirtual::PARENT_LIST_VALUE_PLACEHOLDER_NUMERIC; // try to fetch post /* $postListData['main_siteaccess'] = $http->postVariable( $prefix . 'MainSiteaccess' . $postfix ); $postListData['siteaccess_array'] = $http->hasPostVariable( $prefix . 'SiteaccessArray' . $postfix ) ? $http->postVariable( $prefix . 'SiteaccessArray' . $postfix ) : array(); $postListData['output_format_array'] = $http->hasPostVariable( $prefix . 'OutputFormatArray' . $postfix ) ? $http->postVariable( $prefix . 'OutputFormatArray' . $postfix ) : array(); $postListData['email_sender'] = $http->postVariable( $prefix . 'EmailSender' . $postfix ); $postListData['email_reply_to'] = $http->postVariable( $prefix . 'EmailReplyTo' . $postfix ); $postListData['email_return_path'] = $http->postVariable( $prefix . 'EmailReturnPath' . $postfix ); $postListData['email_sender_name'] = $http->postVariable( $prefix . 'EmailSenderName' . $postfix ); $postListData['email_receiver_test'] = $http->postVariable( $prefix . 'EmailReceiverTest' . $postfix ); $postListData['auto_approve_registered_user'] = $http->postVariable( $prefix . 'AutoApproveRegisterdUser' . $postfix ); */ $postListData['skin_name'] = $http->hasPostVariable($prefix . 'SkinName' . $postfix) ? $http->postVariable($prefix . 'SkinName' . $postfix) : ''; //$postListData['personalize_content'] = (int) $http->postVariable( $prefix . 'PersonalizeContent' . $postfix ); //$requireFieldArray = array( 'main_siteaccess', 'siteaccess_array', 'output_format_array', 'email_sender' ); $requireFieldArray = array(); foreach ($postListData as $varName => $varValue) { if ($varValue == CjwNewsletterListVirtual::PARENT_LIST_VALUE_PLACEHOLDER_STRING || $varValue == CjwNewsletterListVirtual::PARENT_LIST_VALUE_PLACEHOLDER_NUMERIC) { continue; } else { switch ($varName) { case 'main_siteaccess': if ($postListData['main_siteaccess'] == '') { $validationErrorMesssageArray[] = ezi18n('cjw_newsletter/datatype/cjwnewsletterlist', "Main Siteaccess must be set", null, array()); } else { // array_push( $postListData['siteaccess_array'], $postListData['main_siteaccess'] ); // $postListData['siteaccess_array'] = array_unique( $postListData['siteaccess_array'] ); } break; /* case 'siteaccess_array': if ( count( $postListData['siteaccess_array'] ) == 0 ) { $validationErrorMesssageArray[] = ezi18n( 'cjw_newsletter/datatype/cjwnewsletterlist', "You have to choose a siteaccess for the list", null , array( ) ); } break; */ /* case 'siteaccess_array': if ( count( $postListData['siteaccess_array'] ) == 0 ) { $validationErrorMesssageArray[] = ezi18n( 'cjw_newsletter/datatype/cjwnewsletterlist', "You have to choose a siteaccess for the list", null , array( ) ); } break; */ case 'output_format_array': if (count($postListData['output_format_array']) == 0) { $validationErrorMesssageArray[] = ezi18n('cjw_newsletter/datatype/cjwnewsletterlist', "You have to choose an output format", null, array()); } break; case 'email_sender': if ($postListData['email_sender'] == '' or !eZMail::validate($postListData['email_sender'])) { $validationErrorMesssageArray[] = ezi18n('cjw_newsletter/datatype/cjwnewsletterlist', "You have to set a valid email adress", null, array()); } break; case 'email_receiver_test': if ($postListData['email_receiver_test'] == '') { $validationErrorMesssageArray[] = ezi18n('cjw_newsletter/datatype/cjwnewsletterlist', "You have to set a valid semder email", null, array()); } else { $explodeRecieverArr = explode(';', $postListData['email_receiver_test']); foreach ($explodeRecieverArr as $index => $reciever) { // check if email if (eZMail::validate($reciever) == false) { $validationErrorMesssageArray[] = ezi18n('cjw_newsletter/datatype/cjwnewsletterlist', "You have to set a valid semder email adress >> {$reciever}", null, array()); } } } break; default: break; } } } if ($postListData['output_format_array'] == CjwNewsletterListVirtual::PARENT_LIST_VALUE_PLACEHOLDER_STRING) { $outputFormatArrayString = CjwNewsletterListVirtual::PARENT_LIST_VALUE_PLACEHOLDER_STRING; } else { $outputFormatArrayString = CjwNewsletterList::arrayToString($postListData['output_format_array']); } $listObject = new CjwNewsletterListVirtual(array('is_virtual' => 1, 'contentobject_attribute_id' => $contentObjectAttribute->attribute('id'), 'contentobject_attribute_version' => $contentObjectAttribute->attribute('version'), 'contentobject_id' => $contentObjectAttribute->attribute('contentobject_id'), 'contentclass_id' => $contentclassAttribute->attribute('contentclass_id'), 'main_siteaccess' => $postListData['main_siteaccess'], 'siteaccess_array_string' => CjwNewsletterListVirtual::PARENT_LIST_VALUE_PLACEHOLDER_STRING, 'email_sender_name' => $postListData['email_sender_name'], 'email_sender' => $postListData['email_sender'], 'email_reply_to' => $postListData['email_reply_to'], 'email_return_path' => $postListData['email_return_path'], 'email_receiver_test' => $postListData['email_receiver_test'], 'output_format_array_string' => $outputFormatArrayString, 'auto_approve_registered_user' => $postListData['auto_approve_registered_user'], 'skin_name' => $postListData['skin_name'], 'personalize_content' => $postListData['personalize_content'])); $listObject->decodePostVariable('F'); $contentObjectAttribute->Content = $listObject; // $listObject->store(); // $listObject->sync(); if (count($validationErrorMesssageArray) > 0) { $inputValidationCheck = false; } if ($inputValidationCheck == true) { // 3.x/ return EZ_INPUT_VALIDATOR_STATE_ACCEPTED; return eZInputValidator::STATE_ACCEPTED; } else { $validationErrorMessage = implode('<br \\>', $validationErrorMesssageArray); $error = $contentObjectAttribute->setValidationError($validationErrorMessage); // 3.x/ return EZ_INPUT_VALIDATOR_STATE_INVALID; return eZInputValidator::STATE_INVALID; } }
* * @copyright Copyright (C) 2007-2010 CJW Network - Coolscreen.de, JAC Systeme GmbH, Webmanufaktur. All rights reserved. * @license http://ez.no/licenses/gnu_gpl GNU GPL v2 * @version //autogentag// * @package cjw_newsletter * @subpackage modules * @filesource */ $module = $Params['Module']; $templateFile = "design:newsletter/mailbox_list.tpl"; require_once 'kernel/common/i18n.php'; include_once 'kernel/common/template.php'; $mailboxObject = new CjwNewsletterMailbox(true); $listMailboxesCount = 0; // return array with mailbox objects // TODO result check (is array or object etc ) if (is_object($mailboxObject)) { $listMailboxes = $mailboxObject->fetchAllMailboxes(); $listMailboxesCount = count($listMailboxes); } $tpl = templateInit(); $viewParameters = array('offset' => 0, 'namefilter' => '', 'redirect_uri' => $module->currentRedirectionURI()); $userParameters = $Params['UserParameters']; $viewParameters = array_merge($viewParameters, $userParameters); $tpl->setVariable('view_parameters', $viewParameters); $tpl->setVariable('mailbox_list', $listMailboxes); $tpl->setVariable('mailbox_list_count', $listMailboxesCount); $Result = array(); $Result['content'] = $tpl->fetch($templateFile); $Result['path'] = array(array('url' => 'newsletter/index', 'text' => ezi18n('cjw_newsletter', 'Newsletter')), array('url' => false, 'text' => ezi18n('cjw_newsletter/mailbox_item_list', 'Mail accounts')));
/** * Wrapper method to translate labels and eventually takes advantage of new 4.3 i18n API * @param $context * @param $message * @param $comment * @param $argument * @return string */ public static function ezpI18ntr($context, $message, $comment = null, $argument = null) { // eZ Publish < 4.3 => use old i18n system if (eZPublishSDK::majorVersion() == 4 && eZPublishSDK::minorVersion() < 3) { include_once 'kernel/common/i18n.php'; return ezi18n($context, $message, $comment, $argument); } else { return ezpI18n::tr($context, $message, $comment, $argument); } }
$newNewsletterUserObject = CjwNewsletterUser::fetchByEmail($subscriptionDataArr['email']); if (is_object($newNewsletterUserObject)) { $redirectUrlStore = '/newsletter/user_view/' . $newNewsletterUserObject->attribute('id'); } } elseif ($redirectUrlStore === false) { $redirectUrlStore = '/newsletter/user_list/'; } // if all is ok $module->redirectTo($redirectUrlStore); } elseif ($module->isCurrentAction('Cancel')) { if ($redirectUrlCancel === false) { $redirectUrlCancel = '/newsletter/user_list/'; } $module->redirectTo($redirectUrlCancel); } //$newsletterUserObject = CjwNewsletterUser::fetch( $newsletterUserId ); $tpl->setVariable('add_subscription_for_list_id', $addSubscriptionForListId); $tpl->setVariable('newsletter_user_subscription_array', $newsletter_user_subscription_array); $tpl->setVariable('subscription_data_array', $subscriptionDataArr); $tpl->setVariable('newsletter_user_id', $newsletterUserId); $tpl->setVariable('warning_array', $warningArr); $tpl->setVariable('message_feedback', $messageFeedback); $tpl->setVariable('newsletter_user', $newsletterUserObject); $tpl->setVariable('available_salutation_array', CjwNewsletterUser::getAvailableSalutationNameArrayFromIni()); $tpl->setVariable('redirect_url_action_cancel', $redirectUrlCancel); $tpl->setVariable('redirect_url_action_store', $redirectUrlStore); $Result = array(); //$Result[ 'ui_context' ] = 'edit'; $Result['content'] = $tpl->fetch($templateFile); $Result['path'] = array(array('url' => false, 'text' => ezi18n('cjw_newsletter/path', 'Newsletter')), array('url' => false, 'text' => ezi18n('cjw_newsletter/user_list', 'Users')), array('url' => false, 'text' => $newsletterUserObject->attribute('name')));
/** * Validates the input and returns true if the input was * valid for this datatype. */ function validateObjectAttributeHTTPInput($http, $base, $contentObjectAttribute) { $classAttribute = $contentObjectAttribute->contentClassAttribute(); // if datatype is used as informationcollector if ($classAttribute->attribute('is_information_collector')) { } else { $userDataArray = $this->fetchCurrentContentObjectData($contentObjectAttribute); if (is_array($userDataArray) == false) { $contentObjectAttribute->setValidationError(ezi18n('cjw_newsletter/datatype/cjwnewslettersubcription/validation_error', 'Datatype can not be used here - user_account required.')); return eZInputValidator::STATE_INVALID; } // new value form POST $ezUserId = (int) $userDataArray['subscription_data_array']['ez_user_id']; $email = strtolower(trim($userDataArray['subscription_data_array']['email'])); $checkResult = CjwNewsletterUser::checkIfUserCanBeUpdated($email, $ezUserId, $updateNewEmail = false); switch ($checkResult) { // create new user case 40: break; // update user // update user case 41: break; // update user with new mail // update user with new mail case 42: break; case -20: // the email is already used by an other nl_user with a different user_id // we ignore the check because we think that the email is the unique key // between ezuser and nl_user break; case -21: // the email is emty break; case -1: $contentObjectAttribute->setValidationError(ezi18n('cjw_newsletter/datatype/cjwnewslettersubcription/validation_error', 'No user account found')); return eZInputValidator::STATE_INVALID; break; default: return eZInputValidator::STATE_INVALID; } } return eZInputValidator::STATE_ACCEPTED; }
/** * publishHandlerLink (Publish handler, pass 2 after schema validation) * Publish handler for link element, converts href to [object|node|link]_id. * * @param DOMElement $element * @param array $param parameters for xml element * @return null|array changes structure if it contains 'result' key */ function publishHandlerLink($element, &$params) { $ret = null; $href = $element->getAttribute('href'); if ($href) { $objectID = false; if (strpos($href, 'ezobject') === 0 && preg_match("@^ezobject://([0-9]+)/?(#.+)?@i", $href, $matches)) { $objectID = $matches[1]; if (isset($matches[2])) { $anchorName = substr($matches[2], 1); } $element->setAttribute('object_id', $objectID); if (!eZContentObject::exists($objectID)) { $this->Messages[] = ezi18n('design/standard/ezoe/handler', 'Object %1 does not exist.', false, array($objectID)); } } elseif (strpos($href, 'eznode') === 0 && preg_match("@^eznode://([^#]+)(#.+)?@i", $href, $matches)) { $nodePath = trim($matches[1], '/'); if (isset($matches[2])) { $anchorName = substr($matches[2], 1); } if (is_numeric($nodePath)) { $nodeID = $nodePath; $node = eZContentObjectTreeNode::fetch($nodeID); if (!$node instanceof eZContentObjectTreeNode) { $this->Messages[] = ezi18n('design/standard/ezoe/handler', 'Node %1 does not exist.', false, array($nodeID)); } } else { $node = eZContentObjectTreeNode::fetchByURLPath($nodePath); if (!$node instanceof eZContentObjectTreeNode) { $this->Messages[] = ezi18n('design/standard/ezoe/handler', 'Node '%1' does not exist.', false, array($nodePath)); } else { $nodeID = $node->attribute('node_id'); } $element->setAttribute('show_path', 'true'); } if (isset($nodeID) && $nodeID) { $element->setAttribute('node_id', $nodeID); } if (isset($node) && $node instanceof eZContentObjectTreeNode) { $objectID = $node->attribute('contentobject_id'); } } elseif (strpos($href, '#') === 0) { $anchorName = substr($href, 1); } else { $temp = explode('#', $href); $url = $temp[0]; if (isset($temp[1])) { $anchorName = $temp[1]; } if ($url) { // Protection from XSS attack if (preg_match("/^(java|vb)script:.*/i", $url)) { $this->isInputValid = false; $this->Messages[] = "Using scripts in links is not allowed, '{$url}' has been removed"; $element->removeAttribute('href'); return $ret; } // Check mail address validity if (preg_match("/^mailto:(.*)/i", $url, $mailAddr)) { if (!eZMail::validate($mailAddr[1])) { $this->isInputValid = false; if ($this->errorLevel >= 0) { $this->Messages[] = ezi18n('kernel/classes/datatypes/ezxmltext', "Invalid e-mail address: '%1'", false, array($mailAddr[1])); } $element->removeAttribute('href'); return $ret; } } // Store urlID instead of href $url = str_replace(array('&', '%28', '%29'), array('&', '(', ')'), $url); $urlID = eZURL::registerURL($url); if ($urlID) { if (!in_array($urlID, $this->urlIDArray)) { $this->urlIDArray[] = $urlID; } $element->setAttribute('url_id', $urlID); } } } if ($objectID && !in_array($objectID, $this->linkedObjectIDArray)) { $this->linkedObjectIDArray[] = $objectID; } if (isset($anchorName) && $anchorName) { $element->setAttribute('anchor_name', $anchorName); } } return $ret; }
/** * Validates input on content object level * * * @see kernel/classes/eZDataType#validateObjectAttributeHTTPInput($http, $base, $objectAttribute) * @return EZ_INPUT_VALIDATOR_STATE */ function validateObjectAttributeHTTPInput($http, $base, $contentObjectAttribute) { $contentclassAttribute = $contentObjectAttribute->attribute('contentclass_attribute'); $inputValidationCheck = true; $validationErrorMesssageArray = array(); $prefix = $base . '_CjwNewsletterEdition_'; $postfix = '_' . $contentObjectAttribute->attribute('id'); // ContentObjectAttribute_CjwNewsletterEdition_MainSiteaccess_123 $postListData = array(); $postListData['status'] = $http->hasPostVariable($prefix . 'Status' . $postfix) ? (int) $http->postVariable($prefix . 'Status' . $postfix) : 0; $requireFieldArray = array('status'); foreach ($postListData as $varName => $varValue) { switch ($varName) { case 'status': /* if ( $postListData['email_receiver_test'] == '' or !eZMail::validate( $postListData['email_receiver_test'] ) ) { $validationErrorMesssageArray[] = ezi18n( 'cjw_newsletter/datatype/cjwnewsletteredition', "You have to set a valid email adress", null , array( ) ); } */ break; default: break; } } $object = new CjwNewsletterEdition(array('contentobject_attribute_id' => $contentObjectAttribute->attribute('id'), 'contentobject_attribute_version' => $contentObjectAttribute->attribute('version'), 'contentobject_id' => $contentObjectAttribute->attribute('contentobject_id'), 'contentclass_id' => $contentclassAttribute->attribute('contentclass_id'), 'status' => $postListData['status'])); $contentObjectAttribute->Content = $object; // if the current version != DRAFT, than abort, because a version can't has more than one status if ($object->attribute('is_process') || $object->attribute('is_abort') || $object->attribute('is_archive')) { $error = $contentObjectAttribute->setValidationError(ezi18n('cjw_newsletter/datatype/cjwnewsletteredition', "The current edition is already in sending process - you have to create a new copy of this object", null, array())); return eZInputValidator::STATE_INVALID; } if (count($validationErrorMesssageArray) > 0) { $inputValidationCheck = false; } if ($inputValidationCheck == true) { // 3.x/ return EZ_INPUT_VALIDATOR_STATE_ACCEPTED; return eZInputValidator::STATE_ACCEPTED; } else { $validationErrorMessage = implode('<br />', $validationErrorMesssageArray); $error = $contentObjectAttribute->setValidationError($validationErrorMessage); // 3.x/ return EZ_INPUT_VALIDATOR_STATE_INVALID; return eZInputValidator::STATE_INVALID; } }
<?php /** * File index.php * * @copyright Copyright (C) 2007-2010 CJW Network - Coolscreen.de, JAC Systeme GmbH, Webmanufaktur. All rights reserved. * @license http://ez.no/licenses/gnu_gpl GNU GPL v2 * @version //autogentag// * @package cjw_newsletter * @subpackage modules * @filesource */ require_once 'kernel/common/i18n.php'; include_once 'kernel/common/template.php'; $module = $Params['Module']; $http = eZHTTPTool::instance(); $viewParameters = array('offset' => 0, 'namefilter' => ''); $userParameters = $Params['UserParameters']; $viewParameters = array_merge($viewParameters, $userParameters); $tpl = templateInit(); $tpl->setVariable('view_parameters', $viewParameters); $tpl->setVariable('current_siteaccess', $viewParameters); $Result = array(); $Result['content'] = $tpl->fetch("design:newsletter/index.tpl"); $Result['path'] = array(array('url' => false, 'text' => ezi18n('cjw_newsletter', 'Newsletter')), array('url' => false, 'text' => ezi18n('cjw_newsletter/index', 'Dashboard')));
} } // if AddButton was pushed than store new data if ($http->hasVariable('AddButton')) { if (is_object($blacklistItemObject)) { $newsletterUserObject = $blacklistItemObject->attribute('newsletter_user_object'); // $newsletterUserObject->setBlacklisted(); $blacklistItemObject->store(); if (is_object($newsletterUserObject)) { $message = ezi18n('cjw_newsletter/blacklist_item_add', 'Successfully adding newsletter user %nl_user_id with email %email to blacklist', '', array('%nl_user_id' => $newsletterUserObject->attribute('id'), '%email' => $newsletterUserObject->attribute('email'))); $isBlacklistDone = true; } else { $message = ezi18n('cjw_newsletter/blacklist_item_add', 'Successfully adding email address %email to blacklist', '', array('%email' => $blacklistItemObject->attribute('email'))); $isBlacklistDone = true; } } } elseif ($http->hasVariable('DiscardButton')) { $module->redirectTo('/newsletter/blacklist_item_list'); } $viewParameters = array('offset' => 0, 'namefilter' => ''); $userParameters = $Params['UserParameters']; $viewParameters = array_merge($viewParameters, $userParameters); $tpl->setVariable('is_blacklist_done', $isBlacklistDone); $tpl->setVariable('message', $message); $tpl->setVariable('blacklist_item', $blacklistItemObject); $tpl->setVariable('view_parameters', $viewParameters); $Result = array(); $Result['content'] = $tpl->fetch($templateFile); //$Result[ 'ui_context' ] = 'edit'; $Result['path'] = array(array('url' => false, 'text' => ezi18n('cjw_newsletter/path', 'Newsletter')), array('url' => false, 'text' => ezi18n('cjw_newsletter/blacklist_item_add', 'Blacklist add')));
/** * get an array of all available subscription status id with translated Names * @return array */ static function availableStatusIdNameArray() { return array(self::STATUS_PENDING => ezi18n('cjw_newsletter/subscription/status', 'Pending'), self::STATUS_CONFIRMED => ezi18n('cjw_newsletter/subscription/status', 'Confirmed'), self::STATUS_APPROVED => ezi18n('cjw_newsletter/subscription/status', 'Approved'), self::STATUS_REMOVED_SELF => ezi18n('cjw_newsletter/subscription/status', 'Removed by user'), self::STATUS_REMOVED_ADMIN => ezi18n('cjw_newsletter/subscription/status', 'Removed by admin'), self::STATUS_BOUNCED_SOFT => ezi18n('cjw_newsletter/subscription/status', 'Bounced soft'), self::STATUS_BOUNCED_HARD => ezi18n('cjw_newsletter/subscription/status', 'Bounced hard'), self::STATUS_BLACKLISTED => ezi18n('cjw_newsletter/subscription/status', 'Blacklisted')); }
$redirectUrlRemove = '/newsletter/user_list/'; if ($http->hasVariable('RedirectUrlActionRemove')) { $redirectUrlRemove = $http->variable('RedirectUrlActionRemove'); } // show an overview of all things we will be delete /* - all subscriptions - user data - edition_send_items we should keep at the moment - may be give an option for blacklist user */ if ($module->isCurrentAction('Remove')) { // remove nl user object and all subscriptions $newsletterUserObject->remove(); $module->redirectTo($redirectUrlRemove); } elseif ($module->isCurrentAction('Cancel')) { $module->redirectTo($redirectUrlCancel); } $viewParameters = array(); if (is_array($Params['UserParameters'])) { $viewParameters = array_merge($viewParameters, $Params['UserParameters']); } $tpl->setVariable('view_parameters', $viewParameters); $tpl->setVariable('newsletter_user', $newsletterUserObject); $tpl->setVariable('newsletter_user_id', $newsLetterUserId); $tpl->setVariable('redirect_url_action_cancel', $redirectUrlCancel); $tpl->setVariable('redirect_url_action_remove', $redirectUrlRemove); $Result = array(); $Result['content'] = $tpl->fetch($templateFile); $Result['path'] = array(array('url' => false, 'text' => ezi18n('cjw_newsletter/user_remove', 'Remove newsletter user')));
$newsletterContent = false; if (isset($newsletterDataArray[$outputFormatId])) { $newsletterContentArray = $newsletterDataArray[$outputFormatId]; } // html / text - multipart/alternative if ($outputFormatId === 0) { $newsletterContent .= $newsletterContentArray['body']['html']; $textContent = "<hr /><pre>" . $newsletterContentArray['body']['text'] . "</pre></body>"; $newsletterContent = preg_replace(array('%</body>%'), array($textContent), $newsletterContent); } elseif ($outputFormatId === 1) { $newsletterContent .= '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>newsletter - outputformat - text</title></head><body><pre>' . $newsletterContentArray['body']['text'] . '</pre></body></html>'; } else { return $module->handleError(eZError::KERNEL_NOT_FOUND, 'kernel'); } $mailSubjectLabel = ezi18n('cjw_newsletter/preview', 'Email subject'); $subjectStyle = 'style="background-color:#dddddd;border-color: #cccccc;border-width: 0 0 1px 0;border-style: solid;color:#333333;"'; $mailSubject = '<body${1}><!-- email subject preview start --><table width="100%" cellpadding="5" cellspacing="0" border="0" bgcolor="#dddddd" class="newsletter-skin-preview-email-subject" ' . $subjectStyle . '><tr><th width="1%" nowrap>' . $mailSubjectLabel . ':</th><td width="99%">' . $newsletterContentArray['subject'] . '</td></tr></table></span><!-- email subject preview end -->'; $newsletterContent = preg_replace("%<body(.*)>%", $mailSubject, $newsletterContent); /*$mailSubject = "<body><b>Email subject:</b> ". $newsletterContentArray['subject'] . "<br />"; $newsletterContent = preg_replace( array('%<body>%'), array( $mailSubject ), $newsletterContent);*/ $debug = 0; if ($debug == 0) { header("Content-type: text/html"); echo $newsletterContent; eZExecution::cleanExit(); } else { $Result = array(); $Result['content'] = '<code>' . $newsletterContent . '</code>'; // header( "Content-type: text/html" ); }
function CreateSubtreeNotificationRuleType() { $this->eZWorkflowEventType(CreateSubtreeNotificationRuleType::WORKFLOW_TYPE_STRING, ezi18n('kernel/workflow/event', 'Create Subtree Notification Rule')); // limit workflows which use this event to be used only on the post-publish trigger $this->setTriggerTypes(array('content' => array('publish' => array('after')))); }